@digithings-ai/ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -2
- package/package.json +143 -4
- package/src/components/NavShell.tsx +776 -0
- package/src/components/SocialRow.tsx +87 -0
- package/src/components/Spinner.tsx +27 -0
- package/src/components/StackLogo.tsx +40 -0
- package/src/components/Terminal.tsx +110 -0
- package/src/components/TerminalManifest.tsx +212 -0
- package/src/components/ThemeProvider.tsx +271 -0
- package/src/components/account/AuthCard.tsx +309 -0
- package/src/components/assistant-ui/elements/mermaid-diagram.aui.tsx +63 -0
- package/src/components/assistant-ui/elements/mermaid-diagram.tsx +340 -0
- package/src/components/brand/BrandWordmark.tsx +32 -0
- package/src/components/changelog/ReleaseRail.tsx +81 -0
- package/src/components/changelog/index.ts +1 -0
- package/src/components/chat/ChatCodeBlock.tsx +67 -0
- package/src/components/chat/ChatMarkdown.tsx +66 -0
- package/src/components/chat/ChatMarkdownSource.tsx +203 -0
- package/src/components/chat/ChatMermaidBlock.tsx +202 -0
- package/src/components/chat/ChatMessage.tsx +77 -0
- package/src/components/chat/ChatPlayback.tsx +422 -0
- package/src/components/chat/ChatStreamCursor.tsx +25 -0
- package/src/components/chat/ChatThinking.tsx +113 -0
- package/src/components/chat/ChatToolCall.tsx +190 -0
- package/src/components/chat/ChatTranscript.tsx +60 -0
- package/src/components/chat/ChatWidgetFrame.tsx +107 -0
- package/src/components/chat/DigichatBootLoader.tsx +683 -0
- package/src/components/chat/DigichatLauncher.tsx +361 -0
- package/src/components/chat/DigichatThread.tsx +118 -0
- package/src/components/chat/DigichatThreadList.tsx +54 -0
- package/src/components/chat/DigichatWordmark.tsx +24 -0
- package/src/components/chat/DotMatrix.tsx +650 -0
- package/src/components/chat/boot-lab.tsx +766 -0
- package/src/components/chat/boot-signal.ts +144 -0
- package/src/components/chat/chat-surfaces.ts +52 -0
- package/src/components/chat/connection-status.ts +40 -0
- package/src/components/chat/digichat-wordmark.ts +355 -0
- package/src/components/chat/disclosure-chevron.tsx +49 -0
- package/src/components/chat/followable-href.ts +9 -0
- package/src/components/chat/gallery-thread/action-icons.tsx +25 -0
- package/src/components/chat/gallery-thread/attachment.aui.tsx +262 -0
- package/src/components/chat/gallery-thread/block-caret.tsx +439 -0
- package/src/components/chat/gallery-thread/cn.ts +1 -0
- package/src/components/chat/gallery-thread/composer-keyboard.ts +106 -0
- package/src/components/chat/gallery-thread/composer-trigger-popover.aui.tsx +235 -0
- package/src/components/chat/gallery-thread/css.d.ts +6 -0
- package/src/components/chat/gallery-thread/file.tsx +238 -0
- package/src/components/chat/gallery-thread/follow-up-suggestions.aui.tsx +92 -0
- package/src/components/chat/gallery-thread/format-json-dump.ts +112 -0
- package/src/components/chat/gallery-thread/hooks/use-attachment-src.ts +46 -0
- package/src/components/chat/gallery-thread/hooks/use-copy-to-clipboard.ts +9 -0
- package/src/components/chat/gallery-thread/image.tsx +519 -0
- package/src/components/chat/gallery-thread/markdown-text.tsx +278 -0
- package/src/components/chat/gallery-thread/message-error.aui.tsx +105 -0
- package/src/components/chat/gallery-thread/message-timing.aui.tsx +143 -0
- package/src/components/chat/gallery-thread/private-work-step.tsx +188 -0
- package/src/components/chat/gallery-thread/reasoning.tsx +332 -0
- package/src/components/chat/gallery-thread/scroll-mode.ts +174 -0
- package/src/components/chat/gallery-thread/source.tsx +76 -0
- package/src/components/chat/gallery-thread/thread.aui.tsx +1619 -0
- package/src/components/chat/gallery-thread/tooltip-icon-button.tsx +53 -0
- package/src/components/chat/gallery-thread/typed-welcome-copy.tsx +18 -0
- package/src/components/chat/gallery-thread/ui/tooltip.tsx +22 -0
- package/src/components/chat/gallery-thread/work-chain-summary.tsx +48 -0
- package/src/components/chat/gallery-thread/work-chain.tsx +110 -0
- package/src/components/chat/gallery-thread/work-status.ts +66 -0
- package/src/components/chat/overlay-scrollbar.tsx +86 -0
- package/src/components/chat/sanitize-mermaid-svg.ts +38 -0
- package/src/components/chat/skins/SOURCE.md +36 -0
- package/src/components/chat/skins/base/attachment.aui.tsx +287 -0
- package/src/components/chat/skins/base/aui-default/README.md +45 -0
- package/src/components/chat/skins/base/aui-default/collapsible-root.tsx +19 -0
- package/src/components/chat/skins/base/aui-default/collapsible.tsx +21 -0
- package/src/components/chat/skins/base/aui-default/reasoning.aui.tsx +120 -0
- package/src/components/chat/skins/base/aui-default/reasoning.tsx +331 -0
- package/src/components/chat/skins/base/aui-default/surfaces.ts +7 -0
- package/src/components/chat/skins/base/aui-default/tool-fallback.aui.tsx +772 -0
- package/src/components/chat/skins/base/aui-default/tool-group.aui.tsx +241 -0
- package/src/components/chat/skins/base/docs-model-options.ts +6 -0
- package/src/components/chat/skins/base/elements/assistant-trace.aui.tsx +169 -0
- package/src/components/chat/skins/base/elements/composer-trigger-popover.aui.tsx +271 -0
- package/src/components/chat/skins/base/elements/directive-text.aui.tsx +29 -0
- package/src/components/chat/skins/base/elements/directive-text.tsx +76 -0
- package/src/components/chat/skins/base/elements/message-timing.aui.tsx +104 -0
- package/src/components/chat/skins/base/elements/model-selector.aui.tsx +140 -0
- package/src/components/chat/skins/base/elements/model-selector.tsx +720 -0
- package/src/components/chat/skins/base/elements/quote.aui.tsx +290 -0
- package/src/components/chat/skins/base/elements/work-chain.tsx +100 -0
- package/src/components/chat/skins/base/markdown-text.tsx +294 -0
- package/src/components/chat/skins/base/model.ts +1 -0
- package/src/components/chat/skins/base/thread.tsx +1050 -0
- package/src/components/chat/skins/base/tooltip-icon-button.tsx +56 -0
- package/src/components/chat/skins/base/ui/avatar.tsx +115 -0
- package/src/components/chat/skins/base/ui/badge.tsx +51 -0
- package/src/components/chat/skins/base/ui/button.tsx +67 -0
- package/src/components/chat/skins/base/ui/command.tsx +185 -0
- package/src/components/chat/skins/base/ui/dialog.tsx +168 -0
- package/src/components/chat/skins/base/ui/dot-matrix.tsx +267 -0
- package/src/components/chat/skins/base/ui/popover.tsx +97 -0
- package/src/components/chat/skins/base/ui/skeleton.tsx +20 -0
- package/src/components/chat/skins/base/ui/textarea.tsx +24 -0
- package/src/components/chat/skins/base/ui/tooltip.tsx +73 -0
- package/src/components/chat/skins/base-assistant-ui/config-provider.tsx +90 -0
- package/src/components/chat/skins/base-assistant-ui/defaults.ts +419 -0
- package/src/components/chat/skins/base-assistant-ui/index.tsx +44 -0
- package/src/components/chat/skins/chatgpt.tsx +448 -0
- package/src/components/chat/skins/claude.tsx +380 -0
- package/src/components/chat/skins/digichat-composer-toolbar.tsx +151 -0
- package/src/components/chat/skins/digichat-context-meter-shares.ts +158 -0
- package/src/components/chat/skins/digichat-context-meter.tsx +243 -0
- package/src/components/chat/skins/digichat-meter-tone.ts +26 -0
- package/src/components/chat/skins/digichat-usage-meter.tsx +103 -0
- package/src/components/chat/skins/digichat.tsx +144 -0
- package/src/components/chat/skins/expo-react-native.tsx +29 -0
- package/src/components/chat/skins/gemini.tsx +322 -0
- package/src/components/chat/skins/grok-icon.tsx +34 -0
- package/src/components/chat/skins/grok.tsx +369 -0
- package/src/components/chat/skins/index.ts +46 -0
- package/src/components/chat/skins/perplexity.tsx +462 -0
- package/src/components/chat/skins/product-page-assistant/assistant-modal.tsx +73 -0
- package/src/components/chat/skins/product-page-assistant/index.tsx +19 -0
- package/src/components/chat/skins/product-page-assistant/product-dashboard.tsx +164 -0
- package/src/components/chat/skins/react-ink.tsx +97 -0
- package/src/components/chat/skins/thread-skin-host-contract.ts +102 -0
- package/src/components/chat/skins/thread-skin-view.tsx +156 -0
- package/src/components/chat/skins/thread-skins.ts +143 -0
- package/src/components/chat/skins/tooltip-icon-button.tsx +35 -0
- package/src/components/chat/skins/ui/dropdown-menu.tsx +272 -0
- package/src/components/chat/skins/webpage-assistant/assistant-config.ts +238 -0
- package/src/components/chat/skins/webpage-assistant/assistant-modal.tsx +78 -0
- package/src/components/chat/skins/webpage-assistant/config-provider.tsx +132 -0
- package/src/components/chat/skins/webpage-assistant/docs-app.tsx +106 -0
- package/src/components/chat/skins/webpage-assistant/docs-article.tsx +109 -0
- package/src/components/chat/skins/webpage-assistant/docs-assistant.tsx +73 -0
- package/src/components/chat/skins/webpage-assistant/docs-nav.tsx +81 -0
- package/src/components/chat/skins/webpage-assistant/host-ui.ts +79 -0
- package/src/components/chat/skins/webpage-assistant/index.tsx +12 -0
- package/src/components/chat/skins/webpage-assistant/markdown-page.tsx +11 -0
- package/src/components/chat/skins/webpage-assistant/pages.ts +9 -0
- package/src/components/chat/skins/webpage-assistant/types.ts +178 -0
- package/src/components/chat/skins/webpage-assistant/use-mobile.ts +19 -0
- package/src/components/chat/stock/SOURCE.md +90 -0
- package/src/components/chat/stock/artifacts-panel.tsx +305 -0
- package/src/components/chat/stock/attachment.aui.tsx +280 -0
- package/src/components/chat/stock/chat-notice.tsx +143 -0
- package/src/components/chat/stock/chat-private-mode.tsx +64 -0
- package/src/components/chat/stock/deploy-ui-context.tsx +89 -0
- package/src/components/chat/stock/embed-chat-prefs.tsx +471 -0
- package/src/components/chat/stock/file.tsx +265 -0
- package/src/components/chat/stock/follow-up-suggestions.aui.tsx +83 -0
- package/src/components/chat/stock/image.tsx +531 -0
- package/src/components/chat/stock/index.ts +129 -0
- package/src/components/chat/stock/json-view.tsx +140 -0
- package/src/components/chat/stock/markdown-text.tsx +319 -0
- package/src/components/chat/stock/message-error.aui.tsx +96 -0
- package/src/components/chat/stock/message-export-menu.tsx +156 -0
- package/src/components/chat/stock/palette-row-preview.tsx +26 -0
- package/src/components/chat/stock/reasoning.aui.tsx +120 -0
- package/src/components/chat/stock/reasoning.tsx +335 -0
- package/src/components/chat/stock/skin-chrome.tsx +81 -0
- package/src/components/chat/stock/skin-credit.tsx +63 -0
- package/src/components/chat/stock/skin-palette-bridge.tsx +235 -0
- package/src/components/chat/stock/skin-palette-context.ts +16 -0
- package/src/components/chat/stock/skin-runtime.tsx +52 -0
- package/src/components/chat/stock/skin-slash-palette.tsx +393 -0
- package/src/components/chat/stock/skin-types.ts +217 -0
- package/src/components/chat/stock/stock-chat-prefs-host.tsx +501 -0
- package/src/components/chat/stock/stock-send-gate.tsx +94 -0
- package/src/components/chat/stock/stock-shape.tsx +39 -0
- package/src/components/chat/stock/thread.aui.tsx +645 -0
- package/src/components/chat/stock/tool-display.ts +6 -0
- package/src/components/chat/stock/tool-fallback.aui.tsx +866 -0
- package/src/components/chat/stock/tool-group.aui.tsx +244 -0
- package/src/components/chat/stock/tool-surface.ts +120 -0
- package/src/components/chat/stock/tooltip-icon-button.tsx +49 -0
- package/src/components/chat/stock/ui/avatar.tsx +108 -0
- package/src/components/chat/stock/ui/button.tsx +81 -0
- package/src/components/chat/stock/ui/collapsible.tsx +21 -0
- package/src/components/chat/stock/ui/dialog.tsx +163 -0
- package/src/components/chat/stock/ui/skeleton.tsx +13 -0
- package/src/components/chat/stock/ui/textarea.tsx +20 -0
- package/src/components/chat/stock/ui/tooltip.tsx +68 -0
- package/src/components/chat/stock/use-attachment-src.ts +42 -0
- package/src/components/chat/stock/use-copy-to-clipboard.ts +29 -0
- package/src/components/chat/strip-model-boilerplate.ts +42 -0
- package/src/components/chat/suggestion-cycle.tsx +230 -0
- package/src/components/chat/suggestion-scroll-row.tsx +81 -0
- package/src/components/chat/trace-grouping/chain-group-by.ts +44 -0
- package/src/components/chat/trace-grouping/chain-state.ts +141 -0
- package/src/components/chat/trace-grouping/index.ts +32 -0
- package/src/components/chat/trace-grouping/tool-row.ts +74 -0
- package/src/components/chat/trace-grouping/use-deploy-work-disclosure.ts +35 -0
- package/src/components/chat/trace-grouping/use-work-chain.ts +103 -0
- package/src/components/chat/trace-i18n/core.ts +48 -0
- package/src/components/chat/trace-i18n/index.tsx +23 -0
- package/src/components/chat/trace-i18n/locales/en.ts +24 -0
- package/src/components/chat/trace-i18n/locales/fr.ts +28 -0
- package/src/components/chat/trace-i18n/types.ts +35 -0
- package/src/components/chat/trace-spacing.ts +249 -0
- package/src/components/chat/transcript/activity-view.ts +375 -0
- package/src/components/chat/transcript/chat-export.ts +133 -0
- package/src/components/chat/transcript/index.ts +10 -0
- package/src/components/chat/transcript/save-file.ts +209 -0
- package/src/components/chat/transcript/transcript-markdown.ts +428 -0
- package/src/components/chat/transcript/types.ts +81 -0
- package/src/components/chat/turn-outcome.ts +52 -0
- package/src/components/chat/use-warmup-phase.ts +18 -0
- package/src/components/chat/work-status-lead.tsx +49 -0
- package/src/components/chrome.tsx +264 -0
- package/src/components/command-palette/CommandPalette.tsx +404 -0
- package/src/components/command-palette/index.ts +6 -0
- package/src/components/contact/ContactMailto.tsx +112 -0
- package/src/components/contact/index.ts +5 -0
- package/src/components/conviction/ConvictionMeter.tsx +40 -0
- package/src/components/conviction/SignedConvictionBadge.tsx +26 -0
- package/src/components/conviction/index.ts +7 -0
- package/src/components/data-layout/BentoGrid.tsx +52 -0
- package/src/components/data-layout/CardRail.tsx +150 -0
- package/src/components/data-layout/DotMatrixStat.tsx +65 -0
- package/src/components/data-layout/FeatureCell.tsx +80 -0
- package/src/components/data-layout/MediaFrame.tsx +125 -0
- package/src/components/data-layout/ModuleGrid.tsx +735 -0
- package/src/components/data-layout/Odometer.tsx +149 -0
- package/src/components/data-layout/ProductFrame.tsx +79 -0
- package/src/components/data-layout/TestimonialWall.tsx +139 -0
- package/src/components/data-layout/index.ts +19 -0
- package/src/components/data-layout/treemap.ts +368 -0
- package/src/components/deck/DeckStack.tsx +243 -0
- package/src/components/desk/DataTable.tsx +373 -0
- package/src/components/desk/KpiGrid.tsx +80 -0
- package/src/components/desk/Sparkline.tsx +63 -0
- package/src/components/desk/StateBlock.tsx +132 -0
- package/src/components/desk/index.ts +18 -0
- package/src/components/diagrams/ArchitectureDiagram.tsx +350 -0
- package/src/components/diagrams/ArchitectureTour.tsx +912 -0
- package/src/components/diagrams/TerminalSchematic.tsx +192 -0
- package/src/components/diagrams/architecture-svg.tsx +384 -0
- package/src/components/diagrams/index.ts +30 -0
- package/src/components/diagrams/mermaid-theme.ts +115 -0
- package/src/components/diagrams/tour-camera.ts +171 -0
- package/src/components/docs/CodeTabs.tsx +90 -0
- package/src/components/docs/CopyCommand.tsx +151 -0
- package/src/components/docs/DocsLayout.tsx +197 -0
- package/src/components/docs/DocsSearch.tsx +97 -0
- package/src/components/docs/Endpoint.tsx +135 -0
- package/src/components/document/DocumentFrame.tsx +43 -0
- package/src/components/document/GlyphList.tsx +51 -0
- package/src/components/document/PageTitle.tsx +44 -0
- package/src/components/document/Prose.tsx +38 -0
- package/src/components/document/Section.tsx +55 -0
- package/src/components/document/index.ts +13 -0
- package/src/components/effects-chrome/AnnouncementBar.tsx +88 -0
- package/src/components/effects-chrome/HorizontalScrollTrack.tsx +461 -0
- package/src/components/effects-chrome/Pipeline.tsx +226 -0
- package/src/components/effects-chrome/RotatingPrompts.tsx +116 -0
- package/src/components/effects-chrome/StackingPanels.tsx +101 -0
- package/src/components/effects-chrome/TabStrip.tsx +232 -0
- package/src/components/effects-chrome/ToastStack.tsx +201 -0
- package/src/components/effects-chrome/horizontal-track-core.ts +70 -0
- package/src/components/effects-chrome/index.ts +35 -0
- package/src/components/emblems.tsx +188 -0
- package/src/components/faviconTheme.ts +23 -0
- package/src/components/figure/Figure.tsx +38 -0
- package/src/components/figure/index.ts +2 -0
- package/src/components/finance-charts/DrawdownPlot.tsx +76 -0
- package/src/components/finance-charts/EquityCurve.tsx +71 -0
- package/src/components/finance-charts/PriceChart.tsx +119 -0
- package/src/components/finance-charts/chart-host.tsx +236 -0
- package/src/components/finance-charts/chart-scale.ts +93 -0
- package/src/components/finance-charts/demo-data.ts +88 -0
- package/src/components/finance-charts/index.ts +46 -0
- package/src/components/finance-charts/lw-chart.tsx +292 -0
- package/src/components/finance-composites/MarketBar.tsx +243 -0
- package/src/components/finance-composites/OrderBook.tsx +133 -0
- package/src/components/finance-composites/PerformanceDashboard.tsx +185 -0
- package/src/components/finance-composites/SortableTable.tsx +144 -0
- package/src/components/finance-composites/StockTicker.tsx +65 -0
- package/src/components/finance-composites/SyncedTearsheet.tsx +226 -0
- package/src/components/finance-composites/index.ts +28 -0
- package/src/components/finance-tearsheet/KpiStrip.tsx +49 -0
- package/src/components/finance-tearsheet/LiveBadge.tsx +29 -0
- package/src/components/finance-tearsheet/ReturnsMatrix.tsx +321 -0
- package/src/components/finance-tearsheet/StrategyTearsheet.tsx +99 -0
- package/src/components/finance-tearsheet/TearsheetCard.tsx +54 -0
- package/src/components/finance-tearsheet/TradeLogTable.tsx +73 -0
- package/src/components/finance-tearsheet/charts.tsx +2624 -0
- package/src/components/finance-tearsheet/demo-data.ts +177 -0
- package/src/components/finance-tearsheet/format.ts +41 -0
- package/src/components/finance-tearsheet/index.ts +120 -0
- package/src/components/finance-tearsheet/print.ts +52 -0
- package/src/components/finance-tearsheet/risk-bands.ts +48 -0
- package/src/components/finance-tearsheet/stats.ts +35 -0
- package/src/components/finance-tearsheet/strategy-sheet-model.ts +238 -0
- package/src/components/finance-tearsheet/types.ts +58 -0
- package/src/components/footer/FooterCells.tsx +109 -0
- package/src/components/footer/index.ts +6 -0
- package/src/components/graph.tsx +158 -0
- package/src/components/icons.tsx +98 -0
- package/src/components/landing/PixelWordmark.tsx +36 -0
- package/src/components/logos.ts +39 -0
- package/src/components/marquee/Marquee.tsx +204 -0
- package/src/components/metrics/PerfMetrics.tsx +68 -0
- package/src/components/metrics/StatCounter.tsx +104 -0
- package/src/components/page-geometry.tsx +177 -0
- package/src/components/pricing/Pricing.tsx +174 -0
- package/src/components/pricing/PricingMatrix.tsx +219 -0
- package/src/components/prose/index.ts +2 -0
- package/src/components/prose/prose.tsx +86 -0
- package/src/components/repo-activity/RepoActivity.tsx +599 -0
- package/src/components/repo-activity/RepoHeatmap.tsx +225 -0
- package/src/components/repo-activity/demo.ts +201 -0
- package/src/components/repo-activity/fetch.ts +211 -0
- package/src/components/repo-activity/heatmap.ts +123 -0
- package/src/components/repo-activity/index.ts +28 -0
- package/src/components/repo-activity/types.ts +99 -0
- package/src/components/stages/NumberedStages.tsx +116 -0
- package/src/components/symbols/marks.tsx +116 -0
- package/src/components/symbols/terminal-lockup.tsx +136 -0
- package/src/components/symbols/terminal-marks.tsx +226 -0
- package/src/components/terminal/ChatResponseLoader.tsx +67 -0
- package/src/components/terminal/ContainerBootLoader.tsx +82 -0
- package/src/components/terminal/TerminalStepCaret.tsx +202 -0
- package/src/components/themeInit.ts +24 -0
- package/src/components/typography/MotionReveal.tsx +108 -0
- package/src/components/typography/TypewriterReveal.tsx +101 -0
- package/src/components/typography/WordReveal.tsx +143 -0
- package/src/data/modules.ts +378 -0
- package/src/data/subsystems.ts +101 -0
- package/src/index.ts +587 -0
- package/src/lib/base-path.ts +60 -0
- package/src/lib/cx.ts +25 -0
- package/src/lib/gloomberb.ts +69 -0
- package/src/lib/record.ts +19 -0
- package/src/lib/stub-payload.ts +183 -0
- package/src/lib/useBodyScrollLock.ts +44 -0
- package/src/lib/utils.ts +6 -0
- package/src/motion/primitives.tsx +105 -0
- package/src/motion/scroll-glide.ts +62 -0
- package/src/motion/scrolly-core.ts +38 -0
- package/src/motion/scrolly.tsx +95 -0
- package/src/navigation/HashScrollManager.tsx +167 -0
- package/src/navigation/hashScroll.ts +78 -0
- package/src/replay/browser.ts +280 -0
- package/src/replay/chat-export-run.ts +121 -0
- package/src/replay/export-format.ts +25 -0
- package/src/replay/export-mount.ts +32 -0
- package/src/replay/filename.ts +54 -0
- package/src/replay/index.ts +21 -0
- package/src/replay/redact-dom.ts +178 -0
- package/src/replay/redact.ts +113 -0
- package/src/replay/snapshot.ts +659 -0
- package/src/styles/account-auth.css +339 -0
- package/src/styles/brand-wordmark.css +11 -0
- package/src/styles/card-rail.css +120 -0
- package/src/styles/chat-aui.css +1143 -0
- package/src/styles/chat-core.css +469 -0
- package/src/styles/chat-digichat.css +2531 -0
- package/src/styles/chat-math.css +70 -0
- package/src/styles/chat-skin-palette.css +138 -0
- package/src/styles/chat-stock-menu.css +37 -0
- package/src/styles/chat-widgets.css +190 -0
- package/src/styles/command-palette.css +372 -0
- package/src/styles/controls-core.css +2261 -0
- package/src/styles/controls-overlay.css +603 -0
- package/src/styles/data-layout.css +288 -0
- package/src/styles/deck.css +141 -0
- package/src/styles/diagrams.css +1860 -0
- package/src/styles/digichat-app-theme.css +250 -0
- package/src/styles/digichat-boot-loader.css +487 -0
- package/src/styles/digichat-launcher.css +377 -0
- package/src/styles/docs.css +165 -0
- package/src/styles/effects-chrome.css +888 -0
- package/src/styles/finance-composites.css +214 -0
- package/src/styles/finance-tearsheet-overlay.css +90 -0
- package/src/styles/finance-tearsheet.css +945 -0
- package/src/styles/marquee.css +168 -0
- package/src/styles/metrics.css +82 -0
- package/src/styles/nav-shell.css +551 -0
- package/src/styles/pricing.css +79 -0
- package/src/styles/repo-activity.css +575 -0
- package/src/styles/stages.css +69 -0
- package/src/styles/terminal-loaders.css +122 -0
- package/src/styles/terminal-manifest.css +228 -0
- package/src/styles/web-theme.css +1007 -0
- package/src/styles/word-reveal.css +204 -0
- package/src/theme/apply-theme.ts +214 -0
- package/src/theme/index.ts +27 -0
- package/src/theme/palette-registry.ts +855 -0
- package/src/theme/tui-prefs.ts +64 -0
- package/src/ui/alert.tsx +78 -0
- package/src/ui/avatar.tsx +104 -0
- package/src/ui/badge.tsx +75 -0
- package/src/ui/breadcrumb.tsx +61 -0
- package/src/ui/button.tsx +67 -0
- package/src/ui/card.tsx +139 -0
- package/src/ui/checkbox.tsx +27 -0
- package/src/ui/collapsible.tsx +32 -0
- package/src/ui/date-pager.tsx +325 -0
- package/src/ui/dialog.tsx +157 -0
- package/src/ui/dropdown-menu.tsx +267 -0
- package/src/ui/empty-state.tsx +165 -0
- package/src/ui/field.tsx +104 -0
- package/src/ui/form.tsx +36 -0
- package/src/ui/icon-button.tsx +36 -0
- package/src/ui/index.ts +34 -0
- package/src/ui/input.tsx +33 -0
- package/src/ui/kbd.tsx +30 -0
- package/src/ui/label.tsx +32 -0
- package/src/ui/pager.tsx +119 -0
- package/src/ui/pagination.tsx +126 -0
- package/src/ui/radio-group.tsx +51 -0
- package/src/ui/search-bar.tsx +85 -0
- package/src/ui/segmented-control.tsx +76 -0
- package/src/ui/select.tsx +257 -0
- package/src/ui/separator.tsx +24 -0
- package/src/ui/sheet.tsx +141 -0
- package/src/ui/skeleton.tsx +76 -0
- package/src/ui/slider.tsx +76 -0
- package/src/ui/switch.tsx +31 -0
- package/src/ui/table.tsx +179 -0
- package/src/ui/tabs.tsx +89 -0
- package/src/ui/tags-input.tsx +168 -0
- package/src/ui/textarea.tsx +17 -0
- package/src/ui/tooltip.tsx +71 -0
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Session prefs for full-app stock chrome (#3736). Same session toggles as
|
|
5
|
+
* the embed — no sign-in required. MCP URLs never live here.
|
|
6
|
+
*
|
|
7
|
+
* WS4 Step 3: the hook takes a narrow structural config plus injectable deps
|
|
8
|
+
* instead of the product `DigichatClientConfig`, so the module moves into the
|
|
9
|
+
* package without importing app code. Behavior is unchanged — hosts pass the
|
|
10
|
+
* same app functions and values.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_EMBED_CHAT_PREFS,
|
|
16
|
+
EmbedChatPrefsProvider,
|
|
17
|
+
catalogToolsFromClient,
|
|
18
|
+
createDefaultEmbedChatPrefs,
|
|
19
|
+
chromePrefsFromDeploy,
|
|
20
|
+
resetChromePrefsFromDeploy,
|
|
21
|
+
persistDensity,
|
|
22
|
+
persistScroll,
|
|
23
|
+
useStoredDensityAfterMount,
|
|
24
|
+
useStoredScrollAfterMount,
|
|
25
|
+
disabledCatalogIds,
|
|
26
|
+
extraOffFromCatalog,
|
|
27
|
+
type CatalogToolRow,
|
|
28
|
+
type EmbedChatPrefs,
|
|
29
|
+
type EmbedChatPrefsApi,
|
|
30
|
+
} from "./embed-chat-prefs";
|
|
31
|
+
// Package twins of the app types (identical literals/shapes; see skin-types.ts).
|
|
32
|
+
// Aliased to the app names so the hook body below reads unchanged (WS4).
|
|
33
|
+
import {
|
|
34
|
+
isStockComposerMenuKind,
|
|
35
|
+
type StockComposerMenuKind as ComposerMenuKind,
|
|
36
|
+
} from "./skin-types";
|
|
37
|
+
import type { SkinMcpServerConfig as SessionMcpConfig } from "./skin-types";
|
|
38
|
+
import type { ThinkingMode, ViewMode } from "./skin-types";
|
|
39
|
+
|
|
40
|
+
/** Narrow structural config: only the fields the prefs hook reads. */
|
|
41
|
+
export type StockChatPrefsConfig = {
|
|
42
|
+
catalog: CatalogToolRow[];
|
|
43
|
+
servers: CatalogToolRow[];
|
|
44
|
+
defaultLanguage?: string;
|
|
45
|
+
defaultModel?: string;
|
|
46
|
+
availableModels: readonly string[];
|
|
47
|
+
/** Catalog presets and groups. The menu falls back to raw ids when absent. */
|
|
48
|
+
modelPicker?: {
|
|
49
|
+
presets: readonly { id: string; label: string; model: string }[];
|
|
50
|
+
groups: readonly { provider: string; models: readonly { id: string; label: string }[] }[];
|
|
51
|
+
showFullList: boolean;
|
|
52
|
+
};
|
|
53
|
+
/** Host pre-computes models.allowPicker || features.modelPicker. */
|
|
54
|
+
allowModelPicker?: boolean;
|
|
55
|
+
view: ViewMode;
|
|
56
|
+
thinking: ThinkingMode;
|
|
57
|
+
/** Deployment default. A stored `dt-density` still wins for this user. */
|
|
58
|
+
density?: "compact" | "default" | "airy";
|
|
59
|
+
effort?: "low" | "medium" | "high";
|
|
60
|
+
searchEngine?: string;
|
|
61
|
+
toolbar?: boolean;
|
|
62
|
+
scrollbars?: "always" | "auto";
|
|
63
|
+
/** Deployment default for follow/free. A stored `dt-scroll` still wins. */
|
|
64
|
+
scroll?: { mode: "follow" | "free" };
|
|
65
|
+
tenantAllowsWeb: boolean;
|
|
66
|
+
showByok: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The backend that serves this chat, as a display label. The host owns
|
|
69
|
+
* the provider vocabulary; absent means unknown.
|
|
70
|
+
*/
|
|
71
|
+
providerLabel?: string;
|
|
72
|
+
allowUserServers?: boolean;
|
|
73
|
+
allowAddForm?: boolean;
|
|
74
|
+
/** Foundry is `agent`, a host lock is `locked`, otherwise tools toggle. */
|
|
75
|
+
toolControl?: "toggle" | "locked" | "agent";
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Injectable product deps: pure app functions the package must not import. */
|
|
79
|
+
export type StockChatPrefsDeps = {
|
|
80
|
+
defaultLanguageCode: string;
|
|
81
|
+
detectLanguage?: () => string | undefined;
|
|
82
|
+
resolveLanguage?: (code: string) => string | null | undefined;
|
|
83
|
+
resolveWebSearch?: (tenantAllows: boolean, userPref: boolean) => boolean;
|
|
84
|
+
mcpOps: {
|
|
85
|
+
replace: (
|
|
86
|
+
list: readonly SessionMcpConfig[],
|
|
87
|
+
previousId: string,
|
|
88
|
+
next: SessionMcpConfig,
|
|
89
|
+
) => SessionMcpConfig[];
|
|
90
|
+
connected: (
|
|
91
|
+
operator: readonly CatalogToolRow[],
|
|
92
|
+
custom: readonly SessionMcpConfig[],
|
|
93
|
+
) => SessionMcpConfig[];
|
|
94
|
+
headerValue: (
|
|
95
|
+
configs: readonly SessionMcpConfig[],
|
|
96
|
+
extraToolOn: (id: string) => boolean,
|
|
97
|
+
allowSessionUrls: boolean,
|
|
98
|
+
) => string | undefined;
|
|
99
|
+
};
|
|
100
|
+
renderMenuPanes?: (args: {
|
|
101
|
+
kind: ComposerMenuKind;
|
|
102
|
+
models: readonly string[];
|
|
103
|
+
defaultModel?: string;
|
|
104
|
+
modelPicker?: StockChatPrefsConfig["modelPicker"];
|
|
105
|
+
providerSeed?: string;
|
|
106
|
+
mcpSeed?: string;
|
|
107
|
+
onClose: () => void;
|
|
108
|
+
}) => ReactNode;
|
|
109
|
+
onOpenSessions?: () => void;
|
|
110
|
+
onOpenArtifacts?: () => void;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const defaultResolveWebSearch = (tenantAllows: boolean, userPref: boolean) =>
|
|
114
|
+
tenantAllows && userPref;
|
|
115
|
+
|
|
116
|
+
const defaultOpenSessions = () => {
|
|
117
|
+
document.querySelector("[data-memory-thread-list]")?.scrollIntoView({
|
|
118
|
+
block: "nearest",
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export function useStockChatPrefs({
|
|
123
|
+
config,
|
|
124
|
+
deps,
|
|
125
|
+
sessionKey,
|
|
126
|
+
hasSessions,
|
|
127
|
+
hasArtifacts = false,
|
|
128
|
+
newThread,
|
|
129
|
+
redo,
|
|
130
|
+
}: {
|
|
131
|
+
config: StockChatPrefsConfig;
|
|
132
|
+
deps: StockChatPrefsDeps;
|
|
133
|
+
sessionKey: string;
|
|
134
|
+
hasSessions: boolean;
|
|
135
|
+
/** Gating flag for /artifacts. Off until an artifact surface is wired. */
|
|
136
|
+
hasArtifacts?: boolean;
|
|
137
|
+
newThread: () => void;
|
|
138
|
+
redo: () => void;
|
|
139
|
+
}) {
|
|
140
|
+
const catalogTools = useMemo(
|
|
141
|
+
() =>
|
|
142
|
+
catalogToolsFromClient({
|
|
143
|
+
tools: { catalog: config.catalog },
|
|
144
|
+
mcp: { servers: config.servers },
|
|
145
|
+
}),
|
|
146
|
+
[config.catalog, config.servers],
|
|
147
|
+
);
|
|
148
|
+
const [chatPrefs, setChatPrefs] = useState<EmbedChatPrefs>(() => ({
|
|
149
|
+
...DEFAULT_EMBED_CHAT_PREFS,
|
|
150
|
+
language: (config.defaultLanguage || deps.detectLanguage?.()) ?? deps.defaultLanguageCode,
|
|
151
|
+
model: initialStockSessionModel(config),
|
|
152
|
+
extra: extraOffFromCatalog(catalogTools),
|
|
153
|
+
view: config.view,
|
|
154
|
+
thinking: config.thinking,
|
|
155
|
+
// No storage on the first render: the server cannot read dt-density, so
|
|
156
|
+
// the stored choice is applied after mount (useStoredDensityAfterMount).
|
|
157
|
+
...chromePrefsFromDeploy(
|
|
158
|
+
{
|
|
159
|
+
density: config.density,
|
|
160
|
+
effort: config.effort,
|
|
161
|
+
searchEngine: config.searchEngine,
|
|
162
|
+
toolbar: config.toolbar,
|
|
163
|
+
scrollbars: config.scrollbars,
|
|
164
|
+
scroll: config.scroll?.mode,
|
|
165
|
+
},
|
|
166
|
+
null,
|
|
167
|
+
),
|
|
168
|
+
}));
|
|
169
|
+
useStoredDensityAfterMount(setChatPrefs);
|
|
170
|
+
useStoredScrollAfterMount(setChatPrefs);
|
|
171
|
+
const [composerMenu, setComposerMenu] = useState<null | ComposerMenuKind>(null);
|
|
172
|
+
const [paletteQuery, setPaletteQuery] = useState("");
|
|
173
|
+
const draftSink = useRef<(text: string) => void>(() => {});
|
|
174
|
+
const [composerDraftBound, setComposerDraftBound] = useState(false);
|
|
175
|
+
const syncPalette = useCallback(
|
|
176
|
+
(next: {
|
|
177
|
+
kind: "closed" | "commands" | "pane";
|
|
178
|
+
menu: "close" | "keep" | string;
|
|
179
|
+
filter: string;
|
|
180
|
+
}) => {
|
|
181
|
+
setPaletteQuery(next.filter);
|
|
182
|
+
if (next.menu === "close") setComposerMenu(null);
|
|
183
|
+
else if (next.menu !== "keep" && isStockComposerMenuKind(next.menu)) {
|
|
184
|
+
setComposerMenu(next.menu);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
[],
|
|
188
|
+
);
|
|
189
|
+
const bindComposerDraft = useCallback((setText: (text: string) => void) => {
|
|
190
|
+
draftSink.current = setText;
|
|
191
|
+
setComposerDraftBound(true);
|
|
192
|
+
}, []);
|
|
193
|
+
const setComposerDraft = useCallback((text: string) => {
|
|
194
|
+
draftSink.current(text);
|
|
195
|
+
}, []);
|
|
196
|
+
const exportSink = useRef<((format: "md" | "html") => void) | null>(null);
|
|
197
|
+
const [threadExportBound, setThreadExportBound] = useState(false);
|
|
198
|
+
const bindThreadExport = useCallback((run: (format: "md" | "html") => void) => {
|
|
199
|
+
exportSink.current = run;
|
|
200
|
+
setThreadExportBound(true);
|
|
201
|
+
}, []);
|
|
202
|
+
const exportThread = useCallback((format: "md" | "html") => {
|
|
203
|
+
exportSink.current?.(format);
|
|
204
|
+
}, []);
|
|
205
|
+
const [providerSeed, setProviderSeed] = useState<string | undefined>();
|
|
206
|
+
const [mcpSeed, setMcpSeed] = useState<string | undefined>();
|
|
207
|
+
const chatPrefsRef = useRef(chatPrefs);
|
|
208
|
+
// eslint-disable-next-line react-hooks/refs -- send-time useLatest (#1339)
|
|
209
|
+
chatPrefsRef.current = chatPrefs;
|
|
210
|
+
|
|
211
|
+
const catalog = config.catalog;
|
|
212
|
+
const tenantAllowsWeb = config.tenantAllowsWeb;
|
|
213
|
+
const showByok = config.showByok;
|
|
214
|
+
const showModels = config.allowModelPicker === true && config.availableModels.length > 0;
|
|
215
|
+
|
|
216
|
+
const getLanguage = useCallback(() => chatPrefsRef.current.language, []);
|
|
217
|
+
const getModel = useCallback(() => {
|
|
218
|
+
const id = chatPrefsRef.current.model.trim();
|
|
219
|
+
return id || undefined;
|
|
220
|
+
}, []);
|
|
221
|
+
const getDisabledTools = useCallback(
|
|
222
|
+
() => disabledCatalogIds(chatPrefsRef.current).join(","),
|
|
223
|
+
[],
|
|
224
|
+
);
|
|
225
|
+
const getEffort = useCallback(() => chatPrefsRef.current.effort, []);
|
|
226
|
+
const getSearchEngine = useCallback(() => chatPrefsRef.current.searchEngine, []);
|
|
227
|
+
const getMcpSession = useCallback(
|
|
228
|
+
() =>
|
|
229
|
+
deps.mcpOps.headerValue(
|
|
230
|
+
deps.mcpOps.connected(config.servers, chatPrefsRef.current.mcpCustom),
|
|
231
|
+
(id) => chatPrefsRef.current.extra[id] !== false,
|
|
232
|
+
config.allowUserServers === true,
|
|
233
|
+
),
|
|
234
|
+
[config.servers, config.allowUserServers, deps.mcpOps],
|
|
235
|
+
);
|
|
236
|
+
const resolveWebSearch = deps.resolveWebSearch ?? defaultResolveWebSearch;
|
|
237
|
+
const getEnableWebSearch = useCallback(
|
|
238
|
+
() => resolveWebSearch(tenantAllowsWeb, chatPrefsRef.current.webSearch),
|
|
239
|
+
[tenantAllowsWeb, resolveWebSearch],
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
const prefsApi = useMemo<EmbedChatPrefsApi>(
|
|
243
|
+
() => ({
|
|
244
|
+
prefs: chatPrefs,
|
|
245
|
+
setWebSearch: (value) => setChatPrefs((p) => ({ ...p, webSearch: value })),
|
|
246
|
+
setDigisearch: (value) => setChatPrefs((p) => ({ ...p, digisearch: value })),
|
|
247
|
+
setVault: (value) => setChatPrefs((p) => ({ ...p, vault: value })),
|
|
248
|
+
setExtraTool: (id, value) =>
|
|
249
|
+
setChatPrefs((p) => ({ ...p, extra: { ...p.extra, [id]: value } })),
|
|
250
|
+
extraToolOn: (id) => chatPrefs.extra[id] !== false,
|
|
251
|
+
setMcpConfig: (config, previousId) =>
|
|
252
|
+
setChatPrefs((p) => ({
|
|
253
|
+
...p,
|
|
254
|
+
mcpCustom: deps.mcpOps.replace(p.mcpCustom, previousId ?? config.id, config),
|
|
255
|
+
})),
|
|
256
|
+
removeMcpConfig: (id) =>
|
|
257
|
+
setChatPrefs((p) => ({
|
|
258
|
+
...p,
|
|
259
|
+
mcpCustom: p.mcpCustom.filter((s) => s.id !== id),
|
|
260
|
+
})),
|
|
261
|
+
setLanguage: (code) => {
|
|
262
|
+
const resolved = (deps.resolveLanguage ?? ((c) => c))(code) ?? deps.defaultLanguageCode;
|
|
263
|
+
setChatPrefs((p) => ({ ...p, language: resolved }));
|
|
264
|
+
},
|
|
265
|
+
setView: (mode) => setChatPrefs((p) => ({ ...p, view: mode })),
|
|
266
|
+
setThinking: (value) => setChatPrefs((p) => ({ ...p, thinking: value })),
|
|
267
|
+
setModel: (id) => setChatPrefs((p) => ({ ...p, model: id })),
|
|
268
|
+
availableModels: config.availableModels,
|
|
269
|
+
setEffort: (effort) => setChatPrefs((p) => ({ ...p, effort })),
|
|
270
|
+
setSearchEngine: (engine) => setChatPrefs((p) => ({ ...p, searchEngine: engine })),
|
|
271
|
+
setToolbar: (visible) => setChatPrefs((p) => ({ ...p, toolbar: visible })),
|
|
272
|
+
setScrollbars: (mode) => setChatPrefs((p) => ({ ...p, scrollbars: mode })),
|
|
273
|
+
setDensity: (density) => {
|
|
274
|
+
persistDensity(density);
|
|
275
|
+
setChatPrefs((p) => ({ ...p, density }));
|
|
276
|
+
},
|
|
277
|
+
setScroll: (mode) => {
|
|
278
|
+
persistScroll(mode);
|
|
279
|
+
setChatPrefs((p) => ({ ...p, scroll: mode }));
|
|
280
|
+
},
|
|
281
|
+
reset: () =>
|
|
282
|
+
setChatPrefs({
|
|
283
|
+
...createDefaultEmbedChatPrefs({ language: deps.defaultLanguageCode }),
|
|
284
|
+
extra: extraOffFromCatalog(catalogTools),
|
|
285
|
+
view: config.view,
|
|
286
|
+
thinking: config.thinking,
|
|
287
|
+
...resetChromePrefsFromDeploy({
|
|
288
|
+
density: config.density,
|
|
289
|
+
effort: config.effort,
|
|
290
|
+
searchEngine: config.searchEngine,
|
|
291
|
+
toolbar: config.toolbar,
|
|
292
|
+
scrollbars: config.scrollbars,
|
|
293
|
+
scroll: config.scroll?.mode,
|
|
294
|
+
}),
|
|
295
|
+
}),
|
|
296
|
+
tenantAllowsWeb,
|
|
297
|
+
showByok,
|
|
298
|
+
providerLabel: config.providerLabel,
|
|
299
|
+
showModels,
|
|
300
|
+
hasDigisearch: catalog.some((e) => e.id === "digisearch"),
|
|
301
|
+
hasVault: catalog.some((e) => e.id === "digivault"),
|
|
302
|
+
hasSessions,
|
|
303
|
+
hasArtifacts,
|
|
304
|
+
allowUserMcp: config.allowUserServers === true,
|
|
305
|
+
allowAddMcp: config.allowAddForm === true,
|
|
306
|
+
catalogTools,
|
|
307
|
+
mcpServers: config.servers,
|
|
308
|
+
sessionKey,
|
|
309
|
+
openSettings: () => {
|
|
310
|
+
setComposerMenu("settings");
|
|
311
|
+
},
|
|
312
|
+
openHelp: () => {
|
|
313
|
+
setComposerMenu("help");
|
|
314
|
+
},
|
|
315
|
+
openTools: () => {
|
|
316
|
+
setComposerMenu("tools");
|
|
317
|
+
},
|
|
318
|
+
openMcp: (seed?: string) => {
|
|
319
|
+
setMcpSeed(seed);
|
|
320
|
+
setComposerMenu("mcp");
|
|
321
|
+
},
|
|
322
|
+
openByok: (seed?: string) => {
|
|
323
|
+
setProviderSeed(seed);
|
|
324
|
+
setComposerMenu("provider");
|
|
325
|
+
},
|
|
326
|
+
openModels: () => {
|
|
327
|
+
setComposerMenu("models");
|
|
328
|
+
},
|
|
329
|
+
openEffort: () => {
|
|
330
|
+
setComposerMenu("effort");
|
|
331
|
+
},
|
|
332
|
+
openSearchEngine: () => {
|
|
333
|
+
setComposerMenu("search-engine");
|
|
334
|
+
},
|
|
335
|
+
openView: () => {
|
|
336
|
+
setComposerMenu("view");
|
|
337
|
+
},
|
|
338
|
+
openDensity: () => {
|
|
339
|
+
setComposerMenu("density");
|
|
340
|
+
},
|
|
341
|
+
openTheme: () => {
|
|
342
|
+
setComposerMenu("theme");
|
|
343
|
+
},
|
|
344
|
+
openThinking: () => {
|
|
345
|
+
setComposerMenu("thinking");
|
|
346
|
+
},
|
|
347
|
+
openLanguage: () => {
|
|
348
|
+
setComposerMenu("language");
|
|
349
|
+
},
|
|
350
|
+
openSessions: deps.onOpenSessions ?? defaultOpenSessions,
|
|
351
|
+
openArtifacts: deps.onOpenArtifacts ?? (() => {}),
|
|
352
|
+
newThread: () => {
|
|
353
|
+
setChatPrefs({
|
|
354
|
+
...createDefaultEmbedChatPrefs({ language: deps.defaultLanguageCode }),
|
|
355
|
+
extra: extraOffFromCatalog(catalogTools),
|
|
356
|
+
view: config.view,
|
|
357
|
+
thinking: config.thinking,
|
|
358
|
+
...resetChromePrefsFromDeploy({
|
|
359
|
+
density: config.density,
|
|
360
|
+
effort: config.effort,
|
|
361
|
+
searchEngine: config.searchEngine,
|
|
362
|
+
toolbar: config.toolbar,
|
|
363
|
+
scrollbars: config.scrollbars,
|
|
364
|
+
scroll: config.scroll?.mode,
|
|
365
|
+
}),
|
|
366
|
+
});
|
|
367
|
+
newThread();
|
|
368
|
+
},
|
|
369
|
+
compactThread: () => {
|
|
370
|
+
setChatPrefs({
|
|
371
|
+
...createDefaultEmbedChatPrefs({ language: deps.defaultLanguageCode }),
|
|
372
|
+
extra: extraOffFromCatalog(catalogTools),
|
|
373
|
+
view: config.view,
|
|
374
|
+
thinking: config.thinking,
|
|
375
|
+
...resetChromePrefsFromDeploy({
|
|
376
|
+
density: config.density,
|
|
377
|
+
effort: config.effort,
|
|
378
|
+
searchEngine: config.searchEngine,
|
|
379
|
+
toolbar: config.toolbar,
|
|
380
|
+
scrollbars: config.scrollbars,
|
|
381
|
+
scroll: config.scroll?.mode,
|
|
382
|
+
}),
|
|
383
|
+
});
|
|
384
|
+
newThread();
|
|
385
|
+
},
|
|
386
|
+
undo: () => {},
|
|
387
|
+
redo,
|
|
388
|
+
toolControl: config.toolControl,
|
|
389
|
+
paletteQuery,
|
|
390
|
+
setComposerDraft,
|
|
391
|
+
bindComposerDraft,
|
|
392
|
+
composerDraftBound,
|
|
393
|
+
exportThread,
|
|
394
|
+
bindThreadExport,
|
|
395
|
+
threadExportBound,
|
|
396
|
+
syncPalette,
|
|
397
|
+
}),
|
|
398
|
+
[
|
|
399
|
+
chatPrefs,
|
|
400
|
+
tenantAllowsWeb,
|
|
401
|
+
showByok,
|
|
402
|
+
showModels,
|
|
403
|
+
catalog,
|
|
404
|
+
catalogTools,
|
|
405
|
+
sessionKey,
|
|
406
|
+
hasSessions,
|
|
407
|
+
hasArtifacts,
|
|
408
|
+
newThread,
|
|
409
|
+
redo,
|
|
410
|
+
config.allowUserServers,
|
|
411
|
+
config.allowAddForm,
|
|
412
|
+
config.providerLabel,
|
|
413
|
+
config.servers,
|
|
414
|
+
config.view,
|
|
415
|
+
config.thinking,
|
|
416
|
+
config.density,
|
|
417
|
+
config.effort,
|
|
418
|
+
config.searchEngine,
|
|
419
|
+
config.toolbar,
|
|
420
|
+
config.scrollbars,
|
|
421
|
+
deps.mcpOps,
|
|
422
|
+
deps.resolveLanguage,
|
|
423
|
+
deps.defaultLanguageCode,
|
|
424
|
+
deps.onOpenSessions,
|
|
425
|
+
config.toolControl,
|
|
426
|
+
config.availableModels,
|
|
427
|
+
paletteQuery,
|
|
428
|
+
setComposerDraft,
|
|
429
|
+
bindComposerDraft,
|
|
430
|
+
composerDraftBound,
|
|
431
|
+
exportThread,
|
|
432
|
+
bindThreadExport,
|
|
433
|
+
threadExportBound,
|
|
434
|
+
syncPalette,
|
|
435
|
+
],
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
const panes = composerMenu ? (
|
|
439
|
+
deps.renderMenuPanes?.({
|
|
440
|
+
kind: composerMenu,
|
|
441
|
+
models: config.availableModels,
|
|
442
|
+
defaultModel: config.defaultModel,
|
|
443
|
+
modelPicker: config.modelPicker,
|
|
444
|
+
providerSeed,
|
|
445
|
+
mcpSeed,
|
|
446
|
+
onClose: () => {
|
|
447
|
+
setComposerMenu(null);
|
|
448
|
+
setProviderSeed(undefined);
|
|
449
|
+
setMcpSeed(undefined);
|
|
450
|
+
},
|
|
451
|
+
}) ?? null
|
|
452
|
+
) : null;
|
|
453
|
+
|
|
454
|
+
return {
|
|
455
|
+
prefsApi,
|
|
456
|
+
panes,
|
|
457
|
+
getLanguage,
|
|
458
|
+
getModel,
|
|
459
|
+
getDisabledTools,
|
|
460
|
+
getEnableWebSearch,
|
|
461
|
+
getMcpSession,
|
|
462
|
+
getEffort,
|
|
463
|
+
getSearchEngine,
|
|
464
|
+
setWebSearch: (on: boolean) => setChatPrefs((p) => ({ ...p, webSearch: on })),
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Model id the session starts on. When the curated default is the model the
|
|
470
|
+
* Auto preset resolves to, the session starts on Auto (empty): the toolbar
|
|
471
|
+
* reads "auto", the Auto row is selected, and the turn sends no
|
|
472
|
+
* X-Digi-Model, so the server runs its default (that same model). Mirrors
|
|
473
|
+
* the embed client's `sessionModelSeed` (#6326). Otherwise the curated
|
|
474
|
+
* default, else the first available id.
|
|
475
|
+
*/
|
|
476
|
+
export function initialStockSessionModel(
|
|
477
|
+
config: Pick<StockChatPrefsConfig, "defaultModel" | "availableModels" | "modelPicker">,
|
|
478
|
+
): string {
|
|
479
|
+
const named = config.defaultModel?.trim() || "";
|
|
480
|
+
const auto =
|
|
481
|
+
config.modelPicker?.presets.find((preset) => preset.id === "auto")?.model.trim() || "";
|
|
482
|
+
if (named && auto && named === auto) return "";
|
|
483
|
+
return config.defaultModel ?? config.availableModels[0] ?? "";
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export function StockChatPrefsHost({
|
|
487
|
+
value,
|
|
488
|
+
children,
|
|
489
|
+
panes,
|
|
490
|
+
}: {
|
|
491
|
+
value: EmbedChatPrefsApi;
|
|
492
|
+
children: ReactNode;
|
|
493
|
+
panes: ReactNode;
|
|
494
|
+
}) {
|
|
495
|
+
return (
|
|
496
|
+
<EmbedChatPrefsProvider value={value}>
|
|
497
|
+
{children}
|
|
498
|
+
{panes}
|
|
499
|
+
</EmbedChatPrefsProvider>
|
|
500
|
+
);
|
|
501
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Optional pre-send intercept for stock Composer (embed free-tier / BYOK hold).
|
|
5
|
+
* When shouldHold returns true, ComposerPrimitive.Root onSubmit preventDefaults
|
|
6
|
+
* so composer.send() never runs and POST /api/chat is not fired.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
createContext,
|
|
11
|
+
useCallback,
|
|
12
|
+
useContext,
|
|
13
|
+
type FormEvent,
|
|
14
|
+
type ReactNode,
|
|
15
|
+
} from "react";
|
|
16
|
+
import { useAui, type CreateAttachment } from "@assistant-ui/react";
|
|
17
|
+
|
|
18
|
+
export type StockSendGateHandlers = {
|
|
19
|
+
/**
|
|
20
|
+
* Return true to swallow the submit (hold question / open settings).
|
|
21
|
+
* Return false to let the default composer.send() proceed.
|
|
22
|
+
*/
|
|
23
|
+
shouldHold: (text: string) => boolean;
|
|
24
|
+
/** Called after shouldHold(true); text is already trimmed. */
|
|
25
|
+
onHold: (text: string) => void;
|
|
26
|
+
/** Called when submit is allowed through (e.g. arm turn charge). */
|
|
27
|
+
onAllowSend?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* System document to attach just before composer.send() (page-context chip).
|
|
30
|
+
* Not a user file picker — callers keep `features.attachments` false.
|
|
31
|
+
*/
|
|
32
|
+
takePendingPageContextAttachment?: () => CreateAttachment | null;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const StockSendGateContext = createContext<StockSendGateHandlers | null>(null);
|
|
36
|
+
|
|
37
|
+
export function StockSendGateProvider({
|
|
38
|
+
handlers,
|
|
39
|
+
children,
|
|
40
|
+
}: {
|
|
41
|
+
handlers: StockSendGateHandlers | null;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}) {
|
|
44
|
+
return (
|
|
45
|
+
<StockSendGateContext.Provider value={handlers}>
|
|
46
|
+
{children}
|
|
47
|
+
</StockSendGateContext.Provider>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function useStockSendGate(): StockSendGateHandlers | null {
|
|
52
|
+
return useContext(StockSendGateContext);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Form onSubmit for ComposerPrimitive.Root. Must run before the primitive's
|
|
57
|
+
* own handleSubmit (radix composeEventHandlers — preventDefault skips send).
|
|
58
|
+
*/
|
|
59
|
+
export function useStockComposerGateSubmit():
|
|
60
|
+
| ((event: FormEvent<HTMLFormElement>) => void)
|
|
61
|
+
| undefined {
|
|
62
|
+
const gate = useStockSendGate();
|
|
63
|
+
const aui = useAui();
|
|
64
|
+
|
|
65
|
+
return useCallback(
|
|
66
|
+
(event: FormEvent<HTMLFormElement>) => {
|
|
67
|
+
if (!gate) return;
|
|
68
|
+
const text = aui.composer.getState().text.trim();
|
|
69
|
+
if (!text) return;
|
|
70
|
+
if (gate.shouldHold(text)) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
aui.composer.setText("");
|
|
73
|
+
void aui.composer.clearAttachments();
|
|
74
|
+
gate.onHold(text);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const pageAttachment = gate.takePendingPageContextAttachment?.();
|
|
78
|
+
if (pageAttachment) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
void (async () => {
|
|
81
|
+
const existing = aui.composer.getState().attachments ?? [];
|
|
82
|
+
if (!existing.some((a) => a.name === pageAttachment.name)) {
|
|
83
|
+
await aui.composer.addAttachment(pageAttachment);
|
|
84
|
+
}
|
|
85
|
+
gate.onAllowSend?.();
|
|
86
|
+
aui.composer.send();
|
|
87
|
+
})();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
gate.onAllowSend?.();
|
|
91
|
+
},
|
|
92
|
+
[aui, gate],
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, type FC, type ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Whether the element renders inside the stock assistant-ui Thread.
|
|
7
|
+
*
|
|
8
|
+
* The stock Thread follows assistant-ui's default rounded shapes (base
|
|
9
|
+
* registry, `@assistant-ui/react@^0.15.32`, and its shadcn base-nova
|
|
10
|
+
* primitives). Several stock files are shared with other skins (markdown,
|
|
11
|
+
* tool rows, reasoning, notices, the copy button and its tooltip), which keep
|
|
12
|
+
* their square house dress. Those files read this flag and only switch to the
|
|
13
|
+
* assistant-ui radius when it is set, so other skins render exactly as before.
|
|
14
|
+
* React context crosses portals, so portaled tooltips and dialogs follow it.
|
|
15
|
+
*/
|
|
16
|
+
const StockShapeContext = createContext(false);
|
|
17
|
+
|
|
18
|
+
export const StockShapeProvider: FC<{ children: ReactNode }> = ({ children }) => (
|
|
19
|
+
<StockShapeContext.Provider value={true}>{children}</StockShapeContext.Provider>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export function useStockShape(): boolean {
|
|
23
|
+
return useContext(StockShapeContext);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The assistant-ui radius in the stock Thread, the square house radius elsewhere. */
|
|
27
|
+
export function stockRadius(stock: boolean, upstream: string, house = "rounded-none"): string {
|
|
28
|
+
return stock ? upstream : house;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Marks a portaled stock surface (a dialog) rendered from inside the stock
|
|
33
|
+
* Thread, so chat-aui.css's `bg-surface-2` utility paints in it. The thread
|
|
34
|
+
* root carries `data-stock-thread`; a portal leaves that subtree, so it
|
|
35
|
+
* carries this instead. Outside the provider it adds nothing.
|
|
36
|
+
*/
|
|
37
|
+
export function stockPortalProps(stock: boolean): { "data-stock-portal"?: "" } {
|
|
38
|
+
return stock ? { "data-stock-portal": "" } : {};
|
|
39
|
+
}
|