@pyxis-llm/react 0.0.0-stage → 0.5.3

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.
Files changed (192) hide show
  1. package/dist/AgentProfileEditor.d.ts +48 -0
  2. package/dist/AgentProfileEditor.d.ts.map +1 -0
  3. package/dist/AgentProfileEditor.js +122 -0
  4. package/dist/AgentProfileList.d.ts +17 -0
  5. package/dist/AgentProfileList.d.ts.map +1 -0
  6. package/dist/AgentProfileList.js +46 -0
  7. package/dist/AskCardAnswerChip.d.ts +8 -0
  8. package/dist/AskCardAnswerChip.d.ts.map +1 -0
  9. package/dist/AskCardAnswerChip.js +21 -0
  10. package/dist/AskCardView.d.ts +85 -0
  11. package/dist/AskCardView.d.ts.map +1 -0
  12. package/dist/AskCardView.js +158 -0
  13. package/dist/CatalogColumnBrowser.d.ts +33 -0
  14. package/dist/CatalogColumnBrowser.d.ts.map +1 -0
  15. package/dist/CatalogColumnBrowser.js +219 -0
  16. package/dist/CatalogModelPicker.d.ts +68 -0
  17. package/dist/CatalogModelPicker.d.ts.map +1 -0
  18. package/dist/CatalogModelPicker.js +119 -0
  19. package/dist/CatalogModelPickerMenuContent.d.ts +17 -0
  20. package/dist/CatalogModelPickerMenuContent.d.ts.map +1 -0
  21. package/dist/CatalogModelPickerMenuContent.js +103 -0
  22. package/dist/CatalogPickerMenuItem.d.ts +17 -0
  23. package/dist/CatalogPickerMenuItem.d.ts.map +1 -0
  24. package/dist/CatalogPickerMenuItem.js +15 -0
  25. package/dist/CatalogTreePickerOptions.d.ts +52 -0
  26. package/dist/CatalogTreePickerOptions.d.ts.map +1 -0
  27. package/dist/CatalogTreePickerOptions.js +248 -0
  28. package/dist/ChatMessage.d.ts +172 -0
  29. package/dist/ChatMessage.d.ts.map +1 -0
  30. package/dist/ChatMessage.js +295 -0
  31. package/dist/ChatPanel.d.ts +252 -0
  32. package/dist/ChatPanel.d.ts.map +1 -0
  33. package/dist/ChatPanel.js +247 -0
  34. package/dist/ChatTranscriptFind.d.ts +19 -0
  35. package/dist/ChatTranscriptFind.d.ts.map +1 -0
  36. package/dist/ChatTranscriptFind.js +224 -0
  37. package/dist/ChatTranscriptFindBar.d.ts +15 -0
  38. package/dist/ChatTranscriptFindBar.d.ts.map +1 -0
  39. package/dist/ChatTranscriptFindBar.js +22 -0
  40. package/dist/Composer.d.ts +43 -0
  41. package/dist/Composer.d.ts.map +1 -0
  42. package/dist/Composer.js +45 -0
  43. package/dist/ComposerAttachments.d.ts +101 -0
  44. package/dist/ComposerAttachments.d.ts.map +1 -0
  45. package/dist/ComposerAttachments.js +126 -0
  46. package/dist/DisplayCards.d.ts +18 -0
  47. package/dist/DisplayCards.d.ts.map +1 -0
  48. package/dist/DisplayCards.js +72 -0
  49. package/dist/ErrorBoundary.d.ts +27 -0
  50. package/dist/ErrorBoundary.d.ts.map +1 -0
  51. package/dist/ErrorBoundary.js +107 -0
  52. package/dist/ImageDisplayCard.d.ts +6 -0
  53. package/dist/ImageDisplayCard.d.ts.map +1 -0
  54. package/dist/ImageDisplayCard.js +57 -0
  55. package/dist/MarkdownCodeComponents.d.ts +23 -0
  56. package/dist/MarkdownCodeComponents.d.ts.map +1 -0
  57. package/dist/MarkdownCodeComponents.js +256 -0
  58. package/dist/MermaidDiagram.d.ts +18 -0
  59. package/dist/MermaidDiagram.d.ts.map +1 -0
  60. package/dist/MermaidDiagram.js +66 -0
  61. package/dist/MessageContentWithPastes.d.ts +14 -0
  62. package/dist/MessageContentWithPastes.d.ts.map +1 -0
  63. package/dist/MessageContentWithPastes.js +44 -0
  64. package/dist/PastePill.d.ts +16 -0
  65. package/dist/PastePill.d.ts.map +1 -0
  66. package/dist/PastePill.js +43 -0
  67. package/dist/ProviderAuthTerminal.d.ts +12 -0
  68. package/dist/ProviderAuthTerminal.d.ts.map +1 -0
  69. package/dist/ProviderAuthTerminal.js +50 -0
  70. package/dist/ProviderConnectForm.d.ts +62 -0
  71. package/dist/ProviderConnectForm.d.ts.map +1 -0
  72. package/dist/ProviderConnectForm.js +206 -0
  73. package/dist/ProviderList.d.ts +18 -0
  74. package/dist/ProviderList.d.ts.map +1 -0
  75. package/dist/ProviderList.js +67 -0
  76. package/dist/QueueStrip.d.ts +17 -0
  77. package/dist/QueueStrip.d.ts.map +1 -0
  78. package/dist/QueueStrip.js +60 -0
  79. package/dist/SettingsScreen.d.ts +10 -0
  80. package/dist/SettingsScreen.d.ts.map +1 -0
  81. package/dist/SettingsScreen.js +26 -0
  82. package/dist/StreamingMarkdown.d.ts +47 -0
  83. package/dist/StreamingMarkdown.d.ts.map +1 -0
  84. package/dist/StreamingMarkdown.js +103 -0
  85. package/dist/TurnTimer.d.ts +72 -0
  86. package/dist/TurnTimer.d.ts.map +1 -0
  87. package/dist/TurnTimer.js +114 -0
  88. package/dist/VegaChart.d.ts +36 -0
  89. package/dist/VegaChart.d.ts.map +1 -0
  90. package/dist/VegaChart.js +180 -0
  91. package/dist/browser.d.ts +7 -0
  92. package/dist/browser.d.ts.map +1 -0
  93. package/dist/browser.js +18 -0
  94. package/dist/catalogColumnBrowserTree.d.ts +9 -0
  95. package/dist/catalogColumnBrowserTree.d.ts.map +1 -0
  96. package/dist/catalogColumnBrowserTree.js +48 -0
  97. package/dist/catalogPickerMenuStyles.d.ts +81 -0
  98. package/dist/catalogPickerMenuStyles.d.ts.map +1 -0
  99. package/dist/catalogPickerMenuStyles.js +130 -0
  100. package/dist/charts.d.ts +12 -0
  101. package/dist/charts.d.ts.map +1 -0
  102. package/dist/charts.js +45 -0
  103. package/dist/chatMessageScroll.d.ts +40 -0
  104. package/dist/chatMessageScroll.d.ts.map +1 -0
  105. package/dist/chatMessageScroll.js +62 -0
  106. package/dist/chatModelOptions.d.ts +28 -0
  107. package/dist/chatModelOptions.d.ts.map +1 -0
  108. package/dist/chatModelOptions.js +59 -0
  109. package/dist/chatTranscriptFindHighlights.d.ts +9 -0
  110. package/dist/chatTranscriptFindHighlights.d.ts.map +1 -0
  111. package/dist/chatTranscriptFindHighlights.js +88 -0
  112. package/dist/draftStore.d.ts +13 -0
  113. package/dist/draftStore.d.ts.map +1 -0
  114. package/dist/draftStore.js +38 -0
  115. package/dist/highlight.d.ts +4 -0
  116. package/dist/highlight.d.ts.map +1 -0
  117. package/dist/highlight.js +47 -0
  118. package/dist/index.d.ts +74 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +48 -0
  121. package/dist/keyboardShortcuts.d.ts +5 -0
  122. package/dist/keyboardShortcuts.d.ts.map +1 -0
  123. package/dist/keyboardShortcuts.js +19 -0
  124. package/dist/markdownClipboard.d.ts +22 -0
  125. package/dist/markdownClipboard.d.ts.map +1 -0
  126. package/dist/markdownClipboard.js +98 -0
  127. package/dist/markdownPlugins.d.ts +31 -0
  128. package/dist/markdownPlugins.d.ts.map +1 -0
  129. package/dist/markdownPlugins.js +32 -0
  130. package/dist/mermaid.d.ts +17 -0
  131. package/dist/mermaid.d.ts.map +1 -0
  132. package/dist/mermaid.js +11 -0
  133. package/dist/mermaidRuntime.d.ts +21 -0
  134. package/dist/mermaidRuntime.d.ts.map +1 -0
  135. package/dist/mermaidRuntime.js +140 -0
  136. package/dist/modelCatalogHelpers.d.ts +14 -0
  137. package/dist/modelCatalogHelpers.d.ts.map +1 -0
  138. package/dist/modelCatalogHelpers.js +65 -0
  139. package/dist/modelCatalogSource.d.ts +22 -0
  140. package/dist/modelCatalogSource.d.ts.map +1 -0
  141. package/dist/modelCatalogSource.js +26 -0
  142. package/dist/modelCatalogTree.d.ts +24 -0
  143. package/dist/modelCatalogTree.d.ts.map +1 -0
  144. package/dist/modelCatalogTree.js +77 -0
  145. package/dist/node.d.ts +9 -0
  146. package/dist/node.d.ts.map +1 -0
  147. package/dist/node.js +13 -0
  148. package/dist/pasteFences.d.ts +20 -0
  149. package/dist/pasteFences.d.ts.map +1 -0
  150. package/dist/pasteFences.js +157 -0
  151. package/dist/pasteFormat.d.ts +5 -0
  152. package/dist/pasteFormat.d.ts.map +1 -0
  153. package/dist/pasteFormat.js +18 -0
  154. package/dist/plugins.d.ts +110 -0
  155. package/dist/plugins.d.ts.map +1 -0
  156. package/dist/plugins.js +98 -0
  157. package/dist/remarkAlerts.d.ts +12 -0
  158. package/dist/remarkAlerts.d.ts.map +1 -0
  159. package/dist/remarkAlerts.js +52 -0
  160. package/dist/sendMode.d.ts +69 -0
  161. package/dist/sendMode.d.ts.map +1 -0
  162. package/dist/sendMode.js +66 -0
  163. package/dist/useLlmdChatDriver.d.ts +367 -0
  164. package/dist/useLlmdChatDriver.d.ts.map +1 -0
  165. package/dist/useLlmdChatDriver.js +1739 -0
  166. package/dist/useLlmdModelCatalog.d.ts +23 -0
  167. package/dist/useLlmdModelCatalog.d.ts.map +1 -0
  168. package/dist/useLlmdModelCatalog.js +89 -0
  169. package/dist/useLlmdSessionModel.d.ts +34 -0
  170. package/dist/useLlmdSessionModel.d.ts.map +1 -0
  171. package/dist/useLlmdSessionModel.js +79 -0
  172. package/dist/useProviderAuthCommand.d.ts +26 -0
  173. package/dist/useProviderAuthCommand.d.ts.map +1 -0
  174. package/dist/useProviderAuthCommand.js +80 -0
  175. package/dist/vegaRuntime.d.ts +83 -0
  176. package/dist/vegaRuntime.d.ts.map +1 -0
  177. package/dist/vegaRuntime.js +314 -0
  178. package/dist/vendor/llmd-types/conversationEvents.d.ts +238 -0
  179. package/dist/vendor/llmd-types/conversationEvents.d.ts.map +1 -0
  180. package/dist/vendor/llmd-types/conversationEvents.js +98 -0
  181. package/dist/vendor/llmd-types/index.d.ts +4 -0
  182. package/dist/vendor/llmd-types/index.d.ts.map +1 -0
  183. package/dist/vendor/llmd-types/index.js +5 -0
  184. package/dist/vendor/llmd-types/messages.d.ts +67 -0
  185. package/dist/vendor/llmd-types/messages.d.ts.map +1 -0
  186. package/dist/vendor/llmd-types/messages.js +71 -0
  187. package/dist/vendor/llmd-types/sessionQueue.d.ts +54 -0
  188. package/dist/vendor/llmd-types/sessionQueue.d.ts.map +1 -0
  189. package/dist/vendor/llmd-types/sessionQueue.js +40 -0
  190. package/package.json +120 -4
  191. package/styles.css +389 -0
  192. package/README.md +0 -3
@@ -0,0 +1,74 @@
1
+ export { markdownCodeComponents, markdownThinkingStreamCodeComponents, MarkdownLinkRendererContext, type MarkdownLinkRendererProps, } from './MarkdownCodeComponents.js';
2
+ export type { AttachmentKindRenderer, AttachmentRenderProps, DisplayCardRenderProps, DisplayCardRenderer, HighlightedCodeProps, LanguageBlockRenderer, LlmdPlugin, ResolvedLlmdPlugins, } from './plugins.js';
3
+ export { LlmdPluginProvider, registerLlmdPlugin, registeredLlmdPlugins, resolveLlmdPlugins, useLlmdPlugins, } from './plugins.js';
4
+ export type { MarkdownPluginList, MarkdownPlugins } from './markdownPlugins.js';
5
+ export { MarkdownPluginProvider, useMarkdownPlugins } from './markdownPlugins.js';
6
+ export { splitStreamingMarkdown, StreamingMarkdown } from './StreamingMarkdown.js';
7
+ export type { ChatMessageData, ChatMessageSegment, ChatMessageProps, ChatMessageUsage } from './ChatMessage.js';
8
+ export { ChatMessage, fmtModelDuration, usageFromMessageMetadata } from './ChatMessage.js';
9
+ export type { AskCardViewProps, AskCardSubmitOptions } from './AskCardView.js';
10
+ export { AskCardView } from './AskCardView.js';
11
+ export { MessageContentWithPastes, inlineMarkdownComponents } from './MessageContentWithPastes.js';
12
+ export type { PasteFenceSegment } from './pasteFences.js';
13
+ export { PASTE_FENCE_TICKS, formatPasteFence, messageContainsPasteFenceForNumber, messageHasPasteFences, normalizeOutgoingPasteSpacing, splitMessageByPasteFences, } from './pasteFences.js';
14
+ export { countPasteLines, formatPastePlaceholder } from './pasteFormat.js';
15
+ export { PastePill, pastePillLabel } from './PastePill.js';
16
+ export type { MarkdownCopyHandlerOptions } from './markdownClipboard.js';
17
+ export { bindMarkdownRenderedCopy, copyEventShiftKey, handleMarkdownRenderedCopy, htmlFragmentToMarkdown, plainTextFromSelection, } from './markdownClipboard.js';
18
+ export type { ComposerProps } from './Composer.js';
19
+ export { Composer } from './Composer.js';
20
+ export type { ChatPanelProps, ChatPanelHandle, ChatPanelScrollRequest, } from './ChatPanel.js';
21
+ export { ChatPanel } from './ChatPanel.js';
22
+ export type { DraftStore } from './draftStore.js';
23
+ export { useDraft } from './draftStore.js';
24
+ export { CHAT_PANEL_BOTTOM_THRESHOLD_PX, centerMessageInViewport, findMessageElement, isPinnedToBottom, } from './chatMessageScroll.js';
25
+ export type { QueueStripProps } from './QueueStrip.js';
26
+ export { QueueStrip } from './QueueStrip.js';
27
+ export type { TurnTiming, TurnTimerProps, TurnTimerState } from './TurnTimer.js';
28
+ export { TurnTimer, TurnTimerView, formatTurnDuration, useTurnTimer } from './TurnTimer.js';
29
+ export type { SendBehavior, SendMode, SendModeContext, SendModeLabel } from './sendMode.js';
30
+ export { isAlternateSend, sendBehaviorFor, sendHintFor, sendLabelFor, useSendMode } from './sendMode.js';
31
+ export { DisplayCardAttachment, PluginAttachment } from './DisplayCards.js';
32
+ export { ImageCardView, imageCardPlugin } from './ImageDisplayCard.js';
33
+ export type { AskCardAnswerChipProps } from './AskCardAnswerChip.js';
34
+ export { AskCardAnswerChip } from './AskCardAnswerChip.js';
35
+ export type { ComposerAttachment, PlanDesignListItemForAttachment, ComposerAttachmentUnifiedPanelProps, ComposerOutgoingAttachment, } from './ComposerAttachments.js';
36
+ export { AddAttachmentModal, COMPOSER_ATTACHMENT_KIND, appendComposerAttachmentsToMessage, composerAttachmentsToMessageAttachments, composerAttachmentSignature, useComposerAttachmentsSessionState, } from './ComposerAttachments.js';
37
+ export type { ChatTranscriptFindProps } from './ChatTranscriptFind.js';
38
+ export { ChatTranscriptFind } from './ChatTranscriptFind.js';
39
+ export type { ChatTranscriptFindBarProps } from './ChatTranscriptFindBar.js';
40
+ export { ChatTranscriptFindBar } from './ChatTranscriptFindBar.js';
41
+ export { applyChatTranscriptFindHighlights, clearChatTranscriptFindHighlights, collectChatTranscriptMatchRanges, scrollChatTranscriptMatchIntoView, supportsCssCustomHighlight, } from './chatTranscriptFindHighlights.js';
42
+ export { isModKey, isTypingTarget } from './keyboardShortcuts.js';
43
+ export { ErrorBoundary } from './ErrorBoundary.js';
44
+ export type { CatalogTree, CatalogTreeModelInput, CatalogTreeNode, CatalogTreeNodeKind, } from './modelCatalogTree.js';
45
+ export { buildCatalogTree, catalogTreeBreadcrumb, catalogTreeIsFlat, flattenCatalogTreeLeaves, formatCatalogTreeBreadcrumb, } from './modelCatalogTree.js';
46
+ export { filterMultiProviderRoots, filterSelectableTreeNodes, makeResolveOption, optionLookupKey, } from './catalogColumnBrowserTree.js';
47
+ export type { ChatModelOption } from './chatModelOptions.js';
48
+ export { buildConfiguredModelOptions, decodeChatModelOptionValue, encodeChatModelOptionValue, } from './chatModelOptions.js';
49
+ export type { StoredModelPair } from './modelCatalogHelpers.js';
50
+ export { formatEffectiveModelLabel, modelOptionExists, resolveCanonicalModelOption, } from './modelCatalogHelpers.js';
51
+ export * from './catalogPickerMenuStyles.js';
52
+ export type { CatalogPickerMenuItemProps } from './CatalogPickerMenuItem.js';
53
+ export { CatalogPickerMenuItem } from './CatalogPickerMenuItem.js';
54
+ export type { CatalogColumnBrowserHandle, CatalogColumnBrowserProps, } from './CatalogColumnBrowser.js';
55
+ export { CatalogColumnBrowser } from './CatalogColumnBrowser.js';
56
+ export type { CatalogTreeBuilder, CatalogTreePickerOptionsProps } from './CatalogTreePickerOptions.js';
57
+ export { CatalogTreePickerOptions, getFilteredFlatOptions, } from './CatalogTreePickerOptions.js';
58
+ export type { CatalogModelPickerMenuContentProps } from './CatalogModelPickerMenuContent.js';
59
+ export { CatalogModelPickerMenuContent } from './CatalogModelPickerMenuContent.js';
60
+ export type { CatalogModelPickerProps } from './CatalogModelPicker.js';
61
+ export { CatalogModelPicker, formatCatalogModelPickerLabel, } from './CatalogModelPicker.js';
62
+ export type { CatalogModelSummaryLike, LlmProviderSummaryLike, } from './modelCatalogSource.js';
63
+ export { chatModelOptionsFromCatalog } from './modelCatalogSource.js';
64
+ export type { ProviderConnectConfig, ProviderConnectConfigType, ProviderConnectFormProps, ProviderConnectionTestResult, } from './ProviderConnectForm.js';
65
+ export { ProviderConnectForm } from './ProviderConnectForm.js';
66
+ export type { ProviderListProps } from './ProviderList.js';
67
+ export { ProviderList } from './ProviderList.js';
68
+ export type { AgentProfileEditorProps, AgentProfileToolOption, } from './AgentProfileEditor.js';
69
+ export { AgentProfileEditor, AGENT_TOOL_POLICY, INSTRUCTIONS_SECTION_ID, IDENTITY_SECTION_ID, buildProfileSections, } from './AgentProfileEditor.js';
70
+ export type { AgentProfileListProps } from './AgentProfileList.js';
71
+ export { AgentProfileList } from './AgentProfileList.js';
72
+ export type { ProviderAuthTerminalProps } from './ProviderAuthTerminal.js';
73
+ export { ProviderAuthTerminal } from './ProviderAuthTerminal.js';
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,oCAAoC,EACpC,2BAA2B,EAC3B,KAAK,yBAAyB,GAC/B,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAIlF,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEnF,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAA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AM,yBAAyB,CAAC;AAEjC,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,YAAY,EACV,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,48 @@
1
+ // @pyxis-llm/react barrel — populated incrementally as components are extracted
2
+ // from app-specific UI into a reusable, Mantine-based surface.
3
+ export { markdownCodeComponents, markdownThinkingStreamCodeComponents, MarkdownLinkRendererContext, } from './MarkdownCodeComponents.js';
4
+ export { LlmdPluginProvider, registerLlmdPlugin, registeredLlmdPlugins, resolveLlmdPlugins, useLlmdPlugins, } from './plugins.js';
5
+ export { MarkdownPluginProvider, useMarkdownPlugins } from './markdownPlugins.js';
6
+ // Mermaid, syntax highlighting and charts live in `@pyxis-llm/react/mermaid`,
7
+ // `@pyxis-llm/react/highlight` and `@pyxis-llm/react/charts` so their (optional peer)
8
+ // deps stay out of this entry.
9
+ export { splitStreamingMarkdown, StreamingMarkdown } from './StreamingMarkdown.js';
10
+ export { ChatMessage, fmtModelDuration, usageFromMessageMetadata } from './ChatMessage.js';
11
+ export { AskCardView } from './AskCardView.js';
12
+ export { MessageContentWithPastes, inlineMarkdownComponents } from './MessageContentWithPastes.js';
13
+ export { PASTE_FENCE_TICKS, formatPasteFence, messageContainsPasteFenceForNumber, messageHasPasteFences, normalizeOutgoingPasteSpacing, splitMessageByPasteFences, } from './pasteFences.js';
14
+ export { countPasteLines, formatPastePlaceholder } from './pasteFormat.js';
15
+ export { PastePill, pastePillLabel } from './PastePill.js';
16
+ export { bindMarkdownRenderedCopy, copyEventShiftKey, handleMarkdownRenderedCopy, htmlFragmentToMarkdown, plainTextFromSelection, } from './markdownClipboard.js';
17
+ export { Composer } from './Composer.js';
18
+ export { ChatPanel } from './ChatPanel.js';
19
+ export { useDraft } from './draftStore.js';
20
+ export { CHAT_PANEL_BOTTOM_THRESHOLD_PX, centerMessageInViewport, findMessageElement, isPinnedToBottom, } from './chatMessageScroll.js';
21
+ export { QueueStrip } from './QueueStrip.js';
22
+ export { TurnTimer, TurnTimerView, formatTurnDuration, useTurnTimer } from './TurnTimer.js';
23
+ export { isAlternateSend, sendBehaviorFor, sendHintFor, sendLabelFor, useSendMode } from './sendMode.js';
24
+ export { DisplayCardAttachment, PluginAttachment } from './DisplayCards.js';
25
+ export { ImageCardView, imageCardPlugin } from './ImageDisplayCard.js';
26
+ export { AskCardAnswerChip } from './AskCardAnswerChip.js';
27
+ export { AddAttachmentModal, COMPOSER_ATTACHMENT_KIND, appendComposerAttachmentsToMessage, composerAttachmentsToMessageAttachments, composerAttachmentSignature, useComposerAttachmentsSessionState, } from './ComposerAttachments.js';
28
+ export { ChatTranscriptFind } from './ChatTranscriptFind.js';
29
+ export { ChatTranscriptFindBar } from './ChatTranscriptFindBar.js';
30
+ export { applyChatTranscriptFindHighlights, clearChatTranscriptFindHighlights, collectChatTranscriptMatchRanges, scrollChatTranscriptMatchIntoView, supportsCssCustomHighlight, } from './chatTranscriptFindHighlights.js';
31
+ export { isModKey, isTypingTarget } from './keyboardShortcuts.js';
32
+ export { ErrorBoundary } from './ErrorBoundary.js';
33
+ export { buildCatalogTree, catalogTreeBreadcrumb, catalogTreeIsFlat, flattenCatalogTreeLeaves, formatCatalogTreeBreadcrumb, } from './modelCatalogTree.js';
34
+ export { filterMultiProviderRoots, filterSelectableTreeNodes, makeResolveOption, optionLookupKey, } from './catalogColumnBrowserTree.js';
35
+ export { buildConfiguredModelOptions, decodeChatModelOptionValue, encodeChatModelOptionValue, } from './chatModelOptions.js';
36
+ export { formatEffectiveModelLabel, modelOptionExists, resolveCanonicalModelOption, } from './modelCatalogHelpers.js';
37
+ export * from './catalogPickerMenuStyles.js';
38
+ export { CatalogPickerMenuItem } from './CatalogPickerMenuItem.js';
39
+ export { CatalogColumnBrowser } from './CatalogColumnBrowser.js';
40
+ export { CatalogTreePickerOptions, getFilteredFlatOptions, } from './CatalogTreePickerOptions.js';
41
+ export { CatalogModelPickerMenuContent } from './CatalogModelPickerMenuContent.js';
42
+ export { CatalogModelPicker, formatCatalogModelPickerLabel, } from './CatalogModelPicker.js';
43
+ export { chatModelOptionsFromCatalog } from './modelCatalogSource.js';
44
+ export { ProviderConnectForm } from './ProviderConnectForm.js';
45
+ export { ProviderList } from './ProviderList.js';
46
+ export { AgentProfileEditor, AGENT_TOOL_POLICY, INSTRUCTIONS_SECTION_ID, IDENTITY_SECTION_ID, buildProfileSections, } from './AgentProfileEditor.js';
47
+ export { AgentProfileList } from './AgentProfileList.js';
48
+ export { ProviderAuthTerminal } from './ProviderAuthTerminal.js';
@@ -0,0 +1,5 @@
1
+ /** True when the event uses Cmd (macOS) or Ctrl (Windows/Linux). */
2
+ export declare function isModKey(e: KeyboardEvent | React.KeyboardEvent): boolean;
3
+ /** Skip app shortcuts while the user is typing in a form field. */
4
+ export declare function isTypingTarget(target: EventTarget | null): boolean;
5
+ //# sourceMappingURL=keyboardShortcuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboardShortcuts.d.ts","sourceRoot":"","sources":["../src/keyboardShortcuts.ts"],"names":[],"mappings":"AAKA,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,aAAa,GAAG,KAAK,CAAC,aAAa,GAAG,OAAO,CAExE;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAMlE"}
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright 2026 John Ewart <john@johnewart.net>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ /** True when the event uses Cmd (macOS) or Ctrl (Windows/Linux). */
6
+ export function isModKey(e) {
7
+ return e.metaKey || e.ctrlKey;
8
+ }
9
+ /** Skip app shortcuts while the user is typing in a form field. */
10
+ export function isTypingTarget(target) {
11
+ if (!(target instanceof HTMLElement))
12
+ return false;
13
+ const tag = target.tagName;
14
+ if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT')
15
+ return true;
16
+ if (target.isContentEditable)
17
+ return true;
18
+ return false;
19
+ }
@@ -0,0 +1,22 @@
1
+ /** Modifier keys are not on ClipboardEvent in lib.dom but are set by browsers on copy. */
2
+ export declare function copyEventShiftKey(e: ClipboardEvent): boolean;
3
+ /** Plain text for the current DOM selection, or the root's visible text when empty. */
4
+ export declare function plainTextFromSelection(root: HTMLElement | null): string;
5
+ /** Convert a cloned selection fragment to markdown (approximate). */
6
+ export declare function htmlFragmentToMarkdown(fragment: DocumentFragment): string;
7
+ export type MarkdownCopyHandlerOptions = {
8
+ /** Full document markdown when the selection cannot be mapped (optional). */
9
+ sourceMarkdown?: string;
10
+ /** Root element used for plain-text fallback and selection containment checks. */
11
+ root: HTMLElement;
12
+ /** When set, used for markdown copy instead of Turndown (e.g. MDXEditor API). */
13
+ getMarkdownForCopy?: () => string;
14
+ };
15
+ export declare function handleMarkdownRenderedCopy(e: ClipboardEvent, opts: MarkdownCopyHandlerOptions): void;
16
+ /**
17
+ * Clipboard copy handler for markdown-rendered UI.
18
+ * Attach with addEventListener('copy', handler, true) on the render root.
19
+ * Re-bind (e.g. from a useEffect) when `sourceMarkdown` changes.
20
+ */
21
+ export declare function bindMarkdownRenderedCopy(root: HTMLElement | null, sourceMarkdown?: string, getMarkdownForCopy?: () => string): (() => void) | undefined;
22
+ //# sourceMappingURL=markdownClipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownClipboard.d.ts","sourceRoot":"","sources":["../src/markdownClipboard.ts"],"names":[],"mappings":"AAWA,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,cAAc,GAAG,OAAO,CAE5D;AA4BD,uFAAuF;AACvF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,MAAM,CAMvE;AAED,qEAAqE;AACrE,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAIzE;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,6EAA6E;IAC7E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,IAAI,EAAE,WAAW,CAAC;IAClB,iFAAiF;IACjF,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,CAAC,EAAE,cAAc,EACjB,IAAI,EAAE,0BAA0B,GAC/B,IAAI,CAgCN;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,cAAc,CAAC,EAAE,MAAM,EACvB,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAChC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAO1B"}
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Copyright 2026 John Ewart <john@johnewart.net>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ *
5
+ * Copy behavior for markdown-rendered surfaces:
6
+ * - Cmd/Ctrl+C: raw markdown (from source or HTML→markdown via Turndown)
7
+ * - Shift+Cmd/Ctrl+C: plain text only (visible selection, no markdown syntax)
8
+ */
9
+ import TurndownService from 'turndown';
10
+ /** Modifier keys are not on ClipboardEvent in lib.dom but are set by browsers on copy. */
11
+ export function copyEventShiftKey(e) {
12
+ return Boolean(e.shiftKey);
13
+ }
14
+ let turndownSingleton = null;
15
+ function getTurndown() {
16
+ if (!turndownSingleton) {
17
+ turndownSingleton = new TurndownService({
18
+ headingStyle: 'atx',
19
+ codeBlockStyle: 'fenced',
20
+ emDelimiter: '*',
21
+ });
22
+ turndownSingleton.addRule('fencedCode', {
23
+ filter: (node) => node.nodeName === 'PRE' &&
24
+ node.firstChild != null &&
25
+ node.firstChild.nodeName === 'CODE',
26
+ replacement: (_content, node) => {
27
+ const codeEl = node.firstChild;
28
+ const langMatch = /language-(\S+)/.exec(codeEl.className || '');
29
+ const lang = langMatch?.[1] ?? '';
30
+ const code = codeEl.textContent ?? '';
31
+ return `\n\`\`\`${lang}\n${code}\n\`\`\`\n`;
32
+ },
33
+ });
34
+ }
35
+ return turndownSingleton;
36
+ }
37
+ /** Plain text for the current DOM selection, or the root's visible text when empty. */
38
+ export function plainTextFromSelection(root) {
39
+ const sel = window.getSelection();
40
+ if (sel && sel.rangeCount > 0 && !sel.isCollapsed) {
41
+ return sel.toString();
42
+ }
43
+ return root?.innerText ?? '';
44
+ }
45
+ /** Convert a cloned selection fragment to markdown (approximate). */
46
+ export function htmlFragmentToMarkdown(fragment) {
47
+ const host = document.createElement('div');
48
+ host.appendChild(fragment);
49
+ return getTurndown().turndown(host.innerHTML).trim();
50
+ }
51
+ export function handleMarkdownRenderedCopy(e, opts) {
52
+ const { root, sourceMarkdown, getMarkdownForCopy } = opts;
53
+ const sel = window.getSelection();
54
+ if (!sel || sel.rangeCount === 0)
55
+ return;
56
+ if (!root.contains(sel.anchorNode) && !root.contains(sel.focusNode))
57
+ return;
58
+ const plain = plainTextFromSelection(root);
59
+ if (copyEventShiftKey(e)) {
60
+ if (!plain.trim())
61
+ return;
62
+ e.preventDefault();
63
+ e.stopPropagation();
64
+ e.clipboardData?.setData('text/plain', plain);
65
+ return;
66
+ }
67
+ let md = '';
68
+ if (getMarkdownForCopy) {
69
+ md = getMarkdownForCopy();
70
+ }
71
+ else if (!sel.isCollapsed) {
72
+ const range = sel.getRangeAt(0);
73
+ md = htmlFragmentToMarkdown(range.cloneContents());
74
+ }
75
+ if (!md.trim() && sourceMarkdown?.trim()) {
76
+ md = sourceMarkdown;
77
+ }
78
+ if (!md.trim())
79
+ return;
80
+ e.preventDefault();
81
+ e.stopPropagation();
82
+ e.clipboardData?.setData('text/plain', md);
83
+ e.clipboardData?.setData('text/markdown', md);
84
+ }
85
+ /**
86
+ * Clipboard copy handler for markdown-rendered UI.
87
+ * Attach with addEventListener('copy', handler, true) on the render root.
88
+ * Re-bind (e.g. from a useEffect) when `sourceMarkdown` changes.
89
+ */
90
+ export function bindMarkdownRenderedCopy(root, sourceMarkdown, getMarkdownForCopy) {
91
+ if (!root)
92
+ return undefined;
93
+ const onCopy = (e) => {
94
+ handleMarkdownRenderedCopy(e, { root, sourceMarkdown, getMarkdownForCopy });
95
+ };
96
+ root.addEventListener('copy', onCopy, true);
97
+ return () => root.removeEventListener('copy', onCopy, true);
98
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import type { Options as ReactMarkdownOptions } from 'react-markdown';
3
+ export type MarkdownPluginList = NonNullable<ReactMarkdownOptions['remarkPlugins']>;
4
+ /**
5
+ * Extra unified plugins for every @pyxis-llm/react markdown surface (chat messages,
6
+ * paste messages, streamed text). They are APPENDED to the built-in
7
+ * `remark-gfm`, never replace it.
8
+ *
9
+ * - Pass stable (module-level or memoized) arrays: a fresh array per render
10
+ * invalidates every memoized markdown block and forces a re-parse.
11
+ * - Streamed text is parsed block-by-block (split on top-level blank lines),
12
+ * so plugins whose syntax spans blank lines (e.g. multi-paragraph
13
+ * directives) only see one block at a time while streaming.
14
+ * - Adding `rehype-raw` (or similar) renders raw HTML from model output; that
15
+ * is an explicit opt-out of sanitization — pair it with `rehype-sanitize`.
16
+ */
17
+ export type MarkdownPlugins = {
18
+ remarkPlugins?: MarkdownPluginList;
19
+ rehypePlugins?: MarkdownPluginList;
20
+ };
21
+ /**
22
+ * Register markdown plugins for every markdown surface below. Nested providers
23
+ * append to their parent's plugins (parent first).
24
+ */
25
+ export declare function MarkdownPluginProvider({ plugins, children, }: {
26
+ plugins: MarkdownPlugins;
27
+ children?: React.ReactNode;
28
+ }): React.JSX.Element;
29
+ /** Resolved plugin lists (built-ins + registered) for a `<ReactMarkdown>`. Stable across renders. */
30
+ export declare function useMarkdownPlugins(): Required<MarkdownPlugins>;
31
+ //# sourceMappingURL=markdownPlugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownPlugins.d.ts","sourceRoot":"","sources":["../src/markdownPlugins.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAItE,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC;AAEpF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,aAAa,CAAC,EAAE,kBAAkB,CAAC;CACpC,CAAC;AAIF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,qBAYA;AAID,qGAAqG;AACrG,wBAAgB,kBAAkB,IAAI,QAAQ,CAAC,eAAe,CAAC,CAW9D"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2026 John Ewart <john@johnewart.net>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { createContext, useContext, useMemo } from 'react';
7
+ import remarkGfm from 'remark-gfm';
8
+ import { remarkAlerts } from './remarkAlerts.js';
9
+ const MarkdownPluginsContext = createContext({});
10
+ /**
11
+ * Register markdown plugins for every markdown surface below. Nested providers
12
+ * append to their parent's plugins (parent first).
13
+ */
14
+ export function MarkdownPluginProvider({ plugins, children, }) {
15
+ const parent = useContext(MarkdownPluginsContext);
16
+ const merged = useMemo(() => ({
17
+ remarkPlugins: [...(parent.remarkPlugins ?? []), ...(plugins.remarkPlugins ?? [])],
18
+ rehypePlugins: [...(parent.rehypePlugins ?? []), ...(plugins.rehypePlugins ?? [])],
19
+ }), [parent, plugins.remarkPlugins, plugins.rehypePlugins]);
20
+ return (_jsx(MarkdownPluginsContext.Provider, { value: merged, children: children }));
21
+ }
22
+ const BUILTIN_REMARK = [remarkGfm, remarkAlerts];
23
+ /** Resolved plugin lists (built-ins + registered) for a `<ReactMarkdown>`. Stable across renders. */
24
+ export function useMarkdownPlugins() {
25
+ const ctx = useContext(MarkdownPluginsContext);
26
+ return useMemo(() => ({
27
+ remarkPlugins: ctx.remarkPlugins?.length
28
+ ? [...BUILTIN_REMARK, ...ctx.remarkPlugins]
29
+ : BUILTIN_REMARK,
30
+ rehypePlugins: ctx.rehypePlugins ?? [],
31
+ }), [ctx]);
32
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `@pyxis-llm/react/mermaid` — mermaid diagram rendering for ```mermaid fences.
3
+ * Requires the optional peer `mermaid` (and optionally `@mermaid-js/layout-elk`).
4
+ *
5
+ * import { mermaidPlugin } from '@pyxis-llm/react/mermaid';
6
+ * registerLlmdPlugin(mermaidPlugin);
7
+ *
8
+ * Not registered on import: a host may draw mermaid its own way (for
9
+ * example, to match the styling of its own documents).
10
+ */
11
+ import type { LlmdPlugin } from './plugins.js';
12
+ export type { MermaidDiagramProps } from './MermaidDiagram.js';
13
+ export { MermaidDiagram, MermaidMarkdownCodeBlock } from './MermaidDiagram.js';
14
+ export { normalizeMermaidSource, renderMermaidDiagram, resetMermaidRuntimeForTests, } from './mermaidRuntime.js';
15
+ export type { RenderMermaidResult } from './mermaidRuntime.js';
16
+ export declare const mermaidPlugin: LlmdPlugin;
17
+ //# sourceMappingURL=mermaid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid.d.ts","sourceRoot":"","sources":["../src/mermaid.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,eAAO,MAAM,aAAa,EAAE,UAG3B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Copyright 2026 John Ewart <john@johnewart.net>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { MermaidMarkdownCodeBlock } from './MermaidDiagram.js';
6
+ export { MermaidDiagram, MermaidMarkdownCodeBlock } from './MermaidDiagram.js';
7
+ export { normalizeMermaidSource, renderMermaidDiagram, resetMermaidRuntimeForTests, } from './mermaidRuntime.js';
8
+ export const mermaidPlugin = {
9
+ id: 'llmd.mermaid',
10
+ languages: { mermaid: MermaidMarkdownCodeBlock },
11
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Normalize diagram source before handing it to mermaid.
3
+ *
4
+ * Historically this rewrote `flowchart` / `graph TD` to the `flowchart-elk`
5
+ * diagram keyword. In mermaid v11 ELK is a *layout* selected via
6
+ * `layout: 'elk'` (set in buildMermaidConfig); the `flowchart-elk` keyword is
7
+ * legacy and does nothing more than set that same layout flag. The rewrite was
8
+ * therefore redundant, and its multiline regexes could rewrite a `flowchart`
9
+ * line appearing inside a diagram body. Source is now passed through as-is.
10
+ */
11
+ export declare function normalizeMermaidSource(code: string): string;
12
+ export type RenderMermaidResult = {
13
+ svg: string;
14
+ bindFunctions?: (element: Element) => void;
15
+ } | {
16
+ error: string;
17
+ };
18
+ export declare function renderMermaidDiagram(code: string, isDark: boolean): Promise<RenderMermaidResult>;
19
+ /** Reset cached mermaid instance (tests / hot reload). */
20
+ export declare function resetMermaidRuntimeForTests(): void;
21
+ //# sourceMappingURL=mermaidRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaidRuntime.d.ts","sourceRoot":"","sources":["../src/mermaidRuntime.ts"],"names":[],"mappings":"AA8EA;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,GAC3D;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtB,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,mBAAmB,CAAC,CAyB9B;AA8BD,0DAA0D;AAC1D,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD"}
@@ -0,0 +1,140 @@
1
+ /*
2
+ * Copyright 2026 John Ewart <john@johnewart.net>
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ let mermaidPromise = null;
6
+ let mermaidTheme = null;
7
+ let elkLayoutAvailable = false;
8
+ let diagramCounter = 0;
9
+ function buildMermaidConfig(isDark) {
10
+ return {
11
+ startOnLoad: false,
12
+ theme: isDark ? 'dark' : 'default',
13
+ // Never let mermaid paint its own "Syntax error in text" diagram. We surface
14
+ // parse failures inline via RenderMermaidResult.error instead; without this
15
+ // mermaid draws the error SVG into a temp node it appends to <body>.
16
+ suppressErrorRendering: true,
17
+ securityLevel: 'strict',
18
+ fontFamily: 'inherit',
19
+ flowchart: {
20
+ useMaxWidth: true,
21
+ htmlLabels: true,
22
+ padding: 18,
23
+ nodeSpacing: 50,
24
+ rankSpacing: 55,
25
+ curve: 'basis',
26
+ wrappingWidth: 220,
27
+ },
28
+ sequence: {
29
+ useMaxWidth: true,
30
+ wrap: true,
31
+ messageFontSize: 14,
32
+ },
33
+ er: {
34
+ useMaxWidth: true,
35
+ },
36
+ ...(elkLayoutAvailable ? { layout: 'elk' } : {}),
37
+ };
38
+ }
39
+ async function loadMermaid(isDark) {
40
+ if (mermaidPromise && mermaidTheme === (isDark ? 'dark' : 'light')) {
41
+ return mermaidPromise;
42
+ }
43
+ mermaidTheme = isDark ? 'dark' : 'light';
44
+ mermaidPromise = (async () => {
45
+ const mermaidMod = await import('mermaid');
46
+ const mermaid = mermaidMod.default;
47
+ let elkRegistered = false;
48
+ try {
49
+ // @vite-ignore: this is an OPTIONAL peer of mermaid, not a hard
50
+ // dependency of @pyxis-llm/react (see mermaid-layout-elk.d.ts). Without the
51
+ // ignore hint, bundlers that statically analyze dynamic imports (Vite)
52
+ // fail the build/dev-server transform when it isn't installed, even
53
+ // though this try/catch already handles that at runtime.
54
+ const elkMod = await import(/* @vite-ignore */ '@mermaid-js/layout-elk');
55
+ mermaid.registerLayoutLoaders(elkMod.default);
56
+ elkRegistered = true;
57
+ }
58
+ catch {
59
+ elkRegistered = false;
60
+ }
61
+ elkLayoutAvailable = elkRegistered;
62
+ mermaid.initialize(buildMermaidConfig(isDark));
63
+ return mermaid;
64
+ })();
65
+ return mermaidPromise;
66
+ }
67
+ /**
68
+ * Normalize diagram source before handing it to mermaid.
69
+ *
70
+ * Historically this rewrote `flowchart` / `graph TD` to the `flowchart-elk`
71
+ * diagram keyword. In mermaid v11 ELK is a *layout* selected via
72
+ * `layout: 'elk'` (set in buildMermaidConfig); the `flowchart-elk` keyword is
73
+ * legacy and does nothing more than set that same layout flag. The rewrite was
74
+ * therefore redundant, and its multiline regexes could rewrite a `flowchart`
75
+ * line appearing inside a diagram body. Source is now passed through as-is.
76
+ */
77
+ export function normalizeMermaidSource(code) {
78
+ return code.trim();
79
+ }
80
+ export async function renderMermaidDiagram(code, isDark) {
81
+ const trimmed = code.trim();
82
+ if (!trimmed) {
83
+ return { error: 'Diagram source is empty.' };
84
+ }
85
+ const id = `mermaid-diagram-${++diagramCounter}-${Date.now()}`;
86
+ // Own the scratch node ourselves so mermaid never appends to <body>.
87
+ const container = createOffscreenContainer();
88
+ try {
89
+ const mermaid = await loadMermaid(isDark);
90
+ const normalized = normalizeMermaidSource(trimmed);
91
+ const result = await mermaid.render(id, normalized, container ?? undefined);
92
+ return {
93
+ svg: result.svg,
94
+ bindFunctions: result.bindFunctions,
95
+ };
96
+ }
97
+ catch (e) {
98
+ return {
99
+ error: e instanceof Error ? e.message : String(e),
100
+ };
101
+ }
102
+ finally {
103
+ cleanupMermaidScratchNodes(id, container);
104
+ }
105
+ }
106
+ function createOffscreenContainer() {
107
+ if (typeof document === 'undefined')
108
+ return null;
109
+ const el = document.createElement('div');
110
+ el.setAttribute('aria-hidden', 'true');
111
+ el.style.position = 'absolute';
112
+ el.style.left = '-10000px';
113
+ el.style.top = '0';
114
+ el.style.width = '0';
115
+ el.style.height = '0';
116
+ el.style.overflow = 'hidden';
117
+ el.style.pointerEvents = 'none';
118
+ document.body.appendChild(el);
119
+ return el;
120
+ }
121
+ /**
122
+ * Remove every node mermaid may have left behind for `id`. Even with
123
+ * suppressErrorRendering and a caller-owned container, older/edge paths inside
124
+ * mermaid append temp nodes keyed on `#id` and `#d{id}` directly to <body>;
125
+ * if render throws they are never reclaimed and leak visible stray text.
126
+ */
127
+ function cleanupMermaidScratchNodes(id, container) {
128
+ if (typeof document === 'undefined')
129
+ return;
130
+ document.getElementById(id)?.remove();
131
+ document.getElementById(`d${id}`)?.remove();
132
+ container?.remove();
133
+ }
134
+ /** Reset cached mermaid instance (tests / hot reload). */
135
+ export function resetMermaidRuntimeForTests() {
136
+ mermaidPromise = null;
137
+ mermaidTheme = null;
138
+ elkLayoutAvailable = false;
139
+ diagramCounter = 0;
140
+ }
@@ -0,0 +1,14 @@
1
+ import type { ChatModelOption } from './chatModelOptions.js';
2
+ export type StoredModelPair = {
3
+ providerId: string;
4
+ modelId: string;
5
+ };
6
+ export declare function modelOptionExists(options: ChatModelOption[], providerId: string, modelId: string): boolean;
7
+ /**
8
+ * Map a persisted provider+model to the current catalog row when possible
9
+ * (case drift, or a path-shaped id like "org/model" vs. just "model").
10
+ * Returns null when no catalog row matches; callers keep the persisted ids as-is.
11
+ */
12
+ export declare function resolveCanonicalModelOption(options: ChatModelOption[], stored: StoredModelPair): StoredModelPair | null;
13
+ export declare function formatEffectiveModelLabel(providerId: string | null, modelId: string | null, allModelOptions: ChatModelOption[]): string;
14
+ //# sourceMappingURL=modelCatalogHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modelCatalogHelpers.d.ts","sourceRoot":"","sources":["../src/modelCatalogHelpers.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,eAAe,EAAE,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAIT;AAMD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,eAAe,EAAE,EAC1B,MAAM,EAAE,eAAe,GACtB,eAAe,GAAG,IAAI,CAyCxB;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,eAAe,EAAE,eAAe,EAAE,GACjC,MAAM,CAUR"}