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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ChatMessage, PendingApproval, MentionResult, MentionData, MentionConfig, ChatClassNames, ChatComponents, ChatLocale, SuggestionsConfig, TruncationInfo, ToolResultDisplayConfig, ToolLabelConfig, VoiceInputConfig, PipelineStepReport, PipelineState, PipelineMessageTranslator, StepSummaryFormatter, SessionSummary } from '../types.js';
|
|
3
|
+
type MentionTrigger = '@' | '/' | null;
|
|
4
|
+
export interface ChatContextValue {
|
|
5
|
+
classNames: ChatClassNames;
|
|
6
|
+
components: ChatComponents;
|
|
7
|
+
locale: ChatLocale;
|
|
8
|
+
/**
|
|
9
|
+
* Resolved theme vars (CSS custom properties). Spread this onto the
|
|
10
|
+
* `style` prop of any widget root (`data-component="ai-chat-panel"`,
|
|
11
|
+
* `chat-window`, `ai-trigger-button`) to apply the `theme` prop.
|
|
12
|
+
*/
|
|
13
|
+
themeVars: CSSProperties;
|
|
14
|
+
/**
|
|
15
|
+
* Optional hint for themes that require special CSS treatment (e.g.
|
|
16
|
+
* `liquid-glass` needs `backdrop-filter`). Apply as
|
|
17
|
+
* `data-theme-effect={themeEffect}` on widget roots.
|
|
18
|
+
*/
|
|
19
|
+
themeEffect: string | undefined;
|
|
20
|
+
suggestions: SuggestionsConfig;
|
|
21
|
+
toolLabels: ToolLabelConfig;
|
|
22
|
+
toolResults: ToolResultDisplayConfig;
|
|
23
|
+
voice: VoiceInputConfig;
|
|
24
|
+
mentionConfig?: MentionConfig;
|
|
25
|
+
pipelineMessageTranslator?: PipelineMessageTranslator;
|
|
26
|
+
stepSummaryFormatter?: StepSummaryFormatter;
|
|
27
|
+
messages: ChatMessage[];
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
error: Error | null;
|
|
30
|
+
send: (message: string) => void;
|
|
31
|
+
stop: () => void;
|
|
32
|
+
clear: () => void;
|
|
33
|
+
loadMore: () => void;
|
|
34
|
+
hasMore: boolean;
|
|
35
|
+
pipelineSteps: PipelineStepReport[];
|
|
36
|
+
pipelineState: PipelineState | null;
|
|
37
|
+
pendingApprovals: PendingApproval[];
|
|
38
|
+
approve: (id: string) => void;
|
|
39
|
+
reject: (id: string) => void;
|
|
40
|
+
isProcessingApproval: boolean;
|
|
41
|
+
approvalDescription: (toolName: string, approvalId: string, args: unknown) => PendingApproval;
|
|
42
|
+
truncation: TruncationInfo | null;
|
|
43
|
+
continueTruncation: () => void;
|
|
44
|
+
dismissTruncation: () => void;
|
|
45
|
+
mentionQuery: string;
|
|
46
|
+
mentionTrigger: MentionTrigger;
|
|
47
|
+
mentionResults: MentionResult[];
|
|
48
|
+
setMentionSearch: (query: string, trigger: MentionTrigger) => void;
|
|
49
|
+
clearMentionSearch: () => void;
|
|
50
|
+
selectMention: (result: MentionResult) => void;
|
|
51
|
+
activeMentions: MentionData[];
|
|
52
|
+
addActiveMention: (mention: MentionData) => void;
|
|
53
|
+
removeActiveMention: (mentionId: string) => void;
|
|
54
|
+
clearActiveMentions: () => void;
|
|
55
|
+
isMentionSearching: boolean;
|
|
56
|
+
hasMentions: boolean;
|
|
57
|
+
suggestionChips: string[];
|
|
58
|
+
selectSuggestion: (suggestion: string) => void;
|
|
59
|
+
refreshSuggestions: () => void;
|
|
60
|
+
isSuggestionsGenerating: boolean;
|
|
61
|
+
/** All known sessions; empty when the consumer does not supply `session.list`. */
|
|
62
|
+
sessions: SessionSummary[];
|
|
63
|
+
/** Currently-active session id. Defaults to `'default'` when no session config is given. */
|
|
64
|
+
activeSessionId: string;
|
|
65
|
+
/** `true` when the consumer provided `list`, `create`, and `remove`. */
|
|
66
|
+
sessionsSupported: boolean;
|
|
67
|
+
/** `true` while session CRUD or loading is in flight. */
|
|
68
|
+
isSessionsLoading: boolean;
|
|
69
|
+
/** Switch to an existing session. Reloads messages from `session.load`. */
|
|
70
|
+
switchSession: (id: string) => Promise<void>;
|
|
71
|
+
/** Create a new session, switch to it, refresh the list. */
|
|
72
|
+
createSession: (opts?: {
|
|
73
|
+
title?: string;
|
|
74
|
+
}) => Promise<SessionSummary | null>;
|
|
75
|
+
/** Remove a session. If it was active, falls back to the first remaining session. */
|
|
76
|
+
removeSession: (id: string) => Promise<void>;
|
|
77
|
+
/** Rename a session. */
|
|
78
|
+
renameSession: (id: string, title: string) => Promise<void>;
|
|
79
|
+
/** Manually re-fetch the session list (e.g. after external mutation). */
|
|
80
|
+
refreshSessions: () => Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
export declare const ChatContext: import("react").Context<ChatContextValue | null>;
|
|
83
|
+
export declare function useChatContext(): ChatContextValue;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatContext = void 0;
|
|
4
|
+
exports.useChatContext = useChatContext;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
exports.ChatContext = (0, react_1.createContext)(null);
|
|
7
|
+
function useChatContext() {
|
|
8
|
+
const context = (0, react_1.useContext)(exports.ChatContext);
|
|
9
|
+
if (!context) {
|
|
10
|
+
throw new Error('useChatContext must be used within an <AiChatProvider>');
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AiChatPanelProps, ChatInputProps, MessageBubbleProps, MessageListProps } from './types.js';
|
|
2
|
+
type ClassDictionary = Record<string, boolean | null | undefined>;
|
|
3
|
+
type ClassArray = ClassValue[];
|
|
4
|
+
type ClassPrimitive = string | number | null | undefined | false;
|
|
5
|
+
export type ClassValue = ClassPrimitive | ClassDictionary | ClassArray;
|
|
6
|
+
export declare function cn(...values: ClassValue[]): string;
|
|
7
|
+
export declare const defaultTheme: {
|
|
8
|
+
readonly colors: {
|
|
9
|
+
readonly primary: "#6366f1";
|
|
10
|
+
readonly background: "#ffffff";
|
|
11
|
+
readonly bubbleUser: "#e0e7ff";
|
|
12
|
+
readonly bubbleAssistant: "#f3f4f6";
|
|
13
|
+
readonly border: "#e5e7eb";
|
|
14
|
+
readonly text: "#111827";
|
|
15
|
+
readonly textMuted: "#6b7280";
|
|
16
|
+
};
|
|
17
|
+
readonly radius: {
|
|
18
|
+
readonly panel: "0.75rem";
|
|
19
|
+
readonly bubble: "0.75rem";
|
|
20
|
+
readonly input: "0.5rem";
|
|
21
|
+
readonly chip: "9999px";
|
|
22
|
+
};
|
|
23
|
+
readonly spacing: {
|
|
24
|
+
readonly panelPadding: "1rem";
|
|
25
|
+
readonly bubbleGap: "0.75rem";
|
|
26
|
+
readonly inputPadding: "0.75rem";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type ChatTheme = typeof defaultTheme;
|
|
30
|
+
export declare const tailwindThemeExtension: {
|
|
31
|
+
readonly colors: {
|
|
32
|
+
readonly 'chat-primary': "rgb(var(--chat-primary) / <alpha-value>)";
|
|
33
|
+
readonly 'chat-background': "rgb(var(--chat-background) / <alpha-value>)";
|
|
34
|
+
readonly 'chat-bubble-user': "rgb(var(--chat-bubble-user) / <alpha-value>)";
|
|
35
|
+
readonly 'chat-bubble-assistant': "rgb(var(--chat-bubble-assistant) / <alpha-value>)";
|
|
36
|
+
readonly 'chat-border': "rgb(var(--chat-border) / <alpha-value>)";
|
|
37
|
+
readonly 'chat-text': "rgb(var(--chat-text) / <alpha-value>)";
|
|
38
|
+
readonly 'chat-text-muted': "rgb(var(--chat-text-muted) / <alpha-value>)";
|
|
39
|
+
};
|
|
40
|
+
readonly borderRadius: {
|
|
41
|
+
readonly 'chat-panel': "0.75rem";
|
|
42
|
+
readonly 'chat-bubble': "0.75rem";
|
|
43
|
+
readonly 'chat-input': "0.5rem";
|
|
44
|
+
readonly 'chat-chip': "9999px";
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export interface StyledMessageBubbleProps extends MessageBubbleProps {
|
|
48
|
+
classNames?: {
|
|
49
|
+
base?: string;
|
|
50
|
+
user?: string;
|
|
51
|
+
assistant?: string;
|
|
52
|
+
system?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare function StyledMessageBubble({ message, className, classNames, }: StyledMessageBubbleProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export interface StyledMessageListProps extends MessageListProps {
|
|
57
|
+
classNames?: {
|
|
58
|
+
root?: string;
|
|
59
|
+
loadMore?: string;
|
|
60
|
+
bubble?: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export declare function StyledMessageList({ className, classNames }: StyledMessageListProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export interface StyledChatInputProps extends ChatInputProps {
|
|
65
|
+
classNames?: {
|
|
66
|
+
root?: string;
|
|
67
|
+
textarea?: string;
|
|
68
|
+
sendButton?: string;
|
|
69
|
+
stopButton?: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export declare function StyledChatInput({ className, onSubmit, classNames, }: StyledChatInputProps): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export interface StyledChatPanelProps extends AiChatPanelProps {
|
|
74
|
+
classNames?: {
|
|
75
|
+
root?: string;
|
|
76
|
+
errorBanner?: string;
|
|
77
|
+
emptyState?: string;
|
|
78
|
+
suggestionBar?: string;
|
|
79
|
+
suggestionChip?: string;
|
|
80
|
+
mentionChip?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export declare function StyledChatPanel({ className, classNames }: StyledChatPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tailwindThemeExtension = exports.defaultTheme = void 0;
|
|
4
|
+
exports.cn = cn;
|
|
5
|
+
exports.StyledMessageBubble = StyledMessageBubble;
|
|
6
|
+
exports.StyledMessageList = StyledMessageList;
|
|
7
|
+
exports.StyledChatInput = StyledChatInput;
|
|
8
|
+
exports.StyledChatPanel = StyledChatPanel;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
const ai_chat_panel_js_1 = require("./components/ai-chat-panel.js");
|
|
11
|
+
const chat_input_js_1 = require("./components/chat-input.js");
|
|
12
|
+
const message_bubble_js_1 = require("./components/message-bubble.js");
|
|
13
|
+
const message_list_js_1 = require("./components/message-list.js");
|
|
14
|
+
function appendClass(output, value) {
|
|
15
|
+
if (!value)
|
|
16
|
+
return;
|
|
17
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
18
|
+
output.push(String(value));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
for (const item of value)
|
|
23
|
+
appendClass(output, item);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
for (const [key, enabled] of Object.entries(value)) {
|
|
27
|
+
if (enabled)
|
|
28
|
+
output.push(key);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function cn(...values) {
|
|
32
|
+
const output = [];
|
|
33
|
+
for (const value of values)
|
|
34
|
+
appendClass(output, value);
|
|
35
|
+
return output.join(' ');
|
|
36
|
+
}
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Theme tokens
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
exports.defaultTheme = {
|
|
41
|
+
colors: {
|
|
42
|
+
primary: '#6366f1',
|
|
43
|
+
background: '#ffffff',
|
|
44
|
+
bubbleUser: '#e0e7ff',
|
|
45
|
+
bubbleAssistant: '#f3f4f6',
|
|
46
|
+
border: '#e5e7eb',
|
|
47
|
+
text: '#111827',
|
|
48
|
+
textMuted: '#6b7280',
|
|
49
|
+
},
|
|
50
|
+
radius: {
|
|
51
|
+
panel: '0.75rem',
|
|
52
|
+
bubble: '0.75rem',
|
|
53
|
+
input: '0.5rem',
|
|
54
|
+
chip: '9999px',
|
|
55
|
+
},
|
|
56
|
+
spacing: {
|
|
57
|
+
panelPadding: '1rem',
|
|
58
|
+
bubbleGap: '0.75rem',
|
|
59
|
+
inputPadding: '0.75rem',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
exports.tailwindThemeExtension = {
|
|
63
|
+
colors: {
|
|
64
|
+
'chat-primary': 'rgb(var(--chat-primary) / <alpha-value>)',
|
|
65
|
+
'chat-background': 'rgb(var(--chat-background) / <alpha-value>)',
|
|
66
|
+
'chat-bubble-user': 'rgb(var(--chat-bubble-user) / <alpha-value>)',
|
|
67
|
+
'chat-bubble-assistant': 'rgb(var(--chat-bubble-assistant) / <alpha-value>)',
|
|
68
|
+
'chat-border': 'rgb(var(--chat-border) / <alpha-value>)',
|
|
69
|
+
'chat-text': 'rgb(var(--chat-text) / <alpha-value>)',
|
|
70
|
+
'chat-text-muted': 'rgb(var(--chat-text-muted) / <alpha-value>)',
|
|
71
|
+
},
|
|
72
|
+
borderRadius: {
|
|
73
|
+
'chat-panel': '0.75rem',
|
|
74
|
+
'chat-bubble': '0.75rem',
|
|
75
|
+
'chat-input': '0.5rem',
|
|
76
|
+
'chat-chip': '9999px',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
function StyledMessageBubble({ message, className, classNames, }) {
|
|
80
|
+
return ((0, jsx_runtime_1.jsx)(message_bubble_js_1.MessageBubble, { message: message, className: cn('max-w-[85%] rounded-xl px-4 py-3 text-sm leading-relaxed shadow-sm', classNames?.base, message.role === 'user' && 'ml-auto bg-[rgb(var(--chat-bubble-user,224_231_255))] text-right', message.role === 'user' && classNames?.user, message.role === 'assistant' && 'mr-auto bg-[rgb(var(--chat-bubble-assistant,243_244_246))] text-left', message.role === 'assistant' && classNames?.assistant, message.role === 'system' && 'mx-auto bg-[rgb(var(--chat-bubble-assistant,243_244_246))] text-center', message.role === 'system' && classNames?.system, className) }));
|
|
81
|
+
}
|
|
82
|
+
function StyledMessageList({ className, classNames }) {
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(message_list_js_1.MessageList, { className: cn('flex-1 min-h-0 overflow-y-auto px-4 py-3', '[&>[data-action=load-more]]:mx-auto [&>[data-action=load-more]]:mb-3', '[&>[data-action=load-more]]:rounded-md [&>[data-action=load-more]]:border', '[&>[data-action=load-more]]:border-[rgb(var(--chat-border,229_231_235))]', '[&>[data-action=load-more]]:px-3 [&>[data-action=load-more]]:py-1.5', '[&>[data-action=load-more]]:text-xs [&>[data-action=load-more]]:font-medium', '[&>[data-component=message-bubble]]:mb-3', classNames?.root, classNames?.loadMore, classNames?.bubble, className) }));
|
|
84
|
+
}
|
|
85
|
+
function StyledChatInput({ className, onSubmit, classNames, }) {
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(chat_input_js_1.ChatInput, { className: cn('shrink-0 border-t border-[rgb(var(--chat-border,229_231_235))]', 'bg-[rgb(var(--chat-background,255_255_255))] px-4 py-3', 'flex items-end gap-2', '[&_textarea]:min-h-[44px] [&_textarea]:max-h-[160px] [&_textarea]:flex-1 [&_textarea]:resize-none', '[&_textarea]:rounded-lg [&_textarea]:border [&_textarea]:border-[rgb(var(--chat-border,229_231_235))]', '[&_textarea]:bg-transparent [&_textarea]:px-3 [&_textarea]:py-2.5', '[&_textarea]:text-[rgb(var(--chat-text,17_24_39))]', '[&_textarea]:placeholder:text-[rgb(var(--chat-text-muted,107_114_128))]', '[&_textarea]:outline-none [&_textarea]:focus:ring-2 [&_textarea]:focus:ring-indigo-200', '[&_[data-action=send]]:rounded-lg [&_[data-action=send]]:bg-[rgb(var(--chat-primary,99_102_241))]', '[&_[data-action=send]]:px-3 [&_[data-action=send]]:py-2 [&_[data-action=send]]:text-sm', '[&_[data-action=send]]:font-medium [&_[data-action=send]]:text-white', '[&_[data-action=send]]:disabled:cursor-not-allowed [&_[data-action=send]]:disabled:opacity-50', '[&_[data-action=stop]]:rounded-lg [&_[data-action=stop]]:border', '[&_[data-action=stop]]:border-[rgb(var(--chat-border,229_231_235))]', '[&_[data-action=stop]]:px-3 [&_[data-action=stop]]:py-2 [&_[data-action=stop]]:text-sm', classNames?.root, classNames?.textarea, classNames?.sendButton, classNames?.stopButton, className), onSubmit: onSubmit }));
|
|
87
|
+
}
|
|
88
|
+
function StyledChatPanel({ className, classNames }) {
|
|
89
|
+
return ((0, jsx_runtime_1.jsx)(ai_chat_panel_js_1.AiChatPanel, { className: cn('flex h-full min-h-0 flex-col overflow-hidden rounded-xl border', 'border-[rgb(var(--chat-border,229_231_235))]', 'bg-[rgb(var(--chat-background,255_255_255))] text-[rgb(var(--chat-text,17_24_39))]', 'shadow-sm', '[&_[data-component=error-banner]]:border-b [&_[data-component=error-banner]]:border-red-200', '[&_[data-component=error-banner]]:bg-red-50 [&_[data-component=error-banner]]:px-4', '[&_[data-component=error-banner]]:py-2.5 [&_[data-component=error-banner]]:text-sm', '[&_[data-component=empty-state]]:flex-1 [&_[data-component=empty-state]]:grid', '[&_[data-component=empty-state]]:place-items-center [&_[data-component=empty-state]]:px-6', '[&_[data-component=empty-state]]:text-sm [&_[data-component=empty-state]]:text-[rgb(var(--chat-text-muted,107_114_128))]', '[&_[data-component=suggestion-bar]]:px-4 [&_[data-component=suggestion-bar]]:pb-2', '[&_[data-component=suggestion-chip]]:rounded-full', '[&_[data-component=suggestion-chip]]:bg-[rgb(var(--chat-primary,99_102_241))]', '[&_[data-component=suggestion-chip]]:px-3 [&_[data-component=suggestion-chip]]:py-1.5', '[&_[data-component=suggestion-chip]]:text-xs [&_[data-component=suggestion-chip]]:font-medium', '[&_[data-component=suggestion-chip]]:text-white', '[&_[data-component=mention-chip]]:inline-flex [&_[data-component=mention-chip]]:items-center', '[&_[data-component=mention-chip]]:rounded-full [&_[data-component=mention-chip]]:bg-slate-100', '[&_[data-component=mention-chip]]:px-2.5 [&_[data-component=mention-chip]]:py-1', '[&_[data-component=mention-chip]]:text-xs', classNames?.root, classNames?.errorBanner, classNames?.emptyState, classNames?.suggestionBar, classNames?.suggestionChip, classNames?.mentionChip, className) }));
|
|
90
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChatTheme, ChatThemeColors, ChatThemePreset } from './types.js';
|
|
2
|
+
interface ResolvedTheme {
|
|
3
|
+
colors: Required<ChatThemeColors>;
|
|
4
|
+
radius: string;
|
|
5
|
+
radiusSmall: string;
|
|
6
|
+
fontFamily: string;
|
|
7
|
+
/** Optional effect hint applied as `data-theme-effect` on widget roots. */
|
|
8
|
+
effect?: 'glass';
|
|
9
|
+
}
|
|
10
|
+
declare const PRESETS: Record<ChatThemePreset, ResolvedTheme>;
|
|
11
|
+
export declare const DEFAULT_THEME_PRESET: ChatThemePreset;
|
|
12
|
+
/** Returns the `data-theme-effect` attribute value for a theme, or `undefined`. */
|
|
13
|
+
export declare function getThemeEffect(theme?: ChatTheme): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a `ChatTheme` prop into a plain `Record<string, string>` of
|
|
16
|
+
* CSS custom properties that can be spread onto a component `style` prop.
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const vars = getThemeVars(theme);
|
|
20
|
+
* <div style={vars}>…</div>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function getThemeVars(theme?: ChatTheme): Record<string, string>;
|
|
24
|
+
export { PRESETS as CHAT_THEME_PRESETS };
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHAT_THEME_PRESETS = exports.DEFAULT_THEME_PRESET = void 0;
|
|
4
|
+
exports.getThemeEffect = getThemeEffect;
|
|
5
|
+
exports.getThemeVars = getThemeVars;
|
|
6
|
+
const DEFAULT_FONT = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
|
|
7
|
+
const MONO_FONT = '"JetBrains Mono", "Fira Code", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace';
|
|
8
|
+
const PROFESSIONAL_LIGHTBLUE = {
|
|
9
|
+
colors: {
|
|
10
|
+
primary: '#6366f1',
|
|
11
|
+
primarySoft: '#818cf8',
|
|
12
|
+
primaryTint: 'rgba(99, 102, 241, 0.12)',
|
|
13
|
+
bg: '#ffffff',
|
|
14
|
+
bgMuted: '#f9fafb',
|
|
15
|
+
bubbleUser: '#e0e7ff',
|
|
16
|
+
bubbleAssistant: '#f3f4f6',
|
|
17
|
+
text: '#111827',
|
|
18
|
+
textMuted: '#6b7280',
|
|
19
|
+
border: '#e5e7eb',
|
|
20
|
+
danger: '#dc2626',
|
|
21
|
+
},
|
|
22
|
+
radius: '0.875rem',
|
|
23
|
+
radiusSmall: '0.5rem',
|
|
24
|
+
fontFamily: DEFAULT_FONT,
|
|
25
|
+
};
|
|
26
|
+
const PROFESSIONAL_DARK = {
|
|
27
|
+
colors: {
|
|
28
|
+
primary: '#818cf8',
|
|
29
|
+
primarySoft: '#a78bfa',
|
|
30
|
+
primaryTint: 'rgba(129, 140, 248, 0.18)',
|
|
31
|
+
bg: '#0f172a',
|
|
32
|
+
bgMuted: '#1e293b',
|
|
33
|
+
bubbleUser: '#312e81',
|
|
34
|
+
bubbleAssistant: '#1e293b',
|
|
35
|
+
text: '#f8fafc',
|
|
36
|
+
textMuted: '#94a3b8',
|
|
37
|
+
border: '#334155',
|
|
38
|
+
danger: '#f87171',
|
|
39
|
+
},
|
|
40
|
+
radius: '0.875rem',
|
|
41
|
+
radiusSmall: '0.5rem',
|
|
42
|
+
fontFamily: DEFAULT_FONT,
|
|
43
|
+
};
|
|
44
|
+
const MINIMAL_WHITE = {
|
|
45
|
+
colors: {
|
|
46
|
+
primary: '#111827',
|
|
47
|
+
primarySoft: '#374151',
|
|
48
|
+
primaryTint: 'rgba(17, 24, 39, 0.06)',
|
|
49
|
+
bg: '#ffffff',
|
|
50
|
+
bgMuted: '#fafafa',
|
|
51
|
+
bubbleUser: '#f3f4f6',
|
|
52
|
+
bubbleAssistant: '#fafafa',
|
|
53
|
+
text: '#111827',
|
|
54
|
+
textMuted: '#6b7280',
|
|
55
|
+
border: '#e5e7eb',
|
|
56
|
+
danger: '#991b1b',
|
|
57
|
+
},
|
|
58
|
+
radius: '0.5rem',
|
|
59
|
+
radiusSmall: '0.375rem',
|
|
60
|
+
fontFamily: DEFAULT_FONT,
|
|
61
|
+
};
|
|
62
|
+
const VIBRANT_INDIGO = {
|
|
63
|
+
colors: {
|
|
64
|
+
primary: '#8b5cf6',
|
|
65
|
+
primarySoft: '#ec4899',
|
|
66
|
+
primaryTint: 'rgba(139, 92, 246, 0.16)',
|
|
67
|
+
bg: '#ffffff',
|
|
68
|
+
bgMuted: '#faf5ff',
|
|
69
|
+
bubbleUser: '#ede9fe',
|
|
70
|
+
bubbleAssistant: '#fdf2f8',
|
|
71
|
+
text: '#1e1b4b',
|
|
72
|
+
textMuted: '#6b21a8',
|
|
73
|
+
border: '#e9d5ff',
|
|
74
|
+
danger: '#dc2626',
|
|
75
|
+
},
|
|
76
|
+
radius: '1.25rem',
|
|
77
|
+
radiusSmall: '0.75rem',
|
|
78
|
+
fontFamily: DEFAULT_FONT,
|
|
79
|
+
};
|
|
80
|
+
const TERMINAL_GREEN = {
|
|
81
|
+
colors: {
|
|
82
|
+
primary: '#22c55e',
|
|
83
|
+
primarySoft: '#4ade80',
|
|
84
|
+
primaryTint: 'rgba(34, 197, 94, 0.15)',
|
|
85
|
+
bg: '#000000',
|
|
86
|
+
bgMuted: '#0a0a0a',
|
|
87
|
+
bubbleUser: '#052e16',
|
|
88
|
+
bubbleAssistant: '#0a0a0a',
|
|
89
|
+
text: '#4ade80',
|
|
90
|
+
textMuted: '#15803d',
|
|
91
|
+
border: '#14532d',
|
|
92
|
+
danger: '#ef4444',
|
|
93
|
+
},
|
|
94
|
+
radius: '0.25rem',
|
|
95
|
+
radiusSmall: '0.125rem',
|
|
96
|
+
fontFamily: MONO_FONT,
|
|
97
|
+
};
|
|
98
|
+
/** Translucent frosted-glass look — pairs with a blurred background. */
|
|
99
|
+
const LIQUID_GLASS = {
|
|
100
|
+
colors: {
|
|
101
|
+
primary: '#60a5fa',
|
|
102
|
+
primarySoft: '#c4b5fd',
|
|
103
|
+
primaryTint: 'rgba(96, 165, 250, 0.18)',
|
|
104
|
+
bg: 'rgba(255, 255, 255, 0.72)',
|
|
105
|
+
bgMuted: 'rgba(255, 255, 255, 0.55)',
|
|
106
|
+
bubbleUser: 'rgba(96, 165, 250, 0.22)',
|
|
107
|
+
bubbleAssistant: 'rgba(255, 255, 255, 0.82)',
|
|
108
|
+
text: '#0f172a',
|
|
109
|
+
textMuted: '#475569',
|
|
110
|
+
border: 'rgba(255, 255, 255, 0.6)',
|
|
111
|
+
danger: '#ef4444',
|
|
112
|
+
},
|
|
113
|
+
radius: '1.5rem',
|
|
114
|
+
radiusSmall: '0.875rem',
|
|
115
|
+
fontFamily: DEFAULT_FONT,
|
|
116
|
+
effect: 'glass',
|
|
117
|
+
};
|
|
118
|
+
const PURPLE_HAZE = {
|
|
119
|
+
colors: {
|
|
120
|
+
primary: '#a855f7',
|
|
121
|
+
primarySoft: '#d946ef',
|
|
122
|
+
primaryTint: 'rgba(168, 85, 247, 0.18)',
|
|
123
|
+
bg: '#1a0b2e',
|
|
124
|
+
bgMuted: '#2a1348',
|
|
125
|
+
bubbleUser: '#4c1d95',
|
|
126
|
+
bubbleAssistant: '#2a1348',
|
|
127
|
+
text: '#f5f3ff',
|
|
128
|
+
textMuted: '#c4b5fd',
|
|
129
|
+
border: '#4c1d95',
|
|
130
|
+
danger: '#fb7185',
|
|
131
|
+
},
|
|
132
|
+
radius: '1rem',
|
|
133
|
+
radiusSmall: '0.625rem',
|
|
134
|
+
fontFamily: DEFAULT_FONT,
|
|
135
|
+
};
|
|
136
|
+
const BLUE_DREAM = {
|
|
137
|
+
colors: {
|
|
138
|
+
primary: '#3b82f6',
|
|
139
|
+
primarySoft: '#0ea5e9',
|
|
140
|
+
primaryTint: 'rgba(59, 130, 246, 0.14)',
|
|
141
|
+
bg: '#f0f9ff',
|
|
142
|
+
bgMuted: '#e0f2fe',
|
|
143
|
+
bubbleUser: '#dbeafe',
|
|
144
|
+
bubbleAssistant: '#ffffff',
|
|
145
|
+
text: '#0c4a6e',
|
|
146
|
+
textMuted: '#0369a1',
|
|
147
|
+
border: '#bae6fd',
|
|
148
|
+
danger: '#dc2626',
|
|
149
|
+
},
|
|
150
|
+
radius: '1.125rem',
|
|
151
|
+
radiusSmall: '0.625rem',
|
|
152
|
+
fontFamily: DEFAULT_FONT,
|
|
153
|
+
};
|
|
154
|
+
const SUNSET_ORANGE = {
|
|
155
|
+
colors: {
|
|
156
|
+
primary: '#f97316',
|
|
157
|
+
primarySoft: '#ec4899',
|
|
158
|
+
primaryTint: 'rgba(249, 115, 22, 0.16)',
|
|
159
|
+
bg: '#fffbeb',
|
|
160
|
+
bgMuted: '#fef3c7',
|
|
161
|
+
bubbleUser: '#fed7aa',
|
|
162
|
+
bubbleAssistant: '#ffffff',
|
|
163
|
+
text: '#7c2d12',
|
|
164
|
+
textMuted: '#b45309',
|
|
165
|
+
border: '#fde68a',
|
|
166
|
+
danger: '#dc2626',
|
|
167
|
+
},
|
|
168
|
+
radius: '1.25rem',
|
|
169
|
+
radiusSmall: '0.75rem',
|
|
170
|
+
fontFamily: DEFAULT_FONT,
|
|
171
|
+
};
|
|
172
|
+
const OCEAN_TEAL = {
|
|
173
|
+
colors: {
|
|
174
|
+
primary: '#14b8a6',
|
|
175
|
+
primarySoft: '#06b6d4',
|
|
176
|
+
primaryTint: 'rgba(20, 184, 166, 0.14)',
|
|
177
|
+
bg: '#042f2e',
|
|
178
|
+
bgMuted: '#134e4a',
|
|
179
|
+
bubbleUser: '#115e59',
|
|
180
|
+
bubbleAssistant: '#134e4a',
|
|
181
|
+
text: '#ccfbf1',
|
|
182
|
+
textMuted: '#5eead4',
|
|
183
|
+
border: '#134e4a',
|
|
184
|
+
danger: '#fb7185',
|
|
185
|
+
},
|
|
186
|
+
radius: '0.875rem',
|
|
187
|
+
radiusSmall: '0.5rem',
|
|
188
|
+
fontFamily: DEFAULT_FONT,
|
|
189
|
+
};
|
|
190
|
+
/** Pure monochrome. Black background, stark white text, zero color. */
|
|
191
|
+
const MIDNIGHT_MONO = {
|
|
192
|
+
colors: {
|
|
193
|
+
primary: '#ffffff',
|
|
194
|
+
primarySoft: '#d4d4d4',
|
|
195
|
+
primaryTint: 'rgba(255, 255, 255, 0.08)',
|
|
196
|
+
bg: '#0a0a0a',
|
|
197
|
+
bgMuted: '#171717',
|
|
198
|
+
bubbleUser: '#262626',
|
|
199
|
+
bubbleAssistant: '#171717',
|
|
200
|
+
text: '#fafafa',
|
|
201
|
+
textMuted: '#a3a3a3',
|
|
202
|
+
border: '#262626',
|
|
203
|
+
danger: '#f87171',
|
|
204
|
+
},
|
|
205
|
+
radius: '0.75rem',
|
|
206
|
+
radiusSmall: '0.375rem',
|
|
207
|
+
fontFamily: DEFAULT_FONT,
|
|
208
|
+
};
|
|
209
|
+
const PRESETS = {
|
|
210
|
+
'professional-lightblue': PROFESSIONAL_LIGHTBLUE,
|
|
211
|
+
'professional-dark': PROFESSIONAL_DARK,
|
|
212
|
+
'minimal-white': MINIMAL_WHITE,
|
|
213
|
+
'vibrant-indigo': VIBRANT_INDIGO,
|
|
214
|
+
'terminal-green': TERMINAL_GREEN,
|
|
215
|
+
'liquid-glass': LIQUID_GLASS,
|
|
216
|
+
'purple-haze': PURPLE_HAZE,
|
|
217
|
+
'blue-dream': BLUE_DREAM,
|
|
218
|
+
'sunset-orange': SUNSET_ORANGE,
|
|
219
|
+
'ocean-teal': OCEAN_TEAL,
|
|
220
|
+
'midnight-mono': MIDNIGHT_MONO,
|
|
221
|
+
};
|
|
222
|
+
exports.CHAT_THEME_PRESETS = PRESETS;
|
|
223
|
+
exports.DEFAULT_THEME_PRESET = 'professional-lightblue';
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
// Resolution
|
|
226
|
+
// ---------------------------------------------------------------------------
|
|
227
|
+
function resolve(theme) {
|
|
228
|
+
if (!theme)
|
|
229
|
+
return PROFESSIONAL_LIGHTBLUE;
|
|
230
|
+
if (typeof theme === 'string')
|
|
231
|
+
return PRESETS[theme] ?? PROFESSIONAL_LIGHTBLUE;
|
|
232
|
+
const override = theme;
|
|
233
|
+
const base = (override.preset && PRESETS[override.preset]) ?? PROFESSIONAL_LIGHTBLUE;
|
|
234
|
+
return {
|
|
235
|
+
colors: { ...base.colors, ...(override.colors ?? {}) },
|
|
236
|
+
radius: override.radius ?? base.radius,
|
|
237
|
+
radiusSmall: override.radiusSmall ?? base.radiusSmall,
|
|
238
|
+
fontFamily: override.fontFamily ?? base.fontFamily,
|
|
239
|
+
effect: base.effect,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/** Returns the `data-theme-effect` attribute value for a theme, or `undefined`. */
|
|
243
|
+
function getThemeEffect(theme) {
|
|
244
|
+
return resolve(theme).effect;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Resolve a `ChatTheme` prop into a plain `Record<string, string>` of
|
|
248
|
+
* CSS custom properties that can be spread onto a component `style` prop.
|
|
249
|
+
*
|
|
250
|
+
* ```tsx
|
|
251
|
+
* const vars = getThemeVars(theme);
|
|
252
|
+
* <div style={vars}>…</div>
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
function getThemeVars(theme) {
|
|
256
|
+
const r = resolve(theme);
|
|
257
|
+
return {
|
|
258
|
+
'--cm-primary': r.colors.primary,
|
|
259
|
+
'--cm-primary-soft': r.colors.primarySoft,
|
|
260
|
+
'--cm-primary-tint': r.colors.primaryTint,
|
|
261
|
+
'--cm-bg': r.colors.bg,
|
|
262
|
+
'--cm-bg-muted': r.colors.bgMuted,
|
|
263
|
+
'--cm-bubble-user': r.colors.bubbleUser,
|
|
264
|
+
'--cm-bubble-assistant': r.colors.bubbleAssistant,
|
|
265
|
+
'--cm-text': r.colors.text,
|
|
266
|
+
'--cm-text-muted': r.colors.textMuted,
|
|
267
|
+
'--cm-border': r.colors.border,
|
|
268
|
+
'--cm-danger': r.colors.danger,
|
|
269
|
+
'--cm-radius': r.radius,
|
|
270
|
+
'--cm-radius-sm': r.radiusSmall,
|
|
271
|
+
'--cm-font': r.fontFamily,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { useLangGraphChatTransport, useLangGraphChatTransport as useLangGraph, type UseLangGraphChatTransportOptions, type LangGraphUpdatesEvent, type LangGraphMessageEvent, type LangGraphCustomEvent, type LangGraphToolCallEvent, type LangGraphToolResultEvent, type LangGraphErrorEvent, type LangGraphRequestBody, } from '../langgraph.js';
|
|
2
|
+
export { LangGraphAiChat, type LangGraphAiChatProps } from './langgraph-ai-chat.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LangGraphAiChat = exports.useLangGraph = exports.useLangGraphChatTransport = void 0;
|
|
4
|
+
var langgraph_js_1 = require("../langgraph.js");
|
|
5
|
+
Object.defineProperty(exports, "useLangGraphChatTransport", { enumerable: true, get: function () { return langgraph_js_1.useLangGraphChatTransport; } });
|
|
6
|
+
Object.defineProperty(exports, "useLangGraph", { enumerable: true, get: function () { return langgraph_js_1.useLangGraphChatTransport; } });
|
|
7
|
+
var langgraph_ai_chat_js_1 = require("./langgraph-ai-chat.js");
|
|
8
|
+
Object.defineProperty(exports, "LangGraphAiChat", { enumerable: true, get: function () { return langgraph_ai_chat_js_1.LangGraphAiChat; } });
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FloatingChatUIProps } from '../../components/floating-chat-ui.js';
|
|
3
|
+
import { type LangGraphCustomEvent } from '../langgraph.js';
|
|
4
|
+
import type { AiChatProviderConfig, ChatTransportDataPart, SessionConfig } from '../../types.js';
|
|
5
|
+
export interface LangGraphAiChatProps extends AiChatProviderConfig, FloatingChatUIProps {
|
|
6
|
+
/** Chat API endpoint URL (e.g. `/api/chat`). */
|
|
7
|
+
endpoint: string;
|
|
8
|
+
/** Static headers or a function that returns headers per request. */
|
|
9
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
10
|
+
/**
|
|
11
|
+
* Fixed LangGraph thread id. Ignored when `sessions` is provided —
|
|
12
|
+
* in that mode the active session id is used as the thread id.
|
|
13
|
+
*/
|
|
14
|
+
threadId?: string;
|
|
15
|
+
/** Extra fields to merge into every request body. */
|
|
16
|
+
bodyExtras?: Record<string, unknown> | (() => Record<string, unknown>);
|
|
17
|
+
/** fetch credentials mode. Default: `same-origin`. */
|
|
18
|
+
credentials?: RequestCredentials;
|
|
19
|
+
/** Hook for translating backend `event: custom` events into data parts. */
|
|
20
|
+
onCustomEvent?: (evt: LangGraphCustomEvent) => ChatTransportDataPart | null;
|
|
21
|
+
/** Hook for rendering LangGraph `event: updates` as status labels. */
|
|
22
|
+
renderUpdate?: (node: string, update: Record<string, unknown>) => string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Multi-session hooks. When provided, the drop-in renders a session
|
|
25
|
+
* switcher in the header and wires the active session id into the
|
|
26
|
+
* LangGraph transport as `threadId`. Pass your own `SessionConfig`
|
|
27
|
+
* (typically a bridge to `chatService.getSessions/createSession/...`).
|
|
28
|
+
*
|
|
29
|
+
* See `SessionConfig` in `glirastes/react`.
|
|
30
|
+
*/
|
|
31
|
+
sessions?: SessionConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Replace the default floating UI with custom children. Useful when you
|
|
34
|
+
* want to compose `<MessageList />`, `<ChatInput />`, etc. yourself or
|
|
35
|
+
* render an inline `<AiChatPanel />` instead of a floating window.
|
|
36
|
+
*/
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Drop-in LangGraph chat widget. Bundles transport, provider, and a
|
|
41
|
+
* floating (trigger button + draggable window) chat UI into one component.
|
|
42
|
+
* Zero dependency on `@ai-sdk/react` or `ai`.
|
|
43
|
+
*
|
|
44
|
+
* ```tsx
|
|
45
|
+
* 'use client';
|
|
46
|
+
* import { LangGraphAiChat } from 'glirastes/react/langgraph';
|
|
47
|
+
*
|
|
48
|
+
* export default function Layout({ children }) {
|
|
49
|
+
* return (
|
|
50
|
+
* <>
|
|
51
|
+
* {children}
|
|
52
|
+
* <LangGraphAiChat endpoint="/api/chat" />
|
|
53
|
+
* </>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* All `AiChatProviderConfig` fields (session, mentions, classNames, etc.)
|
|
59
|
+
* and `FloatingChatUIProps` (title, defaultOpen, width, height, draggable,
|
|
60
|
+
* resizable) are accepted as top-level props.
|
|
61
|
+
*/
|
|
62
|
+
export declare function LangGraphAiChat({ endpoint, headers, threadId, bodyExtras, credentials, onCustomEvent, renderUpdate, sessions, title, open, onOpenChange, defaultOpen, draggable, resizable, size, hideTriggerWhenOpen, shortcut, showClearButton, confirmClear, showSessionSwitcher, headerActions, triggerIcon, showMic, welcomeMessage, children, ...providerConfig }: LangGraphAiChatProps): import("react/jsx-runtime").JSX.Element;
|