@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,280 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type PropsWithChildren,
|
|
5
|
+
useState,
|
|
6
|
+
type FC,
|
|
7
|
+
isValidElement,
|
|
8
|
+
} from "react";
|
|
9
|
+
import {
|
|
10
|
+
XIcon,
|
|
11
|
+
PlusIcon,
|
|
12
|
+
FileText,
|
|
13
|
+
AlertCircleIcon,
|
|
14
|
+
} from "lucide-react";
|
|
15
|
+
import {
|
|
16
|
+
AttachmentPrimitive,
|
|
17
|
+
ComposerPrimitive,
|
|
18
|
+
MessagePrimitive,
|
|
19
|
+
useAuiState,
|
|
20
|
+
useAui,
|
|
21
|
+
} from "@assistant-ui/react";
|
|
22
|
+
import {
|
|
23
|
+
Tooltip,
|
|
24
|
+
TooltipContent,
|
|
25
|
+
TooltipProvider,
|
|
26
|
+
TooltipTrigger,
|
|
27
|
+
} from "./ui/tooltip";
|
|
28
|
+
import {
|
|
29
|
+
Dialog,
|
|
30
|
+
DialogTitle,
|
|
31
|
+
DialogContent,
|
|
32
|
+
DialogTrigger,
|
|
33
|
+
} from "./ui/dialog";
|
|
34
|
+
import { Avatar, AvatarImage, AvatarFallback } from "./ui/avatar";
|
|
35
|
+
import { TooltipIconButton } from "./tooltip-icon-button";
|
|
36
|
+
import { useAttachmentSrc } from "./use-attachment-src";
|
|
37
|
+
import { useSkinChrome } from "./skin-chrome";
|
|
38
|
+
import { cn } from "../../../lib/utils";
|
|
39
|
+
import { DotMatrix } from "../DotMatrix";
|
|
40
|
+
|
|
41
|
+
// Protocol literal mirrored from the app's embed-page-context-messages
|
|
42
|
+
// (`PAGE_CONTEXT_ATTACHMENT_NAME = "page-context.html"`). The sending side
|
|
43
|
+
// names the page-context attachment; silent skins suppress its chip by this
|
|
44
|
+
// name. Kept as a literal so the package never imports app code (WS4).
|
|
45
|
+
const PAGE_CONTEXT_ATTACHMENT_NAME = "page-context.html";
|
|
46
|
+
|
|
47
|
+
type AttachmentPreviewProps = {
|
|
48
|
+
src: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {
|
|
52
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
53
|
+
return (
|
|
54
|
+
<img
|
|
55
|
+
src={src}
|
|
56
|
+
alt="Attachment preview"
|
|
57
|
+
className={cn(
|
|
58
|
+
"block h-auto max-h-[80vh] w-auto max-w-full rounded-sm object-contain transition-opacity duration-(--dur) motion-reduce:transition-none",
|
|
59
|
+
isLoaded
|
|
60
|
+
? "aui-attachment-preview-image-loaded opacity-100"
|
|
61
|
+
: "aui-attachment-preview-image-loading opacity-0",
|
|
62
|
+
)}
|
|
63
|
+
onLoad={() => setIsLoaded(true)}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {
|
|
69
|
+
const src = useAttachmentSrc();
|
|
70
|
+
|
|
71
|
+
if (!src) return children;
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<Dialog>
|
|
75
|
+
<DialogTrigger
|
|
76
|
+
nativeButton={false}
|
|
77
|
+
className="aui-attachment-preview-trigger cursor-zoom-in"
|
|
78
|
+
render={
|
|
79
|
+
isValidElement(children) ? (
|
|
80
|
+
children
|
|
81
|
+
) : (
|
|
82
|
+
<button type="button">{children}</button>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
<DialogContent className="aui-attachment-preview-dialog-content [&>button]:bg-ink/60 [&>button]:hover:bg-ink/80 [&_svg]:text-background p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:ring-0!">
|
|
87
|
+
<DialogTitle className="aui-sr-only sr-only">
|
|
88
|
+
Image Attachment Preview
|
|
89
|
+
</DialogTitle>
|
|
90
|
+
<div className="aui-attachment-preview bg-surface relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden rounded-sm">
|
|
91
|
+
<AttachmentPreview src={src} />
|
|
92
|
+
</div>
|
|
93
|
+
</DialogContent>
|
|
94
|
+
</Dialog>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const AttachmentThumb: FC = () => {
|
|
99
|
+
const src = useAttachmentSrc();
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Avatar className="aui-attachment-tile-avatar h-full w-full rounded-none after:hidden">
|
|
103
|
+
<AvatarImage
|
|
104
|
+
src={src}
|
|
105
|
+
alt="Attachment preview"
|
|
106
|
+
className="aui-attachment-tile-image rounded-none object-cover"
|
|
107
|
+
/>
|
|
108
|
+
<AvatarFallback>
|
|
109
|
+
<FileText className="aui-attachment-tile-fallback-icon text-ink-mute size-6 stroke-[1.5]" />
|
|
110
|
+
</AvatarFallback>
|
|
111
|
+
</Avatar>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const AttachmentUI: FC = () => {
|
|
116
|
+
const aui = useAui();
|
|
117
|
+
const isComposer = aui.attachment.source !== "message";
|
|
118
|
+
|
|
119
|
+
const { pageContext } = useSkinChrome();
|
|
120
|
+
const attachmentName = useAuiState((s) => s.attachment.name);
|
|
121
|
+
|
|
122
|
+
const isImage = useAuiState((s) => s.attachment.type === "image");
|
|
123
|
+
const typeLabel = useAuiState((s) => {
|
|
124
|
+
const type = s.attachment.type;
|
|
125
|
+
switch (type) {
|
|
126
|
+
case "image":
|
|
127
|
+
return "Image";
|
|
128
|
+
case "document":
|
|
129
|
+
return "Document";
|
|
130
|
+
case "file":
|
|
131
|
+
return "File";
|
|
132
|
+
default:
|
|
133
|
+
return type;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const uploadState = useAuiState((s) =>
|
|
138
|
+
s.attachment.status.type === "running"
|
|
139
|
+
? "uploading"
|
|
140
|
+
: s.attachment.status.type === "incomplete" &&
|
|
141
|
+
s.attachment.status.reason === "error"
|
|
142
|
+
? "error"
|
|
143
|
+
: undefined,
|
|
144
|
+
);
|
|
145
|
+
const isUploading = uploadState === "uploading";
|
|
146
|
+
const isError = uploadState === "error";
|
|
147
|
+
|
|
148
|
+
const errorMessage = useAuiState((s) =>
|
|
149
|
+
s.attachment.status.type === "incomplete" &&
|
|
150
|
+
s.attachment.status.reason === "error"
|
|
151
|
+
? (s.attachment.status.message ?? "Upload failed")
|
|
152
|
+
: undefined,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
// Hooks above — safe to bail. The attachment stays on the runtime so its
|
|
156
|
+
// file part still reaches the model; only the chip is suppressed.
|
|
157
|
+
if (pageContext === "silent" && attachmentName === PAGE_CONTEXT_ATTACHMENT_NAME) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<TooltipProvider>
|
|
163
|
+
<Tooltip>
|
|
164
|
+
<AttachmentPrimitive.Root
|
|
165
|
+
className={cn(
|
|
166
|
+
"aui-attachment-root relative",
|
|
167
|
+
isComposer &&
|
|
168
|
+
"animate-in fade-in-0 zoom-in-95 duration-(--duration-hover) motion-reduce:animate-none",
|
|
169
|
+
isImage &&
|
|
170
|
+
!isComposer &&
|
|
171
|
+
"aui-attachment-root-message only:*:first:size-24",
|
|
172
|
+
)}
|
|
173
|
+
>
|
|
174
|
+
<AttachmentPreviewDialog>
|
|
175
|
+
<TooltipTrigger
|
|
176
|
+
render={
|
|
177
|
+
<div
|
|
178
|
+
className={cn(
|
|
179
|
+
"aui-attachment-tile bg-surface-2 hover:after:bg-ink/10 focus-visible:ring-accent/50 relative size-14 cursor-pointer overflow-hidden rounded-[calc(var(--composer-radius,1rem)-var(--composer-padding,8px))] transition-transform outline-none after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-black/10 after:transition-colors after:ring-inset focus-visible:ring-1 active:scale-[0.96] motion-reduce:transition-none dark:after:ring-white/10",
|
|
180
|
+
isError &&
|
|
181
|
+
"after:ring-danger/60 dark:after:ring-danger/60",
|
|
182
|
+
)}
|
|
183
|
+
role="button"
|
|
184
|
+
tabIndex={0}
|
|
185
|
+
aria-label={`${typeLabel} attachment${
|
|
186
|
+
isError
|
|
187
|
+
? ", upload failed"
|
|
188
|
+
: isUploading
|
|
189
|
+
? ", uploading"
|
|
190
|
+
: ""
|
|
191
|
+
}`}
|
|
192
|
+
/>
|
|
193
|
+
}
|
|
194
|
+
>
|
|
195
|
+
<AttachmentThumb />
|
|
196
|
+
{isUploading && (
|
|
197
|
+
<div
|
|
198
|
+
aria-hidden="true"
|
|
199
|
+
className="aui-attachment-tile-uploading bg-surface/60 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"
|
|
200
|
+
>
|
|
201
|
+
<DotMatrix state="loading" decorative className="text-ink-mute size-4" />
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
204
|
+
{isError && (
|
|
205
|
+
<div
|
|
206
|
+
aria-hidden="true"
|
|
207
|
+
className="aui-attachment-tile-error bg-surface/70 animate-in fade-in-0 absolute inset-0 flex items-center justify-center backdrop-blur-[2px] motion-reduce:animate-none"
|
|
208
|
+
>
|
|
209
|
+
<AlertCircleIcon className="text-danger size-4" />
|
|
210
|
+
</div>
|
|
211
|
+
)}
|
|
212
|
+
</TooltipTrigger>
|
|
213
|
+
</AttachmentPreviewDialog>
|
|
214
|
+
{isComposer && <AttachmentRemove />}
|
|
215
|
+
</AttachmentPrimitive.Root>
|
|
216
|
+
<TooltipContent side="top">
|
|
217
|
+
<AttachmentPrimitive.Name />
|
|
218
|
+
{errorMessage && (
|
|
219
|
+
<p className="aui-attachment-error-message">{errorMessage}</p>
|
|
220
|
+
)}
|
|
221
|
+
</TooltipContent>
|
|
222
|
+
</Tooltip>
|
|
223
|
+
</TooltipProvider>
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const AttachmentRemove: FC = () => {
|
|
228
|
+
return (
|
|
229
|
+
<AttachmentPrimitive.Remove
|
|
230
|
+
render={
|
|
231
|
+
<TooltipIconButton
|
|
232
|
+
tooltip="Remove file"
|
|
233
|
+
className="aui-attachment-tile-remove absolute end-1 top-1 size-5 rounded-full bg-ink/60! text-bg after:absolute after:-inset-1.5 hover:bg-ink/80! hover:text-bg! active:scale-[0.96] motion-reduce:transition-none"
|
|
234
|
+
side="top"
|
|
235
|
+
/>
|
|
236
|
+
}
|
|
237
|
+
>
|
|
238
|
+
<XIcon className="aui-attachment-remove-icon size-3 stroke-[2.5]" />
|
|
239
|
+
</AttachmentPrimitive.Remove>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export const UserMessageAttachments: FC = () => {
|
|
244
|
+
return (
|
|
245
|
+
<div className="aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2">
|
|
246
|
+
<MessagePrimitive.Attachments>
|
|
247
|
+
{() => <AttachmentUI />}
|
|
248
|
+
</MessagePrimitive.Attachments>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export const ComposerAttachments: FC = () => {
|
|
254
|
+
return (
|
|
255
|
+
<div className="aui-composer-attachments flex w-full flex-row items-center gap-2 overflow-x-auto empty:hidden">
|
|
256
|
+
<ComposerPrimitive.Attachments>
|
|
257
|
+
{() => <AttachmentUI />}
|
|
258
|
+
</ComposerPrimitive.Attachments>
|
|
259
|
+
</div>
|
|
260
|
+
);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export const ComposerAddAttachment: FC = () => {
|
|
264
|
+
return (
|
|
265
|
+
<ComposerPrimitive.AddAttachment
|
|
266
|
+
render={
|
|
267
|
+
<TooltipIconButton
|
|
268
|
+
tooltip="Add Attachment"
|
|
269
|
+
side="bottom"
|
|
270
|
+
variant="ghost"
|
|
271
|
+
size="icon"
|
|
272
|
+
className="aui-composer-add-attachment text-ink-mute hover:text-ink hover:bg-ink-mute/15 dark:border-hair dark:hover:bg-ink-mute/30 size-7 rounded-full active:scale-[0.96] motion-reduce:transition-none"
|
|
273
|
+
aria-label="Add Attachment"
|
|
274
|
+
/>
|
|
275
|
+
}
|
|
276
|
+
>
|
|
277
|
+
<PlusIcon className="aui-attachment-add-icon size-4" />
|
|
278
|
+
</ComposerPrimitive.AddAttachment>
|
|
279
|
+
);
|
|
280
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import type { FC, ReactNode } from "react";
|
|
4
|
+
import { DotMatrix } from "../DotMatrix";
|
|
5
|
+
// Relative, not `@/lib/utils`: host apps (digithings-web) import this file
|
|
6
|
+
// through `@digithings-ai/ui/chat/notice`, where `@/` is their own root.
|
|
7
|
+
import { cn } from "../../../lib/utils";
|
|
8
|
+
import { stockRadius, useStockShape } from "./stock-shape";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* One boxed notice for everything the backend tells the reader outside the
|
|
12
|
+
* answer itself (DIG-4459 chat transparency): a failed turn, a failed tool
|
|
13
|
+
* call, a status line. Error notices are red-tinted, status notices are
|
|
14
|
+
* neutral. The message error banner puts these props on assistant-ui's
|
|
15
|
+
* ErrorPrimitive.Root; tool errors and status lines use a plain div.
|
|
16
|
+
*/
|
|
17
|
+
export type ChatNoticeTone = "error" | "status";
|
|
18
|
+
|
|
19
|
+
const TONE_CLASS: Record<ChatNoticeTone, string> = {
|
|
20
|
+
error:
|
|
21
|
+
"border-danger/20 bg-danger/[0.04] text-ink [&_.aui-chat-notice-title]:text-danger",
|
|
22
|
+
status: "border-hair bg-surface-2/40 text-ink",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function chatNoticeRootProps(
|
|
26
|
+
tone: ChatNoticeTone,
|
|
27
|
+
className?: string,
|
|
28
|
+
/** Inside the stock Thread (useStockShape): assistant-ui's rounded-md box. */
|
|
29
|
+
stock = false,
|
|
30
|
+
): {
|
|
31
|
+
className: string;
|
|
32
|
+
"data-slot": "chat-notice";
|
|
33
|
+
"data-tone": ChatNoticeTone;
|
|
34
|
+
role: "alert" | "status";
|
|
35
|
+
} {
|
|
36
|
+
return {
|
|
37
|
+
className: cn(
|
|
38
|
+
"aui-chat-notice flex w-full items-start gap-2 border px-3 py-2 text-xs leading-snug",
|
|
39
|
+
stockRadius(stock, "rounded-md"),
|
|
40
|
+
TONE_CLASS[tone],
|
|
41
|
+
className,
|
|
42
|
+
),
|
|
43
|
+
"data-slot": "chat-notice",
|
|
44
|
+
"data-tone": tone,
|
|
45
|
+
role: tone === "error" ? "alert" : "status",
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The full detail (error text, traceback, JSON payload). Never cut and never
|
|
51
|
+
* folded: it sits in a max-height scroll area (Chris, 21 Oct).
|
|
52
|
+
*/
|
|
53
|
+
export const ChatNoticeDetail: FC<{ text: string }> = ({ text }) => (
|
|
54
|
+
<pre
|
|
55
|
+
data-slot="chat-notice-detail"
|
|
56
|
+
className="aui-chat-notice-detail mt-1 max-h-72 overflow-auto overscroll-contain whitespace-pre-wrap break-words font-mono text-[0.68rem] leading-relaxed"
|
|
57
|
+
>
|
|
58
|
+
{text}
|
|
59
|
+
</pre>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
/** Marker + title + optional detail + optional action, inside a notice root. */
|
|
63
|
+
export const ChatNoticeContent: FC<{
|
|
64
|
+
tone: ChatNoticeTone;
|
|
65
|
+
title: ReactNode;
|
|
66
|
+
detail?: string;
|
|
67
|
+
extra?: ReactNode;
|
|
68
|
+
action?: ReactNode;
|
|
69
|
+
}> = ({ tone, title, detail, extra, action }) => (
|
|
70
|
+
<>
|
|
71
|
+
<DotMatrix
|
|
72
|
+
state={tone === "error" ? "error" : "idle"}
|
|
73
|
+
label={tone === "error" ? "Error" : "Status"}
|
|
74
|
+
className={cn(
|
|
75
|
+
"aui-chat-notice-marker !size-3 mt-0.5 shrink-0",
|
|
76
|
+
tone === "error" ? "text-danger/60" : "text-ink-mute",
|
|
77
|
+
)}
|
|
78
|
+
/>
|
|
79
|
+
<div className="min-w-0 flex-1">
|
|
80
|
+
<div
|
|
81
|
+
data-slot="chat-notice-title"
|
|
82
|
+
className="aui-chat-notice-title whitespace-pre-wrap break-words font-medium"
|
|
83
|
+
>
|
|
84
|
+
{title}
|
|
85
|
+
</div>
|
|
86
|
+
{detail ? <ChatNoticeDetail text={detail} /> : null}
|
|
87
|
+
{extra}
|
|
88
|
+
</div>
|
|
89
|
+
{action}
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
/** A neutral status line from the backend ("Waiting for model capacity…"). */
|
|
94
|
+
export const ChatStatusNotice: FC<{
|
|
95
|
+
message: string;
|
|
96
|
+
detail?: string;
|
|
97
|
+
className?: string;
|
|
98
|
+
}> = ({ message, detail, className }) => {
|
|
99
|
+
const stock = useStockShape();
|
|
100
|
+
return (
|
|
101
|
+
<div {...chatNoticeRootProps("status", cn("my-1", className), stock)}>
|
|
102
|
+
<ChatNoticeContent tone="status" title={message} detail={detail} />
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* A backend notice carried as a data part: `data-notice` with
|
|
109
|
+
* `{ message, detail?, tone? }`, or a `data-status` that carries a `message`.
|
|
110
|
+
* Returns null for every other data part (connection state, conversation id,
|
|
111
|
+
* usage…), which have their own renderers or none.
|
|
112
|
+
*/
|
|
113
|
+
export function backendNoticeOf(part: {
|
|
114
|
+
readonly type: string;
|
|
115
|
+
readonly name?: string;
|
|
116
|
+
readonly data?: unknown;
|
|
117
|
+
}): { tone: ChatNoticeTone; message: string; detail?: string } | null {
|
|
118
|
+
if (part.type !== "data") return null;
|
|
119
|
+
if (part.name !== "notice" && part.name !== "status") return null;
|
|
120
|
+
const data = (part.data ?? {}) as { message?: unknown; detail?: unknown; tone?: unknown };
|
|
121
|
+
const message = typeof data.message === "string" ? data.message.trim() : "";
|
|
122
|
+
if (!message) return null;
|
|
123
|
+
const detail = typeof data.detail === "string" && data.detail.trim() ? data.detail : undefined;
|
|
124
|
+
const tone: ChatNoticeTone = data.tone === "error" ? "error" : "status";
|
|
125
|
+
return { tone, message, ...(detail ? { detail } : {}) };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Renders a backend notice part, or nothing. */
|
|
129
|
+
export const BackendNotice: FC<{
|
|
130
|
+
part: { readonly type: string; readonly name?: string; readonly data?: unknown };
|
|
131
|
+
}> = ({ part }) => {
|
|
132
|
+
const notice = backendNoticeOf(part);
|
|
133
|
+
const stock = useStockShape();
|
|
134
|
+
if (!notice) return null;
|
|
135
|
+
if (notice.tone === "status") {
|
|
136
|
+
return <ChatStatusNotice message={notice.message} detail={notice.detail} />;
|
|
137
|
+
}
|
|
138
|
+
return (
|
|
139
|
+
<div {...chatNoticeRootProps("error", "my-1", stock)}>
|
|
140
|
+
<ChatNoticeContent tone="error" title={notice.message} detail={notice.detail} />
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, useEffect, useSyncExternalStore, type ReactNode } from "react";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The one private-session flag every skin's export reads.
|
|
7
|
+
*
|
|
8
|
+
* Private mode keeps the typed text out of files: the stored messages still
|
|
9
|
+
* hold it, and an export (its file name carries a slug of the question)
|
|
10
|
+
* would hand it over. The host owns the session flag and passes it to
|
|
11
|
+
* `ThreadSkinView`, which wraps every skin in `ChatPrivateModeProvider`.
|
|
12
|
+
*
|
|
13
|
+
* Two readers:
|
|
14
|
+
* - React (`useChatPrivateMode`) for the menus, which render nothing.
|
|
15
|
+
* - Plain code (`isChatPrivateMode`) for the export runners, which refuse.
|
|
16
|
+
* A mounted private scope counts until it unmounts or turns the mode off.
|
|
17
|
+
*/
|
|
18
|
+
let privateScopes = 0;
|
|
19
|
+
const listeners = new Set<() => void>();
|
|
20
|
+
|
|
21
|
+
function emit(): void {
|
|
22
|
+
for (const listener of listeners) listener();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** True while any mounted chat is in a private session. */
|
|
26
|
+
export function isChatPrivateMode(): boolean {
|
|
27
|
+
return privateScopes > 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function subscribeChatPrivateMode(listener: () => void): () => void {
|
|
31
|
+
listeners.add(listener);
|
|
32
|
+
return () => {
|
|
33
|
+
listeners.delete(listener);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ChatPrivateModeContext = createContext(false);
|
|
38
|
+
|
|
39
|
+
export function ChatPrivateModeProvider({
|
|
40
|
+
privateMode,
|
|
41
|
+
children,
|
|
42
|
+
}: {
|
|
43
|
+
privateMode?: boolean | undefined;
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}) {
|
|
46
|
+
const on = privateMode === true;
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!on) return;
|
|
49
|
+
privateScopes += 1;
|
|
50
|
+
emit();
|
|
51
|
+
return () => {
|
|
52
|
+
privateScopes -= 1;
|
|
53
|
+
emit();
|
|
54
|
+
};
|
|
55
|
+
}, [on]);
|
|
56
|
+
return <ChatPrivateModeContext.Provider value={on}>{children}</ChatPrivateModeContext.Provider>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The private flag for this chat (its provider) or any mounted private chat. */
|
|
60
|
+
export function useChatPrivateMode(): boolean {
|
|
61
|
+
const scoped = useContext(ChatPrivateModeContext);
|
|
62
|
+
const anywhere = useSyncExternalStore(subscribeChatPrivateMode, isChatPrivateMode, () => false);
|
|
63
|
+
return scoped || anywhere;
|
|
64
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deploy-driven UI knobs for the stock (baseline) Thread.
|
|
5
|
+
* Provided by ProductStockShell — never imports Ink / CLI packages.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createContext, useContext } from "react";
|
|
9
|
+
import type {
|
|
10
|
+
ChainDisclosureMode,
|
|
11
|
+
ThinkingMode,
|
|
12
|
+
UserAlign,
|
|
13
|
+
ViewMode,
|
|
14
|
+
} from "./skin-types";
|
|
15
|
+
|
|
16
|
+
export type DeployUiValue = {
|
|
17
|
+
/** Effective reasoning disclosure (view mode + thinking override). */
|
|
18
|
+
reasoning: ChainDisclosureMode;
|
|
19
|
+
/** Effective tool-call disclosure (view mode only). */
|
|
20
|
+
toolCalls: ChainDisclosureMode;
|
|
21
|
+
/**
|
|
22
|
+
* The raw view level, before it is folded into a disclosure mode. The
|
|
23
|
+
* distinction matters: `quiet` is not "closed", it is "one summary line".
|
|
24
|
+
*/
|
|
25
|
+
view: ViewMode;
|
|
26
|
+
/** The raw thinking override, before folding. */
|
|
27
|
+
thinking: ThinkingMode;
|
|
28
|
+
userAlign: UserAlign;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const DEFAULT_DEPLOY_UI: DeployUiValue = {
|
|
32
|
+
reasoning: "collapsed",
|
|
33
|
+
toolCalls: "collapsed",
|
|
34
|
+
view: "balanced",
|
|
35
|
+
thinking: "auto",
|
|
36
|
+
userAlign: "right",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const DeployUiContext = createContext<DeployUiValue>(DEFAULT_DEPLOY_UI);
|
|
40
|
+
|
|
41
|
+
export const DeployUiProvider = DeployUiContext.Provider;
|
|
42
|
+
|
|
43
|
+
export function useDeployUi(): DeployUiValue {
|
|
44
|
+
return useContext(DeployUiContext);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function useDisclosureUi(kind: "reasoning" | "toolCalls") {
|
|
48
|
+
const ui = useDeployUi();
|
|
49
|
+
const mode = ui[kind];
|
|
50
|
+
return {
|
|
51
|
+
mode,
|
|
52
|
+
visible: mode !== "off",
|
|
53
|
+
defaultOpen: mode === "expanded",
|
|
54
|
+
locked: false,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* How the /view level folds the chain in skins that render it with plain
|
|
60
|
+
* collapsibles (base, chatgpt). Collapsibles only read `defaultOpen` on mount,
|
|
61
|
+
* so `key` changes with the level and a /view switch remounts them in the new
|
|
62
|
+
* state. quiet: tool calls fold into the group's one summary line and thinking
|
|
63
|
+
* stays folded even while it streams. balanced: today's layout (folded group
|
|
64
|
+
* and cards; thinking opens while it streams). verbose: everything open.
|
|
65
|
+
*/
|
|
66
|
+
export type ViewDisclosure = {
|
|
67
|
+
key: string;
|
|
68
|
+
toolGroupOpen: boolean;
|
|
69
|
+
toolCardOpen: boolean;
|
|
70
|
+
reasoningOpen: (running: boolean) => boolean;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export function viewDisclosure(
|
|
74
|
+
ui: Pick<DeployUiValue, "view" | "toolCalls" | "reasoning">,
|
|
75
|
+
): ViewDisclosure {
|
|
76
|
+
const { view, toolCalls, reasoning } = ui;
|
|
77
|
+
const verbose = toolCalls === "expanded";
|
|
78
|
+
return {
|
|
79
|
+
key: `${view}:${toolCalls}:${reasoning}`,
|
|
80
|
+
toolGroupOpen: verbose,
|
|
81
|
+
toolCardOpen: verbose,
|
|
82
|
+
reasoningOpen: (running) =>
|
|
83
|
+
reasoning === "expanded" || (running && view !== "quiet" && reasoning !== "collapsed"),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function useViewDisclosure(): ViewDisclosure {
|
|
88
|
+
return viewDisclosure(useDeployUi());
|
|
89
|
+
}
|