@red-hat-developer-hub/backstage-plugin-intelligent-assistant 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/AttachmentContext.esm.js +1 -1
  3. package/dist/components/ChatLoadingFallback.esm.js +37 -0
  4. package/dist/components/ChatLoadingFallback.esm.js.map +1 -0
  5. package/dist/components/CollapsedHistoryStrip.esm.js +1 -1
  6. package/dist/components/LightSpeedChat.esm.js +2 -2
  7. package/dist/components/LightspeedChatBox.esm.js +2 -2
  8. package/dist/components/LightspeedChatBoxHeader.esm.js +2 -2
  9. package/dist/components/LightspeedChatContainer.esm.js +18 -3
  10. package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
  11. package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
  12. package/dist/components/LightspeedDrawerProvider.esm.js +11 -26
  13. package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
  14. package/dist/components/LightspeedFABContent.esm.js +14 -2
  15. package/dist/components/LightspeedFABContent.esm.js.map +1 -1
  16. package/dist/components/LightspeedOverlayChat.esm.js +39 -0
  17. package/dist/components/LightspeedOverlayChat.esm.js.map +1 -0
  18. package/dist/components/McpConfigureServerModal.esm.js +2 -2
  19. package/dist/components/MessageBarModelSelector.esm.js +2 -2
  20. package/dist/components/ScreenContextChip.esm.js +2 -2
  21. package/dist/components/ToastAlertGroup.esm.js +1 -1
  22. package/dist/components/criticalFabBundle.esm.js +3 -0
  23. package/dist/components/criticalFabBundle.esm.js.map +1 -0
  24. package/dist/components/loaders.esm.js +11 -0
  25. package/dist/components/loaders.esm.js.map +1 -0
  26. package/dist/components/notebooks/AddDocumentModal.esm.js +2 -2
  27. package/dist/components/notebooks/DocumentSidebar.esm.js +1 -1
  28. package/dist/components/notebooks/NotebookCard.esm.js +1 -1
  29. package/dist/components/notebooks/NotebookStreamProvider.esm.js +1 -1
  30. package/dist/components/notebooks/NotebookView.esm.js +3 -3
  31. package/dist/components/notebooks/OverwriteConfirmModal.esm.js +1 -1
  32. package/dist/components/notebooks/UploadResourceScreen.esm.js +1 -1
  33. package/dist/components/notebooks/notebookStreamStore.esm.js +1 -1
  34. package/dist/components/notebooks/notebookStreamStore.esm.js.map +1 -1
  35. package/dist/const.esm.js +9 -1
  36. package/dist/const.esm.js.map +1 -1
  37. package/dist/fabModule.esm.js +51 -0
  38. package/dist/fabModule.esm.js.map +1 -0
  39. package/dist/hooks/useConversationMessages.esm.js +2 -1
  40. package/dist/hooks/useConversationMessages.esm.js.map +1 -1
  41. package/dist/hooks/useDisplayModeSettings.esm.js +1 -1
  42. package/dist/hooks/useDisplayModeSettings.esm.js.map +1 -1
  43. package/dist/hooks/useLightspeedProviderState.esm.js +1 -2
  44. package/dist/hooks/useLightspeedProviderState.esm.js.map +1 -1
  45. package/dist/index.d.ts +1 -15
  46. package/dist/index.esm.js +7 -69
  47. package/dist/index.esm.js.map +1 -1
  48. package/dist/intelligent-assistant-fab-module.d.ts +12 -4
  49. package/dist/intelligent-assistant-fab-module.esm.js +1 -1
  50. package/dist/intelligent-assistant-translations-module.d.ts +10 -4
  51. package/dist/intelligent-assistant-translations-module.esm.js +1 -1
  52. package/dist/lazy/LazyLightspeedChatDrawerContent.esm.js +13 -0
  53. package/dist/lazy/LazyLightspeedChatDrawerContent.esm.js.map +1 -0
  54. package/dist/lazy/LazyLightspeedFabRootWrapper.esm.js +17 -0
  55. package/dist/lazy/LazyLightspeedFabRootWrapper.esm.js.map +1 -0
  56. package/dist/legacy.d.ts +14 -16
  57. package/dist/legacy.esm.js +2 -9
  58. package/dist/legacy.esm.js.map +1 -1
  59. package/dist/loadChatPatternflyStyles.esm.js +14 -0
  60. package/dist/loadChatPatternflyStyles.esm.js.map +1 -0
  61. package/dist/muiClassNameConfig.esm.js +6 -0
  62. package/dist/muiClassNameConfig.esm.js.map +1 -0
  63. package/dist/plugin.esm.js +4 -4
  64. package/dist/plugin.esm.js.map +1 -1
  65. package/dist/translationsModule.esm.js +18 -0
  66. package/dist/translationsModule.esm.js.map +1 -0
  67. package/dist/types.esm.js.map +1 -1
  68. package/dist/utils/lightspeed-chatbox-message-utils.esm.js +145 -0
  69. package/dist/utils/lightspeed-chatbox-message-utils.esm.js.map +1 -0
  70. package/dist/utils/lightspeed-chatbox-utils.esm.js +20 -144
  71. package/dist/utils/lightspeed-chatbox-utils.esm.js.map +1 -1
  72. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"useLightspeedProviderState.esm.js","sources":["../../src/hooks/useLightspeedProviderState.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useLocation, useMatch, useNavigate } from 'react-router-dom';\n\nimport { ChatbotDisplayMode } from '@patternfly/chatbot';\n\nimport { useAppDrawer } from '@red-hat-developer-hub/backstage-plugin-app-react';\n\nimport type {\n LightspeedDrawerContextType,\n LightspeedEmbeddedNotebooksTarget,\n} from '../components/LightspeedDrawerContext';\nimport { LIGHTSPEED_APP_DRAWER_ID, LIGHTSPEED_PATH } from '../const';\nimport type { FileContent } from '../types';\nimport { useBackstageUserIdentity } from './useBackstageUserIdentity';\nimport { useDisplayModeSettings } from './useDisplayModeSettings';\nimport type { SettingsTab } from './useSettingsPanelUrlState';\n\nfunction lightspeedRoutePath(conversationId?: string): string {\n return conversationId\n ? `${LIGHTSPEED_PATH}/conversation/${conversationId}`\n : LIGHTSPEED_PATH;\n}\n\n/**\n * Encapsulates LightspeedDrawerProvider state, routing, and ApplicationDrawer sync.\n *\n * @internal\n */\nexport function useLightspeedProviderState(): {\n contextValue: LightspeedDrawerContextType;\n shouldRenderOverlayModal: boolean;\n closeChatbot: () => void;\n} {\n const navigate = useNavigate();\n const location = useLocation();\n const { openDrawer, closeDrawer } = useAppDrawer();\n const user = useBackstageUserIdentity();\n const {\n displayMode: persistedDisplayMode,\n setDisplayMode: setPersistedDisplayMode,\n } = useDisplayModeSettings(user, ChatbotDisplayMode.default);\n\n const [displayModeState, setDisplayModeState] =\n useState<ChatbotDisplayMode>(persistedDisplayMode);\n const [isOpen, setIsOpen] = useState(false);\n const [drawerWidth, setDrawerWidth] = useState(400);\n const [currentConversationIdState, setCurrentConversationIdState] = useState<\n string | undefined\n >(undefined);\n const [draftMessage, setDraftMessageState] = useState('');\n const [draftFileContents, setDraftFileContentsState] = useState<\n FileContent[]\n >([]);\n const [shellViewTab, setShellViewTabState] = useState(0);\n const [activeNotebookId, setActiveNotebookId] = useState<string | undefined>(\n undefined,\n );\n const [settingsTab, setSettingsTabState] = useState<SettingsTab | null>(null);\n const setSettingsTab = useCallback((tab: SettingsTab | null) => {\n setSettingsTabState(tab);\n }, []);\n const shellViewTabRef = useRef(shellViewTab);\n shellViewTabRef.current = shellViewTab;\n const setShellViewTab = useCallback((tab: number) => {\n const next = tab === 1 ? 1 : 0;\n shellViewTabRef.current = next;\n setShellViewTabState(next);\n }, []);\n const openedViaFABRef = useRef(false);\n const dockedAfterLeavingFullscreenRef = useRef(false);\n /** True while navigating off /lightspeed after user chose overlay/docked (URL can lag persisted mode). */\n const leavingLightspeedForNonEmbeddedShellRef = useRef(false);\n /** True until overlay/docked LightspeedChat consumes it (new mount after leaving fullscreen route). */\n const pendingOverlayThreadHandoffRef = useRef(false);\n /** Used to detect in-app moves (e.g. Chat ↔ Notebooks) so display mode is not reset to embedded. */\n const lightspeedPathnamePrevRef = useRef<string | null>(null);\n\n const isLightspeedRouteRef = useRef(false);\n const isOnNotebooksPathRef = useRef(false);\n const persistedDisplayModeRef = useRef(persistedDisplayMode);\n\n const isLightspeedRoute = location.pathname.startsWith(LIGHTSPEED_PATH);\n isLightspeedRouteRef.current = isLightspeedRoute;\n isOnNotebooksPathRef.current = location.pathname.startsWith(\n `${LIGHTSPEED_PATH}/notebooks`,\n );\n persistedDisplayModeRef.current = persistedDisplayMode;\n const conversationMatch = useMatch(\n `${LIGHTSPEED_PATH}/conversation/:conversationId`,\n );\n const conversationId = conversationMatch?.params?.conversationId;\n\n const syncShellDrawerForMode = useCallback(\n (mode: ChatbotDisplayMode) => {\n if (mode === ChatbotDisplayMode.docked) {\n if (isLightspeedRoute) {\n dockedAfterLeavingFullscreenRef.current = true;\n } else {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n } else {\n dockedAfterLeavingFullscreenRef.current = false;\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n },\n [closeDrawer, isLightspeedRoute, openDrawer],\n );\n\n const navigateBackOrGoToCatalog = useCallback(() => {\n if (!openedViaFABRef.current) {\n navigate('/catalog');\n openedViaFABRef.current = true;\n return;\n }\n navigate(-1);\n }, [navigate]);\n\n /**\n * Leaving /lightspeed for overlay/docked must not use navigate(-1): after the first FAB\n * open, navigateBackOrGoToCatalog uses -1 and can land back on /lightspeed (fullscreen).\n */\n const leaveLightspeedRouteForShellDisplayMode = useCallback(() => {\n navigate('/catalog', { replace: true });\n }, [navigate]);\n\n useEffect(() => {\n const pathname = location.pathname;\n const prevPathname = lightspeedPathnamePrevRef.current;\n const isUnderLightspeedPath = (p: string | null) =>\n Boolean(p && p.startsWith(LIGHTSPEED_PATH));\n const isInternalLightspeedRouteChange =\n isUnderLightspeedPath(prevPathname) &&\n isUnderLightspeedPath(pathname) &&\n prevPathname !== pathname;\n\n if (!isLightspeedRoute) {\n leavingLightspeedForNonEmbeddedShellRef.current = false;\n }\n\n if (conversationId) {\n setCurrentConversationIdState(conversationId);\n } else if (isLightspeedRoute) {\n // On `/lightspeed` without a `:conversationId` segment, URL implies a fresh thread.\n // When navigating to another app route (overlay/docked), keep the last id so display\n // mode switches and re-entry to fullscreen stay on the active conversation.\n setCurrentConversationIdState(undefined);\n }\n\n if (isLightspeedRoute) {\n if (!isInternalLightspeedRouteChange) {\n if (\n leavingLightspeedForNonEmbeddedShellRef.current &&\n persistedDisplayMode !== ChatbotDisplayMode.embedded\n ) {\n setDisplayModeState(persistedDisplayMode);\n } else {\n setDisplayModeState(ChatbotDisplayMode.embedded);\n }\n }\n setIsOpen(true);\n if (!dockedAfterLeavingFullscreenRef.current) {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n } else if (persistedDisplayMode === ChatbotDisplayMode.embedded) {\n // Off /lightspeed there is no fullscreen surface; use overlay so FAB stays available.\n // (Persisted preference remains \"fullscreen\" for the next open.)\n setDisplayModeState(ChatbotDisplayMode.default);\n } else {\n setDisplayModeState(persistedDisplayMode);\n }\n\n lightspeedPathnamePrevRef.current = pathname;\n }, [\n closeDrawer,\n conversationId,\n isLightspeedRoute,\n location.pathname,\n persistedDisplayMode,\n ]);\n\n useEffect(() => {\n if (\n !isLightspeedRoute &&\n isOpen &&\n displayModeState === ChatbotDisplayMode.docked\n ) {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n dockedAfterLeavingFullscreenRef.current = false;\n }\n }, [displayModeState, isLightspeedRoute, isOpen, openDrawer]);\n\n const openChatbot = useCallback(() => {\n openedViaFABRef.current = true;\n const rawMode = persistedDisplayMode || ChatbotDisplayMode.default;\n\n if (rawMode === ChatbotDisplayMode.embedded) {\n if (!isLightspeedRoute) {\n if (shellViewTabRef.current === 1) {\n navigate(`${LIGHTSPEED_PATH}/notebooks`);\n } else {\n navigate(lightspeedRoutePath(currentConversationIdState));\n }\n }\n setDisplayModeState(ChatbotDisplayMode.embedded);\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n setIsOpen(true);\n return;\n }\n\n setDisplayModeState(rawMode);\n\n if (rawMode === ChatbotDisplayMode.docked) {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n } else {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n\n setIsOpen(true);\n }, [\n closeDrawer,\n currentConversationIdState,\n isLightspeedRoute,\n navigate,\n openDrawer,\n persistedDisplayMode,\n ]);\n\n const closeChatbot = useCallback(() => {\n dockedAfterLeavingFullscreenRef.current = false;\n if (displayModeState === ChatbotDisplayMode.embedded && isLightspeedRoute) {\n navigateBackOrGoToCatalog();\n }\n if (displayModeState === ChatbotDisplayMode.docked) {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n setIsOpen(false);\n }, [\n closeDrawer,\n displayModeState,\n isLightspeedRoute,\n navigateBackOrGoToCatalog,\n ]);\n\n const toggleChatbot = useCallback(() => {\n if (isOpen) {\n closeChatbot();\n } else {\n openChatbot();\n }\n }, [isOpen, openChatbot, closeChatbot]);\n\n const setCurrentConversationId = useCallback(\n (id: string | undefined) => {\n setCurrentConversationIdState(id);\n // Refs: first-stream completion calls onStart after unmount / mode change; a stale\n // embedded + /lightspeed closure would navigate back to fullscreen without this.\n // Skip navigation when the user is on a notebooks path — conversation route updates\n // must not overwrite the notebooks URL (fixes notebook closing on mode switch).\n if (\n persistedDisplayModeRef.current === ChatbotDisplayMode.embedded &&\n isLightspeedRouteRef.current &&\n !isOnNotebooksPathRef.current\n ) {\n navigate(\n {\n pathname: lightspeedRoutePath(id),\n search: location.search,\n },\n { replace: true },\n );\n }\n },\n [navigate, location.search],\n );\n\n const setDraftMessage = useCallback((message: string) => {\n setDraftMessageState(message);\n }, []);\n\n const setDraftFileContents = useCallback((files: FileContent[]) => {\n setDraftFileContentsState(files);\n }, []);\n\n const consumePendingOverlayThreadHandoff = useCallback(() => {\n if (!pendingOverlayThreadHandoffRef.current) {\n return false;\n }\n pendingOverlayThreadHandoffRef.current = false;\n return true;\n }, []);\n\n const setDisplayMode = useCallback(\n (\n mode: ChatbotDisplayMode,\n conversationIdParam?: string,\n embeddedNotebooks?: LightspeedEmbeddedNotebooksTarget,\n ) => {\n if (mode === displayModeState) {\n return;\n }\n setPersistedDisplayMode(mode);\n syncShellDrawerForMode(mode);\n\n if (mode === ChatbotDisplayMode.embedded) {\n if (embeddedNotebooks) {\n const path =\n embeddedNotebooks === 'notebooks'\n ? `${LIGHTSPEED_PATH}/notebooks`\n : `${LIGHTSPEED_PATH}/notebooks/${embeddedNotebooks.notebookSessionId}`;\n navigate(path);\n } else if (shellViewTabRef.current === 1) {\n navigate(`${LIGHTSPEED_PATH}/notebooks`);\n } else {\n const convId = conversationIdParam ?? currentConversationIdState;\n navigate(lightspeedRoutePath(convId));\n }\n setIsOpen(true);\n } else {\n if (isLightspeedRoute) {\n leavingLightspeedForNonEmbeddedShellRef.current = true;\n pendingOverlayThreadHandoffRef.current = true;\n leaveLightspeedRouteForShellDisplayMode();\n }\n setIsOpen(true);\n }\n },\n [\n currentConversationIdState,\n displayModeState,\n isLightspeedRoute,\n leaveLightspeedRouteForShellDisplayMode,\n navigate,\n setPersistedDisplayMode,\n syncShellDrawerForMode,\n ],\n );\n\n const shouldRenderOverlayModal =\n isOpen &&\n displayModeState === ChatbotDisplayMode.default &&\n !isLightspeedRoute;\n\n const contextValue = useMemo(\n () => ({\n isChatbotActive: isOpen,\n toggleChatbot,\n displayMode: displayModeState,\n setDisplayMode,\n drawerWidth,\n setDrawerWidth,\n currentConversationId: currentConversationIdState,\n setCurrentConversationId,\n draftMessage,\n setDraftMessage,\n draftFileContents,\n setDraftFileContents,\n consumePendingOverlayThreadHandoff,\n shellViewTab,\n setShellViewTab,\n activeNotebookId,\n setActiveNotebookId,\n settingsTab,\n setSettingsTab,\n }),\n [\n isOpen,\n toggleChatbot,\n displayModeState,\n setDisplayMode,\n drawerWidth,\n currentConversationIdState,\n setCurrentConversationId,\n draftMessage,\n setDraftMessage,\n draftFileContents,\n setDraftFileContents,\n consumePendingOverlayThreadHandoff,\n shellViewTab,\n setShellViewTab,\n activeNotebookId,\n setActiveN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AAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,OAAO;AAAA,IACL,YAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useLightspeedProviderState.esm.js","sources":["../../src/hooks/useLightspeedProviderState.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useLocation, useMatch, useNavigate } from 'react-router-dom';\n\nimport { useAppDrawer } from '@red-hat-developer-hub/backstage-plugin-app-react';\n\nimport type {\n LightspeedDrawerContextType,\n LightspeedEmbeddedNotebooksTarget,\n} from '../components/LightspeedDrawerContext';\nimport {\n ChatbotDisplayMode,\n LIGHTSPEED_APP_DRAWER_ID,\n LIGHTSPEED_PATH,\n} from '../const';\nimport type { FileContent } from '../types';\nimport { useBackstageUserIdentity } from './useBackstageUserIdentity';\nimport { useDisplayModeSettings } from './useDisplayModeSettings';\nimport type { SettingsTab } from './useSettingsPanelUrlState';\n\nfunction lightspeedRoutePath(conversationId?: string): string {\n return conversationId\n ? `${LIGHTSPEED_PATH}/conversation/${conversationId}`\n : LIGHTSPEED_PATH;\n}\n\n/**\n * Encapsulates LightspeedDrawerProvider state, routing, and ApplicationDrawer sync.\n *\n * @internal\n */\nexport function useLightspeedProviderState(): {\n contextValue: LightspeedDrawerContextType;\n shouldRenderOverlayModal: boolean;\n closeChatbot: () => void;\n} {\n const navigate = useNavigate();\n const location = useLocation();\n const { openDrawer, closeDrawer } = useAppDrawer();\n const user = useBackstageUserIdentity();\n const {\n displayMode: persistedDisplayMode,\n setDisplayMode: setPersistedDisplayMode,\n } = useDisplayModeSettings(user, ChatbotDisplayMode.default);\n\n const [displayModeState, setDisplayModeState] =\n useState<ChatbotDisplayMode>(persistedDisplayMode);\n const [isOpen, setIsOpen] = useState(false);\n const [drawerWidth, setDrawerWidth] = useState(400);\n const [currentConversationIdState, setCurrentConversationIdState] = useState<\n string | undefined\n >(undefined);\n const [draftMessage, setDraftMessageState] = useState('');\n const [draftFileContents, setDraftFileContentsState] = useState<\n FileContent[]\n >([]);\n const [shellViewTab, setShellViewTabState] = useState(0);\n const [activeNotebookId, setActiveNotebookId] = useState<string | undefined>(\n undefined,\n );\n const [settingsTab, setSettingsTabState] = useState<SettingsTab | null>(null);\n const setSettingsTab = useCallback((tab: SettingsTab | null) => {\n setSettingsTabState(tab);\n }, []);\n const shellViewTabRef = useRef(shellViewTab);\n shellViewTabRef.current = shellViewTab;\n const setShellViewTab = useCallback((tab: number) => {\n const next = tab === 1 ? 1 : 0;\n shellViewTabRef.current = next;\n setShellViewTabState(next);\n }, []);\n const openedViaFABRef = useRef(false);\n const dockedAfterLeavingFullscreenRef = useRef(false);\n /** True while navigating off /lightspeed after user chose overlay/docked (URL can lag persisted mode). */\n const leavingLightspeedForNonEmbeddedShellRef = useRef(false);\n /** True until overlay/docked LightspeedChat consumes it (new mount after leaving fullscreen route). */\n const pendingOverlayThreadHandoffRef = useRef(false);\n /** Used to detect in-app moves (e.g. Chat ↔ Notebooks) so display mode is not reset to embedded. */\n const lightspeedPathnamePrevRef = useRef<string | null>(null);\n\n const isLightspeedRouteRef = useRef(false);\n const isOnNotebooksPathRef = useRef(false);\n const persistedDisplayModeRef = useRef(persistedDisplayMode);\n\n const isLightspeedRoute = location.pathname.startsWith(LIGHTSPEED_PATH);\n isLightspeedRouteRef.current = isLightspeedRoute;\n isOnNotebooksPathRef.current = location.pathname.startsWith(\n `${LIGHTSPEED_PATH}/notebooks`,\n );\n persistedDisplayModeRef.current = persistedDisplayMode;\n const conversationMatch = useMatch(\n `${LIGHTSPEED_PATH}/conversation/:conversationId`,\n );\n const conversationId = conversationMatch?.params?.conversationId;\n\n const syncShellDrawerForMode = useCallback(\n (mode: ChatbotDisplayMode) => {\n if (mode === ChatbotDisplayMode.docked) {\n if (isLightspeedRoute) {\n dockedAfterLeavingFullscreenRef.current = true;\n } else {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n } else {\n dockedAfterLeavingFullscreenRef.current = false;\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n },\n [closeDrawer, isLightspeedRoute, openDrawer],\n );\n\n const navigateBackOrGoToCatalog = useCallback(() => {\n if (!openedViaFABRef.current) {\n navigate('/catalog');\n openedViaFABRef.current = true;\n return;\n }\n navigate(-1);\n }, [navigate]);\n\n /**\n * Leaving /lightspeed for overlay/docked must not use navigate(-1): after the first FAB\n * open, navigateBackOrGoToCatalog uses -1 and can land back on /lightspeed (fullscreen).\n */\n const leaveLightspeedRouteForShellDisplayMode = useCallback(() => {\n navigate('/catalog', { replace: true });\n }, [navigate]);\n\n useEffect(() => {\n const pathname = location.pathname;\n const prevPathname = lightspeedPathnamePrevRef.current;\n const isUnderLightspeedPath = (p: string | null) =>\n Boolean(p && p.startsWith(LIGHTSPEED_PATH));\n const isInternalLightspeedRouteChange =\n isUnderLightspeedPath(prevPathname) &&\n isUnderLightspeedPath(pathname) &&\n prevPathname !== pathname;\n\n if (!isLightspeedRoute) {\n leavingLightspeedForNonEmbeddedShellRef.current = false;\n }\n\n if (conversationId) {\n setCurrentConversationIdState(conversationId);\n } else if (isLightspeedRoute) {\n // On `/lightspeed` without a `:conversationId` segment, URL implies a fresh thread.\n // When navigating to another app route (overlay/docked), keep the last id so display\n // mode switches and re-entry to fullscreen stay on the active conversation.\n setCurrentConversationIdState(undefined);\n }\n\n if (isLightspeedRoute) {\n if (!isInternalLightspeedRouteChange) {\n if (\n leavingLightspeedForNonEmbeddedShellRef.current &&\n persistedDisplayMode !== ChatbotDisplayMode.embedded\n ) {\n setDisplayModeState(persistedDisplayMode);\n } else {\n setDisplayModeState(ChatbotDisplayMode.embedded);\n }\n }\n setIsOpen(true);\n if (!dockedAfterLeavingFullscreenRef.current) {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n } else if (persistedDisplayMode === ChatbotDisplayMode.embedded) {\n // Off /lightspeed there is no fullscreen surface; use overlay so FAB stays available.\n // (Persisted preference remains \"fullscreen\" for the next open.)\n setDisplayModeState(ChatbotDisplayMode.default);\n } else {\n setDisplayModeState(persistedDisplayMode);\n }\n\n lightspeedPathnamePrevRef.current = pathname;\n }, [\n closeDrawer,\n conversationId,\n isLightspeedRoute,\n location.pathname,\n persistedDisplayMode,\n ]);\n\n useEffect(() => {\n if (\n !isLightspeedRoute &&\n isOpen &&\n displayModeState === ChatbotDisplayMode.docked\n ) {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n dockedAfterLeavingFullscreenRef.current = false;\n }\n }, [displayModeState, isLightspeedRoute, isOpen, openDrawer]);\n\n const openChatbot = useCallback(() => {\n openedViaFABRef.current = true;\n const rawMode = persistedDisplayMode || ChatbotDisplayMode.default;\n\n if (rawMode === ChatbotDisplayMode.embedded) {\n if (!isLightspeedRoute) {\n if (shellViewTabRef.current === 1) {\n navigate(`${LIGHTSPEED_PATH}/notebooks`);\n } else {\n navigate(lightspeedRoutePath(currentConversationIdState));\n }\n }\n setDisplayModeState(ChatbotDisplayMode.embedded);\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n setIsOpen(true);\n return;\n }\n\n setDisplayModeState(rawMode);\n\n if (rawMode === ChatbotDisplayMode.docked) {\n openDrawer(LIGHTSPEED_APP_DRAWER_ID);\n } else {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n\n setIsOpen(true);\n }, [\n closeDrawer,\n currentConversationIdState,\n isLightspeedRoute,\n navigate,\n openDrawer,\n persistedDisplayMode,\n ]);\n\n const closeChatbot = useCallback(() => {\n dockedAfterLeavingFullscreenRef.current = false;\n if (displayModeState === ChatbotDisplayMode.embedded && isLightspeedRoute) {\n navigateBackOrGoToCatalog();\n }\n if (displayModeState === ChatbotDisplayMode.docked) {\n closeDrawer(LIGHTSPEED_APP_DRAWER_ID);\n }\n setIsOpen(false);\n }, [\n closeDrawer,\n displayModeState,\n isLightspeedRoute,\n navigateBackOrGoToCatalog,\n ]);\n\n const toggleChatbot = useCallback(() => {\n if (isOpen) {\n closeChatbot();\n } else {\n openChatbot();\n }\n }, [isOpen, openChatbot, closeChatbot]);\n\n const setCurrentConversationId = useCallback(\n (id: string | undefined) => {\n setCurrentConversationIdState(id);\n // Refs: first-stream completion calls onStart after unmount / mode change; a stale\n // embedded + /lightspeed closure would navigate back to fullscreen without this.\n // Skip navigation when the user is on a notebooks path — conversation route updates\n // must not overwrite the notebooks URL (fixes notebook closing on mode switch).\n if (\n persistedDisplayModeRef.current === ChatbotDisplayMode.embedded &&\n isLightspeedRouteRef.current &&\n !isOnNotebooksPathRef.current\n ) {\n navigate(\n {\n pathname: lightspeedRoutePath(id),\n search: location.search,\n },\n { replace: true },\n );\n }\n },\n [navigate, location.search],\n );\n\n const setDraftMessage = useCallback((message: string) => {\n setDraftMessageState(message);\n }, []);\n\n const setDraftFileContents = useCallback((files: FileContent[]) => {\n setDraftFileContentsState(files);\n }, []);\n\n const consumePendingOverlayThreadHandoff = useCallback(() => {\n if (!pendingOverlayThreadHandoffRef.current) {\n return false;\n }\n pendingOverlayThreadHandoffRef.current = false;\n return true;\n }, []);\n\n const setDisplayMode = useCallback(\n (\n mode: ChatbotDisplayMode,\n conversationIdParam?: string,\n embeddedNotebooks?: LightspeedEmbeddedNotebooksTarget,\n ) => {\n if (mode === displayModeState) {\n return;\n }\n setPersistedDisplayMode(mode);\n syncShellDrawerForMode(mode);\n\n if (mode === ChatbotDisplayMode.embedded) {\n if (embeddedNotebooks) {\n const path =\n embeddedNotebooks === 'notebooks'\n ? `${LIGHTSPEED_PATH}/notebooks`\n : `${LIGHTSPEED_PATH}/notebooks/${embeddedNotebooks.notebookSessionId}`;\n navigate(path);\n } else if (shellViewTabRef.current === 1) {\n navigate(`${LIGHTSPEED_PATH}/notebooks`);\n } else {\n const convId = conversationIdParam ?? currentConversationIdState;\n navigate(lightspeedRoutePath(convId));\n }\n setIsOpen(true);\n } else {\n if (isLightspeedRoute) {\n leavingLightspeedForNonEmbeddedShellRef.current = true;\n pendingOverlayThreadHandoffRef.current = true;\n leaveLightspeedRouteForShellDisplayMode();\n }\n setIsOpen(true);\n }\n },\n [\n currentConversationIdState,\n displayModeState,\n isLightspeedRoute,\n leaveLightspeedRouteForShellDisplayMode,\n navigate,\n setPersistedDisplayMode,\n syncShellDrawerForMode,\n ],\n );\n\n const shouldRenderOverlayModal =\n isOpen &&\n displayModeState === ChatbotDisplayMode.default &&\n !isLightspeedRoute;\n\n const contextValue = useMemo(\n () => ({\n isChatbotActive: isOpen,\n toggleChatbot,\n displayMode: displayModeState,\n setDisplayMode,\n drawerWidth,\n setDrawerWidth,\n currentConversationId: currentConversationIdState,\n setCurrentConversationId,\n draftMessage,\n setDraftMessage,\n draftFileContents,\n setDraftFileContents,\n consumePendingOverlayThreadHandoff,\n shellViewTab,\n setShellViewTab,\n activeNotebookId,\n setActiveNotebookId,\n settingsTab,\n setSettingsTab,\n }),\n [\n isOpen,\n toggleChatbot,\n displayModeState,\n setDisplayMode,\n drawerWidth,\n currentConversationIdState,\n setCurrentConversationId,\n draftMessage,\n setDraftMessage,\n draftFileContents,\n setDraftFileContents,\n consumePendingOverlayThreadHandoff,\n shellViewTab,\n setShellViewTab,\n activeNotebookId,\n setActiveNotebookId,\n settingsTab,\n setSettingsTab,\n ],\n );\n\n return {\n contextValue,\n shouldRenderOverlayModal,\n closeChatbot,\n };\n}\n"],"names":[],"mappings":";;;;;;;AAmCA,SAAS,oBAAoB,cAAA,EAAiC;AAC5D,EAAA,OAAO,cAAA,GACH,CAAA,EAAG,eAAe,CAAA,cAAA,EAAiB,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,IAAI,CAAA;AAAA,MAChB;AAAA,IACF,CAAA;AAAA,IACA;AAAA,MACE,0BAAA;AAAA,MACA,gBAAA;AAAA,MACA,iBAAA;AAAA,MACA,uCAAA;AAAA,MACA,QAAA;AAAA,MACA,uBAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,MAAM,wBAAA,GACJ,MAAA,IACA,gBAAA,KAAqB,kBAAA,CAAmB,WACxC,CAAC,iBAAA;AAEH,EAAA,MAAM,YAAA,GAAe,OAAA;AAAA,IACnB,OAAO;AAAA,MACL,eAAA,EAAiB,MAAA;AAAA,MACjB,aAAA;AAAA,MACA,WAAA,EAAa,gBAAA;AAAA,MACb,cAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA,qBAAA,EAAuB,0BAAA;AAAA,MACvB,wBAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,oBAAA;AAAA,MACA,kCAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,gBAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,MAAA;AAAA,MACA,aAAA;AAAA,MACA,gBAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,0BAAA;AAAA,MACA,wBAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,oBAAA;AAAA,MACA,kCAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,gBAAA;AAAA,MACA,mBAAA;AAAA,MACA,WAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,OAAO;AAAA,IACL,YAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
package/dist/index.d.ts CHANGED
@@ -2,20 +2,6 @@ import * as react from 'react';
2
2
  import * as _red_hat_developer_hub_backstage_plugin_app_react from '@red-hat-developer-hub/backstage-plugin-app-react';
3
3
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
4
4
 
5
- /**
6
- * @public
7
- */
8
- declare const intelligentAssistantRedirectModule: _backstage_frontend_plugin_api.FrontendModule;
9
- /**
10
- * @public
11
- */
12
- declare const intelligentAssistantFABModule: _backstage_frontend_plugin_api.FrontendModule;
13
- /**
14
- * Translation wiring for the language selector (app-config `app.extensions`).
15
- *
16
- * @public
17
- */
18
- declare const intelligentAssistantTranslationsModule: _backstage_frontend_plugin_api.FrontendModule;
19
5
  /**
20
6
  * Lightspeed plugin for the Backstage new frontend system.
21
7
  *
@@ -110,4 +96,4 @@ declare const _default: _backstage_frontend_plugin_api.OverridableFrontendPlugin
110
96
  }>;
111
97
  }>;
112
98
 
113
- export { _default as default, intelligentAssistantFABModule, intelligentAssistantRedirectModule, intelligentAssistantTranslationsModule };
99
+ export { _default as default };
package/dist/index.esm.js CHANGED
@@ -1,23 +1,14 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useEffect, useLayoutEffect } from 'react';
3
- import { useLocation, useNavigate } from 'react-router-dom';
4
- import { createRouteRef, createSubRouteRef, ApiBlueprint, createApiFactory, fetchApiRef, configApiRef, PageBlueprint, createFrontendModule, createFrontendPlugin } from '@backstage/frontend-plugin-api';
5
- import { AppRootWrapperBlueprint, TranslationBlueprint } from '@backstage/plugin-app-react';
6
- import { unstable_ClassNameGenerator } from '@mui/material/className';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createRouteRef, createSubRouteRef, ApiBlueprint, createApiFactory, fetchApiRef, configApiRef, PageBlueprint, createFrontendPlugin } from '@backstage/frontend-plugin-api';
7
3
  import { AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react';
8
4
  import { lightspeedApiRef } from './api/api.esm.js';
9
5
  import { LightspeedApiClient } from './api/LightspeedApiClient.esm.js';
10
6
  import { notebooksApiRef } from './api/notebooksApi.esm.js';
11
7
  import { NotebooksApiClient } from './api/NotebooksApiClient.esm.js';
12
- import { LightspeedChatContainer } from './components/LightspeedChatContainer.esm.js';
13
- import { LightspeedDrawerProvider } from './components/LightspeedDrawerProvider.esm.js';
14
- import { LightspeedFABContent } from './components/LightspeedFABContent.esm.js';
15
- import { LIGHTSPEED_PATH, LIGHTSPEED_APP_DRAWER_ID, LIGHTSPEED_LEGACY_PATH } from './const.esm.js';
16
- import { lightspeedTranslations } from './translations/index.esm.js';
8
+ import { LIGHTSPEED_PATH, LIGHTSPEED_APP_DRAWER_ID } from './const.esm.js';
9
+ import { LazyLightspeedChatDrawerContent } from './lazy/LazyLightspeedChatDrawerContent.esm.js';
10
+ import './muiClassNameConfig.esm.js';
17
11
 
18
- unstable_ClassNameGenerator.configure(
19
- (componentName) => componentName.startsWith("v5-") ? componentName : `v5-${componentName}`
20
- );
21
12
  const nfsRootRouteRef = createRouteRef();
22
13
  const nfsConversationRouteRef = createSubRouteRef({
23
14
  parent: nfsRootRouteRef,
@@ -61,65 +52,12 @@ const intelligentAssistantDrawer = AppDrawerContentBlueprint.make({
61
52
  name: "intelligent-assistant",
62
53
  params: {
63
54
  id: LIGHTSPEED_APP_DRAWER_ID,
64
- element: /* @__PURE__ */ jsx(LightspeedChatContainer, {}),
55
+ element: /* @__PURE__ */ jsx(LazyLightspeedChatDrawerContent, {}),
65
56
  resizable: true,
66
57
  defaultWidth: 400,
67
58
  priority: 100
68
59
  }
69
60
  });
70
- const LightspeedLegacyRedirect = ({ children }) => {
71
- const location = useLocation();
72
- const navigate = useNavigate();
73
- useEffect(() => {
74
- if (location.pathname.startsWith(LIGHTSPEED_LEGACY_PATH)) {
75
- const newPath = location.pathname.replace(
76
- LIGHTSPEED_LEGACY_PATH,
77
- LIGHTSPEED_PATH
78
- );
79
- navigate(newPath + location.search + location.hash, {
80
- replace: true
81
- });
82
- }
83
- }, [location, navigate]);
84
- useLayoutEffect(() => {
85
- document.documentElement.style.containerType = "normal";
86
- }, []);
87
- return /* @__PURE__ */ jsx(Fragment, { children });
88
- };
89
- const intelligentAssistantRedirect = AppRootWrapperBlueprint.make({
90
- name: "intelligent-assistant-redirect",
91
- params: {
92
- component: LightspeedLegacyRedirect
93
- }
94
- });
95
- const intelligentAssistantRedirectModule = createFrontendModule({
96
- pluginId: "app",
97
- extensions: [intelligentAssistantRedirect]
98
- });
99
- const intelligentAssistantFABExtension = AppRootWrapperBlueprint.make({
100
- name: "intelligent-assistant-fab",
101
- params: {
102
- component: ({ children }) => /* @__PURE__ */ jsxs(LightspeedDrawerProvider, { children: [
103
- /* @__PURE__ */ jsx(LightspeedFABContent, {}),
104
- children
105
- ] })
106
- }
107
- });
108
- const intelligentAssistantFABModule = createFrontendModule({
109
- pluginId: "app",
110
- extensions: [intelligentAssistantFABExtension, intelligentAssistantRedirect]
111
- });
112
- const intelligentAssistantTranslationsModule = createFrontendModule({
113
- pluginId: "app",
114
- extensions: [
115
- TranslationBlueprint.make({
116
- name: "intelligent-assistant-translations",
117
- params: {
118
- resource: lightspeedTranslations
119
- }
120
- })
121
- ]
122
- });
123
61
  var index = createFrontendPlugin({
124
62
  pluginId: "intelligent-assistant",
125
63
  extensions: [
@@ -134,5 +72,5 @@ var index = createFrontendPlugin({
134
72
  }
135
73
  });
136
74
 
137
- export { index as default, intelligentAssistantFABModule, intelligentAssistantRedirectModule, intelligentAssistantTranslationsModule };
75
+ export { index as default };
138
76
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/index.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useLayoutEffect, type ReactNode } from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport {\n ApiBlueprint,\n configApiRef,\n createApiFactory,\n createFrontendModule,\n createFrontendPlugin,\n createRouteRef,\n createSubRouteRef,\n fetchApiRef,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport {\n AppRootWrapperBlueprint,\n TranslationBlueprint,\n} from '@backstage/plugin-app-react';\n\nimport { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\nimport { AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react';\n\nimport { lightspeedApiRef } from './api/api';\nimport { LightspeedApiClient } from './api/LightspeedApiClient';\nimport { notebooksApiRef } from './api/notebooksApi';\nimport { NotebooksApiClient } from './api/NotebooksApiClient';\nimport { LightspeedChatContainer as LightspeedChatContainerElement } from './components/LightspeedChatContainer';\nimport { LightspeedDrawerProvider as LightspeedProvider } from './components/LightspeedDrawerProvider';\nimport { LightspeedFABContent as LightspeedFABComponent } from './components/LightspeedFABContent';\nimport {\n LIGHTSPEED_APP_DRAWER_ID,\n LIGHTSPEED_LEGACY_PATH,\n LIGHTSPEED_PATH,\n} from './const';\nimport { lightspeedTranslations } from './translations';\n\nClassNameGenerator.configure(componentName =>\n componentName.startsWith('v5-') ? componentName : `v5-${componentName}`,\n);\n\nconst nfsRootRouteRef = createRouteRef();\nconst nfsConversationRouteRef = createSubRouteRef({\n parent: nfsRootRouteRef,\n path: '/conversation/:conversationId',\n});\n\nconst intelligentAssistantApi = ApiBlueprint.make({\n name: 'intelligent-assistant',\n params: defineParams =>\n defineParams(\n createApiFactory({\n api: lightspeedApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new LightspeedApiClient({ configApi, fetchApi }),\n }),\n ),\n});\n\nconst notebooksApi = ApiBlueprint.make({\n name: 'notebooks',\n params: defineParams =>\n defineParams(\n createApiFactory({\n api: notebooksApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new NotebooksApiClient({ configApi, fetchApi }),\n }),\n ),\n});\n\nconst intelligentAssistantPage = PageBlueprint.make({\n params: {\n path: LIGHTSPEED_PATH,\n routeRef: nfsRootRouteRef,\n noHeader: true,\n loader: () => import('./components/Router').then(m => <m.Router />),\n },\n});\n\nconst intelligentAssistantDrawer = AppDrawerContentBlueprint.make({\n name: 'intelligent-assistant',\n params: {\n id: LIGHTSPEED_APP_DRAWER_ID,\n element: <LightspeedChatContainerElement />,\n resizable: true,\n defaultWidth: 400,\n priority: 100,\n },\n});\n\nconst LightspeedLegacyRedirect = ({ children }: { children: ReactNode }) => {\n const location = useLocation();\n const navigate = useNavigate();\n useEffect(() => {\n if (location.pathname.startsWith(LIGHTSPEED_LEGACY_PATH)) {\n const newPath = location.pathname.replace(\n LIGHTSPEED_LEGACY_PATH,\n LIGHTSPEED_PATH,\n );\n navigate(newPath + location.search + location.hash, {\n replace: true,\n });\n }\n }, [location, navigate]);\n\n // Workaround: PF 6.6.0 base-no-reset.css sets container-type: inline-size on :root,\n // breaking body height. Remove after https://github.com/patternfly/patternfly-react/issues/12568\n useLayoutEffect(() => {\n document.documentElement.style.containerType = 'normal';\n }, []);\n\n return <>{children}</>;\n};\n\nconst intelligentAssistantRedirect = AppRootWrapperBlueprint.make({\n name: 'intelligent-assistant-redirect',\n params: {\n component: LightspeedLegacyRedirect,\n },\n});\n\n/**\n * @public\n */\nexport const intelligentAssistantRedirectModule = createFrontendModule({\n pluginId: 'app',\n extensions: [intelligentAssistantRedirect],\n});\n\n/**\n * Lightspeed FAB module\n * @public\n */\nconst intelligentAssistantFABExtension = AppRootWrapperBlueprint.make({\n name: 'intelligent-assistant-fab',\n params: {\n component: ({ children }) => (\n <LightspeedProvider>\n <LightspeedFABComponent />\n {children}\n </LightspeedProvider>\n ),\n },\n});\n\n/**\n * @public\n */\nexport const intelligentAssistantFABModule = createFrontendModule({\n pluginId: 'app',\n extensions: [intelligentAssistantFABExtension, intelligentAssistantRedirect],\n});\n\n/**\n * Translation wiring for the language selector (app-config `app.extensions`).\n *\n * @public\n */\nexport const intelligentAssistantTranslationsModule = createFrontendModule({\n pluginId: 'app',\n extensions: [\n TranslationBlueprint.make({\n name: 'intelligent-assistant-translations',\n params: {\n resource: lightspeedTranslations,\n },\n }),\n ],\n});\n\n/**\n * Lightspeed plugin for the Backstage new frontend system.\n *\n * @public\n */\nexport default createFrontendPlugin({\n pluginId: 'intelligent-assistant',\n extensions: [\n intelligentAssistantApi,\n notebooksApi,\n intelligentAssistantPage,\n intelligentAssistantDrawer,\n ],\n routes: {\n root: nfsRootRouteRef,\n lightspeedConversation: nfsConversationRouteRef,\n },\n});\n"],"names":["ClassNameGenerator","LightspeedChatContainerElement","LightspeedProvider","LightspeedFABComponent"],"mappings":";;;;;;;;;;;;;;;;;AAqDAA,2BAAA,CAAmB,SAAA;AAAA,EAAU,mBAC3B,aAAA,CAAc,UAAA,CAAW,KAAK,CAAA,GAAI,aAAA,GAAgB,MAAM,aAAa,CAAA;AACvE,CAAA;AAEA,MAAM,kBAAkB,cAAA,EAAe;AACvC,MAAM,0BAA0B,iBAAA,CAAkB;AAAA,EAChD,MAAA,EAAQ,eAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAC,CAAA;AAED,MAAM,uBAAA,GAA0B,aAAa,IAAA,CAAK;AAAA,EAChD,IAAA,EAAM,uBAAA;AAAA,EACN,QAAQ,CAAA,YAAA,KACN,YAAA;AAAA,IACE,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,gBAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,SAAA,EAAW,YAAA;AAAA,QACX,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,QAAA,EAAS,KAC9B,IAAI,mBAAA,CAAoB,EAAE,SAAA,EAAW,QAAA,EAAU;AAAA,K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AAAA,EACzE,QAAA,EAAU,KAAA;AAAA,EACV,UAAA,EAAY;AAAA,IACV,qBAAqB,IAAA,CAAK;AAAA,MACxB,IAAA,EAAM,oCAAA;AAAA,MACN,MAAA,EAAQ;AAAA,QACN,QAAA,EAAU;AAAA;AACZ,KACD;AAAA;AAEL,CAAC;AAOD,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,uBAAA;AAAA,EACV,UAAA,EAAY;AAAA,IACV,uBAAA;AAAA,IACA,YAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,eAAA;AAAA,IACN,sBAAA,EAAwB;AAAA;AAE5B,CAAC,CAAA;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/index.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ApiBlueprint,\n configApiRef,\n createApiFactory,\n createFrontendPlugin,\n createRouteRef,\n createSubRouteRef,\n fetchApiRef,\n PageBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nimport { AppDrawerContentBlueprint } from '@red-hat-developer-hub/backstage-plugin-app-react';\n\nimport { lightspeedApiRef } from './api/api';\nimport { LightspeedApiClient } from './api/LightspeedApiClient';\nimport { notebooksApiRef } from './api/notebooksApi';\nimport { NotebooksApiClient } from './api/NotebooksApiClient';\nimport { LIGHTSPEED_APP_DRAWER_ID, LIGHTSPEED_PATH } from './const';\nimport { LazyLightspeedChatDrawerContent } from './lazy/LazyLightspeedChatDrawerContent';\n\nimport './muiClassNameConfig';\n\nconst nfsRootRouteRef = createRouteRef();\nconst nfsConversationRouteRef = createSubRouteRef({\n parent: nfsRootRouteRef,\n path: '/conversation/:conversationId',\n});\n\nconst intelligentAssistantApi = ApiBlueprint.make({\n name: 'intelligent-assistant',\n params: defineParams =>\n defineParams(\n createApiFactory({\n api: lightspeedApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new LightspeedApiClient({ configApi, fetchApi }),\n }),\n ),\n});\n\nconst notebooksApi = ApiBlueprint.make({\n name: 'notebooks',\n params: defineParams =>\n defineParams(\n createApiFactory({\n api: notebooksApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new NotebooksApiClient({ configApi, fetchApi }),\n }),\n ),\n});\n\nconst intelligentAssistantPage = PageBlueprint.make({\n params: {\n path: LIGHTSPEED_PATH,\n routeRef: nfsRootRouteRef,\n noHeader: true,\n loader: () => import('./components/Router').then(m => <m.Router />),\n },\n});\n\nconst intelligentAssistantDrawer = AppDrawerContentBlueprint.make({\n name: 'intelligent-assistant',\n params: {\n id: LIGHTSPEED_APP_DRAWER_ID,\n element: <LazyLightspeedChatDrawerContent />,\n resizable: true,\n defaultWidth: 400,\n priority: 100,\n },\n});\n\n/**\n * Lightspeed plugin for the Backstage new frontend system.\n *\n * @public\n */\nexport default createFrontendPlugin({\n pluginId: 'intelligent-assistant',\n extensions: [\n intelligentAssistantApi,\n notebooksApi,\n intelligentAssistantPage,\n intelligentAssistantDrawer,\n ],\n routes: {\n root: nfsRootRouteRef,\n lightspeedConversation: nfsConversationRouteRef,\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;AAsCA,MAAM,kBAAkB,cAAA,EAAe;AACvC,MAAM,0BAA0B,iBAAA,CAAkB;AAAA,EAChD,MAAA,EAAQ,eAAA;AAAA,EACR,IAAA,EAAM;AACR,CAAC,CAAA;AAED,MAAM,uBAAA,G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,EAAI,wBAAA;AAAA,IACJ,OAAA,sBAAU,+BAAA,EAAA,EAAgC,CAAA;AAAA,IAC1C,SAAA,EAAW,IAAA;AAAA,IACX,YAAA,EAAc,GAAA;AAAA,IACd,QAAA,EAAU;AAAA;AAEd,CAAC,CAAA;AAOD,YAAe,oBAAA,CAAqB;AAAA,EAClC,QAAA,EAAU,uBAAA;AAAA,EACV,UAAA,EAAY;AAAA,IACV,uBAAA;AAAA,IACA,YAAA;AAAA,IACA,wBAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,eAAA;AAAA,IACN,sBAAA,EAAwB;AAAA;AAE5B,CAAC,CAAA;;;;"}
@@ -1,4 +1,12 @@
1
- export { intelligentAssistantFABModule as default } from './index.js';
2
- import 'react';
3
- import '@red-hat-developer-hub/backstage-plugin-app-react';
4
- import '@backstage/frontend-plugin-api';
1
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
+
3
+ /**
4
+ * @public
5
+ */
6
+ declare const intelligentAssistantRedirectModule: _backstage_frontend_plugin_api.FrontendModule;
7
+ /**
8
+ * @public
9
+ */
10
+ declare const intelligentAssistantFABModule: _backstage_frontend_plugin_api.FrontendModule;
11
+
12
+ export { intelligentAssistantFABModule as default, intelligentAssistantRedirectModule };
@@ -1,2 +1,2 @@
1
- export { intelligentAssistantFABModule as default } from './index.esm.js';
1
+ export { intelligentAssistantFABModule as default, intelligentAssistantRedirectModule } from './fabModule.esm.js';
2
2
  //# sourceMappingURL=intelligent-assistant-fab-module.esm.js.map
@@ -1,4 +1,10 @@
1
- export { intelligentAssistantTranslationsModule as default } from './index.js';
2
- import 'react';
3
- import '@red-hat-developer-hub/backstage-plugin-app-react';
4
- import '@backstage/frontend-plugin-api';
1
+ import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
+
3
+ /**
4
+ * Translation wiring for the language selector (app-config `app.extensions`).
5
+ *
6
+ * @public
7
+ */
8
+ declare const intelligentAssistantTranslationsModule: _backstage_frontend_plugin_api.FrontendModule;
9
+
10
+ export { intelligentAssistantTranslationsModule as default };
@@ -1,2 +1,2 @@
1
- export { intelligentAssistantTranslationsModule as default } from './index.esm.js';
1
+ export { intelligentAssistantTranslationsModule as default } from './translationsModule.esm.js';
2
2
  //# sourceMappingURL=intelligent-assistant-translations-module.esm.js.map
@@ -0,0 +1,13 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { lazy, Suspense } from 'react';
3
+ import { ChatLoadingFallback } from '../components/ChatLoadingFallback.esm.js';
4
+
5
+ const LazyLightspeedChatContainer = lazy(
6
+ () => import('../components/LightspeedChatContainer.esm.js').then((m) => ({
7
+ default: m.LightspeedChatContainer
8
+ }))
9
+ );
10
+ const LazyLightspeedChatDrawerContent = () => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(ChatLoadingFallback, {}), children: /* @__PURE__ */ jsx(LazyLightspeedChatContainer, {}) });
11
+
12
+ export { LazyLightspeedChatDrawerContent };
13
+ //# sourceMappingURL=LazyLightspeedChatDrawerContent.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LazyLightspeedChatDrawerContent.esm.js","sources":["../../src/lazy/LazyLightspeedChatDrawerContent.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lazy, Suspense } from 'react';\n\nimport { ChatLoadingFallback } from '../components/ChatLoadingFallback';\n\nconst LazyLightspeedChatContainer = lazy(() =>\n import('../components/LightspeedChatContainer').then(m => ({\n default: m.LightspeedChatContainer,\n })),\n);\n\n/**\n * Thin sync boundary for AppDrawerContentBlueprint — heavy chat UI loads asynchronously.\n */\nexport const LazyLightspeedChatDrawerContent = () => (\n <Suspense fallback={<ChatLoadingFallback />}>\n <LazyLightspeedChatContainer />\n </Suspense>\n);\n"],"names":[],"mappings":";;;;AAoBA,MAAM,2BAAA,GAA8B,IAAA;AAAA,EAAK,MACvC,OAAO,8CAAuC,CAAA,CAAE,KAAK,CAAA,CAAA,MAAM;AAAA,IACzD,SAAS,CAAA,CAAE;AAAA,GACb,CAAE;AACJ,CAAA;AAKO,MAAM,+BAAA,GAAkC,sBAC7C,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,sBAAW,mBAAA,EAAA,EAAoB,CAAA,EACvC,QAAA,kBAAA,GAAA,CAAC,2BAAA,EAAA,EAA4B,CAAA,EAC/B;;;;"}
@@ -0,0 +1,17 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { lazy, Suspense } from 'react';
3
+ import { loadCriticalFabBundle } from '../components/loaders.esm.js';
4
+
5
+ const LazyCriticalFabRoot = lazy(async () => {
6
+ const { LightspeedDrawerProvider, LightspeedFABContent } = await loadCriticalFabBundle();
7
+ return {
8
+ default: ({ children }) => /* @__PURE__ */ jsxs(LightspeedDrawerProvider, { children: [
9
+ /* @__PURE__ */ jsx(LightspeedFABContent, {}),
10
+ children
11
+ ] })
12
+ };
13
+ });
14
+ const LazyLightspeedFabRootWrapper = ({ children }) => /* @__PURE__ */ jsx(Suspense, { fallback: children, children: /* @__PURE__ */ jsx(LazyCriticalFabRoot, { children }) });
15
+
16
+ export { LazyLightspeedFabRootWrapper };
17
+ //# sourceMappingURL=LazyLightspeedFabRootWrapper.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LazyLightspeedFabRootWrapper.esm.js","sources":["../../src/lazy/LazyLightspeedFabRootWrapper.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lazy, Suspense, type ReactNode } from 'react';\n\nimport { loadCriticalFabBundle } from '../components/loaders';\n\nconst LazyCriticalFabRoot = lazy(async () => {\n const { LightspeedDrawerProvider, LightspeedFABContent } =\n await loadCriticalFabBundle();\n\n return {\n default: ({ children }: { children: ReactNode }) => (\n <LightspeedDrawerProvider>\n <LightspeedFABContent />\n {children}\n </LightspeedDrawerProvider>\n ),\n };\n});\n\ntype Props = {\n children: ReactNode;\n};\n\n/**\n * App root wrapper that defers FAB + drawer provider off the sync chunk.\n * DrawerProvider and FABContent share one async chunk via loadCriticalFabBundle().\n */\nexport const LazyLightspeedFabRootWrapper = ({ children }: Props) => (\n <Suspense fallback={children}>\n <LazyCriticalFabRoot>{children}</LazyCriticalFabRoot>\n </Suspense>\n);\n"],"names":[],"mappings":";;;;AAoBA,MAAM,mBAAA,GAAsB,KAAK,YAAY;AAC3C,EAAA,MAAM,EAAE,wBAAA,EAA0B,oBAAA,EAAqB,GACrD,MAAM,qBAAA,EAAsB;AAE9B,EAAA,OAAO;AAAA,IACL,SAAS,CAAC,EAAE,QAAA,EAAS,0BAClB,wBAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,CAAA;AAAA,MACrB;AAAA,KAAA,EACH;AAAA,GAEJ;AACF,CAAC,CAAA;AAUM,MAAM,4BAAA,GAA+B,CAAC,EAAE,QAAA,EAAS,qBACtD,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,EAAU,QAAA,EAClB,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAqB,QAAA,EAAS,CAAA,EACjC;;;;"}
package/dist/legacy.d.ts CHANGED
@@ -23,24 +23,31 @@ declare const LightspeedPage: () => react_jsx_runtime.JSX.Element;
23
23
  * @public
24
24
  */
25
25
  declare const LightspeedDrawerProvider: React.ComponentType<PropsWithChildren>;
26
-
27
26
  /**
27
+ * Lightspeed FAB for global floating action button fot LightspeedAI
28
+ *
28
29
  * @public
29
- * Intelligent Assistant Icon
30
30
  */
31
- declare const LightspeedIcon: () => react_jsx_runtime.JSX.Element;
32
-
31
+ declare const LightspeedFAB: React.ComponentType;
33
32
  /**
33
+ * Lightspeed Drawer State Exposer exposes its drawer state
34
+ *
34
35
  * @public
35
- * Lightspeed Floating action button to open/close the lightspeed chatbot
36
36
  */
37
- declare const LightspeedFAB: () => react_jsx_runtime.JSX.Element | null;
38
-
37
+ declare const LightspeedDrawerStateExposer: ({ onStateChange, }: DrawerStateExposerProps) => null;
39
38
  /**
39
+ * Lightspeed Chat Container component extension
40
+ *
40
41
  * @public
41
42
  */
42
43
  declare const LightspeedChatContainer: () => react_jsx_runtime.JSX.Element;
43
44
 
45
+ /**
46
+ * @public
47
+ * Intelligent Assistant Icon
48
+ */
49
+ declare const LightspeedIcon: () => react_jsx_runtime.JSX.Element;
50
+
44
51
  /**
45
52
  * @public
46
53
  * Partial Lightspeed drawer state exposed to the ApplicationDrawer
@@ -62,14 +69,5 @@ type DrawerStateExposerProps = {
62
69
  */
63
70
  onStateChange: (state: DrawerState) => void;
64
71
  };
65
- /**
66
- * @public
67
- * This exposes LightspeedDrawer's partial context to the ApplicationDrawer
68
- *
69
- * It reads the LightspeedDrawerContext and calls the onStateChange callback with the
70
- * partial state (id, isDrawerOpen, drawerWidth, setDrawerWidth).
71
-
72
- */
73
- declare const LightspeedDrawerStateExposer: ({ onStateChange, }: DrawerStateExposerProps) => null;
74
72
 
75
73
  export { type DrawerState, type DrawerStateExposerProps, LightspeedChatContainer, LightspeedDrawerProvider, LightspeedDrawerStateExposer, LightspeedFAB, LightspeedIcon, LightspeedPage, lightspeedPlugin };
@@ -1,11 +1,4 @@
1
- import { unstable_ClassNameGenerator } from '@mui/material/className';
2
- export { LightspeedDrawerProvider, LightspeedPage, lightspeedPlugin } from './plugin.esm.js';
1
+ import './muiClassNameConfig.esm.js';
2
+ export { LightspeedChatContainer, LightspeedDrawerProvider, LightspeedDrawerStateExposer, LightspeedFAB, LightspeedPage, lightspeedPlugin } from './plugin.esm.js';
3
3
  export { LightspeedIcon } from './components/LightspeedIcon.esm.js';
4
- export { LightspeedFAB } from './components/LightspeedFAB.esm.js';
5
- export { LightspeedChatContainer } from './components/LightspeedChatContainer.esm.js';
6
- export { LightspeedDrawerStateExposer } from './components/LightspeedDrawerStateExposer.esm.js';
7
-
8
- unstable_ClassNameGenerator.configure(
9
- (componentName) => componentName.startsWith("v5-") ? componentName : `v5-${componentName}`
10
- );
11
4
  //# sourceMappingURL=legacy.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.esm.js","sources":["../src/legacy.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\nClassNameGenerator.configure(componentName =>\n componentName.startsWith('v5-') ? componentName : `v5-${componentName}`,\n);\n\nexport {\n lightspeedPlugin,\n LightspeedPage,\n LightspeedDrawerProvider,\n} from './plugin';\nexport { LightspeedIcon } from './components/LightspeedIcon';\nexport { LightspeedFAB } from './components/LightspeedFAB';\nexport { LightspeedChatContainer } from './components/LightspeedChatContainer';\nexport { LightspeedDrawerStateExposer } from './components/LightspeedDrawerStateExposer';\nexport type {\n DrawerStateExposerProps,\n DrawerState,\n} from './components/LightspeedDrawerStateExposer';\n"],"names":["ClassNameGenerator"],"mappings":";;;;;;;AAkBAA,2BAAA,CAAmB,SAAA;AAAA,EAAU,mBAC3B,aAAA,CAAc,UAAA,CAAW,KAAK,CAAA,GAAI,aAAA,GAAgB,MAAM,aAAa,CAAA;AACvE,CAAA"}
1
+ {"version":3,"file":"legacy.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,14 @@
1
+ let loadPromise;
2
+ function loadChatPatternflyStyles() {
3
+ loadPromise ??= Promise.all([
4
+ import('@patternfly/react-core/dist/styles/base-no-reset.css'),
5
+ import('@patternfly/chatbot/dist/css/main.css')
6
+ ]).then(() => void 0).catch((error) => {
7
+ loadPromise = void 0;
8
+ throw error;
9
+ });
10
+ return loadPromise;
11
+ }
12
+
13
+ export { loadChatPatternflyStyles };
14
+ //# sourceMappingURL=loadChatPatternflyStyles.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadChatPatternflyStyles.esm.js","sources":["../src/loadChatPatternflyStyles.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet loadPromise: Promise<void> | undefined;\n\n/**\n * Loads PatternFly chat styles on demand so they are not part of the MF sync graph.\n */\nexport function loadChatPatternflyStyles(): Promise<void> {\n loadPromise ??= Promise.all([\n import('@patternfly/react-core/dist/styles/base-no-reset.css'),\n import('@patternfly/chatbot/dist/css/main.css'),\n ])\n .then(() => undefined)\n .catch(error => {\n loadPromise = undefined;\n throw error;\n });\n return loadPromise;\n}\n"],"names":[],"mappings":"AAgBA,IAAI,WAAA;AAKG,SAAS,wBAAA,GAA0C;AACxD,EAAA,WAAA,KAAgB,QAAQ,GAAA,CAAI;AAAA,IAC1B,OAAO,sDAAsD,CAAA;AAAA,IAC7D,OAAO,uCAAuC;AAAA,GAC/C,CAAA,CACE,IAAA,CAAK,MAAM,MAAS,CAAA,CACpB,MAAM,CAAA,KAAA,KAAS;AACd,IAAA,WAAA,GAAc,MAAA;AACd,IAAA,MAAM,KAAA;AAAA,EACR,CAAC,CAAA;AACH,EAAA,OAAO,WAAA;AACT;;;;"}
@@ -0,0 +1,6 @@
1
+ import { unstable_ClassNameGenerator } from '@mui/material/className';
2
+
3
+ unstable_ClassNameGenerator.configure(
4
+ (componentName) => componentName.startsWith("v5-") ? componentName : `v5-${componentName}`
5
+ );
6
+ //# sourceMappingURL=muiClassNameConfig.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"muiClassNameConfig.esm.js","sources":["../src/muiClassNameConfig.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';\n\nClassNameGenerator.configure(componentName =>\n componentName.startsWith('v5-') ? componentName : `v5-${componentName}`,\n);\n"],"names":["ClassNameGenerator"],"mappings":";;AAkBAA,2BAAA,CAAmB,SAAA;AAAA,EAAU,mBAC3B,aAAA,CAAc,UAAA,CAAW,KAAK,CAAA,GAAI,aAAA,GAAgB,MAAM,aAAa,CAAA;AACvE,CAAA"}
@@ -49,7 +49,7 @@ const LightspeedDrawerProvider = lightspeedPlugin.provide(
49
49
  }
50
50
  })
51
51
  );
52
- lightspeedPlugin.provide(
52
+ const LightspeedFAB = lightspeedPlugin.provide(
53
53
  createComponentExtension({
54
54
  name: "LightspeedFAB",
55
55
  component: {
@@ -57,7 +57,7 @@ lightspeedPlugin.provide(
57
57
  }
58
58
  })
59
59
  );
60
- lightspeedPlugin.provide(
60
+ const LightspeedDrawerStateExposer = lightspeedPlugin.provide(
61
61
  createComponentExtension({
62
62
  name: "LightspeedDrawerStateExposer",
63
63
  component: {
@@ -67,7 +67,7 @@ lightspeedPlugin.provide(
67
67
  }
68
68
  })
69
69
  );
70
- lightspeedPlugin.provide(
70
+ const LightspeedChatContainer = lightspeedPlugin.provide(
71
71
  createComponentExtension({
72
72
  name: "LightspeedChatContainer",
73
73
  component: {
@@ -78,5 +78,5 @@ lightspeedPlugin.provide(
78
78
  })
79
79
  );
80
80
 
81
- export { LightspeedDrawerProvider, LightspeedPage, lightspeedPlugin };
81
+ export { LightspeedChatContainer, LightspeedDrawerProvider, LightspeedDrawerStateExposer, LightspeedFAB, LightspeedPage, lightspeedPlugin };
82
82
  //# sourceMappingURL=plugin.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport {\n configApiRef,\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { lightspeedApiRef } from './api/api';\nimport { LightspeedApiClient } from './api/LightspeedApiClient';\nimport { notebooksApiRef } from './api/notebooksApi';\nimport { NotebooksApiClient } from './api/NotebooksApiClient';\nimport {\n addConversationRouteRef,\n notebooksRouteRef,\n notebookViewRouteRef,\n rootRouteRef,\n} from './routes';\n\n/**\n * Lightspeed Plugin\n * @public\n */\nexport const lightspeedPlugin = createPlugin({\n id: 'intelligent-assistant',\n routes: {\n root: rootRouteRef,\n lightspeedConversation: addConversationRouteRef,\n lightspeedNotebooks: notebooksRouteRef,\n lightspeedNotebookView: notebookViewRouteRef,\n },\n apis: [\n createApiFactory({\n api: lightspeedApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new LightspeedApiClient({ configApi, fetchApi }),\n }),\n createApiFactory({\n api: notebooksApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new NotebooksApiClient({ configApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * Lightspeed Page Router\n * @public\n */\nexport const LightspeedPage = lightspeedPlugin.provide(\n createRoutableExtension({\n name: 'LightspeedPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Lightspeed Drawer Provider\n *\n * @public\n */\nexport const LightspeedDrawerProvider: React.ComponentType<PropsWithChildren> =\n lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerProvider',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerProvider').then(\n m => m.LightspeedDrawerProvider,\n ),\n },\n }),\n );\n\n/**\n * Lightspeed FAB for global floating action button fot LightspeedAI\n *\n * @public\n */\nexport const LightspeedFAB: React.ComponentType = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedFAB',\n component: {\n lazy: () =>\n import('./components/LightspeedFAB').then(m => m.LightspeedFAB),\n },\n }),\n);\n\n/**\n * Lightspeed Drawer State Exposer exposes its drawer state\n *\n * @public\n */\nexport const LightspeedDrawerStateExposer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerStateExposer',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerStateExposer').then(\n m => m.LightspeedDrawerStateExposer,\n ),\n },\n }),\n);\n\n/**\n * Lightspeed Chat Container component extension\n *\n * @public\n */\nexport const LightspeedChatContainer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedChatContainer',\n component: {\n lazy: () =>\n import('./components/LightspeedChatContainer').then(\n m => m.LightspeedChatContainer,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;;;AA0CO,MAAM,mBAAmB,YAAA,CAAa;AAAA,EAC3C,EAAA,EAAI,uBAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,sBAAA,EAAwB,uBAAA;AAAA,IACxB,mBAAA,EAAqB,iBAAA;AAAA,IACrB,sBAAA,EAAwB;AAAA,GAC1B;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,gBAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,SAAA,EAAW,YAAA;AAAA,QACX,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,QAAA,EAAS,KAC9B,IAAI,mBAAA,CAAoB,EAAE,SAAA,EAAW,QAAA,EAAU;AAAA,KAClD,CAAA;AAAA,IACD,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,eAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,SAAA,EAAW,YAAA;AAAA,QACX,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,QAAA,EAAS,KAC9B,IAAI,kBAAA,CAAmB,EAAE,SAAA,EAAW,QAAA,EAAU;AAAA,KACjD;AAAA;AAEL,CAAC;AAMM,MAAM,iBAAiB,gBAAA,CAAiB,OAAA;AAAA,EAC7C,uBAAA,CAAwB;AAAA,IACtB,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,4BAAqB,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACjE,UAAA,EAAY;AAAA,GACb;AACH;AAOO,MAAM,2BACX,gBAAA,CAAiB,OAAA;AAAA,EACf,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,0BAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,8CAAuC,CAAA,CAAE,IAAA;AAAA,QAC9C,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;AAOgD,gBAAA,CAAiB,OAAA;AAAA,EACjE,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,eAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,mCAA4B,EAAE,IAAA,CAAK,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAClE,GACD;AACH;AAO4C,gBAAA,CAAiB,OAAA;AAAA,EAC3D,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,8BAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,kDAA2C,CAAA,CAAE,IAAA;AAAA,QAClD,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;AAOuC,gBAAA,CAAiB,OAAA;AAAA,EACtD,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,yBAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,6CAAsC,CAAA,CAAE,IAAA;AAAA,QAC7C,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PropsWithChildren } from 'react';\n\nimport {\n configApiRef,\n createApiFactory,\n createComponentExtension,\n createPlugin,\n createRoutableExtension,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { lightspeedApiRef } from './api/api';\nimport { LightspeedApiClient } from './api/LightspeedApiClient';\nimport { notebooksApiRef } from './api/notebooksApi';\nimport { NotebooksApiClient } from './api/NotebooksApiClient';\nimport {\n addConversationRouteRef,\n notebooksRouteRef,\n notebookViewRouteRef,\n rootRouteRef,\n} from './routes';\n\n/**\n * Lightspeed Plugin\n * @public\n */\nexport const lightspeedPlugin = createPlugin({\n id: 'intelligent-assistant',\n routes: {\n root: rootRouteRef,\n lightspeedConversation: addConversationRouteRef,\n lightspeedNotebooks: notebooksRouteRef,\n lightspeedNotebookView: notebookViewRouteRef,\n },\n apis: [\n createApiFactory({\n api: lightspeedApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new LightspeedApiClient({ configApi, fetchApi }),\n }),\n createApiFactory({\n api: notebooksApiRef,\n deps: {\n configApi: configApiRef,\n fetchApi: fetchApiRef,\n },\n factory: ({ configApi, fetchApi }) =>\n new NotebooksApiClient({ configApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * Lightspeed Page Router\n * @public\n */\nexport const LightspeedPage = lightspeedPlugin.provide(\n createRoutableExtension({\n name: 'LightspeedPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n\n/**\n * Lightspeed Drawer Provider\n *\n * @public\n */\nexport const LightspeedDrawerProvider: React.ComponentType<PropsWithChildren> =\n lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerProvider',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerProvider').then(\n m => m.LightspeedDrawerProvider,\n ),\n },\n }),\n );\n\n/**\n * Lightspeed FAB for global floating action button fot LightspeedAI\n *\n * @public\n */\nexport const LightspeedFAB: React.ComponentType = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedFAB',\n component: {\n lazy: () =>\n import('./components/LightspeedFAB').then(m => m.LightspeedFAB),\n },\n }),\n);\n\n/**\n * Lightspeed Drawer State Exposer exposes its drawer state\n *\n * @public\n */\nexport const LightspeedDrawerStateExposer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedDrawerStateExposer',\n component: {\n lazy: () =>\n import('./components/LightspeedDrawerStateExposer').then(\n m => m.LightspeedDrawerStateExposer,\n ),\n },\n }),\n);\n\n/**\n * Lightspeed Chat Container component extension\n *\n * @public\n */\nexport const LightspeedChatContainer = lightspeedPlugin.provide(\n createComponentExtension({\n name: 'LightspeedChatContainer',\n component: {\n lazy: () =>\n import('./components/LightspeedChatContainer').then(\n m => m.LightspeedChatContainer,\n ),\n },\n }),\n);\n"],"names":[],"mappings":";;;;;;;AA0CO,MAAM,mBAAmB,YAAA,CAAa;AAAA,EAC3C,EAAA,EAAI,uBAAA;AAAA,EACJ,MAAA,EAAQ;AAAA,IACN,IAAA,EAAM,YAAA;AAAA,IACN,sBAAA,EAAwB,uBAAA;AAAA,IACxB,mBAAA,EAAqB,iBAAA;AAAA,IACrB,sBAAA,EAAwB;AAAA,GAC1B;AAAA,EACA,IAAA,EAAM;AAAA,IACJ,gBAAA,CAAiB;AAAA,MACf,GAAA,EAAK,gBAAA;AAAA,MACL,IAAA,EAAM;AAAA,QACJ,SAAA,EAAW,YAAA;AAAA,QACX,QAAA,EAAU;AAAA,OACZ;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,SAAA,EAAW,QAAA,EAAS,KAC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C,CAAA,CAAE,IAAA;AAAA,QAClD,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;AAOO,MAAM,0BAA0B,gBAAA,CAAiB,OAAA;AAAA,EACtD,wBAAA,CAAyB;AAAA,IACvB,IAAA,EAAM,yBAAA;AAAA,IACN,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,MACJ,OAAO,6CAAsC,CAAA,CAAE,IAAA;AAAA,QAC7C,OAAK,CAAA,CAAE;AAAA;AACT;AACJ,GACD;AACH;;;;"}
@@ -0,0 +1,18 @@
1
+ import { createFrontendModule } from '@backstage/frontend-plugin-api';
2
+ import { TranslationBlueprint } from '@backstage/plugin-app-react';
3
+ import { lightspeedTranslations } from './translations/index.esm.js';
4
+
5
+ const intelligentAssistantTranslationsModule = createFrontendModule({
6
+ pluginId: "app",
7
+ extensions: [
8
+ TranslationBlueprint.make({
9
+ name: "intelligent-assistant-translations",
10
+ params: {
11
+ resource: lightspeedTranslations
12
+ }
13
+ })
14
+ ]
15
+ });
16
+
17
+ export { intelligentAssistantTranslationsModule };
18
+ //# sourceMappingURL=translationsModule.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translationsModule.esm.js","sources":["../src/translationsModule.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createFrontendModule } from '@backstage/frontend-plugin-api';\nimport { TranslationBlueprint } from '@backstage/plugin-app-react';\n\nimport { lightspeedTranslations } from './translations';\n\n/**\n * Translation wiring for the language selector (app-config `app.extensions`).\n *\n * @public\n */\nexport const intelligentAssistantTranslationsModule = createFrontendModule({\n pluginId: 'app',\n extensions: [\n TranslationBlueprint.make({\n name: 'intelligent-assistant-translations',\n params: {\n resource: lightspeedTranslations,\n },\n }),\n ],\n});\n"],"names":[],"mappings":";;;;AA0BO,MAAM,yCAAyC,oBAAA,CAAqB;AAAA,EACzE,QAAA,EAAU,KAAA;AAAA,EACV,UAAA,EAAY;AAAA,IACV,qBAAqB,IAAA,CAAK;AAAA,MACxB,IAAA,EAAM,oCAAA;AAAA,MACN,MAAA,EAAQ;AAAA,QACN,QAAA,EAAU;AAAA;AACZ,KACD;AAAA;AAEL,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SourcesCardProps } from '@patternfly/chatbot';\nimport { AlertProps } from '@patternfly/react-core';\n\nexport type Conversations = {\n [key: string]: {\n user: string;\n bot: string;\n model: string;\n loading: boolean;\n timestamp: string;\n botTimestamp: string;\n error?: AlertProps;\n };\n};\n\n/**\n * @public\n * Referenced document metadata\n */\nexport type ReferencedDocument = {\n doc_title: string;\n doc_url: string;\n doc_description?: string;\n source?: string;\n};\n\n/**\n * @public\n * List of referenced documents\n */\nexport type ReferencedDocuments = ReferencedDocument[];\n\n/**\n * @public\n * LCS model type - embedding or llm\n */\nexport type LCSModelType = 'embedding' | 'llm';\n\n/**\n * @public\n * LCS model API model type\n */\nexport type LCSModelApiModelType = 'embedding' | 'llm';\n\n/**\n * @public\n * LCS Model interface\n */\nexport interface LCSModel {\n identifier: string;\n metadata: {\n embedding_dimension: number;\n };\n api_model_type: LCSModelApiModelType;\n provider_id: string;\n type: 'model';\n provider_resource_id: string;\n model_type: LCSModelType;\n /**\n * Whether the model supports vision (JPEG image) input, set by the backend\n * GET /v1/models handler; absent if capability could not be determined.\n */\n supportsVision?: boolean;\n}\nexport interface LCSConversation {\n provider: string;\n model: string;\n messages: BaseMessage[];\n started_at: string;\n completed_at: string;\n referenced_documents?: ReferencedDocuments;\n}\n\nexport interface LCSShield {\n identifier: string;\n provider_id: string;\n type: 'shield';\n params: {};\n provider_resource_id: string;\n}\n\n/**\n * @public\n * Base message interface for chat messages\n */\nexport interface BaseMessage {\n name: string;\n type: string;\n id: number;\n content: string;\n model: string;\n timestamp: string;\n sources?: SourcesCardProps;\n referenced_documents?: ReferencedDocuments;\n error?: AlertProps;\n}\n\n/**\n * @public\n * Conversation summary type\n */\nexport type ConversationSummary = {\n conversation_id: string;\n last_message_timestamp: number;\n topic_summary: string | null;\n};\n\nexport enum SupportedFileType {\n JSON = 'application/json',\n YAML = 'application/x-yaml',\n TEXT = 'text/plain',\n}\nexport interface FileContent {\n content: string;\n type: string;\n name: string;\n}\n\n/**\n * @public\n * Attachment type for file attachments in chat messages\n */\nexport type Attachment = {\n attachment_type: string;\n content_type: string;\n content: string;\n};\n\n/**\n * @public\n * List of conversation summaries\n */\nexport type ConversationList = ConversationSummary[];\n\nexport type SamplePrompt =\n | {\n title: string;\n message: string;\n }\n | {\n titleKey: string;\n messageKey: string;\n };\n\nexport type SamplePrompts = SamplePrompt[];\n\n/**\n * @public\n * Feedback capture payload for user feedback on AI responses\n */\nexport type CaptureFeedback = {\n conversation_id: string;\n user_question: string;\n llm_response: string;\n user_feedback: string;\n sentiment: number;\n};\n\n// Tool Calling Types\nexport interface ToolCall {\n id: number | string;\n toolName: string;\n description?: string;\n arguments: Record<string, any>;\n response?: string;\n startTime: number;\n endTime?: number;\n executionTime?: number; // in seconds\n isLoading: boolean;\n}\n\nexport interface ToolCallEvent {\n id: number | string;\n token?: string | { tool_name: string; arguments: Record<string, any> };\n name?: string;\n args?: Record<string, any>;\n arguments?: Record<string, any>;\n type?: string;\n}\n\nexport interface ToolResultEvent {\n id: number | string;\n token?: { tool_name: string; response: string };\n status?: string;\n content?: string;\n}\n\n/**\n * @public\n * Notebook session metadata from AI Notebooks API\n */\nexport type NotebookSessionMetadata = {\n category?: string;\n tags?: string[];\n project?: string;\n document_ids?: string[];\n conversation_id?: string;\n};\n\n/**\n * @public\n * Notebook session from AI Notebooks API\n */\nexport type NotebookSession = {\n session_id: string;\n user_id: string;\n name: string;\n description?: string;\n created_at: string;\n updated_at: string;\n document_count?: number;\n metadata?: NotebookSessionMetadata;\n};\n\n/**\n * @public\n * Supported file types for notebook document uploads\n */\nexport type NotebookDocumentSourceType =\n 'text' | 'pdf' | 'md' | 'json' | 'yaml' | 'log';\n\n/**\n * @public\n * Document within a notebook session\n */\nexport type SessionDocument = {\n document_id: string;\n title: string;\n session_id: string;\n user_id: string;\n source_type: NotebookDocumentSourceType;\n created_at: string;\n metadata?: Record<string, any>;\n};\n\n/**\n * @public\n * Response from the document upload endpoint (HTTP 202)\n */\nexport type UploadDocumentResponse = {\n status: 'processing';\n document_id: string;\n session_id: string;\n message: string;\n};\n\n/**\n * @public\n * Document processing status from the status polling endpoint\n */\nexport type DocumentStatus = {\n status: 'in_progress' | 'completed' | 'failed' | 'cancelled';\n document_id: string;\n session_id: string;\n error?: string;\n};\n\n/**\n * @public\n * Response wrapper for session creation\n */\nexport type SessionResponse = {\n status: 'success' | 'error';\n session?: NotebookSession;\n message?: string;\n error?: string;\n};\n\n/**\n * @public\n * Response wrapper for document list\n */\nexport type DocumentListResponse = {\n status: 'success' | 'error';\n session_id?: string;\n documents?: SessionDocument[];\n count?: number;\n error?: string;\n};\n"],"names":["SupportedFileType"],"mappings":"AA2HO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACL,EAAAA,mBAAA,MAAA,CAAA,GAAO,kBAAA;AACP,EAAAA,mBAAA,MAAA,CAAA,GAAO,oBAAA;AACP,EAAAA,mBAAA,MAAA,CAAA,GAAO,YAAA;AAHG,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA;;;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SourcesCardProps } from '@patternfly/chatbot';\nimport type { AlertProps } from '@patternfly/react-core';\n\nexport type Conversations = {\n [key: string]: {\n user: string;\n bot: string;\n model: string;\n loading: boolean;\n timestamp: string;\n botTimestamp: string;\n error?: AlertProps;\n };\n};\n\n/**\n * @public\n * Referenced document metadata\n */\nexport type ReferencedDocument = {\n doc_title: string;\n doc_url: string;\n doc_description?: string;\n source?: string;\n};\n\n/**\n * @public\n * List of referenced documents\n */\nexport type ReferencedDocuments = ReferencedDocument[];\n\n/**\n * @public\n * LCS model type - embedding or llm\n */\nexport type LCSModelType = 'embedding' | 'llm';\n\n/**\n * @public\n * LCS model API model type\n */\nexport type LCSModelApiModelType = 'embedding' | 'llm';\n\n/**\n * @public\n * LCS Model interface\n */\nexport interface LCSModel {\n identifier: string;\n metadata: {\n embedding_dimension: number;\n };\n api_model_type: LCSModelApiModelType;\n provider_id: string;\n type: 'model';\n provider_resource_id: string;\n model_type: LCSModelType;\n /**\n * Whether the model supports vision (JPEG image) input, set by the backend\n * GET /v1/models handler; absent if capability could not be determined.\n */\n supportsVision?: boolean;\n}\nexport interface LCSConversation {\n provider: string;\n model: string;\n messages: BaseMessage[];\n started_at: string;\n completed_at: string;\n referenced_documents?: ReferencedDocuments;\n}\n\nexport interface LCSShield {\n identifier: string;\n provider_id: string;\n type: 'shield';\n params: {};\n provider_resource_id: string;\n}\n\n/**\n * @public\n * Base message interface for chat messages\n */\nexport interface BaseMessage {\n name: string;\n type: string;\n id: number;\n content: string;\n model: string;\n timestamp: string;\n sources?: SourcesCardProps;\n referenced_documents?: ReferencedDocuments;\n error?: AlertProps;\n}\n\n/**\n * @public\n * Conversation summary type\n */\nexport type ConversationSummary = {\n conversation_id: string;\n last_message_timestamp: number;\n topic_summary: string | null;\n};\n\nexport enum SupportedFileType {\n JSON = 'application/json',\n YAML = 'application/x-yaml',\n TEXT = 'text/plain',\n}\nexport interface FileContent {\n content: string;\n type: string;\n name: string;\n}\n\n/**\n * @public\n * Attachment type for file attachments in chat messages\n */\nexport type Attachment = {\n attachment_type: string;\n content_type: string;\n content: string;\n};\n\n/**\n * @public\n * List of conversation summaries\n */\nexport type ConversationList = ConversationSummary[];\n\nexport type SamplePrompt =\n | {\n title: string;\n message: string;\n }\n | {\n titleKey: string;\n messageKey: string;\n };\n\nexport type SamplePrompts = SamplePrompt[];\n\n/**\n * @public\n * Feedback capture payload for user feedback on AI responses\n */\nexport type CaptureFeedback = {\n conversation_id: string;\n user_question: string;\n llm_response: string;\n user_feedback: string;\n sentiment: number;\n};\n\n// Tool Calling Types\nexport interface ToolCall {\n id: number | string;\n toolName: string;\n description?: string;\n arguments: Record<string, any>;\n response?: string;\n startTime: number;\n endTime?: number;\n executionTime?: number; // in seconds\n isLoading: boolean;\n}\n\nexport interface ToolCallEvent {\n id: number | string;\n token?: string | { tool_name: string; arguments: Record<string, any> };\n name?: string;\n args?: Record<string, any>;\n arguments?: Record<string, any>;\n type?: string;\n}\n\nexport interface ToolResultEvent {\n id: number | string;\n token?: { tool_name: string; response: string };\n status?: string;\n content?: string;\n}\n\n/**\n * @public\n * Notebook session metadata from AI Notebooks API\n */\nexport type NotebookSessionMetadata = {\n category?: string;\n tags?: string[];\n project?: string;\n document_ids?: string[];\n conversation_id?: string;\n};\n\n/**\n * @public\n * Notebook session from AI Notebooks API\n */\nexport type NotebookSession = {\n session_id: string;\n user_id: string;\n name: string;\n description?: string;\n created_at: string;\n updated_at: string;\n document_count?: number;\n metadata?: NotebookSessionMetadata;\n};\n\n/**\n * @public\n * Supported file types for notebook document uploads\n */\nexport type NotebookDocumentSourceType =\n 'text' | 'pdf' | 'md' | 'json' | 'yaml' | 'log';\n\n/**\n * @public\n * Document within a notebook session\n */\nexport type SessionDocument = {\n document_id: string;\n title: string;\n session_id: string;\n user_id: string;\n source_type: NotebookDocumentSourceType;\n created_at: string;\n metadata?: Record<string, any>;\n};\n\n/**\n * @public\n * Response from the document upload endpoint (HTTP 202)\n */\nexport type UploadDocumentResponse = {\n status: 'processing';\n document_id: string;\n session_id: string;\n message: string;\n};\n\n/**\n * @public\n * Document processing status from the status polling endpoint\n */\nexport type DocumentStatus = {\n status: 'in_progress' | 'completed' | 'failed' | 'cancelled';\n document_id: string;\n session_id: string;\n error?: string;\n};\n\n/**\n * @public\n * Response wrapper for session creation\n */\nexport type SessionResponse = {\n status: 'success' | 'error';\n session?: NotebookSession;\n message?: string;\n error?: string;\n};\n\n/**\n * @public\n * Response wrapper for document list\n */\nexport type DocumentListResponse = {\n status: 'success' | 'error';\n session_id?: string;\n documents?: SessionDocument[];\n count?: number;\n error?: string;\n};\n"],"names":["SupportedFileType"],"mappings":"AA2HO,IAAK,iBAAA,qBAAAA,kBAAAA,KAAL;AACL,EAAAA,mBAAA,MAAA,CAAA,GAAO,kBAAA;AACP,EAAAA,mBAAA,MAAA,CAAA,GAAO,oBAAA;AACP,EAAAA,mBAAA,MAAA,CAAA,GAAO,YAAA;AAHG,EAAA,OAAAA,kBAAAA;AAAA,CAAA,EAAA,iBAAA,IAAA,EAAA;;;;"}