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.
- package/CHANGELOG.md +96 -0
- package/CODE_OF_CONDUCT.md +85 -0
- package/CONTRIBUTING.md +87 -0
- package/README.md +268 -23
- package/SECURITY.md +46 -0
- package/codegen/package.json +5 -0
- package/dist/cjs/codegen/asset-sync.d.ts +20 -0
- package/dist/cjs/codegen/asset-sync.js +28 -0
- package/dist/cjs/codegen/coverage.d.ts +66 -0
- package/dist/cjs/codegen/coverage.js +408 -0
- package/dist/cjs/codegen/endpoint-scanner.d.ts +16 -0
- package/dist/cjs/codegen/endpoint-scanner.js +197 -0
- package/dist/cjs/codegen/format.d.ts +17 -0
- package/dist/cjs/codegen/format.js +34 -0
- package/dist/cjs/codegen/fs-utils.d.ts +45 -0
- package/dist/cjs/codegen/fs-utils.js +165 -0
- package/dist/cjs/codegen/index.d.ts +13 -0
- package/dist/cjs/codegen/index.js +33 -0
- package/dist/cjs/codegen/mcp-generator.d.ts +50 -0
- package/dist/cjs/codegen/mcp-generator.js +803 -0
- package/dist/cjs/codegen/module-generator.d.ts +11 -0
- package/dist/cjs/codegen/module-generator.js +353 -0
- package/dist/cjs/codegen/nestjs-scanner.d.ts +43 -0
- package/dist/cjs/codegen/nestjs-scanner.js +241 -0
- package/dist/cjs/codegen/output-recommender.d.ts +23 -0
- package/dist/cjs/codegen/output-recommender.js +33 -0
- package/dist/cjs/codegen/scaffolder.d.ts +36 -0
- package/dist/cjs/codegen/scaffolder.js +262 -0
- package/dist/cjs/codegen/skill-generator.d.ts +49 -0
- package/dist/cjs/codegen/skill-generator.js +967 -0
- package/dist/cjs/codegen/types.d.ts +52 -0
- package/dist/cjs/codegen/types.js +16 -0
- package/dist/cjs/codegen/ui-scanner.d.ts +24 -0
- package/dist/cjs/codegen/ui-scanner.js +202 -0
- package/dist/cjs/codegen/validator.d.ts +35 -0
- package/dist/cjs/codegen/validator.js +292 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +23 -0
- package/dist/cjs/openapi/index.d.ts +78 -0
- package/dist/cjs/openapi/index.js +347 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/react/audio-worklet-processor.d.ts +16 -0
- package/dist/cjs/react/audio-worklet-processor.js +27 -0
- package/dist/cjs/react/bridges/rest-session-bridge.d.ts +113 -0
- package/dist/cjs/react/bridges/rest-session-bridge.js +209 -0
- package/dist/cjs/react/components/ai-chat-panel.d.ts +12 -0
- package/dist/cjs/react/components/ai-chat-panel.js +67 -0
- package/dist/cjs/react/components/ai-trigger-button.d.ts +2 -0
- package/dist/cjs/react/components/ai-trigger-button.js +239 -0
- package/dist/cjs/react/components/approval-card.d.ts +9 -0
- package/dist/cjs/react/components/approval-card.js +24 -0
- package/dist/cjs/react/components/bulk-approval-card.d.ts +9 -0
- package/dist/cjs/react/components/bulk-approval-card.js +36 -0
- package/dist/cjs/react/components/chat-input.d.ts +10 -0
- package/dist/cjs/react/components/chat-input.js +60 -0
- package/dist/cjs/react/components/chat-window.d.ts +2 -0
- package/dist/cjs/react/components/chat-window.js +134 -0
- package/dist/cjs/react/components/confirm-dialog.d.ts +32 -0
- package/dist/cjs/react/components/confirm-dialog.js +48 -0
- package/dist/cjs/react/components/floating-chat-ui.d.ts +90 -0
- package/dist/cjs/react/components/floating-chat-ui.js +163 -0
- package/dist/cjs/react/components/mention-chip.d.ts +16 -0
- package/dist/cjs/react/components/mention-chip.js +42 -0
- package/dist/cjs/react/components/mention-input.d.ts +8 -0
- package/dist/cjs/react/components/mention-input.js +117 -0
- package/dist/cjs/react/components/message-bubble.d.ts +11 -0
- package/dist/cjs/react/components/message-bubble.js +171 -0
- package/dist/cjs/react/components/message-list.d.ts +8 -0
- package/dist/cjs/react/components/message-list.js +52 -0
- package/dist/cjs/react/components/pipeline-timeline.d.ts +7 -0
- package/dist/cjs/react/components/pipeline-timeline.js +72 -0
- package/dist/cjs/react/components/recording-bar.d.ts +2 -0
- package/dist/cjs/react/components/recording-bar.js +81 -0
- package/dist/cjs/react/components/recording-controls.d.ts +18 -0
- package/dist/cjs/react/components/recording-controls.js +38 -0
- package/dist/cjs/react/components/rich-mention-input.d.ts +2 -0
- package/dist/cjs/react/components/rich-mention-input.js +571 -0
- package/dist/cjs/react/components/session-switcher.d.ts +14 -0
- package/dist/cjs/react/components/session-switcher.js +133 -0
- package/dist/cjs/react/components/suggestion-bar.d.ts +9 -0
- package/dist/cjs/react/components/suggestion-bar.js +47 -0
- package/dist/cjs/react/components/suggestion-chip.d.ts +9 -0
- package/dist/cjs/react/components/suggestion-chip.js +14 -0
- package/dist/cjs/react/components/voice-input-addon.d.ts +13 -0
- package/dist/cjs/react/components/voice-input-addon.js +31 -0
- package/dist/cjs/react/components/voice-input-button.d.ts +2 -0
- package/dist/cjs/react/components/voice-input-button.js +55 -0
- package/dist/cjs/react/components/wavesurfer-loader.d.ts +5 -0
- package/dist/cjs/react/components/wavesurfer-loader.js +36 -0
- package/dist/cjs/react/hooks/use-ai-chat.d.ts +22 -0
- package/dist/cjs/react/hooks/use-ai-chat.js +51 -0
- package/dist/cjs/react/hooks/use-approvals.d.ts +23 -0
- package/dist/cjs/react/hooks/use-approvals.js +63 -0
- package/dist/cjs/react/hooks/use-deepgram-transcription.d.ts +2 -0
- package/dist/cjs/react/hooks/use-deepgram-transcription.js +329 -0
- package/dist/cjs/react/hooks/use-drag-resize-panel.d.ts +48 -0
- package/dist/cjs/react/hooks/use-drag-resize-panel.js +308 -0
- package/dist/cjs/react/hooks/use-draggable-position.d.ts +25 -0
- package/dist/cjs/react/hooks/use-draggable-position.js +134 -0
- package/dist/cjs/react/hooks/use-keyboard-shortcut.d.ts +20 -0
- package/dist/cjs/react/hooks/use-keyboard-shortcut.js +93 -0
- package/dist/cjs/react/hooks/use-mentions.d.ts +23 -0
- package/dist/cjs/react/hooks/use-mentions.js +42 -0
- package/dist/cjs/react/hooks/use-suggestions.d.ts +22 -0
- package/dist/cjs/react/hooks/use-suggestions.js +39 -0
- package/dist/cjs/react/index.d.ts +43 -0
- package/dist/cjs/react/index.js +111 -0
- package/dist/cjs/react/provider/ai-chat-provider.d.ts +45 -0
- package/dist/cjs/react/provider/ai-chat-provider.js +1024 -0
- package/dist/cjs/react/provider/chat-context.d.ts +84 -0
- package/dist/cjs/react/provider/chat-context.js +13 -0
- package/dist/cjs/react/template.d.ts +84 -0
- package/dist/cjs/react/template.js +90 -0
- package/dist/cjs/react/themes.d.ts +24 -0
- package/dist/cjs/react/themes.js +273 -0
- package/dist/cjs/react/transports/langgraph/index.d.ts +2 -0
- package/dist/cjs/react/transports/langgraph/index.js +8 -0
- package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.d.ts +62 -0
- package/dist/cjs/react/transports/langgraph/langgraph-ai-chat.js +94 -0
- package/dist/cjs/react/transports/langgraph.d.ts +71 -0
- package/dist/cjs/react/transports/langgraph.js +369 -0
- package/dist/cjs/react/transports/vercel/index.d.ts +2 -0
- package/dist/cjs/react/transports/vercel/index.js +8 -0
- package/dist/cjs/react/transports/vercel/vercel-ai-chat.d.ts +49 -0
- package/dist/cjs/react/transports/vercel/vercel-ai-chat.js +81 -0
- package/dist/cjs/react/transports/vercel.d.ts +30 -0
- package/dist/cjs/react/transports/vercel.js +69 -0
- package/dist/cjs/react/types.d.ts +760 -0
- package/dist/cjs/react/types.js +2 -0
- package/dist/cjs/react/ui.d.ts +73 -0
- package/dist/cjs/react/ui.js +183 -0
- package/dist/cjs/react/utils/create-approval-description.d.ts +53 -0
- package/dist/cjs/react/utils/create-approval-description.js +122 -0
- package/dist/cjs/react/utils/create-tool-result-handler.d.ts +90 -0
- package/dist/cjs/react/utils/create-tool-result-handler.js +168 -0
- package/dist/cjs/react/utils/mention-markup.d.ts +13 -0
- package/dist/cjs/react/utils/mention-markup.js +117 -0
- package/dist/cjs/react/utils/merge-pipeline-steps.d.ts +19 -0
- package/dist/cjs/react/utils/merge-pipeline-steps.js +81 -0
- package/dist/cjs/react/utils/sanitize-stored-messages.d.ts +23 -0
- package/dist/cjs/react/utils/sanitize-stored-messages.js +52 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.d.ts +10 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-auth.guard.js +42 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.d.ts +32 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat-module-options.interface.js +4 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.d.ts +11 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.controller.js +80 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.d.ts +9 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.module.js +119 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.d.ts +13 -0
- package/dist/cjs/server/adapters/nestjs/chat/ai-chat.service.js +131 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.d.ts +7 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/ai-chat-request.dto.js +52 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.d.ts +19 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message-part.dto.js +108 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.d.ts +8 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/chat-message.dto.js +59 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/index.d.ts +3 -0
- package/dist/cjs/server/adapters/nestjs/chat/dto/index.js +9 -0
- package/dist/cjs/server/adapters/nestjs/chat/index.d.ts +3 -0
- package/dist/cjs/server/adapters/nestjs/chat/index.js +9 -0
- package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +4 -0
- package/dist/cjs/server/adapters/nestjs/chat/speech-stream.gateway.js +73 -0
- package/dist/cjs/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
- package/dist/cjs/server/adapters/nestjs/chat/ws-loader.js +72 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.d.ts +6 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-module.decorator.js +13 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.d.ts +5 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-param.decorator.js +15 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.d.ts +6 -0
- package/dist/cjs/server/adapters/nestjs/decorators/ai-tool.decorator.js +22 -0
- package/dist/cjs/server/adapters/nestjs/decorators/constants.d.ts +4 -0
- package/dist/cjs/server/adapters/nestjs/decorators/constants.js +7 -0
- package/dist/cjs/server/adapters/nestjs/index.d.ts +14 -0
- package/dist/cjs/server/adapters/nestjs/index.js +42 -0
- package/dist/cjs/server/adapters/nestjs/metadata.d.ts +39 -0
- package/dist/cjs/server/adapters/nestjs/metadata.js +36 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.d.ts +36 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools-explorer.service.js +159 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.d.ts +37 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.module.js +44 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.d.ts +28 -0
- package/dist/cjs/server/adapters/nestjs/module/ai-tools.service.js +41 -0
- package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.d.ts +16 -0
- package/dist/cjs/server/adapters/nestjs/scanner/nestjs-scanner.js +117 -0
- package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.d.ts +26 -0
- package/dist/cjs/server/adapters/nestjs/scanner/schema-builder.js +259 -0
- package/dist/cjs/server/adapters/nestjs/swagger.d.ts +7 -0
- package/dist/cjs/server/adapters/nestjs/swagger.js +39 -0
- package/dist/cjs/server/adapters/nextjs/context-helpers.d.ts +22 -0
- package/dist/cjs/server/adapters/nextjs/context-helpers.js +60 -0
- package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.d.ts +94 -0
- package/dist/cjs/server/adapters/nextjs/create-ai-chat-handler.js +965 -0
- package/dist/cjs/server/adapters/nextjs/filter-fallback-error.d.ts +11 -0
- package/dist/cjs/server/adapters/nextjs/filter-fallback-error.js +41 -0
- package/dist/cjs/server/adapters/nextjs/index.d.ts +8 -0
- package/dist/cjs/server/adapters/nextjs/index.js +22 -0
- package/dist/cjs/server/adapters/nextjs/prepare-model-messages.d.ts +58 -0
- package/dist/cjs/server/adapters/nextjs/prepare-model-messages.js +114 -0
- package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.d.ts +64 -0
- package/dist/cjs/server/adapters/nextjs/sanitize-model-messages.js +489 -0
- package/dist/cjs/server/adapters/nextjs/server-action-helper.d.ts +7 -0
- package/dist/cjs/server/adapters/nextjs/server-action-helper.js +40 -0
- package/dist/cjs/server/adapters/nextjs/types.d.ts +246 -0
- package/dist/cjs/server/adapters/nextjs/types.js +2 -0
- package/dist/cjs/server/adapters/nextjs/with-ai-tool.d.ts +9 -0
- package/dist/cjs/server/adapters/nextjs/with-ai-tool.js +12 -0
- package/dist/cjs/server/core/followup-tool.d.ts +9 -0
- package/dist/cjs/server/core/followup-tool.js +82 -0
- package/dist/cjs/server/core/index.d.ts +139 -0
- package/dist/cjs/server/core/index.js +818 -0
- package/dist/cjs/server/core/intent-classifier.d.ts +94 -0
- package/dist/cjs/server/core/intent-classifier.js +324 -0
- package/dist/cjs/server/core/model-selector.d.ts +12 -0
- package/dist/cjs/server/core/model-selector.js +48 -0
- package/dist/cjs/server/core/module-router.d.ts +14 -0
- package/dist/cjs/server/core/module-router.js +110 -0
- package/dist/cjs/server/core/zod-compact.d.ts +18 -0
- package/dist/cjs/server/core/zod-compact.js +129 -0
- package/dist/cjs/server/index.d.ts +6 -0
- package/dist/cjs/server/index.js +28 -0
- package/dist/cjs/server/lancer/cache.d.ts +9 -0
- package/dist/cjs/server/lancer/cache.js +33 -0
- package/dist/cjs/server/lancer/client.d.ts +2 -0
- package/dist/cjs/server/lancer/client.js +279 -0
- package/dist/cjs/server/lancer/errors.d.ts +13 -0
- package/dist/cjs/server/lancer/errors.js +21 -0
- package/dist/cjs/server/lancer/index.d.ts +3 -0
- package/dist/cjs/server/lancer/index.js +7 -0
- package/dist/cjs/server/lancer/telemetry-buffer.d.ts +15 -0
- package/dist/cjs/server/lancer/telemetry-buffer.js +64 -0
- package/dist/cjs/server/lancer/types.d.ts +201 -0
- package/dist/cjs/server/lancer/types.js +5 -0
- package/dist/cjs/server/pii-shield/aegis-detector.d.ts +26 -0
- package/dist/cjs/server/pii-shield/aegis-detector.js +26 -0
- package/dist/cjs/server/pii-shield/create-pii-shield.d.ts +2 -0
- package/dist/cjs/server/pii-shield/create-pii-shield.js +191 -0
- package/dist/cjs/server/pii-shield/deep-walk.d.ts +1 -0
- package/dist/cjs/server/pii-shield/deep-walk.js +19 -0
- package/dist/cjs/server/pii-shield/fake-data.d.ts +5 -0
- package/dist/cjs/server/pii-shield/fake-data.js +170 -0
- package/dist/cjs/server/pii-shield/index.d.ts +4 -0
- package/dist/cjs/server/pii-shield/index.js +9 -0
- package/dist/cjs/server/pii-shield/leakage.d.ts +1 -0
- package/dist/cjs/server/pii-shield/leakage.js +15 -0
- package/dist/cjs/server/pii-shield/session-mapping.d.ts +12 -0
- package/dist/cjs/server/pii-shield/session-mapping.js +70 -0
- package/dist/cjs/server/pipeline.d.ts +26 -0
- package/dist/cjs/server/pipeline.js +127 -0
- package/dist/cjs/server/testing/approvals.d.ts +11 -0
- package/dist/cjs/server/testing/approvals.js +41 -0
- package/dist/cjs/server/testing/combination.d.ts +3 -0
- package/dist/cjs/server/testing/combination.js +83 -0
- package/dist/cjs/server/testing/create-test-suite.d.ts +29 -0
- package/dist/cjs/server/testing/create-test-suite.js +81 -0
- package/dist/cjs/server/testing/edge-cases.d.ts +8 -0
- package/dist/cjs/server/testing/edge-cases.js +277 -0
- package/dist/cjs/server/testing/guardrails.d.ts +14 -0
- package/dist/cjs/server/testing/guardrails.js +152 -0
- package/dist/cjs/server/testing/helpers.d.ts +14 -0
- package/dist/cjs/server/testing/helpers.js +119 -0
- package/dist/cjs/server/testing/index.d.ts +12 -0
- package/dist/cjs/server/testing/index.js +37 -0
- package/dist/cjs/server/testing/mock-executor.d.ts +8 -0
- package/dist/cjs/server/testing/mock-executor.js +40 -0
- package/dist/cjs/server/testing/regression.d.ts +7 -0
- package/dist/cjs/server/testing/regression.js +27 -0
- package/dist/cjs/server/testing/routing.d.ts +12 -0
- package/dist/cjs/server/testing/routing.js +63 -0
- package/dist/cjs/server/testing/schema-consistency.d.ts +6 -0
- package/dist/cjs/server/testing/schema-consistency.js +56 -0
- package/dist/cjs/server/testing/smoke.d.ts +11 -0
- package/dist/cjs/server/testing/smoke.js +64 -0
- package/dist/cjs/server/testing/types.d.ts +156 -0
- package/dist/cjs/server/testing/types.js +2 -0
- package/dist/cjs/types.d.ts +696 -0
- package/dist/cjs/types.js +91 -0
- package/dist/cli/commands/install-skills.d.ts +17 -0
- package/dist/cli/commands/install-skills.js +185 -0
- package/dist/cli/commands/install-skills.js.map +1 -0
- package/dist/cli/index.js +25 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/react/components/ai-trigger-button.js +4 -6
- package/dist/react/components/ai-trigger-button.js.map +1 -1
- package/dist/react/components/recording-bar.js +4 -6
- package/dist/react/components/recording-bar.js.map +1 -1
- package/dist/react/components/wavesurfer-loader.d.ts +5 -0
- package/dist/react/components/wavesurfer-loader.js +34 -0
- package/dist/react/components/wavesurfer-loader.js.map +1 -0
- package/dist/server/adapters/nestjs/chat/ai-chat.module.d.ts +1 -1
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js +3 -2
- package/dist/server/adapters/nestjs/chat/ai-chat.module.js.map +1 -1
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.d.ts +1 -1
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js +10 -8
- package/dist/server/adapters/nestjs/chat/speech-stream.gateway.js.map +1 -1
- package/dist/server/adapters/nestjs/chat/ws-loader.d.ts +5 -0
- package/dist/server/adapters/nestjs/chat/ws-loader.js +37 -0
- package/dist/server/adapters/nestjs/chat/ws-loader.js.map +1 -0
- package/dist/server/adapters/nextjs/create-ai-chat-handler.d.ts +16 -0
- package/dist/server/adapters/nextjs/create-ai-chat-handler.js +14 -3
- package/dist/server/adapters/nextjs/create-ai-chat-handler.js.map +1 -1
- package/dist/server/adapters/nextjs/filter-fallback-error.d.ts +11 -0
- package/dist/server/adapters/nextjs/filter-fallback-error.js +38 -0
- package/dist/server/adapters/nextjs/filter-fallback-error.js.map +1 -0
- package/openapi/package.json +5 -0
- package/package.json +66 -21
- package/react/langgraph/package.json +5 -0
- package/react/package.json +5 -0
- package/react/vercel/package.json +5 -0
- package/server/nestjs/package.json +5 -0
- package/server/nextjs/package.json +5 -0
- package/server/package.json +5 -0
- package/server/testing/package.json +5 -0
- package/skills/README.md +107 -0
- package/skills/building-glirastes-chat-ui/SKILL.md +378 -0
- package/skills/integrating-glirastes-nestjs/SKILL.md +346 -0
- package/skills/integrating-glirastes-nextjs/SKILL.md +306 -0
- package/skills/integrating-glirastes-nextjs-with-nestjs-backend/SKILL.md +359 -0
- package/skills/maintaining-glirastes-tools/SKILL.md +463 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,102 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-04-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Dual-bundle output (CJS + ESM). The package now ships a CommonJS build at
|
|
15
|
+
`dist/cjs/` alongside the ESM build at `dist/`, so legacy NestJS backends
|
|
16
|
+
on `module: commonjs` can consume `glirastes/server/nestjs` without an ESM
|
|
17
|
+
migration. The `exports` map uses conditional `import`/`require` branches
|
|
18
|
+
with their own typings.
|
|
19
|
+
- Legacy subpath shim directories at the package root (`server/`, `react/`,
|
|
20
|
+
`codegen/`, `openapi/`) so consumers on `moduleResolution: node` (without
|
|
21
|
+
`exports`-map support) still resolve subpaths.
|
|
22
|
+
- Pre-built agent skills under `skills/` (shipped in the npm tarball):
|
|
23
|
+
`integrating-glirastes-nextjs`, `integrating-glirastes-nestjs`,
|
|
24
|
+
`integrating-glirastes-nextjs-with-nestjs-backend`,
|
|
25
|
+
`maintaining-glirastes-tools`, `building-glirastes-chat-ui`. Drop into
|
|
26
|
+
`.claude/skills/` (or `.codex/skills/`) to give a coding agent
|
|
27
|
+
framework-specific guidance for integrating, maintaining, and customizing
|
|
28
|
+
the SDK.
|
|
29
|
+
- New CLI command `glirastes install-skills` — installs the bundled agent
|
|
30
|
+
skills into a target directory. Flags:
|
|
31
|
+
- default: `./.claude/skills` (project-local)
|
|
32
|
+
- `-g` / `--global`: `~/.claude/skills` (shared across all projects on the
|
|
33
|
+
machine; mutually exclusive with `--target`)
|
|
34
|
+
- `--target <dir>`: override the destination (accepts relative, absolute,
|
|
35
|
+
or `~/`-prefixed paths)
|
|
36
|
+
- `--stack nextjs|nestjs|nextjs+nestjs|all` (default `all`): filter
|
|
37
|
+
- `--symlink`: track the installed SDK version automatically
|
|
38
|
+
- `--force`: overwrite existing
|
|
39
|
+
- `--dry-run`: preview without writing
|
|
40
|
+
- Adapter-selection guidance in the README: when both a frontend and a
|
|
41
|
+
separate backend exist, put the chat route on the backend.
|
|
42
|
+
- Scaling-up section in the README explaining the `glirastes scaffold` →
|
|
43
|
+
`generate-tools` → registry-import codegen workflow.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- `@ai-sdk/react` and `react-markdown` moved from `dependencies` to optional
|
|
48
|
+
`peerDependencies`. Backend-only consumers no longer pull a phantom React
|
|
49
|
+
tree into `node_modules`. Frontend consumers must install them themselves
|
|
50
|
+
(the README install section is split per stack).
|
|
51
|
+
- `dependencies.zod` bumped to `^3.25.76` to match what `ai@6` and
|
|
52
|
+
`@ai-sdk/openai` require.
|
|
53
|
+
- `AiChatModule.attachWebSockets()` is now `async`. Consumers that enable
|
|
54
|
+
the speech-to-text feature must `await` the call.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- Optional peer `wavesurfer.js` is now truly optional. The voice
|
|
59
|
+
components load it via a runtime `Function('s', 'return import(s)')`
|
|
60
|
+
helper so browser-side bundlers (Webpack, Turbopack, Vite, esbuild)
|
|
61
|
+
don't try to resolve the specifier at build time when the package is
|
|
62
|
+
not installed. Note: requires `script-src 'unsafe-eval'` CSP — projects
|
|
63
|
+
with strict CSP should install `wavesurfer.js` unconditionally to
|
|
64
|
+
bypass the runtime trick. See `skills/building-glirastes-chat-ui` for
|
|
65
|
+
details.
|
|
66
|
+
- Optional peer `ws` is now truly optional. The NestJS speech-to-text
|
|
67
|
+
gateway uses a plain dynamic `import('ws')` inside `attachWebSockets`,
|
|
68
|
+
guarded by try/catch — backends that don't enable speech-to-text no
|
|
69
|
+
longer crash with `ERR_MODULE_NOT_FOUND` at startup. (Bundled NestJS
|
|
70
|
+
deployments must either install `ws` unconditionally or mark it as a
|
|
71
|
+
bundler external.)
|
|
72
|
+
|
|
73
|
+
## [0.3.0] - 2026-04-28
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
- README NestJS examples now match the real decorator API: `@AiTool({ name })`
|
|
78
|
+
not `toolName`, `@AiModule({ intent, classification })` takes an options
|
|
79
|
+
object, `scanNestJsControllers({ controllers })` takes an options object
|
|
80
|
+
and returns `{ tools, modules, toolsByModule }` (destructure `.tools`
|
|
81
|
+
before passing to `endpointToolsToRegistry`).
|
|
82
|
+
- Stream handler no longer emits the fallback `"No output generated.
|
|
83
|
+
Check the stream for errors."` event when an upstream error has
|
|
84
|
+
already been streamed in the same response.
|
|
85
|
+
|
|
86
|
+
### Changed
|
|
87
|
+
|
|
88
|
+
- Peer-dep range for `@nestjs/common`, `@nestjs/core`, `@nestjs/config`,
|
|
89
|
+
`@nestjs/swagger` widened to support v10 alongside v11.
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
|
|
93
|
+
- `examples/quickstart-nestjs/` and `examples/quickstart-nextjs/` —
|
|
94
|
+
compile-tested in CI via `tests/examples-compile.test.ts`. What you
|
|
95
|
+
copy from the README is what compiles.
|
|
96
|
+
- README "Setup notes" section: recommended `tsconfig.json` (so
|
|
97
|
+
`Cannot find module 'glirastes/server/nestjs'` no longer surprises
|
|
98
|
+
consumers on legacy `moduleResolution`) and a subpath decision-tree
|
|
99
|
+
table.
|
|
100
|
+
- `FOLLOWUPS.md` capturing deferred work: dual ESM+CJS bundle,
|
|
101
|
+
`glirastes`+`glirastes-react` split for production trim, optional
|
|
102
|
+
`baseUrl` for endpoint tools, registry sugar, CLI docs.
|
|
103
|
+
- `DEFAULT_SAFETY_MAX_STEPS` and `resolveStepLimit` are now public exports
|
|
104
|
+
so consumers can pin / replicate the safety-cap behaviour in tests.
|
|
105
|
+
|
|
10
106
|
## [0.2.1] - 2026-04-27
|
|
11
107
|
|
|
12
108
|
### Changed
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
# Contributor Covenant Code of Conduct
|
|
3
|
+
|
|
4
|
+
## Our Pledge
|
|
5
|
+
|
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
7
|
+
|
|
8
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
9
|
+
|
|
10
|
+
## Our Standards
|
|
11
|
+
|
|
12
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
13
|
+
|
|
14
|
+
* Demonstrating empathy and kindness toward other people
|
|
15
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
16
|
+
* Giving and gracefully accepting constructive feedback
|
|
17
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
18
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
19
|
+
|
|
20
|
+
Examples of unacceptable behavior include:
|
|
21
|
+
|
|
22
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
+
* Public or private harassment
|
|
25
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
26
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
27
|
+
|
|
28
|
+
## Enforcement Responsibilities
|
|
29
|
+
|
|
30
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
31
|
+
|
|
32
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
33
|
+
|
|
34
|
+
## Scope
|
|
35
|
+
|
|
36
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
37
|
+
|
|
38
|
+
## Enforcement
|
|
39
|
+
|
|
40
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hello@chainmatics.net. All complaints will be reviewed and investigated promptly and fairly.
|
|
41
|
+
|
|
42
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
43
|
+
|
|
44
|
+
## Enforcement Guidelines
|
|
45
|
+
|
|
46
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
47
|
+
|
|
48
|
+
### 1. Correction
|
|
49
|
+
|
|
50
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
51
|
+
|
|
52
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
53
|
+
|
|
54
|
+
### 2. Warning
|
|
55
|
+
|
|
56
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
57
|
+
|
|
58
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
59
|
+
|
|
60
|
+
### 3. Temporary Ban
|
|
61
|
+
|
|
62
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
63
|
+
|
|
64
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
65
|
+
|
|
66
|
+
### 4. Permanent Ban
|
|
67
|
+
|
|
68
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
69
|
+
|
|
70
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
71
|
+
|
|
72
|
+
## Attribution
|
|
73
|
+
|
|
74
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
75
|
+
|
|
76
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
77
|
+
|
|
78
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
79
|
+
|
|
80
|
+
[homepage]: https://www.contributor-covenant.org
|
|
81
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
82
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
83
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
84
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
85
|
+
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Contributing to glirastes
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing! This document describes how to
|
|
4
|
+
propose changes to the project.
|
|
5
|
+
|
|
6
|
+
## Code of Conduct
|
|
7
|
+
|
|
8
|
+
This project follows the [Contributor Covenant](CODE_OF_CONDUCT.md).
|
|
9
|
+
By participating you agree to uphold its terms. Report unacceptable behavior to
|
|
10
|
+
**conduct@chainmatics.net**.
|
|
11
|
+
|
|
12
|
+
## Development Setup
|
|
13
|
+
|
|
14
|
+
Requirements:
|
|
15
|
+
|
|
16
|
+
- [Bun](https://bun.sh) ≥ 1.0
|
|
17
|
+
- Node.js ≥ 20 (for compatibility checks; runtime is Bun)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/chainmatics/glirastes.git
|
|
21
|
+
cd glirastes
|
|
22
|
+
bun install
|
|
23
|
+
bun run typecheck
|
|
24
|
+
bun run test
|
|
25
|
+
bun run build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
There is no linter or formatter; TypeScript strict mode is the only static
|
|
29
|
+
check.
|
|
30
|
+
|
|
31
|
+
## Submitting Changes
|
|
32
|
+
|
|
33
|
+
1. Fork the repository and create a branch from `main`
|
|
34
|
+
2. Keep PRs **small and focused** — one logical change per PR
|
|
35
|
+
3. Make sure `bun run typecheck` and `bun run test` pass locally
|
|
36
|
+
4. Use [Conventional Commits](https://www.conventionalcommits.org/) for commit
|
|
37
|
+
messages, e.g. `feat(server): add streaming support`
|
|
38
|
+
5. Open the PR with a clear description of *what* changed and *why*
|
|
39
|
+
|
|
40
|
+
## Developer Certificate of Origin (DCO)
|
|
41
|
+
|
|
42
|
+
We use the [Developer Certificate of Origin](https://developercertificate.org/)
|
|
43
|
+
rather than a CLA. By contributing, you certify that you have the right to
|
|
44
|
+
submit your work under the project license (Apache-2.0).
|
|
45
|
+
|
|
46
|
+
Sign-off is **encouraged but not enforced** in CI today. If you want to
|
|
47
|
+
sign-off your commits — or for substantial contributions where provenance
|
|
48
|
+
matters — append a `Signed-off-by` trailer:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git commit -s -m "feat(server): add streaming support"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This adds a `Signed-off-by: Your Name <you@example.com>` line.
|
|
55
|
+
|
|
56
|
+
## Code Style
|
|
57
|
+
|
|
58
|
+
- TypeScript **strict mode** — no `any` without justification
|
|
59
|
+
- ESM only (`"type": "module"`)
|
|
60
|
+
- Relative imports only — no path aliases
|
|
61
|
+
- Avoid comments unless they explain a non-obvious *why*
|
|
62
|
+
- Tests use Vitest; place them next to the source as `*.test.ts`
|
|
63
|
+
|
|
64
|
+
## Reporting Bugs
|
|
65
|
+
|
|
66
|
+
[Open an issue](https://github.com/chainmatics/glirastes/issues/new/choose)
|
|
67
|
+
and include:
|
|
68
|
+
|
|
69
|
+
- `glirastes` version (`bun pm ls glirastes`)
|
|
70
|
+
- Minimal reproduction (a tiny repo or gist is best)
|
|
71
|
+
- Expected vs actual behavior
|
|
72
|
+
- Stack trace, if any
|
|
73
|
+
|
|
74
|
+
## Reporting Security Issues
|
|
75
|
+
|
|
76
|
+
**Do not** open a public issue for security vulnerabilities. See
|
|
77
|
+
[SECURITY.md](SECURITY.md) for the private reporting channel.
|
|
78
|
+
|
|
79
|
+
## Releasing
|
|
80
|
+
|
|
81
|
+
Releases are published from CI on tagged commits. Maintainers only:
|
|
82
|
+
|
|
83
|
+
1. Bump `version` in `package.json`
|
|
84
|
+
2. Commit and push to `main`
|
|
85
|
+
3. `git tag v<version> && git push origin v<version>`
|
|
86
|
+
|
|
87
|
+
The `Publish glirastes` workflow builds and publishes to npm with provenance.
|
package/README.md
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="#quick-start"><strong>Quick Start</strong></a> ·
|
|
13
|
+
<a href="#quick-start-nextjs-or-nestjs"><strong>Quick Start</strong></a> ·
|
|
14
14
|
<a href="#core-concepts"><strong>Concepts</strong></a> ·
|
|
15
15
|
<a href="#examples"><strong>Examples</strong></a> ·
|
|
16
16
|
<a href="#advanced"><strong>Advanced</strong></a> ·
|
|
17
|
-
<a href="#
|
|
17
|
+
<a href="#scaling-up--codegen-workflow"><strong>Scaling up</strong></a> ·
|
|
18
|
+
<a href="#cli"><strong>CLI</strong></a> ·
|
|
19
|
+
<a href="#agent-skills"><strong>Skills</strong></a>
|
|
18
20
|
</p>
|
|
19
21
|
|
|
20
22
|
<p align="center">
|
|
@@ -83,31 +85,61 @@ Building an AI feature means wiring together **tool definitions**, **API calls**
|
|
|
83
85
|
|
|
84
86
|
<br/>
|
|
85
87
|
|
|
86
|
-
## Quick Start ([Next.js](https://nextjs.org/)
|
|
88
|
+
## Quick Start ([Next.js](https://nextjs.org/) or [NestJS](https://nestjs.com/))
|
|
89
|
+
|
|
90
|
+
### Which adapter should I use?
|
|
91
|
+
|
|
92
|
+
If you only have one server, the answer is "that one". If you have **both** a Next.js frontend *and* a separate backend (NestJS, Express, …), put the chat route on the **backend**:
|
|
93
|
+
|
|
94
|
+
| Setup | Use this adapter |
|
|
95
|
+
|---|---|
|
|
96
|
+
| Next.js full-stack (no separate backend) | `glirastes/server/nextjs` |
|
|
97
|
+
| Next.js frontend + NestJS backend | `glirastes/server/nestjs` ✅ |
|
|
98
|
+
| Pure NestJS (Swagger UI as client) | `glirastes/server/nestjs` |
|
|
99
|
+
| Express backend + any frontend | `glirastes/server` (manual wiring) |
|
|
100
|
+
|
|
101
|
+
**Why prefer the real backend over a Next.js Route Handler?**
|
|
102
|
+
|
|
103
|
+
- **Tools are annotated controllers.** Your existing endpoints become AI-callable in place — no second code path, no `defineEndpointTool` mirroring controller URLs.
|
|
104
|
+
- **One auth source.** Your JWT guard / tenant context already runs there. Don't re-validate tokens in a Next.js route just to forward them.
|
|
105
|
+
- **No extra HTTP hop.** Browser → backend → DB instead of Browser → Next.js → backend → DB on every tool call.
|
|
106
|
+
- **Tools can call services directly.** No HTTP membrane between the AI tool and your business logic.
|
|
107
|
+
- **One observability pipeline.** Logs, traces, rate limits where they already live.
|
|
108
|
+
|
|
109
|
+
The Next.js Route Handler is right when Next.js *is* your backend, when you're prototyping, or when every tool is an external API call anyway.
|
|
110
|
+
|
|
111
|
+
Pick your stack — both come up in the same four steps.
|
|
87
112
|
|
|
88
113
|
### 1. Install
|
|
89
114
|
|
|
90
115
|
```bash
|
|
116
|
+
# Backend only (NestJS / Next.js Route Handlers)
|
|
91
117
|
npm install glirastes
|
|
118
|
+
|
|
119
|
+
# Frontend / chat UI consumers — add the React UI peers
|
|
120
|
+
npm install glirastes @ai-sdk/react react-markdown
|
|
92
121
|
```
|
|
93
122
|
|
|
94
|
-
|
|
123
|
+
The Vercel AI SDK (`ai`) is bundled. `@ai-sdk/react` and `react-markdown` are declared as **optional peer dependencies** so backend-only consumers don't have a phantom React tree in their `node_modules`. Install them yourself when you use any `glirastes/react/*` subpath.
|
|
124
|
+
|
|
125
|
+
> **Requirements:** Node.js `>=20`. The React chat UI needs `react` and `react-dom` `^19` — Next.js apps already have these.
|
|
95
126
|
>
|
|
96
|
-
> **
|
|
127
|
+
> **Optional** — only if you want voice input with a live waveform:
|
|
97
128
|
> ```bash
|
|
98
|
-
> # Required for VercelAiChat / LangGraphAiChat:
|
|
99
|
-
> npm install react react-dom ai @ai-sdk/react
|
|
100
|
-
>
|
|
101
|
-
> # Optional — enables Markdown rendering in messages (falls back to plain text):
|
|
102
|
-
> npm install react-markdown
|
|
103
|
-
>
|
|
104
|
-
> # Optional — enables waveform visualization for voice input:
|
|
105
129
|
> npm install wavesurfer.js
|
|
106
130
|
> ```
|
|
107
131
|
|
|
108
|
-
### 2. Define a tool
|
|
132
|
+
### 2. Define a tool
|
|
109
133
|
|
|
110
|
-
|
|
134
|
+
The SDK uses the declared `method` + `path` (or the route the decorator already exposes) to call your own API when the LLM picks this tool — you never write a `fetch` yourself.
|
|
135
|
+
|
|
136
|
+
<table>
|
|
137
|
+
<tr>
|
|
138
|
+
<th>Next.js — co-located <code>ai-tool.ts</code></th>
|
|
139
|
+
<th>NestJS — decorators on your controller</th>
|
|
140
|
+
</tr>
|
|
141
|
+
<tr>
|
|
142
|
+
<td valign="top">
|
|
111
143
|
|
|
112
144
|
```ts
|
|
113
145
|
// app/api/tasks/ai-tool.ts
|
|
@@ -126,7 +158,39 @@ export const listTasks = defineEndpointTool({
|
|
|
126
158
|
});
|
|
127
159
|
```
|
|
128
160
|
|
|
129
|
-
|
|
161
|
+
</td>
|
|
162
|
+
<td valign="top">
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
// tasks.controller.ts
|
|
166
|
+
import { Controller, Get, Query } from '@nestjs/common';
|
|
167
|
+
import { AiModule, AiTool } from 'glirastes/server/nestjs';
|
|
168
|
+
|
|
169
|
+
@Controller('tasks')
|
|
170
|
+
@AiModule({
|
|
171
|
+
intent: 'task_management',
|
|
172
|
+
classification: {
|
|
173
|
+
hint: 'User asks about listing or filtering tasks.',
|
|
174
|
+
examples: ['show me open tasks', 'what is done?', 'list my tasks'],
|
|
175
|
+
},
|
|
176
|
+
})
|
|
177
|
+
export class TaskController {
|
|
178
|
+
@Get()
|
|
179
|
+
@AiTool({
|
|
180
|
+
name: 'list_tasks',
|
|
181
|
+
description: 'List tasks with an optional status filter.',
|
|
182
|
+
})
|
|
183
|
+
list(@Query('status') status?: 'open' | 'done') {
|
|
184
|
+
return this.taskService.list(status);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
</td>
|
|
190
|
+
</tr>
|
|
191
|
+
</table>
|
|
192
|
+
|
|
193
|
+
### 3. Drop a chat widget into your frontend
|
|
130
194
|
|
|
131
195
|
```tsx
|
|
132
196
|
'use client';
|
|
@@ -142,7 +206,15 @@ export default function RootLayout({ children }) {
|
|
|
142
206
|
}
|
|
143
207
|
```
|
|
144
208
|
|
|
145
|
-
### 4. Wire up
|
|
209
|
+
### 4. Wire up the chat handler
|
|
210
|
+
|
|
211
|
+
<table>
|
|
212
|
+
<tr>
|
|
213
|
+
<th>Next.js — <code>app/api/chat/route.ts</code></th>
|
|
214
|
+
<th>NestJS — register controllers in <code>AiChatModule</code></th>
|
|
215
|
+
</tr>
|
|
216
|
+
<tr>
|
|
217
|
+
<td valign="top">
|
|
146
218
|
|
|
147
219
|
```ts
|
|
148
220
|
import { createAiChatHandler } from 'glirastes/server/nextjs';
|
|
@@ -154,7 +226,62 @@ export const POST = createAiChatHandler({
|
|
|
154
226
|
});
|
|
155
227
|
```
|
|
156
228
|
|
|
157
|
-
|
|
229
|
+
</td>
|
|
230
|
+
<td valign="top">
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
import { scanNestJsControllers } from 'glirastes/server/nestjs';
|
|
234
|
+
import { endpointToolsToRegistry } from 'glirastes/server';
|
|
235
|
+
import { TaskController } from './tasks/tasks.controller';
|
|
236
|
+
|
|
237
|
+
const scan = scanNestJsControllers({ controllers: [TaskController] });
|
|
238
|
+
const registry = endpointToolsToRegistry(scan.tools);
|
|
239
|
+
|
|
240
|
+
// Pass `registry` to createAiChatHandler in your chat route.
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
</td>
|
|
244
|
+
</tr>
|
|
245
|
+
</table>
|
|
246
|
+
|
|
247
|
+
Done. AI chat is live, streaming, and your `list_tasks` tool is callable. Add more tools the same way — pick the style that matches your stack. See [NestJS with decorators](#nestjs-with-decorators) below for DTOs, `@AiParam`, and multi-controller scanning.
|
|
248
|
+
|
|
249
|
+
### Setup notes
|
|
250
|
+
|
|
251
|
+
#### tsconfig — modern is best, legacy still works
|
|
252
|
+
|
|
253
|
+
Glirastes ships **both** ESM (`dist/`) and CommonJS (`dist/cjs/`) with a conditional `exports` map, plus subpath shim directories at the package root for legacy resolvers. Both setups below are supported:
|
|
254
|
+
|
|
255
|
+
**Modern (recommended):**
|
|
256
|
+
|
|
257
|
+
```jsonc
|
|
258
|
+
{
|
|
259
|
+
"compilerOptions": {
|
|
260
|
+
"module": "node16", // or "nodenext" / "esnext"
|
|
261
|
+
"moduleResolution": "node16", // or "nodenext" / "bundler"
|
|
262
|
+
"target": "ES2022",
|
|
263
|
+
"esModuleInterop": true,
|
|
264
|
+
"experimentalDecorators": true, // NestJS only
|
|
265
|
+
"emitDecoratorMetadata": true // NestJS only
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Legacy NestJS template (default `module: commonjs`):** works as-is — no tsconfig changes required. The shim directories under `glirastes/server/`, `glirastes/react/` etc. let the classic Node resolver find each subpath, and the CommonJS build under `dist/cjs/` provides the runtime artifacts.
|
|
271
|
+
|
|
272
|
+
#### Which subpath do I import from?
|
|
273
|
+
|
|
274
|
+
| Where the code runs | Import from |
|
|
275
|
+
|---|---|
|
|
276
|
+
| Anywhere (tool definitions, types, helpers) | `glirastes` |
|
|
277
|
+
| Server-side core (registry helpers, pipeline) | `glirastes/server` |
|
|
278
|
+
| Next.js App Router route handlers | `glirastes/server/nextjs` |
|
|
279
|
+
| NestJS controllers / modules | `glirastes/server/nestjs` |
|
|
280
|
+
| Test suite without LLM calls | `glirastes/server/testing` |
|
|
281
|
+
| React components, client hooks | `glirastes/react` |
|
|
282
|
+
| Vercel AI SDK chat widget | `glirastes/react/vercel` |
|
|
283
|
+
| LangGraph chat widget | `glirastes/react/langgraph` |
|
|
284
|
+
| Default chat panel CSS | `glirastes/react/styles.css` |
|
|
158
285
|
|
|
159
286
|
<br/>
|
|
160
287
|
|
|
@@ -307,15 +434,21 @@ Prefer declaring tools where the endpoint lives? Use NestJS decorators. Three pi
|
|
|
307
434
|
|
|
308
435
|
```ts
|
|
309
436
|
// tasks.controller.ts
|
|
310
|
-
import { Controller, Post, Body } from '@nestjs/common';
|
|
437
|
+
import { Controller, Post, Body, Get, Param } from '@nestjs/common';
|
|
311
438
|
import { AiModule, AiTool } from 'glirastes/server/nestjs';
|
|
312
439
|
|
|
313
440
|
@Controller('tasks')
|
|
314
|
-
@AiModule(
|
|
441
|
+
@AiModule({
|
|
442
|
+
intent: 'task_management',
|
|
443
|
+
classification: {
|
|
444
|
+
hint: 'User wants to create, update, or query tasks.',
|
|
445
|
+
examples: ['create a task', 'mark task as done', 'list my tasks'],
|
|
446
|
+
},
|
|
447
|
+
})
|
|
315
448
|
export class TaskController {
|
|
316
449
|
@Post()
|
|
317
450
|
@AiTool({
|
|
318
|
-
|
|
451
|
+
name: 'create_task',
|
|
319
452
|
description: 'Create a new task',
|
|
320
453
|
})
|
|
321
454
|
async create(@Body() dto: CreateTaskDto) {
|
|
@@ -355,11 +488,13 @@ Wire it up in your `AiChatModule`:
|
|
|
355
488
|
import { scanNestJsControllers } from 'glirastes/server/nestjs';
|
|
356
489
|
import { endpointToolsToRegistry } from 'glirastes/server';
|
|
357
490
|
|
|
358
|
-
const
|
|
359
|
-
|
|
491
|
+
const scan = scanNestJsControllers({
|
|
492
|
+
controllers: [TaskController, /* ...other controllers */],
|
|
493
|
+
});
|
|
494
|
+
const registry = endpointToolsToRegistry(scan.tools);
|
|
360
495
|
```
|
|
361
496
|
|
|
362
|
-
|
|
497
|
+
`scanNestJsControllers` returns `{ tools, modules, toolsByModule }` — pass `scan.tools` to `endpointToolsToRegistry`, then hand `registry` to `createAiChatHandler({ tools: registry })`. No separate `ai-tool.ts` files, no manual registration.
|
|
363
498
|
|
|
364
499
|
### Client-side action handlers
|
|
365
500
|
|
|
@@ -637,6 +772,65 @@ The voice button streams audio to your backend, which proxies it to a speech-to-
|
|
|
637
772
|
|
|
638
773
|
<br/>
|
|
639
774
|
|
|
775
|
+
## Scaling up — codegen workflow
|
|
776
|
+
|
|
777
|
+
Hand-importing 50 tool definitions into your chat route doesn't scale. The CLI generates a registry from co-located `*.ai-tool.ts` files so you can stay co-located while still wiring everything centrally.
|
|
778
|
+
|
|
779
|
+
### 1. Bootstrap a tool from an existing route
|
|
780
|
+
|
|
781
|
+
```bash
|
|
782
|
+
npx glirastes scaffold --route src/app/api/tasks/route.ts
|
|
783
|
+
# --dry-run to preview, --force to overwrite
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
Produces `src/app/api/tasks/ai-tool.ts` with a starter `defineEndpointTool({ ... })` call — input schema derived from your route, TODO description, sensible defaults. Edit, save.
|
|
787
|
+
|
|
788
|
+
### 2. Wire the codegen into your scripts
|
|
789
|
+
|
|
790
|
+
```json
|
|
791
|
+
{
|
|
792
|
+
"scripts": {
|
|
793
|
+
"predev": "glirastes generate-tools --quiet",
|
|
794
|
+
"prebuild": "glirastes generate-tools --quiet",
|
|
795
|
+
"ai:scaffold": "glirastes scaffold",
|
|
796
|
+
"ai:coverage": "glirastes coverage",
|
|
797
|
+
"ai:coverage:ci": "glirastes coverage --ci",
|
|
798
|
+
"ai:validate": "glirastes validate-tools",
|
|
799
|
+
"ai:validate:ci": "glirastes validate-tools --ci",
|
|
800
|
+
"ai:test": "glirastes test"
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
`predev` / `prebuild` regenerate `src/generated/ai-tools/{endpoint,ui,modules,action-ids}.generated.ts` on every dev start and CI build — the generated registry becomes source-of-truth.
|
|
806
|
+
|
|
807
|
+
### 3. Import the registry in your chat route
|
|
808
|
+
|
|
809
|
+
```ts
|
|
810
|
+
// app/api/chat/route.ts (Next.js)
|
|
811
|
+
import { createAiChatHandler } from 'glirastes/server/nextjs';
|
|
812
|
+
import { endpointToolRegistry } from '@/generated/ai-tools/endpoint.generated';
|
|
813
|
+
import { uiToolRegistry } from '@/generated/ai-tools/ui.generated';
|
|
814
|
+
|
|
815
|
+
export const POST = createAiChatHandler({
|
|
816
|
+
tools: { ...endpointToolRegistry, ...uiToolRegistry },
|
|
817
|
+
model: openai('gpt-4o-mini'),
|
|
818
|
+
});
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
NestJS users skip this entire workflow: `scanNestJsControllers` reads your `@AiTool`-decorated controllers at runtime. No co-located files, no `*.generated.ts`. See [NestJS with decorators](#nestjs-with-decorators).
|
|
822
|
+
|
|
823
|
+
### 4. CI gates
|
|
824
|
+
|
|
825
|
+
```bash
|
|
826
|
+
npm run ai:coverage:ci # fails if any route lacks an ai-tool.ts (or has an orphan handler)
|
|
827
|
+
npm run ai:validate:ci # fails if a tool definition is malformed or path-mismatched
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
For the full deep-dive — UI patterns, intent modules, approval flow, naming conventions, deterministic testing — drop the [`maintaining-glirastes-tools`](./skills/maintaining-glirastes-tools/SKILL.md) skill into your agent. See [Agent skills](#agent-skills) below.
|
|
831
|
+
|
|
832
|
+
<br/>
|
|
833
|
+
|
|
640
834
|
## CLI
|
|
641
835
|
|
|
642
836
|
The SDK includes a `glirastes` CLI for scaffolding, code generation, and validation. Run any command with `npx glirastes <command>` or `bunx glirastes <command>`:
|
|
@@ -651,6 +845,7 @@ The SDK includes a `glirastes` CLI for scaffolding, code generation, and validat
|
|
|
651
845
|
| `generate-skills` | Export tools as Claude Code / Codex skill files |
|
|
652
846
|
| `generate-mcp-server` | Export tools as a standalone MCP server project |
|
|
653
847
|
| `generate-auto` | Auto-detect layout and run the right generator |
|
|
848
|
+
| `install-skills` | Install the bundled agent skills under `skills/` into your repo (e.g. `.claude/skills/`) |
|
|
654
849
|
| `validate` | Validate OpenAPI spec for `x-ai` correctness |
|
|
655
850
|
| `validate-tools` | Validate AI tool configuration |
|
|
656
851
|
| `coverage` | Report which API routes have AI tools and which don't |
|
|
@@ -661,6 +856,56 @@ The SDK includes a `glirastes` CLI for scaffolding, code generation, and validat
|
|
|
661
856
|
|
|
662
857
|
<br/>
|
|
663
858
|
|
|
859
|
+
## Agent skills
|
|
860
|
+
|
|
861
|
+
Glirastes ships pre-built [agent skills](https://docs.claude.com/en/docs/claude-code/skills) under [`skills/`](./skills) that teach a coding agent (Claude Code, Codex, Cursor, …) how to integrate, maintain, and customize the SDK. Drop them into your repo and the agent picks the right one automatically.
|
|
862
|
+
|
|
863
|
+
| Skill | Use when |
|
|
864
|
+
|---|---|
|
|
865
|
+
| [`integrating-glirastes-nextjs`](./skills/integrating-glirastes-nextjs/SKILL.md) | Adding chat to a Next.js app where Next.js is the backend |
|
|
866
|
+
| [`integrating-glirastes-nestjs`](./skills/integrating-glirastes-nestjs/SKILL.md) | Adding chat to a NestJS backend (with or without a frontend) |
|
|
867
|
+
| [`integrating-glirastes-nextjs-with-nestjs-backend`](./skills/integrating-glirastes-nextjs-with-nestjs-backend/SKILL.md) | Full-stack setup: Next.js frontend + separate NestJS backend |
|
|
868
|
+
| [`maintaining-glirastes-tools`](./skills/maintaining-glirastes-tools/SKILL.md) | Authoring `ai-tool.ts`, intent modules, codegen, all CLI commands |
|
|
869
|
+
| [`building-glirastes-chat-ui`](./skills/building-glirastes-chat-ui/SKILL.md) | Customizing the chat UI — theming, mentions, voice input, action bus |
|
|
870
|
+
|
|
871
|
+
### Install via the bundled CLI
|
|
872
|
+
|
|
873
|
+
After `npm install glirastes`, run the bundled installer. Two scopes:
|
|
874
|
+
|
|
875
|
+
- **Project-local** (default): writes to `./.claude/skills`. Each project gets the skills tied to its own installed `glirastes` version. Best for teams checking the directory into git.
|
|
876
|
+
- **Global** (`-g`): writes to `~/.claude/skills`. Shared across every project on the machine. Best for solo work across multiple Glirastes projects.
|
|
877
|
+
|
|
878
|
+
```bash
|
|
879
|
+
# Project-local — installs into ./.claude/skills (default)
|
|
880
|
+
npx glirastes install-skills
|
|
881
|
+
|
|
882
|
+
# Global — installs into ~/.claude/skills (shared across all projects on this machine)
|
|
883
|
+
npx glirastes install-skills -g
|
|
884
|
+
|
|
885
|
+
# Only the skills relevant to your stack
|
|
886
|
+
npx glirastes install-skills --stack nextjs # Next.js standalone
|
|
887
|
+
npx glirastes install-skills --stack nestjs # NestJS standalone
|
|
888
|
+
npx glirastes install-skills --stack nextjs+nestjs # full-stack monorepo
|
|
889
|
+
|
|
890
|
+
# Different agent? Pass --target
|
|
891
|
+
npx glirastes install-skills --target .codex/skills
|
|
892
|
+
|
|
893
|
+
# Auto-update with the SDK on every npm install
|
|
894
|
+
npx glirastes install-skills --symlink
|
|
895
|
+
|
|
896
|
+
# Preview without writing
|
|
897
|
+
npx glirastes install-skills --dry-run
|
|
898
|
+
|
|
899
|
+
# Overwrite previously installed skills
|
|
900
|
+
npx glirastes install-skills --force
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
`install-skills` reads the bundled skills under `node_modules/glirastes/skills/` and writes them to your repo. The `--symlink` mode keeps them auto-fresh — bumping `glirastes` and rerunning `npm install` updates the skill content without re-running the installer.
|
|
904
|
+
|
|
905
|
+
> **`generate-skills` (CLI command) ≠ these skills.** `generate-skills` exports *your tools* as skill files so external agents can call them. The skills under `skills/` instruct an agent on how to *integrate Glirastes itself*. Both ship in the npm package; they don't conflict.
|
|
906
|
+
|
|
907
|
+
<br/>
|
|
908
|
+
|
|
664
909
|
## License
|
|
665
910
|
|
|
666
911
|
Licensed under the [Apache License, Version 2.0](./LICENSE). You may use, modify, and distribute this SDK freely in commercial and non-commercial projects.
|