@burtson-labs/bandit-engine 2.0.162 → 2.0.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -22
- package/dist/aiProviderStore-PEGSX4PK.mjs +9 -0
- package/dist/chat-OSAVW6L2.mjs +16 -0
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +7 -7
- package/dist/{chunk-ZNK3ELTZ.mjs → chunk-5KBTOCQZ.mjs} +4 -4
- package/dist/chunk-5KBTOCQZ.mjs.map +1 -0
- package/dist/{chunk-Q6LXVYTC.mjs → chunk-CQJGUYRW.mjs} +2 -2
- package/dist/chunk-CQJGUYRW.mjs.map +1 -0
- package/dist/{chunk-47MOBOP3.mjs → chunk-IZX2J65Q.mjs} +2 -2
- package/dist/chunk-IZX2J65Q.mjs.map +1 -0
- package/dist/{chunk-ODGVCSKV.mjs → chunk-J6SWNO7Z.mjs} +6 -27
- package/dist/chunk-J6SWNO7Z.mjs.map +1 -0
- package/dist/{chunk-3ACT5BTW.mjs → chunk-JYBQAKSZ.mjs} +125 -232
- package/dist/chunk-JYBQAKSZ.mjs.map +1 -0
- package/dist/{chunk-G5POQT2R.mjs → chunk-O6P37PFR.mjs} +4 -4
- package/dist/chunk-O6P37PFR.mjs.map +1 -0
- package/dist/{chunk-KCI46M23.mjs → chunk-OCVZVBQQ.mjs} +1 -1
- package/dist/chunk-OCVZVBQQ.mjs.map +1 -0
- package/dist/{chunk-IXIM7BNO.mjs → chunk-P4C5IRM5.mjs} +1 -1
- package/dist/chunk-P4C5IRM5.mjs.map +1 -0
- package/dist/{chunk-RUXYVMW2.mjs → chunk-PNQRS5EN.mjs} +11 -11
- package/dist/chunk-PNQRS5EN.mjs.map +1 -0
- package/dist/{chunk-WQEBTH2R.mjs → chunk-TY5VL3SG.mjs} +3 -3
- package/dist/chunk-TY5VL3SG.mjs.map +1 -0
- package/dist/{chunk-YHSYHU5P.mjs → chunk-URZSIL7X.mjs} +7 -7
- package/dist/chunk-URZSIL7X.mjs.map +1 -0
- package/dist/{chunk-OGMXL7BF.mjs → chunk-VBHI4TJC.mjs} +6 -6
- package/dist/chunk-VBHI4TJC.mjs.map +1 -0
- package/dist/{chunk-R6HMLYKQ.mjs → chunk-WLNZL6SP.mjs} +5 -16
- package/dist/chunk-WLNZL6SP.mjs.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +577 -728
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -31
- package/dist/index.mjs.map +1 -1
- package/dist/management/management.js +217 -352
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +10 -10
- package/dist/{memoryUtils-33TZKHSQ.mjs → memoryUtils-2FVXDSS6.mjs} +1 -1
- package/dist/memoryUtils-2FVXDSS6.mjs.map +1 -0
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +6 -6
- package/dist/modelStore-7XYYDCNC.mjs +9 -0
- package/dist/shared/custom-element.js.map +1 -1
- package/dist/shared/custom-element.mjs +1 -1
- package/docs/05_contributing.md +1 -1
- package/docs/api_reference/assets/navigation.js +1 -1
- package/docs/api_reference/assets/search.js +1 -1
- package/docs/api_reference/classes/DebugLogger.html +11 -11
- package/docs/api_reference/classes/FeatureFlagService.html +13 -13
- package/docs/api_reference/classes/NotificationService.html +10 -10
- package/docs/api_reference/classes/StreamingTTSClient.html +9 -9
- package/docs/api_reference/classes/VectorDatabaseService.html +24 -24
- package/docs/api_reference/classes/VectorMigrationService.html +8 -8
- package/docs/api_reference/classes/VoiceService.html +2 -2
- package/docs/api_reference/enums/TTSState.html +2 -2
- package/docs/api_reference/functions/Chat.html +1 -1
- package/docs/api_reference/functions/ChatModal.html +1 -1
- package/docs/api_reference/functions/ChatProvider.html +1 -1
- package/docs/api_reference/functions/FeatureFlagProvider.html +1 -1
- package/docs/api_reference/functions/FeedbackButton.html +1 -1
- package/docs/api_reference/functions/FeedbackModal.html +1 -1
- package/docs/api_reference/functions/InterestsEditor.html +5 -0
- package/docs/api_reference/functions/Management.html +1 -1
- package/docs/api_reference/functions/NotificationProvider.html +1 -1
- package/docs/api_reference/functions/SubscriptionExpiredGuard.html +1 -1
- package/docs/api_reference/functions/SubscriptionExpiredModal.html +1 -1
- package/docs/api_reference/functions/defineCustomElement.html +1 -1
- package/docs/api_reference/functions/getCriticalConfig.html +2 -1
- package/docs/api_reference/functions/getFeatureMatrix.html +1 -1
- package/docs/api_reference/functions/getStreamingTTSClient.html +1 -1
- package/docs/api_reference/functions/getSystemConstants.html +2 -1
- package/docs/api_reference/functions/getTTSState.html +1 -1
- package/docs/api_reference/functions/handleHttpError.html +1 -1
- package/docs/api_reference/functions/handleSubscriptionUpgrade.html +1 -1
- package/docs/api_reference/functions/handleValidationError.html +1 -1
- package/docs/api_reference/functions/initializeCoreSystem.html +2 -1
- package/docs/api_reference/functions/isWorkspaceAdminRole.html +6 -0
- package/docs/api_reference/functions/pauseTTS.html +1 -1
- package/docs/api_reference/functions/previewTierUpgrade.html +1 -1
- package/docs/api_reference/functions/resolveManagementSections.html +2 -0
- package/docs/api_reference/functions/resumeTTS.html +1 -1
- package/docs/api_reference/functions/showInfoNotification.html +1 -1
- package/docs/api_reference/functions/showSuccessNotification.html +1 -1
- package/docs/api_reference/functions/speakWithStreaming.html +1 -1
- package/docs/api_reference/functions/stopTTS.html +1 -1
- package/docs/api_reference/functions/syncSubscriptionWithAPI.html +1 -1
- package/docs/api_reference/functions/updateSubscriptionTier.html +1 -1
- package/docs/api_reference/functions/useFeatureFlag.html +1 -1
- package/docs/api_reference/functions/useFeatureVisibility.html +1 -1
- package/docs/api_reference/functions/useFeatures.html +1 -1
- package/docs/api_reference/functions/useGatewayHealth.html +1 -1
- package/docs/api_reference/functions/useGatewayMemory.html +1 -1
- package/docs/api_reference/functions/useGatewayModels.html +1 -1
- package/docs/api_reference/functions/useGlobalTTS.html +1 -1
- package/docs/api_reference/functions/useManagementAccess.html +2 -0
- package/docs/api_reference/functions/useNotification.html +1 -1
- package/docs/api_reference/functions/useNotificationService.html +1 -1
- package/docs/api_reference/functions/useTTS.html +1 -1
- package/docs/api_reference/functions/useVectorStore.html +1 -1
- package/docs/api_reference/functions/useVoiceStore.html +2 -2
- package/docs/api_reference/functions/useVoices.html +1 -1
- package/docs/api_reference/functions/validateEnvironment.html +2 -1
- package/docs/api_reference/functions/validateSystemIntegrity.html +2 -1
- package/docs/api_reference/index.html +219 -155
- package/docs/api_reference/interfaces/AIChatRequest.html +2 -2
- package/docs/api_reference/interfaces/AIChatResponse.html +2 -2
- package/docs/api_reference/interfaces/AIGenerateRequest.html +2 -2
- package/docs/api_reference/interfaces/AIGenerateResponse.html +2 -2
- package/docs/api_reference/interfaces/AIMessage.html +2 -2
- package/docs/api_reference/interfaces/AIModel.html +2 -2
- package/docs/api_reference/interfaces/AIProviderConfig.html +5 -2
- package/docs/api_reference/interfaces/ChatConfig.html +3 -3
- package/docs/api_reference/interfaces/ChatModalProps.html +3 -3
- package/docs/api_reference/interfaces/CreateMemoryOptions.html +2 -2
- package/docs/api_reference/interfaces/FeatureEvaluation.html +7 -7
- package/docs/api_reference/interfaces/FeatureFlagConfig.html +9 -9
- package/docs/api_reference/interfaces/FeatureFlagContextValue.html +8 -8
- package/docs/api_reference/interfaces/FeatureFlagProviderProps.html +2 -2
- package/docs/api_reference/interfaces/FeedbackButtonProps.html +10 -10
- package/docs/api_reference/interfaces/FeedbackCategories.html +2 -2
- package/docs/api_reference/interfaces/FeedbackModalProps.html +2 -2
- package/docs/api_reference/interfaces/FeedbackPriorities.html +2 -2
- package/docs/api_reference/interfaces/FeedbackRequest.html +2 -2
- package/docs/api_reference/interfaces/FeedbackResponse.html +2 -2
- package/docs/api_reference/interfaces/FileUploadResult.html +2 -2
- package/docs/api_reference/interfaces/GatewayChatRequest.html +3 -2
- package/docs/api_reference/interfaces/GatewayChatResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayContract.html +2 -2
- package/docs/api_reference/interfaces/GatewayGenerateRequest.html +2 -2
- package/docs/api_reference/interfaces/GatewayGenerateResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayHealthResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayMemoryRecord.html +2 -2
- package/docs/api_reference/interfaces/GatewayMemoryResponse.html +2 -2
- package/docs/api_reference/interfaces/GatewayMessage.html +2 -2
- package/docs/api_reference/interfaces/GatewayMessageContent.html +2 -2
- package/docs/api_reference/interfaces/GatewayModel.html +2 -2
- package/docs/api_reference/interfaces/GatewayModelsResponse.html +2 -2
- package/docs/api_reference/interfaces/ManagementAccess.html +5 -0
- package/docs/api_reference/interfaces/ManagementAccessInput.html +5 -0
- package/docs/api_reference/interfaces/ManagementLink.html +7 -0
- package/docs/api_reference/interfaces/ManagementProps.html +22 -0
- package/docs/api_reference/interfaces/ManagementSectionDef.html +10 -0
- package/docs/api_reference/interfaces/MemorySearchFilters.html +2 -2
- package/docs/api_reference/interfaces/MigrationProgress.html +2 -2
- package/docs/api_reference/interfaces/MigrationStatus.html +2 -2
- package/docs/api_reference/interfaces/NotificationConfig.html +2 -2
- package/docs/api_reference/interfaces/NotificationContextType.html +2 -2
- package/docs/api_reference/interfaces/NotificationProviderProps.html +2 -2
- package/docs/api_reference/interfaces/PackageSettings.html +11 -2
- package/docs/api_reference/interfaces/SearchOptions.html +2 -2
- package/docs/api_reference/interfaces/SearchResult.html +2 -2
- package/docs/api_reference/interfaces/SubscriptionExpiredGuardProps.html +2 -2
- package/docs/api_reference/interfaces/SubscriptionExpiredModalProps.html +2 -2
- package/docs/api_reference/interfaces/TTSOptions.html +2 -2
- package/docs/api_reference/interfaces/TTSProgress.html +2 -2
- package/docs/api_reference/interfaces/TrialUsage.html +2 -2
- package/docs/api_reference/interfaces/UploadRequest.html +3 -3
- package/docs/api_reference/interfaces/UseTTSReturn.html +2 -2
- package/docs/api_reference/interfaces/VectorDocument.html +2 -2
- package/docs/api_reference/interfaces/VectorMemory.html +2 -2
- package/docs/api_reference/interfaces/VectorMemoryMetadata.html +2 -2
- package/docs/api_reference/interfaces/VectorStoreStatus.html +2 -2
- package/docs/api_reference/interfaces/VoiceModelsResponse.html +2 -2
- package/docs/api_reference/interfaces/VoiceState.html +2 -2
- package/docs/api_reference/media/PROTECTION-NOTICE.md +6 -55
- package/docs/api_reference/media/README.md +20 -1
- package/docs/api_reference/modules.html +18 -6
- package/docs/api_reference/types/FeatureKey.html +1 -1
- package/docs/api_reference/types/FeatureMatrix.html +1 -1
- package/docs/api_reference/types/GatewayQueryOptions.html +1 -1
- package/docs/api_reference/types/LogContext.html +1 -1
- package/docs/api_reference/types/ManagementRequest.html +1 -0
- package/docs/api_reference/types/ManagementSectionId.html +2 -0
- package/docs/api_reference/types/SubscriptionTier.html +1 -1
- package/docs/api_reference/variables/DEFAULT_TIER_FEATURES.html +1 -1
- package/docs/api_reference/variables/FeatureFlagContext.html +1 -1
- package/docs/api_reference/variables/MANAGEMENT_SECTIONS.html +1 -0
- package/docs/api_reference/variables/OSS_DEFAULT_FEATURES.html +1 -1
- package/docs/api_reference/variables/SYSTEM_FLAGS.html +2 -1
- package/docs/api_reference/variables/authenticationService.html +1 -1
- package/docs/api_reference/variables/debugLogger-1.html +1 -1
- package/docs/api_reference/variables/featureFlagService-1.html +1 -1
- package/docs/api_reference/variables/notificationService-1.html +1 -1
- package/docs/api_reference/variables/vectorDatabaseService-1.html +1 -1
- package/docs/api_reference/variables/vectorMigrationService-1.html +1 -1
- package/docs/api_reference/variables/voiceService-1.html +1 -1
- package/package.json +1 -1
- package/dist/aiProviderStore-JOB2H4LP.mjs +0 -9
- package/dist/chat-LB6UEEEW.mjs +0 -16
- package/dist/chunk-3ACT5BTW.mjs.map +0 -1
- package/dist/chunk-47MOBOP3.mjs.map +0 -1
- package/dist/chunk-G5POQT2R.mjs.map +0 -1
- package/dist/chunk-IXIM7BNO.mjs.map +0 -1
- package/dist/chunk-KCI46M23.mjs.map +0 -1
- package/dist/chunk-ODGVCSKV.mjs.map +0 -1
- package/dist/chunk-OGMXL7BF.mjs.map +0 -1
- package/dist/chunk-Q6LXVYTC.mjs.map +0 -1
- package/dist/chunk-R6HMLYKQ.mjs.map +0 -1
- package/dist/chunk-RUXYVMW2.mjs.map +0 -1
- package/dist/chunk-WQEBTH2R.mjs.map +0 -1
- package/dist/chunk-YHSYHU5P.mjs.map +0 -1
- package/dist/chunk-ZNK3ELTZ.mjs.map +0 -1
- package/dist/memoryUtils-33TZKHSQ.mjs.map +0 -1
- package/dist/modelStore-FGUGOWTL.mjs +0 -9
- package/docs/api_reference/media/PROTECTION-README.md +0 -39
- /package/dist/{aiProviderStore-JOB2H4LP.mjs.map → aiProviderStore-PEGSX4PK.mjs.map} +0 -0
- /package/dist/{chat-LB6UEEEW.mjs.map → chat-OSAVW6L2.mjs.map} +0 -0
- /package/dist/{modelStore-FGUGOWTL.mjs.map → modelStore-7XYYDCNC.mjs.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/StreamingMarkdown.tsx","../src/utils/installedApp.ts"],"sourcesContent":["/*\n * Copyright (c) 2025 Burtson Labs LLC.\n * SPDX-License-Identifier: BUSL-1.1\n * See LICENSE for the applicable terms.\n */\n\n\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Box, Tooltip, IconButton } from \"@mui/material\";\nimport ReactMarkdown from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypeRaw from \"rehype-raw\";\nimport rehypeSanitize from \"rehype-sanitize\";\nimport { useTheme, alpha } from \"@mui/material/styles\";\nimport type { Element, Text, Root } from \"hast\";\nimport type { Components, ExtraProps } from \"react-markdown\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\n// react-markdown 10 dropped its CodeProps export and the `inline` flag;\n// block vs inline is inferred from the content below.\ntype CodeProps = ComponentPropsWithoutRef<\"code\"> & ExtraProps;\nimport { getHighlightTree } from \"../utils/lowlight\";\nimport { MarkdownImage, markdownSanitizeSchema, renderLowlightChildren } from \"../utils/markdownRendering\";\nimport { CheckIcon, ContentCopyIcon } from \"../icons\";\nimport { maybeHandleFileLinkClick } from \"../utils/openFileLink\";\n\ninterface SourceSummary {\n id: string;\n name: string;\n}\n\ninterface StreamingMarkdownProps {\n content: string;\n isStreaming?: boolean;\n sources?: SourceSummary[];\n}\n\nconst StreamingMarkdown: React.FC<StreamingMarkdownProps> = ({\n content,\n isStreaming = false,\n sources,\n}) => {\n const theme = useTheme();\n const showCursor = isStreaming && content.trim().length > 0;\n const showLoader = isStreaming && content.trim().length === 0; // Show loader when streaming but no content yet\n const prevSanitizedRef = useRef<string>(\"\");\n const containerRef = useRef<HTMLDivElement | null>(null);\n const stableSourcesRef = useRef<SourceSummary[]>([]);\n\n const effectiveSources = useMemo(() => {\n if (Array.isArray(sources) && sources.length > 0) {\n stableSourcesRef.current = sources;\n return sources;\n }\n\n if (sources === undefined) {\n return stableSourcesRef.current;\n }\n\n stableSourcesRef.current = [];\n return [];\n }, [sources]);\n\n const normalizeTables = (markdown: string): string => {\n const lines = markdown.split(\"\\n\");\n const output: string[] = [];\n let inTable = false;\n let tableRows: string[][] = [];\n\n const flushTable = () => {\n if (tableRows.length === 0) return;\n const maxCols = Math.max(...tableRows.map((r) => r.length));\n const padded = tableRows.map((row) => [...row, ...Array(maxCols - row.length).fill(\"\")]);\n const header = padded[0];\n const separator = Array(maxCols).fill(\"---\");\n output.push(\"| \" + header.join(\" | \") + \" |\");\n output.push(\"| \" + separator.join(\" | \") + \" |\");\n for (let i = 1; i < padded.length; i++) {\n const row = padded[i];\n if (row.every((cell) => /^-+$/.test(cell))) continue;\n output.push(\"| \" + row.join(\" | \") + \" |\");\n }\n tableRows = [];\n inTable = false;\n };\n\n for (const line of lines) {\n if (/^\\s*\\|.*\\|\\s*$/.test(line)) {\n inTable = true;\n const cells = line.trim().slice(1, -1).split(\"|\").map((c) => c.trim());\n tableRows.push(cells);\n } else {\n if (inTable) flushTable();\n output.push(line);\n }\n }\n if (inTable) flushTable();\n return output.join(\"\\n\");\n };\n\n const sanitizeMarkdown = (raw: string): string => {\n let sanitized = raw.replace(/<[/]?start_of_turn>|<[/]?end[_]?of[_]?turn>/gi, \"\");\n // Unwrap Box wrappers\n sanitized = sanitized\n .replace(/<div class=\"MuiBox-root[^\"]*\"[^>]*>([\\s\\S]*?)<\\/div>/g, (_, inner) => inner.trim())\n .replace(/<div[^>]*>\\s*<\\/div>/g, \"\");\n // Collapse newline before common punctuation\n sanitized = sanitized.replace(/\\r?\\n\\s*:\\s*/g, \": \");\n sanitized = sanitized.replace(/\\r?\\n\\s*,\\s*/g, \", \");\n // Normalize pipe tables\n sanitized = normalizeTables(sanitized);\n return sanitized;\n };\n\n const sanitizedContent = sanitizeMarkdown(content);\n\n const contentWithSources = useMemo(() => {\n if (!effectiveSources.length || isStreaming) {\n return sanitizedContent;\n }\n\n const existingSection = /\\*\\*Sources?\\*\\*/i.test(sanitizedContent);\n if (existingSection) {\n return sanitizedContent;\n }\n\n const listMarkdown = effectiveSources\n .map((doc, index) => `- ${index + 1}. ${doc.name}`)\n .join(\"\\n\");\n\n return `${sanitizedContent}\\n\\n**Sources**\\n${listMarkdown}`;\n }, [sanitizedContent, effectiveSources, isStreaming]);\n\n // Helpers for safe per-word fade wrapping\n const escapeHtml = (str: string) =>\n str\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\\\"/g, \""\")\n .replace(/'/g, \"'\");\n\n const isPlainAppend = (s: string) => {\n // Avoid wrapping when the delta includes markdown/code/meta characters\n return !/[`*_\\[\\]<>|#~]/.test(s);\n };\n\n // Compute a render string where newly appended words fade in with a stagger\n let renderContent = contentWithSources;\n if (isStreaming) {\n const prev = prevSanitizedRef.current;\n // Find common prefix length to identify newly appended tail\n let i = 0;\n const max = Math.min(prev.length, sanitizedContent.length);\n while (i < max && prev.charCodeAt(i) === sanitizedContent.charCodeAt(i)) i++;\n const base = sanitizedContent.slice(0, i);\n const appended = sanitizedContent.slice(i);\n if (appended && isPlainAppend(appended)) {\n const parts = appended.split(/(\\s+)/); // keep whitespace tokens\n let delayMs = 0;\n const step = 42; // gentle stagger between words for smoother reveal\n const wrapped = parts\n .map((p) => {\n if (/^\\s+$/.test(p) || p === \"\") return p; // preserve whitespace\n const safe = escapeHtml(p);\n const out = `<span class=\\\"bl-fade-word\\\" data-bl-delay=\\\"${delayMs}\\\">${safe}</span>`;\n delayMs += step;\n return out;\n })\n .join(\"\");\n renderContent = base + wrapped;\n }\n }\n\n // After compute: update ref for next render\n useEffect(() => {\n prevSanitizedRef.current = contentWithSources;\n }, [contentWithSources]);\n\n useEffect(() => {\n if (!containerRef.current) return;\n const nodes = containerRef.current.querySelectorAll<HTMLElement>(\".bl-fade-word\");\n nodes.forEach((node) => {\n const delay = node.getAttribute(\"data-bl-delay\");\n if (delay) {\n node.style.setProperty(\"--bl-delay\", `${delay}ms`);\n node.style.animationDelay = `${delay}ms`;\n }\n });\n }, [renderContent, sanitizedContent, isStreaming]);\n\n type MarkProps = ComponentPropsWithoutRef<\"mark\">;\n type AnchorProps = ComponentPropsWithoutRef<\"a\">;\n type EmProps = ComponentPropsWithoutRef<\"em\">;\n type TableProps = ComponentPropsWithoutRef<\"table\">;\n type TableCellProps = ComponentPropsWithoutRef<\"td\">;\n type TableHeaderProps = ComponentPropsWithoutRef<\"th\">;\n type ParagraphProps = ComponentPropsWithoutRef<\"p\">;\n type BlockQuoteProps = ComponentPropsWithoutRef<\"blockquote\">;\n type OrderedListProps = ComponentPropsWithoutRef<\"ol\">;\n type UnorderedListProps = ComponentPropsWithoutRef<\"ul\">;\n\n const MarkRenderer: React.FC<MarkProps> = ({ children, ...props }) => {\n const inlineBg = theme.palette.mode === \"dark\"\n ? alpha(theme.palette.common.white, 0.06)\n : alpha(theme.palette.text.primary, 0.06);\n const inlineBorder = `1px solid ${alpha(theme.palette.text.primary, 0.15)}`;\n return (\n <Box\n component=\"span\"\n sx={{\n display: \"inline-block\",\n backgroundColor: inlineBg,\n border: inlineBorder,\n color: \"inherit\",\n padding: \"0.15em 0.35em\",\n borderRadius: \"4px\",\n fontWeight: 500,\n fontSize: \"0.92em\",\n lineHeight: 1.4,\n whiteSpace: \"normal\",\n width: \"fit-content\",\n maxWidth: \"100%\",\n fontFamily:\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace\",\n }}\n {...props}\n >\n {children}\n </Box>\n );\n };\n\n const LinkRenderer: React.FC<AnchorProps> = ({ href, children, ...props }) => (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n // Standalone PWAs can't download — route file links to the share sheet.\n onClick={(e) => maybeHandleFileLinkClick(e, href)}\n style={{\n color: theme.palette.info?.main ?? theme.palette.primary.main,\n textDecoration: \"underline\",\n textUnderlineOffset: \"2px\",\n }}\n {...props}\n >\n {children}\n </a>\n );\n\n const CodeRenderer: React.FC<CodeProps> = ({ node: _node, className, children, ...props }) => {\n const match = /language-([\\w-]+)/.exec(className || \"\");\n const requestedLanguage = match?.[1]?.toLowerCase() ?? \"\";\n const codeText = String(children).replace(/\\n$/, \"\");\n const isProbablyBlock = codeText.includes(\"\\n\") || Boolean(requestedLanguage);\n\n const [copied, setCopied] = useState(false);\n const handleCopy = () => {\n void navigator.clipboard.writeText(codeText);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n };\n\n\n const highlightTree = useMemo<Root | null>(\n () => (isProbablyBlock ? getHighlightTree(codeText, requestedLanguage) : null),\n [isProbablyBlock, codeText, requestedLanguage]\n );\n\n const highlightedNodes = useMemo<ReactNode[]>(\n () =>\n highlightTree\n ? renderLowlightChildren(\n (highlightTree.children || []).filter(\n (node): node is Element | Text => node.type === \"element\" || node.type === \"text\"\n ),\n `hl-${requestedLanguage || \"auto\"}`\n )\n : [],\n [highlightTree, requestedLanguage]\n );\n\n const dataLanguage =\n highlightTree &&\n highlightTree.data &&\n typeof highlightTree.data === \"object\" &&\n \"language\" in highlightTree.data\n ? String((highlightTree.data as { language?: unknown }).language ?? \"\")\n : \"\";\n\n if (!highlightTree) {\n const inlineBg = theme.palette.mode === \"dark\"\n ? alpha(theme.palette.common.white, 0.06)\n : alpha(theme.palette.text.primary, 0.06);\n const inlineBorder = `1px solid ${alpha(theme.palette.text.primary, 0.15)}`;\n return (\n <code\n style={{\n borderRadius: 4,\n fontSize: \"0.92em\",\n fontFamily: \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace\",\n backgroundColor: inlineBg,\n border: inlineBorder,\n padding: \"0.15em 0.35em\",\n }}\n {...props}\n >\n {children}\n </code>\n );\n }\n\n const resolvedLanguage = (requestedLanguage || dataLanguage || \"code\").toString();\n const languageLabel = resolvedLanguage.toUpperCase();\n const languageClass = resolvedLanguage.toLowerCase();\n\n const highlightColors = theme.palette.mode === \"dark\"\n ? {\n background: \"#0f172a\",\n text: \"#e2e8f0\",\n keyword: \"#c792ea\",\n string: \"#7fdbca\",\n number: \"#f78c6c\",\n comment: \"#64748b\",\n function: \"#82aaff\",\n variable: \"#f07178\",\n }\n : {\n background: \"#f4f6ff\",\n text: \"#1e293b\",\n keyword: \"#7c3aed\",\n string: \"#0f766e\",\n number: \"#b45309\",\n comment: \"#6b7280\",\n function: \"#2563eb\",\n variable: \"#d97706\",\n };\n\n return (\n <Box\n sx={{\n borderRadius: \"4px\",\n overflow: \"auto\",\n my: \"0.5rem\",\n px: 0,\n py: 0,\n mt: 1,\n mb: 0.5,\n fontSize: \"0.9rem\",\n position: \"relative\",\n fontFamily: \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace\",\n width: \"100%\",\n maxWidth: \"100%\",\n }}\n >\n <Box\n sx={{\n px: 2,\n py: 1,\n bgcolor: theme.palette.mode === \"dark\"\n ? alpha(theme.palette.common.white, 0.04)\n : alpha(theme.palette.text.primary, 0.04),\n color: theme.palette.text.secondary,\n fontSize: \"0.75rem\",\n borderBottom: `1px solid ${alpha(theme.palette.text.primary, 0.1)}`,\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n fontFamily: \"inherit\",\n }}\n >\n <span>{languageLabel}</span>\n <Tooltip title={copied ? \"Copied!\" : \"Copy\"} arrow>\n <IconButton\n size=\"small\"\n onClick={handleCopy}\n sx={{\n color: copied ? theme.palette.success.main : theme.palette.text.secondary,\n \"&:hover\": { color: theme.palette.text.primary },\n padding: \"4px\",\n }}\n >\n {copied ? <CheckIcon fontSize=\"small\" /> : <ContentCopyIcon fontSize=\"small\" />}\n </IconButton>\n </Tooltip>\n </Box>\n <Box\n sx={{\n overflowX: \"auto\",\n maxWidth: \"100%\",\n '& .hljs': {\n display: 'block',\n overflowX: 'auto',\n padding: '16px',\n margin: 0,\n backgroundColor: highlightColors.background,\n color: highlightColors.text,\n fontSize: '0.9rem',\n },\n '& .hljs-comment, & .hljs-quote': {\n color: highlightColors.comment,\n fontStyle: 'italic',\n },\n '& .hljs-keyword, & .hljs-selector-tag, & .hljs-literal, & .hljs-built_in': {\n color: highlightColors.keyword,\n },\n '& .hljs-string, & .hljs-doctag, & .hljs-template-tag, & .hljs-attr': {\n color: highlightColors.string,\n },\n '& .hljs-number, & .hljs-symbol, & .hljs-bullet, & .hljs-meta': {\n color: highlightColors.number,\n },\n '& .hljs-title, & .hljs-section, & .hljs-selector-id, & .hljs-function': {\n color: highlightColors.function,\n },\n '& .hljs-variable, & .hljs-params, & .hljs-property': {\n color: highlightColors.variable,\n },\n }}\n >\n <pre className={`hljs language-${languageClass}`} {...props}>\n <code className=\"hljs\">{highlightedNodes}</code>\n </pre>\n </Box>\n </Box>\n );\n };\n\n const EmRenderer: React.FC<EmProps> = ({ children, ...props }) => {\n const onlyChild = Array.isArray(children) && children.length === 1 ? children[0] : null;\n if (\n onlyChild &&\n React.isValidElement<{ className?: unknown; children?: ReactNode }>(onlyChild) &&\n typeof onlyChild.props?.className === \"string\" &&\n onlyChild.props.className.includes(\"MuiBox-root\")\n ) {\n const inner = onlyChild.props.children as ReactNode;\n if (typeof inner === \"string\" && inner.trim().toUpperCase() === \"CODE\") {\n return null;\n }\n return (\n <Box\n sx={{\n fontFamily: \"monospace\",\n fontSize: \"0.9rem\",\n backgroundColor: theme.palette.background.default,\n color: theme.palette.text.primary,\n padding: \"12px 16px\",\n borderRadius: \"4px\",\n border: `1px solid ${theme.palette.divider}`,\n my: 1,\n display: \"inline-block\",\n }}\n >\n {inner}\n </Box>\n );\n }\n return <em {...props}>{children}</em>;\n };\n\n const TableRenderer: React.FC<TableProps> = ({ children, ...props }) => (\n <Box sx={{ overflowX: \"auto\", my: 1 }}>\n <table style={{ borderCollapse: \"collapse\", width: \"100%\" }} {...props}>\n {children}\n </table>\n </Box>\n );\n\n const OrderedListRenderer: React.FC<OrderedListProps> = ({ children, ...props }) => (\n <ol style={{ paddingLeft: 24, marginLeft: 16, listStyleType: \"decimal\" }} {...props}>\n {children}\n </ol>\n );\n\n const UnorderedListRenderer: React.FC<UnorderedListProps> = ({ children, ...props }) => (\n <ul\n style={{\n paddingLeft: \"1.5rem\",\n marginTop: \"0.5rem\",\n marginBottom: \"0.25rem\",\n listStyle: \"disc\",\n }}\n {...props}\n >\n {children}\n </ul>\n );\n\n const BlockQuoteRenderer: React.FC<BlockQuoteProps> = ({ children, ...props }) => (\n <Box\n component=\"blockquote\"\n sx={{\n borderLeft: `4px solid ${theme.palette.divider}`,\n pl: 2,\n ml: 0,\n color: theme.palette.text.secondary,\n }}\n {...props}\n >\n {children}\n </Box>\n );\n\n const TableHeaderRenderer: React.FC<TableHeaderProps> = ({ children, ...props }) => (\n <th\n style={{\n border: \"1px solid #ddd\",\n padding: \"8px\",\n backgroundColor: theme.palette.mode === \"dark\" ? \"#333\" : \"#f2f2f2\",\n textAlign: \"left\",\n }}\n {...props}\n >\n {children}\n </th>\n );\n\n const TableCellRenderer: React.FC<TableCellProps> = ({ children, ...props }) => (\n <td\n style={{\n border: \"1px solid #ddd\",\n padding: \"8px\",\n }}\n {...props}\n >\n {children}\n </td>\n );\n\n const ParagraphRenderer: React.FC<ParagraphProps> = ({ children, ...props }) => (\n <p style={{ marginTop: \"0.5rem\", marginBottom: \"0.5rem\" }} {...props}>\n {children}\n </p>\n );\n\n const components: Components = {\n mark: MarkRenderer,\n code: CodeRenderer,\n a: LinkRenderer,\n img: MarkdownImage,\n em: EmRenderer,\n table: TableRenderer,\n ol: OrderedListRenderer,\n ul: UnorderedListRenderer,\n blockquote: BlockQuoteRenderer,\n th: TableHeaderRenderer,\n td: TableCellRenderer,\n p: ParagraphRenderer,\n };\n\n return (\n <Box\n ref={containerRef}\n sx={{\n // Settle the whole block to full color a beat after streaming ends.\n transition: \"opacity 380ms ease-out, transform 220ms ease-out\",\n \"& .cursor\": {\n display: showCursor ? \"inline\" : \"none\",\n animation: \"blink 1s step-start infinite\",\n },\n \"@keyframes blink\": {\n \"50%\": { opacity: 0 },\n },\n // Each newly-written word focuses in — blur→sharp, a tiny rise, and fade —\n // like ink settling onto the page as the typewriter writes.\n \"& .bl-fade-word\": {\n opacity: 0,\n animation: \"bl-fade-in 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards\",\n },\n \"@keyframes bl-fade-in\": {\n from: { opacity: 0, filter: \"blur(3px)\", transform: \"translateY(2px)\" },\n to: { opacity: 1, filter: \"blur(0)\", transform: \"translateY(0)\" },\n },\n // Dimmed while streaming, then brightens to full color once the answer lands.\n opacity: isStreaming ? 0.86 : 1,\n transform: isStreaming ? \"translateY(0.25px)\" : \"none\",\n // Reduce layout jumpiness between updates\n \"& p:last-child\": { marginBottom: 0 },\n // Add min height when showing loader to prevent layout shift\n minHeight: showLoader ? \"40px\" : \"auto\",\n }}\n >\n {showLoader ? (\n // Show loading indicator when streaming but no content yet\n <Box sx={{ display: \"flex\", alignItems: \"center\", minHeight: \"40px\", pl: 2 }}>\n <div className=\"typing-only\">\n <span className=\"dot\" />\n <span className=\"dot\" />\n <span className=\"dot\" />\n </div>\n </Box>\n ) : (\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n rehypePlugins={[rehypeRaw, [rehypeSanitize, markdownSanitizeSchema]]}\n components={components}\n >\n {(renderContent || sanitizedContent) + (showCursor ? \" ▊\" : \"\")}\n </ReactMarkdown>\n )}\n </Box>\n );\n};\n\n// Skip re-rendering (and re-parsing markdown) when nothing this component cares\n// about changed. Critical for long chats: without this, every streamed token\n// re-parses the markdown of EVERY prior message — the main source of mid-stream\n// jank / \"thread-locky\" feel. Only the actively-streaming message (whose content\n// changes each flush) re-renders.\nconst arePropsEqual = (\n prev: StreamingMarkdownProps,\n next: StreamingMarkdownProps,\n): boolean => {\n if (prev.content !== next.content || prev.isStreaming !== next.isStreaming) {\n return false;\n }\n const a = prev.sources;\n const b = next.sources;\n if (a === b) return true;\n if (!a || !b || a.length !== b.length) return false;\n return a.every((s, i) => s.id === b[i].id && s.name === b[i].name);\n};\n\nexport default React.memo(StreamingMarkdown, arePropsEqual);\n","/*\n * Copyright (c) 2025 Burtson Labs LLC.\n * SPDX-License-Identifier: BUSL-1.1\n * See LICENSE for the applicable terms.\n */\n\n/**\n * \"Is this running as an installed app?\" — either a home-screen PWA in\n * standalone display mode, or the Capacitor native shell (which injects\n * `window.Capacitor` before the page loads). The engine can't import\n * @capacitor/core (it's a host-app dependency), so the native check reads\n * the global directly.\n *\n * Layout code that sizes to the real webview / hides browser chrome should\n * key off this rather than the standalone media query alone — WKWebView\n * reports display-mode \"browser\", so the native app would otherwise get\n * the in-browser layout.\n */\nexport const isNativeShell = (): boolean => {\n if (typeof window === \"undefined\") return false;\n const cap = (window as unknown as { Capacitor?: { isNativePlatform?: () => boolean } }).Capacitor;\n return typeof cap?.isNativePlatform === \"function\" && cap.isNativePlatform() === true;\n};\n\nexport const isStandalonePwa = (): boolean => {\n if (typeof window === \"undefined\") return false;\n const nav = window.navigator as Navigator & { standalone?: boolean };\n return window.matchMedia?.(\"(display-mode: standalone)\").matches || nav.standalone === true;\n};\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AAAA,UACC,eAAe,CAAC,SAAS;AAAA,UACzB,eAAe,CAAC,WAAW,CAAC,gBAAgB,sBAAsB,CAAC;AAAA,UACnE;AAAA,UAEE,4BAAiB,qBAAqB,aAAa,YAAO;AAAA;AAAA,MAC9D;AAAA;AAAA,EAEJ;AAEJ;AAOA,IAAM,gBAAgB,CACpB,MACA,SACY;AACZ,MAAI,KAAK,YAAY,KAAK,WAAW,KAAK,gBAAgB,KAAK,aAAa;AAC1E,WAAO;AAAA,EACT;AACA,QAAM,IAAI,KAAK;AACf,QAAM,IAAI,KAAK;AACf,MAAI,MAAM,EAAG,QAAO;AACpB,MAAI,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,EAAE,OAAQ,QAAO;AAC9C,SAAO,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI;AACnE;AAEA,IAAO,4BAAQ,MAAM,KAAK,mBAAmB,aAAa;;;AC/lBnD,IAAM,gBAAgB,MAAe;AAC1C,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,MAAO,OAA2E;AACxF,SAAO,OAAO,KAAK,qBAAqB,cAAc,IAAI,iBAAiB,MAAM;AACnF;AAEO,IAAM,kBAAkB,MAAe;AAC5C,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,MAAM,OAAO;AACnB,SAAO,OAAO,aAAa,4BAA4B,EAAE,WAAW,IAAI,eAAe;AACzF;","names":[]}
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
indexedDBService_default,
|
|
3
3
|
useModelStore,
|
|
4
4
|
usePackageSettingsStore
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TY5VL3SG.mjs";
|
|
6
6
|
import {
|
|
7
7
|
authenticationService,
|
|
8
8
|
useAIProviderStore,
|
|
9
9
|
useAuthenticationStore
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CQJGUYRW.mjs";
|
|
11
11
|
import {
|
|
12
12
|
debugLogger
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-OCVZVBQQ.mjs";
|
|
14
14
|
|
|
15
15
|
// src/store/aiQueryStore.ts
|
|
16
16
|
import { create } from "zustand";
|
|
@@ -2089,7 +2089,6 @@ var useKnowledgeStore = create6((set, get) => ({
|
|
|
2089
2089
|
|
|
2090
2090
|
// src/util.ts
|
|
2091
2091
|
var toTitleCase = (str) => str.toLowerCase().split(" ").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
2092
|
-
var randomRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
2093
2092
|
var generateSeed = () => Math.floor(Math.random() * 1e4);
|
|
2094
2093
|
var fetchAndConvertToBase64 = async (src) => {
|
|
2095
2094
|
const response = await fetch(src);
|
|
@@ -2297,24 +2296,6 @@ import { lastValueFrom, map } from "rxjs";
|
|
|
2297
2296
|
|
|
2298
2297
|
// src/prompts/getStableQuestionPrompt.ts
|
|
2299
2298
|
var TOPICS = ["everyday life", "finance", "sports", "travel", "technology", "politics", "health", "food", "entertainment", "education", "science", "history", "art", "music", "literature", "philosophy", "psychology", "sociology", "environmental issues", "current events"];
|
|
2300
|
-
var getRandomTopicOfInterest = () => {
|
|
2301
|
-
const minIndex = 0;
|
|
2302
|
-
const maxIndex = TOPICS.length - 1;
|
|
2303
|
-
const randomIndex = randomRange(minIndex, maxIndex);
|
|
2304
|
-
const randomTopic = TOPICS[randomIndex];
|
|
2305
|
-
return randomTopic;
|
|
2306
|
-
};
|
|
2307
|
-
var pickDistinctRandomTopics = (count) => {
|
|
2308
|
-
const pool = [...TOPICS];
|
|
2309
|
-
const picked = [];
|
|
2310
|
-
const n = Math.min(Math.max(count, 0), pool.length);
|
|
2311
|
-
for (let i = 0; i < n; i++) {
|
|
2312
|
-
const idx = randomRange(0, pool.length - 1);
|
|
2313
|
-
picked.push(pool[idx]);
|
|
2314
|
-
pool.splice(idx, 1);
|
|
2315
|
-
}
|
|
2316
|
-
return picked;
|
|
2317
|
-
};
|
|
2318
2299
|
var getStableQuestionPrompt = (args) => {
|
|
2319
2300
|
const { limit, topicOfInterest, modelSystemPrompt, interests, knowledgeTopics, webSearchAvailable } = args;
|
|
2320
2301
|
if (limit < 1 || limit > 10) {
|
|
@@ -3248,7 +3229,7 @@ var VectorDatabaseService = class {
|
|
|
3248
3229
|
onProgress,
|
|
3249
3230
|
validateContent = true
|
|
3250
3231
|
} = options;
|
|
3251
|
-
const { MemoryUtils } = await import("./memoryUtils-
|
|
3232
|
+
const { MemoryUtils } = await import("./memoryUtils-2FVXDSS6.mjs");
|
|
3252
3233
|
try {
|
|
3253
3234
|
let validMemories = memories;
|
|
3254
3235
|
const warnings = [];
|
|
@@ -4852,7 +4833,7 @@ var useVectorStore = () => {
|
|
|
4852
4833
|
}, []);
|
|
4853
4834
|
const checkProviderCompatibility = useCallback2(async () => {
|
|
4854
4835
|
try {
|
|
4855
|
-
const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-
|
|
4836
|
+
const { useAIProviderStore: useAIProviderStore2 } = await import("./aiProviderStore-PEGSX4PK.mjs");
|
|
4856
4837
|
if (!mountedRef.current) return false;
|
|
4857
4838
|
const aiProviderState = useAIProviderStore2.getState();
|
|
4858
4839
|
const provider = aiProviderState.provider;
|
|
@@ -5868,8 +5849,6 @@ export {
|
|
|
5868
5849
|
detectTransparency,
|
|
5869
5850
|
resolveAvatar,
|
|
5870
5851
|
TOPICS,
|
|
5871
|
-
getRandomTopicOfInterest,
|
|
5872
|
-
pickDistinctRandomTopics,
|
|
5873
5852
|
NotificationService,
|
|
5874
5853
|
notificationService,
|
|
5875
5854
|
generateConversationStarters,
|
|
@@ -5895,4 +5874,4 @@ export {
|
|
|
5895
5874
|
useNotification,
|
|
5896
5875
|
NotificationProvider
|
|
5897
5876
|
};
|
|
5898
|
-
//# sourceMappingURL=chunk-
|
|
5877
|
+
//# sourceMappingURL=chunk-J6SWNO7Z.mjs.map
|