+}) => {
const {
subscriptions,
displayType = "list",
@@ -232,55 +195,50 @@ export const AIDisplaySubscriptionsPart = ({ part }: { part: AIDisplaySubscripti
)
}
- switch (displayType) {
- default: {
- return (
-
- )
- }
- }
+ return (
+
+ )
}
return (
-
-
-
-
- ๐
- {title || "My Subscriptions"}
-
-
- {formatDisplayType(displayType)} โข {formatFilterBy(filterBy)} โข {formatGroupBy(groupBy)}
-
-
-
- {/* Statistics Overview */}
-
-
-
- {showCategories && }
-
-
+
+ {/* Statistics Overview */}
+
+
+
+ {showCategories && }
+
+
- {/* Subscriptions Display */}
- {renderSubscriptions()}
-
-
+ {/* Subscriptions Display */}
+ {renderSubscriptions()}
+
)
}
+
+export const AIDisplaySubscriptionsPart = withDisplayStateHandler<
+ AIDisplaySubscriptionsTool["output"]
+>({
+ title: "Subscriptions",
+ loadingDescription: "Fetching subscription data...",
+ errorTitle: "Subscriptions Error",
+})(AIDisplaySubscriptionsPartBase)
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/index.ts
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/index.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/index.ts
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/share.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/share.tsx
new file mode 100644
index 000000000..0a581bd9e
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/share.tsx
@@ -0,0 +1,96 @@
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@follow/components/ui/card/index.js"
+import type { ComponentType, ReactNode } from "react"
+import { memo } from "react"
+import isEqual from "react-fast-compare"
+
+import { ErrorState, LoadingState } from "../shared/common-states"
+
+interface PartWithState {
+ part: {
+ state: string
+ }
+}
+
+export const toolMemo = (FC: ComponentType
): ComponentType
=>
+ memo(FC, (prev, next) => {
+ if (prev.part.state === "output-available") return true
+ return isEqual(prev, next)
+ }) as ComponentType
+
+// Higher-Order Component for display state handling
+export function withDisplayStateHandler(config: {
+ title: string
+ loadingDescription: string
+ errorTitle: string
+ maxWidth?: string
+}) {
+ return function (
+ WrappedComponent: ComponentType
}>,
+ ): ComponentType
{
+ const WithDisplayStateHandler = toolMemo((props: P) => {
+ const { part } = props
+
+ // Handle error state
+ if (part.state === "output-error") {
+ return (
+
+ )
+ }
+
+ // Handle loading/invalid state
+ if (part.state !== "output-available" || !part.output) {
+ return (
+
+ )
+ }
+
+ // Render the wrapped component with the validated output
+ return } />
+ })
+
+ WithDisplayStateHandler.displayName = `withDisplayStateHandler(${WrappedComponent.displayName || WrappedComponent.name})`
+
+ return WithDisplayStateHandler
+ }
+}
+
+// Common card wrapper for display components
+export const DisplayCardWrapper = ({
+ title,
+ emoji,
+ description,
+ children,
+ maxWidth = "max-w-6xl",
+}: {
+ title: string
+ emoji: string
+ description?: string
+ children: ReactNode
+ maxWidth?: string
+}) => (
+
+
+
+
+ {emoji}
+ {title}
+
+ {description && {description} }
+
+ {children}
+
+)
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/AnalyticsMetrics.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/AnalyticsMetrics.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/AnalyticsMetrics.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/AnalyticsMetrics.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/CategoryTag.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/CategoryTag.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/CategoryTag.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/CategoryTag.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/DisplayHeader.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/DisplayHeader.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/DisplayHeader.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/DisplayHeader.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/EmptyState.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/EmptyState.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/EmptyState.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/EmptyState.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/FeedItemCard.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/FeedItemCard.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/FeedItemCard.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/FeedItemCard.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/GroupedContent.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/GroupedContent.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/GroupedContent.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/GroupedContent.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/StatCard.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/StatCard.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/StatCard.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/StatCard.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/index.ts
similarity index 67%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/index.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/index.ts
index 9f5d25734..4b9f64cdf 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/index.ts
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/displays/shared/index.ts
@@ -1,10 +1,7 @@
export * from "./AnalyticsMetrics"
export * from "./CategoryTag"
-export * from "./ChartPlaceholder"
export * from "./DisplayHeader"
export * from "./EmptyState"
export * from "./FeedItemCard"
-export * from "./GridContainer"
export * from "./GroupedContent"
export * from "./StatCard"
-export * from "./StatisticsOverview"
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatContextBar.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatContextBar.tsx
similarity index 91%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatContextBar.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatContextBar.tsx
index c5fd372cf..0f15a9e66 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatContextBar.tsx
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatContextBar.tsx
@@ -22,13 +22,16 @@ import {
DropdownMenuTrigger,
} from "~/components/ui/dropdown-menu/dropdown-menu"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
-import { useAIChatStore } from "~/modules/ai/chat/__internal__/AIChatContext"
-import type { AIChatContextBlock } from "~/modules/ai/chat/__internal__/types"
+import { useAIChatStore } from "~/modules/ai-chat/store/AIChatContext"
+import type { AIChatContextBlock } from "~/modules/ai-chat/store/types"
+import { useSettingModal } from "~/modules/settings/modal/use-setting-modal-hack"
+
+import { useChatBlockActions } from "../../store/hooks"
export const AIChatContextBar: Component<{ onSendShortcut?: (prompt: string) => void }> = memo(
({ className, onSendShortcut }) => {
const blocks = useAIChatStore()((s) => s.blocks)
- const { addBlock } = useAIChatStore()()
+ const blockActions = useChatBlockActions()
const { shortcuts } = useAISettingValue()
// Filter enabled shortcuts
@@ -37,6 +40,7 @@ export const AIChatContextBar: Component<{ onSendShortcut?: (prompt: string) =>
[shortcuts],
)
+ const showSettingModal = useSettingModal()
const contextMenuContent = (
@@ -47,7 +51,7 @@ export const AIChatContextBar: Component<{ onSendShortcut?: (prompt: string) =>
- addBlock({
+ blockActions.addBlock({
type: "referEntry",
value: entryId,
})
@@ -65,7 +69,7 @@ export const AIChatContextBar: Component<{ onSendShortcut?: (prompt: string) =>
- addBlock({
+ blockActions.addBlock({
type: "referEntry",
value: entryId,
})
@@ -81,7 +85,7 @@ export const AIChatContextBar: Component<{ onSendShortcut?: (prompt: string) =>
- addBlock({
+ blockActions.addBlock({
type: "referFeed",
value: feedId,
})
@@ -98,21 +102,21 @@ export const AIChatContextBar: Component<{ onSendShortcut?: (prompt: string) =>
No shortcuts configured
) : (
enabledShortcuts.map((shortcut) => (
- onSendShortcut?.(shortcut.prompt)}
- className="text-xs"
- shortcut={shortcut.hotkey}
- >
-
-
-
- {shortcut.name}
-
-
+ onSendShortcut?.(shortcut.prompt)}>
+
+ {shortcut.name}
))
)}
+
+ {
+ showSettingModal("ai")
+ }}
+ >
+
+ Manage Shortcut
+
)
@@ -227,7 +231,7 @@ const PickerList = ({
const CurrentFeedEntriesPickerList: FC<{ onSelect: (entryId: string) => void }> = ({
onSelect,
}) => {
- const mainEntryId = useAIChatStore()((s) => s.state.mainEntryId)
+ const mainEntryId = useAIChatStore()((s) => s.blocks.find((b) => b.type === "mainEntry")?.value)
const feedId = useEntry(mainEntryId, (e) => e?.feedId)
const entryIds = useEntryIdsByFeedId(feedId!)
@@ -329,7 +333,7 @@ const FeedPickerItem: FC<{
}
const ContextBlock: FC<{ block: AIChatContextBlock }> = ({ block }) => {
- const { removeBlock } = useAIChatStore()()
+ const blockActions = useChatBlockActions()
const getBlockIcon = () => {
switch (block.type) {
@@ -409,7 +413,7 @@ const ContextBlock: FC<{ block: AIChatContextBlock }> = ({ block }) => {
{canRemove && (
removeBlock(block.id)}
+ onClick={() => blockActions.removeBlock(block.id)}
className="text-text-tertiary hover:text-text-secondary flex-shrink-0 opacity-0 transition-all group-hover:opacity-100"
>
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatRoot.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatRoot.tsx
new file mode 100644
index 000000000..ac8e01153
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatRoot.tsx
@@ -0,0 +1,70 @@
+import type { FC, PropsWithChildren } from "react"
+import { useMemo, useRef } from "react"
+
+import { Focusable } from "~/components/common/Focusable"
+import { HotkeyScope } from "~/constants"
+
+import type { AIPanelRefs } from "../../store/AIChatContext"
+import { AIChatStoreContext, AIPanelRefsContext } from "../../store/AIChatContext"
+import { useChatActions, useCurrentChatId } from "../../store/hooks"
+import { createAIChatStore } from "../../store/store"
+
+interface AIChatRootProps extends PropsWithChildren {
+ wrapFocusable?: boolean
+ chatId?: string
+}
+
+// Inner component that has access to the AI chat store context
+const AIChatRootInner: FC = ({ children, chatId: externalChatId }) => {
+ // Use the new internal hooks
+ const currentChatId = useCurrentChatId()
+
+ const chatActions = useChatActions()
+
+ // Initialize room ID on mount
+ useMemo(() => {
+ if (!currentChatId && !externalChatId) {
+ chatActions.newChat()
+ }
+ }, [currentChatId, externalChatId, chatActions])
+
+ const panelRef = useRef(null!)
+ const inputRef = useRef(null!)
+ const refsContext = useMemo(() => ({ panelRef, inputRef }), [panelRef, inputRef])
+
+ if (!currentChatId) {
+ return (
+
+
+
+ Initializing chat...
+
+
+ )
+ }
+
+ return {children}
+}
+
+export const AIChatRoot: FC = ({
+ children,
+ wrapFocusable = true,
+ chatId: externalChatId,
+}) => {
+ const useAiContextStore = useMemo(createAIChatStore, [])
+
+ const Element = (
+
+ {children}
+
+ )
+
+ if (wrapFocusable) {
+ return (
+
+ {Element}
+
+ )
+ }
+ return Element
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatSendButton.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatSendButton.tsx
similarity index 85%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatSendButton.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatSendButton.tsx
index a4a58b0f0..bf843d6af 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatSendButton.tsx
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIChatSendButton.tsx
@@ -26,7 +26,7 @@ export const AIChatSendButton: FC = ({
? "bg-red-500/90 hover:bg-red-500 shadow-lg shadow-red-500/25 backdrop-blur-sm"
: disabled
? "bg-gray-200/80 cursor-not-allowed backdrop-blur-sm"
- : "bg-gradient-to-r from-blue-500/90 to-blue-600/90 hover:from-blue-500 hover:to-blue-600 shadow-lg shadow-blue-500/25 backdrop-blur-sm hover:shadow-blue-500/35",
+ : "bg-gradient-to-r from-accent to-accent/90 hover:from-accent hover:to-accent/90 shadow-lg shadow-accent/25 backdrop-blur-sm hover:shadow-accent/35",
className,
)}
>
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIErrorFallback.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIErrorFallback.tsx
new file mode 100644
index 000000000..d425dcf8e
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/AIErrorFallback.tsx
@@ -0,0 +1,63 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import type { FallbackRender } from "@sentry/react"
+
+import { attachOpenInEditor } from "~/lib/dev"
+
+import { FeedbackIssue } from "../../../../components/common/ErrorElement"
+import { parseError } from "../../../../components/errors/helper"
+
+export const AIErrorFallback: FallbackRender = (props) => {
+ const { message, stack } = parseError(props.error)
+
+ return (
+
+
+ {/* AI-specific icon */}
+
+
+
+
+ {/* Error title */}
+
AI Chat Encountered an Error
+
+ {/* Error message */}
+
+ {message || "An unexpected error occurred while processing your request."}
+
+
+ {/* Development stack trace */}
+ {import.meta.env.DEV && stack ? (
+
+
+ Show technical details
+
+
+ {attachOpenInEditor(stack)}
+
+
+ ) : null}
+
+ {/* Error description */}
+
+ Don't worry! You can try again or reload the chat to continue your conversation.
+
+
+ {/* Action buttons */}
+
+ props.resetError()} variant="primary">
+ Try Again
+
+
+ window.location.reload()} variant="outline">
+ Reload Page
+
+
+
+ {/* Feedback component */}
+
+
+
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatHeader.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatHeader.tsx
similarity index 71%
rename from apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatHeader.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatHeader.tsx
index a00c85860..f9b92189a 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatHeader.tsx
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatHeader.tsx
@@ -1,28 +1,24 @@
import { ActionButton } from "@follow/components/ui/button/index.js"
-import { use, useCallback } from "react"
+import { useCallback } from "react"
import { useTranslation } from "react-i18next"
import { useDialog } from "~/components/ui/modal/stacked/hooks"
-import {
- AIChatContext,
- useAIChatSessionMethods,
-} from "~/modules/ai/chat/__internal__/AIChatContext"
-import { useSessionState } from "~/modules/ai/chat/atoms/session"
+import { useChatActions, useCurrentTitle } from "~/modules/ai-chat/store/hooks"
import { useSettingModal } from "~/modules/settings/modal/use-setting-modal-hack"
import { ChatMoreDropdown } from "./ChatMoreDropdown"
export const ChatHeader = () => {
- const { currentTitle } = useSessionState()
- const { handleNewChat } = useAIChatSessionMethods()
- const settingModalPresent = useSettingModal()
- const { messages } = use(AIChatContext)
+ const currentTitle = useCurrentTitle()
+ const settingModalPresent = useSettingModal()
+ const chatActions = useChatActions()
const { ask } = useDialog()
const { t } = useTranslation("ai")
const handleNewChatClick = useCallback(() => {
- if (messages.length === 0) {
+ const messages = chatActions.getMessages()
+ if (messages.length === 0 && !currentTitle) {
return
}
@@ -31,14 +27,14 @@ export const ChatHeader = () => {
message: t("clear_chat_message"),
variant: "danger",
onConfirm: () => {
- handleNewChat()
+ chatActions.newChat()
},
})
- }, [ask, messages.length, t, handleNewChat])
+ }, [chatActions, currentTitle, ask, t])
const maskImage = `linear-gradient(to bottom, black 0%, black 75%, transparent 100%)`
return (
-
+
{
}}
/>
-
+
{/* Left side - Title */}
{currentTitle && (
-
+
{currentTitle}
@@ -62,11 +58,11 @@ export const ChatHeader = () => {
{/* Right side - Actions */}
-
+
settingModalPresent("ai")}>
-
+
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx
new file mode 100644
index 000000000..cd782d48a
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx
@@ -0,0 +1,123 @@
+import type { LexicalRichEditorRef } from "@follow/components/ui/lexical-rich-editor/index.js"
+import { LexicalRichEditor } from "@follow/components/ui/lexical-rich-editor/index.js"
+import { ScrollArea } from "@follow/components/ui/scroll-area/ScrollArea.js"
+import { cn, stopPropagation } from "@follow/utils"
+import type { VariantProps } from "class-variance-authority"
+import { cva } from "class-variance-authority"
+import type { EditorState, LexicalEditor } from "lexical"
+import { $getRoot } from "lexical"
+import { memo, useCallback, useRef, useState } from "react"
+
+import { AIChatContextBar } from "~/modules/ai-chat/components/layouts/AIChatContextBar"
+
+import { MentionPlugin } from "../../editor"
+import { useChatActions, useChatStatus } from "../../store/hooks"
+import { AIChatSendButton } from "./AIChatSendButton"
+
+const chatInputVariants = cva(
+ [
+ "bg-background/60 focus-within:ring-accent/20 focus-within:border-accent/80 border-border/80",
+ "relative overflow-hidden rounded-2xl border backdrop-blur-xl duration-200 focus-within:ring-2",
+ ],
+ {
+ variants: {
+ variant: {
+ default: "shadow-2xl shadow-black/5 dark:shadow-zinc-800",
+ minimal: "shadow shadow-zinc-100 dark:shadow-black/5",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ },
+)
+
+interface ChatInputProps extends VariantProps
{
+ onSend: (message: EditorState | string, editor: LexicalEditor | null) => void
+}
+
+export const ChatInput = memo(({ onSend, variant }: ChatInputProps) => {
+ const status = useChatStatus()
+ const chatActions = useChatActions()
+
+ const stop = useCallback(() => {
+ chatActions.stop()
+ }, [chatActions])
+
+ const editorRef = useRef(null)
+ const [isEmpty, setIsEmpty] = useState(true)
+ const [currentEditor, setCurrentEditor] = useState(null)
+
+ const isProcessing = status === "submitted" || status === "streaming"
+
+ const handleSend = useCallback(() => {
+ if (currentEditor && editorRef.current && !editorRef.current.isEmpty()) {
+ onSend(currentEditor.getEditorState(), currentEditor)
+ editorRef.current.clear()
+ }
+ }, [currentEditor, onSend])
+
+ const handleKeyDown = useCallback(
+ (event: KeyboardEvent) => {
+ if (event.key === "Enter" && !event.shiftKey) {
+ event.preventDefault()
+ if (isProcessing) {
+ stop?.()
+ } else {
+ handleSend()
+ }
+ return true
+ }
+ return false
+ },
+ [handleSend, isProcessing, stop],
+ )
+
+ const handleEditorChange = useCallback((editorState: EditorState, editor: LexicalEditor) => {
+ setCurrentEditor(editor)
+ // Update isEmpty state based on editor content
+ editorState.read(() => {
+ const root = $getRoot()
+ const textContent = root.getTextContent().trim()
+ setIsEmpty(textContent === "")
+ })
+ }, [])
+
+ return (
+
+ {/* Input Area */}
+
+
+ {/* Context Bar - Always shown, positioned below the input area */}
+
+
onSend(prompt, null)}
+ />
+
+
+ )
+})
+
+ChatInput.displayName = "ChatInput"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInterface.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInterface.tsx
new file mode 100644
index 000000000..b4cdce21b
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInterface.tsx
@@ -0,0 +1,220 @@
+import { ScrollArea } from "@follow/components/ui/scroll-area/ScrollArea.js"
+import { tracker } from "@follow/tracker"
+import { clsx, cn, nextFrame } from "@follow/utils"
+import { springScrollTo } from "@follow/utils/scroller"
+import type { BizUIMessage } from "@folo-services/ai-tools"
+import { ErrorBoundary } from "@sentry/react"
+import type { EditorState, LexicalEditor } from "lexical"
+import { AnimatePresence } from "motion/react"
+import { nanoid } from "nanoid"
+import type { FC } from "react"
+import { useCallback, useEffect, useState } from "react"
+import { useEventCallback } from "usehooks-ts"
+
+import {
+ AIChatMessage,
+ AIChatWaitingIndicator,
+} from "~/modules/ai-chat/components/message/AIChatMessage"
+import { useAutoScroll } from "~/modules/ai-chat/hooks/useAutoScroll"
+import { useLoadMessages } from "~/modules/ai-chat/hooks/useLoadMessages"
+import {
+ useBlockActions,
+ useChatActions,
+ useChatError,
+ useChatStatus,
+ useCurrentChatId,
+ useHasMessages,
+ useMessages,
+} from "~/modules/ai-chat/store/hooks"
+
+import { convertLexicalToMarkdown } from "../../utils/lexical-markdown"
+import { AIErrorFallback } from "./AIErrorFallback"
+import { ChatInput } from "./ChatInput"
+import { CollapsibleError } from "./CollapsibleError"
+import { WelcomeScreen } from "./WelcomeScreen"
+
+const SCROLL_BOTTOM_THRESHOLD = window.innerHeight / 2
+
+const ChatInterfaceContent = () => {
+ const hasMessages = useHasMessages()
+ const status = useChatStatus()
+ const chatActions = useChatActions()
+ const error = useChatError()
+
+ const currentChatId = useCurrentChatId()
+
+ const [scrollAreaRef, setScrollAreaRef] = useState(null)
+ const [isAtBottom, setIsAtBottom] = useState(true)
+
+ // Reset handlers when chatId changes
+ useEffect(() => {
+ setIsAtBottom(true)
+ }, [currentChatId])
+
+ const { isLoading: isLoadingHistory } = useLoadMessages(currentChatId || "", {
+ onLoad: () => {
+ nextFrame(() => {
+ const $scrollArea = scrollAreaRef
+ const scrollHeight = $scrollArea?.scrollHeight
+
+ if (scrollHeight) {
+ $scrollArea?.scrollTo({
+ top: scrollHeight,
+ })
+ }
+ setIsAtBottom(true)
+ })
+ },
+ })
+
+ const { resetScrollState } = useAutoScroll(scrollAreaRef, status === "streaming")
+
+ useEffect(() => {
+ const scrollElement = scrollAreaRef
+
+ if (!scrollElement) return
+
+ const handleScroll = () => {
+ const { scrollTop, scrollHeight, clientHeight } = scrollElement
+ const distanceFromBottom = scrollHeight - scrollTop - clientHeight
+ const atBottom = distanceFromBottom <= SCROLL_BOTTOM_THRESHOLD
+ setIsAtBottom(atBottom)
+ }
+
+ scrollElement.addEventListener("scroll", handleScroll, { passive: true })
+
+ handleScroll()
+
+ return () => {
+ scrollElement.removeEventListener("scroll", handleScroll)
+ }
+ }, [scrollAreaRef])
+
+ const scrollToBottom = useCallback(() => {
+ const scrollElement = scrollAreaRef
+ if (!scrollElement) return
+
+ springScrollTo(scrollElement.scrollHeight, scrollElement)
+ }, [scrollAreaRef])
+
+ const blockActions = useBlockActions()
+ const handleSendMessage = useEventCallback(
+ (message: string | EditorState, editor: LexicalEditor | null) => {
+ resetScrollState()
+
+ const parts: BizUIMessage["parts"] = [
+ {
+ type: "data-block",
+ data: blockActions.getBlocks().map((b) => ({
+ type: b.type,
+ value: b.value,
+ })),
+ },
+ ]
+
+ if (typeof message === "string") {
+ parts.push({
+ type: "text",
+ text: message,
+ })
+ } else if (editor) {
+ parts.push({
+ type: "data-rich-text",
+ data: {
+ state: message.toJSON(),
+ text: convertLexicalToMarkdown(editor),
+ },
+ })
+ }
+
+ chatActions.sendMessage({
+ parts,
+ role: "user",
+ id: nanoid(),
+ })
+ tracker.aiChatMessageSent()
+ },
+ )
+
+ useEffect(() => {
+ if (status === "submitted") {
+ resetScrollState()
+ }
+ }, [status, resetScrollState])
+
+ const shouldShowScrollToBottom = hasMessages && !isAtBottom && !isLoadingHistory
+
+ return (
+
+
+
+ {!hasMessages && !isLoadingHistory ? (
+
+ ) : (
+
+ {isLoadingHistory ? (
+
+
+
+ ) : (
+
+
+ {status === "submitted" &&
}
+
+ )}
+
+ )}
+
+
+
+ {shouldShowScrollToBottom && (
+
+
+
+ {/* Glass effect overlay */}
+
+
+ {/* Content */}
+
+
+
+ Scroll to Bottom
+
+
+
+
+ )}
+
+
+ {error && }
+
+
+
+ )
+}
+
+export const ChatInterface = () => (
+
+
+
+)
+
+const Messages: FC = () => {
+ const messages = useMessages()
+
+ return messages.map((message) => )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatMoreDropdown.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx
similarity index 78%
rename from apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatMoreDropdown.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx
index a753a31a3..5dd31dd74 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatMoreDropdown.tsx
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatMoreDropdown.tsx
@@ -1,5 +1,5 @@
import { ActionButton } from "@follow/components/ui/button/index.js"
-import { use, useCallback, useState } from "react"
+import { useCallback, useState } from "react"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
@@ -15,36 +15,34 @@ import {
DropdownMenuTrigger,
} from "~/components/ui/dropdown-menu/dropdown-menu"
import { useDialog } from "~/components/ui/modal/stacked/hooks"
-import {
- AIChatContext,
- useAIChatSessionMethods,
-} from "~/modules/ai/chat/__internal__/AIChatContext"
-import { useSessionState } from "~/modules/ai/chat/atoms/session"
-import { useChatHistory } from "~/modules/ai/chat/hooks/useChatHistory"
-import { AIPersistService } from "~/modules/ai/chat/services"
-import { downloadMarkdown, exportChatToMarkdown } from "~/modules/ai/chat/utils/export"
+import { useChatHistory } from "~/modules/ai-chat/hooks/useChatHistory"
+import { AIPersistService } from "~/modules/ai-chat/services"
+import { useChatActions, useCurrentChatId, useCurrentTitle } from "~/modules/ai-chat/store/hooks"
+import { downloadMarkdown, exportChatToMarkdown } from "~/modules/ai-chat/utils/export"
export const ChatMoreDropdown = () => {
- const { currentTitle, currentRoomId } = useSessionState()
- const { handleNewChat, handleSwitchRoom } = useAIChatSessionMethods()
+ const currentTitle = useCurrentTitle()
+ const currentChatId = useCurrentChatId()
+
+ const chatActions = useChatActions()
const { t } = useTranslation("ai")
const { ask } = useDialog()
- const [deletingRoomId, setDeletingRoomId] = useState(null)
+ const [deletingChatId, setDeletingChatId] = useState(null)
const { sessions, loading, loadHistory } = useChatHistory()
- const { messages } = use(AIChatContext)
const handleDropdownOpen = (open: boolean) => {
if (open) {
loadHistory()
+ AIPersistService.cleanupEmptySessions()
}
}
const handleDeleteSession = useCallback(
- async (roomId: string, e: React.MouseEvent) => {
+ async (chatId: string, e: React.MouseEvent) => {
e.stopPropagation()
e.preventDefault()
- const session = sessions.find((s) => s.roomId === roomId)
+ const session = sessions.find((s) => s.chatId === chatId)
if (!session) return
const confirm = await ask({
@@ -55,13 +53,13 @@ export const ChatMoreDropdown = () => {
if (!confirm) return
- setDeletingRoomId(roomId)
+ setDeletingChatId(chatId)
try {
- await AIPersistService.deleteSession(roomId)
+ await AIPersistService.deleteSession(chatId)
toast.success(t("delete_chat_success"))
- if (roomId === currentRoomId) {
- handleNewChat()
+ if (chatId === currentChatId) {
+ chatActions.newChat()
}
loadHistory()
@@ -69,13 +67,14 @@ export const ChatMoreDropdown = () => {
console.error("Failed to delete session:", error)
toast.error(t("delete_chat_error"))
} finally {
- setDeletingRoomId(null)
+ setDeletingChatId(null)
}
},
- [sessions, ask, t, currentRoomId, loadHistory, handleNewChat],
+ [sessions, ask, t, currentChatId, loadHistory, chatActions],
)
const handleExport = useCallback(() => {
+ const messages = chatActions.getMessages()
if (messages.length === 0) {
toast.error(t("export_empty_chat"))
return
@@ -90,7 +89,7 @@ export const ChatMoreDropdown = () => {
toast.error(t("export_error"))
console.error("Export error:", error)
}
- }, [messages, currentTitle, t])
+ }, [chatActions, currentTitle, t])
return (
@@ -118,8 +117,8 @@ export const ChatMoreDropdown = () => {
{sessions.map((session) => (
handleSwitchRoom(session.roomId)}
+ key={session.chatId}
+ onClick={() => chatActions.switchToChat(session.chatId)}
className="group flex h-12 cursor-pointer items-center justify-between rounded-md px-2 py-3"
>
@@ -135,11 +134,11 @@ export const ChatMoreDropdown = () => {
handleDeleteSession(session.roomId, e)}
- className="group-data-[highlighted]:text-red bg-accent absolute inset-y-0 right-0 flex items-center px-2 py-1 text-white opacity-0 shadow-lg backdrop-blur-sm group-data-[highlighted]:opacity-100"
- disabled={deletingRoomId === session.roomId}
+ onClick={(e) => handleDeleteSession(session.chatId, e)}
+ className="bg-accent absolute inset-y-0 right-0 flex items-center px-2 py-1 text-white opacity-0 shadow-lg backdrop-blur-sm group-data-[highlighted]:text-white group-data-[highlighted]:opacity-100"
+ disabled={deletingChatId === session.chatId}
>
- {deletingRoomId === session.roomId ? (
+ {deletingChatId === session.chatId ? (
) : (
@@ -150,7 +149,7 @@ export const ChatMoreDropdown = () => {
))}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/CollapsibleError.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/CollapsibleError.tsx
new file mode 100644
index 000000000..f4cecf5da
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/CollapsibleError.tsx
@@ -0,0 +1,229 @@
+import { Spring } from "@follow/components/constants/spring.js"
+import { cn } from "@follow/utils"
+import { ExceptionCodeMap } from "@follow-app/client-sdk"
+import { m } from "motion/react"
+import * as React from "react"
+
+import { useI18n } from "~/hooks/common/useI18n"
+
+interface CollapsibleErrorProps {
+ error: Error | string
+ title?: string
+ className?: string
+ collapsedHeight?: string
+ icon?: string
+}
+
+interface ErrorData {
+ code?: number
+ remainedTokens?: number
+ windowResetTime?: string
+ [key: string]: any
+}
+
+export const CollapsibleError: React.FC = ({
+ error,
+ title,
+ className,
+ collapsedHeight = "48px",
+ icon = "i-mgc-alert-cute-fi",
+}) => {
+ const [isExpanded, setIsExpanded] = React.useState(false)
+ const t = useI18n()
+
+ const { displayMessage, errorCode, errorData, isBusinessError } = React.useMemo(() => {
+ const rawMessage = typeof error === "string" ? error : error.message
+
+ try {
+ const parsed = JSON.parse(rawMessage)
+
+ const errorData: ErrorData = parsed || {}
+ const { code } = errorData
+
+ if (code && ExceptionCodeMap[code]) {
+ // This is a business exception code
+ const errorKey = `errors:${code}` as any
+ const translatedMessage = t(errorKey)
+ // If translation exists and is different from the key, use it; otherwise fallback to raw message
+ const userFriendlyMessage = translatedMessage !== errorKey ? translatedMessage : rawMessage
+ return {
+ displayMessage: userFriendlyMessage,
+ errorCode: code,
+ errorData,
+ isBusinessError: true,
+ }
+ }
+
+ // If no code in data, return the original message
+ return {
+ displayMessage: rawMessage,
+ errorCode: null,
+ errorData: null,
+ isBusinessError: false,
+ }
+ } catch {
+ // If parsing fails, return the original message
+ return {
+ displayMessage: rawMessage,
+ errorCode: null,
+ errorData: null,
+ isBusinessError: false,
+ }
+ }
+ }, [error, t])
+
+ const formatResetTime = (windowResetTime: string) => {
+ const resetDate = new Date(windowResetTime)
+
+ // Format date part as YYYY/MM/DD
+ const dateFormatter = new Intl.DateTimeFormat("en-CA", {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ })
+ const datePart = dateFormatter.format(resetDate).replaceAll("-", "/")
+
+ // Format time part as HH:mm
+ const timeFormatter = new Intl.DateTimeFormat("en-GB", {
+ hour: "2-digit",
+ minute: "2-digit",
+ hour12: false,
+ })
+ const timePart = timeFormatter.format(resetDate)
+
+ // Get timezone offset
+ const timezoneFormatter = new Intl.DateTimeFormat("en", {
+ timeZoneName: "short",
+ })
+ const timezone =
+ timezoneFormatter.formatToParts(resetDate).find((part) => part.type === "timeZoneName")
+ ?.value || ""
+
+ return `${datePart} ${timePart} (${timezone})`
+ }
+
+ const getContextualInfo = () => {
+ if (!isBusinessError || !errorData) return null
+
+ switch (errorCode) {
+ case ExceptionCodeMap.AIRateLimitExceeded: {
+ // AI Rate Limit Exceeded
+ return (
+
+ {errorData.remainedTokens !== undefined && (
+
+ Remaining tokens:
+ {errorData.remainedTokens}
+
+ )}
+ {errorData.windowResetTime && (
+
+ Rate limit resets at:
+ {formatResetTime(errorData.windowResetTime)}
+
+ )}
+
+ )
+ }
+ default: {
+ return null
+ }
+ }
+ }
+
+ const getErrorTitle = () => {
+ if (title) return title
+
+ if (isBusinessError) {
+ switch (errorCode) {
+ case ExceptionCodeMap.AIRateLimitExceeded: {
+ return "AI Rate Limit Exceeded"
+ }
+ default: {
+ return "Error occurred"
+ }
+ }
+ }
+
+ return "Error occurred"
+ }
+
+ const contextualInfo = getContextualInfo()
+
+ return (
+ setIsExpanded(true)}
+ onMouseLeave={() => setIsExpanded(false)}
+ >
+
+
+ {/* Glass effect overlay */}
+
+
+ {/* Collapsed Content */}
+
+
+
+
+
+
+ hover to expand
+
+
+
+ {/* Expanded Content */}
+
+
+
+ {displayMessage as string}
+
+ {contextualInfo && (
+
+ {contextualInfo}
+
+ )}
+
+
+
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/WelcomeScreen.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/WelcomeScreen.tsx
similarity index 60%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/WelcomeScreen.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/WelcomeScreen.tsx
index 761a384ab..ff25037c3 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/WelcomeScreen.tsx
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/WelcomeScreen.tsx
@@ -1,14 +1,13 @@
+import type { EditorState, LexicalEditor } from "lexical"
import { m } from "motion/react"
import { useTranslation } from "react-i18next"
import { useAISettingValue } from "~/atoms/settings/ai"
-import { ChatInput } from "~/modules/ai/chat/components/ChatInput"
+import { AISpline } from "~/modules/ai-chat/components/3d-models/AISpline"
import { useSettingModal } from "~/modules/settings/modal/use-setting-modal-hack"
-import { AISpline } from "../../AISpline"
-
interface WelcomeScreenProps {
- onSend: (message: string) => void
+ onSend: (message: EditorState | string, editor: LexicalEditor | null) => void
}
const DEFAULT_SHORTCUTS = [
"Generate today daily report",
@@ -27,42 +26,20 @@ export const WelcomeScreen = ({ onSend }: WelcomeScreenProps) => {
return (
-
-
+
+
{APP_NAME} AI
-
{t("welcome_description")}
- {hasCustomPrompt && (
-
-
-
- Personal Prompt:
-
-
settingModalPresent("ai")}
- className="text-text-tertiary hover:text-text-secondary flex size-5 items-center justify-center rounded transition-colors"
- title="Edit in Settings"
- >
-
-
-
-
- {aiSettings.personalizePrompt}
-
-
- )}
+
{t("welcome_description")}
-
-
-
+
-
+
{/* Custom shortcuts first */}
{enabledShortcuts.slice(0, 6).map((shortcut, index) => (
{
className="bg-material-medium hover:bg-material-thick border-border text-text-secondary hover:text-text whitespace-nowrap rounded-full border px-4 py-2 text-xs transition-colors"
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
+ exit={{ opacity: 0, y: 10 }}
transition={{ delay: index * 0.1 }}
- onClick={() => onSend(shortcut.prompt)}
+ onClick={() => onSend(shortcut.prompt, null)}
title={shortcut.hotkey ? `${shortcut.name} (${shortcut.hotkey})` : shortcut.name}
>
{shortcut.name}
@@ -86,12 +64,32 @@ export const WelcomeScreen = ({ onSend }: WelcomeScreenProps) => {
className="bg-material-medium hover:bg-material-thick border-border text-text-secondary hover:text-text whitespace-nowrap rounded-full border px-4 py-2 text-xs transition-colors"
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
+ exit={{ opacity: 0, y: 10 }}
transition={{ delay: (enabledShortcuts.length + index) * 0.1 }}
- onClick={() => onSend(suggestion)}
+ onClick={() => onSend(suggestion, null)}
>
{suggestion}
))}
+
+ {hasCustomPrompt && (
+
+
+
Personal Prompt:
+
settingModalPresent("ai")}
+ className="text-text-tertiary hover:text-text-secondary flex size-5 items-center justify-center rounded transition-colors"
+ title="Edit in Settings"
+ >
+
+
+
+
+ {aiSettings.personalizePrompt}
+
+
+ )}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIChatMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIChatMessage.tsx
similarity index 68%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIChatMessage.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIChatMessage.tsx
index 3a9fd8720..888dd4f24 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIChatMessage.tsx
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIChatMessage.tsx
@@ -1,14 +1,18 @@
+import { createDefaultLexicalEditor } from "@follow/components/ui/lexical-rich-editor/editor.js"
import { stopPropagation } from "@follow/utils"
import type { UIDataTypes, UIMessage } from "ai"
+import type { LexicalEditor, SerializedEditorState } from "lexical"
import { m } from "motion/react"
import * as React from "react"
import { toast } from "sonner"
import { copyToClipboard } from "~/lib/clipboard"
-import { AIChatContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-import type { BizUIMetadata, BizUITools } from "~/modules/ai/chat/__internal__/types"
-import { useEditingMessageId, useSetEditingMessageId } from "~/modules/ai/chat/atoms/session"
+import { useEditingMessageId, useSetEditingMessageId } from "~/modules/ai-chat/atoms/session"
+import { useChatActions } from "~/modules/ai-chat/store/hooks"
+import type { BizUIMetadata, BizUITools } from "~/modules/ai-chat/store/types"
+import type { RichTextPart } from "../../types/ChatSession"
+import { convertLexicalToMarkdown } from "../../utils/lexical-markdown"
import { AIMessageParts } from "./AIMessageParts"
import { EditableMessage } from "./EditableMessage"
@@ -26,7 +30,8 @@ interface AIChatMessageProps {
}
export const AIChatMessage: React.FC
= React.memo(({ message }) => {
- const { regenerate, sendMessage, setMessages, messages } = React.use(AIChatContext)
+ const chatActions = useChatActions()
+
const messageId = message.id
const [isHovered, setIsHovered] = React.useState(false)
const editingMessageId = useEditingMessageId()
@@ -35,43 +40,67 @@ export const AIChatMessage: React.FC = React.memo(({ message
const isEditing = editingMessageId === messageId
const isUserMessage = message.role === "user"
- // Get message content for editing
- const messageContent = React.useMemo(() => {
- return (
- message.parts
- ?.filter((part) => part.type === "text")
- .map((part) => part.text)
- .join(" ") || ""
- )
- }, [message.parts])
-
const handleEdit = React.useCallback(() => {
if (isUserMessage) {
setEditingMessageId(messageId)
}
}, [isUserMessage, messageId, setEditingMessageId])
- const handleSaveEdit = React.useCallback(
- (newContent: string) => {
- if (newContent.trim() !== messageContent.trim()) {
- // Find the message index and remove all messages after it (including AI responses)
- const messageIndex = messages.findIndex((msg) => msg.id === messageId)
- if (messageIndex !== -1) {
- const messagesToKeep = messages.slice(0, messageIndex)
- setMessages(messagesToKeep)
-
- // Send the edited message
- sendMessage({
- text: newContent,
- metadata: {
- finishTime: new Date().toISOString(),
- },
- })
+ const getMessageMarkdownFormat = React.useCallback(() => {
+ let content = ""
+ for (const part of message.parts) {
+ let lexicalEditor: LexicalEditor | null = null
+ switch (part.type) {
+ case "text": {
+ content += part.text
+ break
}
+ case "data-rich-text": {
+ lexicalEditor ||= createDefaultLexicalEditor()
+ lexicalEditor.setEditorState(
+ lexicalEditor.parseEditorState((part as RichTextPart).data.state),
+ )
+ content += convertLexicalToMarkdown(lexicalEditor)
+ break
+ }
+
+ default: {
+ if (part.type.startsWith("tool-")) {
+ content += `\n\n[TOOL CALL: ${part.type.replace("tool-", "")}]\n\n`
+ }
+ break
+ }
+ }
+ }
+ return content
+ }, [message.parts])
+
+ const handleSaveEdit = React.useCallback(
+ (newState: SerializedEditorState, editor: LexicalEditor) => {
+ const messageContent = convertLexicalToMarkdown(editor)
+ const messages = chatActions.getMessages()
+ const messageIndex = messages.findIndex((msg) => msg.id === messageId)
+ if (messageIndex !== -1) {
+ const messagesToKeep = messages.slice(0, messageIndex)
+ const nextMessage = messages[messageIndex]!
+ chatActions.setMessages(messagesToKeep)
+
+ const richTextPart = nextMessage.parts.find(
+ (part) => part.type === "data-rich-text",
+ ) as RichTextPart
+ if (richTextPart) {
+ richTextPart.data = {
+ state: newState,
+ text: messageContent,
+ }
+ }
+
+ // Send the edited message
+ chatActions.sendMessage(nextMessage)
}
setEditingMessageId(null)
},
- [messageContent, messageId, messages, setMessages, sendMessage, setEditingMessageId],
+ [chatActions, messageId, setEditingMessageId],
)
const handleCancelEdit = React.useCallback(() => {
@@ -79,17 +108,18 @@ export const AIChatMessage: React.FC = React.memo(({ message
}, [setEditingMessageId])
const handleCopy = React.useCallback(async () => {
+ const messageContent = getMessageMarkdownFormat()
try {
await copyToClipboard(messageContent)
toast.success("Message copied to clipboard")
} catch {
toast.error("Failed to copy message")
}
- }, [messageContent])
+ }, [getMessageMarkdownFormat])
const handleRetry = React.useCallback(() => {
- regenerate({ messageId })
- }, [regenerate, messageId])
+ chatActions.regenerate({ messageId })
+ }, [chatActions, messageId])
return (
= React.memo(({ message
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
-
+
{/* Show editable message if editing */}
{isEditing && isUserMessage ? (
@@ -161,7 +191,7 @@ export const AIChatMessage: React.FC
= React.memo(({ message
{/* Action buttons */}
= React.memo(({ message
)}
+
+
>
)}
@@ -209,29 +241,10 @@ export const AIChatMessage: React.FC
= React.memo(({ message
)
})
-// Typing indicator component
-export const AIChatTypingIndicator: React.FC = () => {
+export const AIChatWaitingIndicator: React.FC = () => {
return (
-
-
-
+
+
+
)
}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIDataBlockPart.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIDataBlockPart.tsx
new file mode 100644
index 000000000..511cc9b3e
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIDataBlockPart.tsx
@@ -0,0 +1,199 @@
+import { useEntry } from "@follow/store/entry/hooks"
+import { useFeedById } from "@follow/store/feed/hooks"
+import { cn } from "@follow/utils/utils"
+import { m } from "motion/react"
+import * as React from "react"
+
+import type { AIChatContextBlock } from "~/modules/ai-chat/store/types"
+
+interface AIDataBlockPartProps {
+ blocks: AIChatContextBlock[]
+}
+
+// Helper components for displaying titles
+const EntryTitle: React.FC<{ entryId?: string; fallback: string }> = ({ entryId, fallback }) => {
+ const entryTitle = useEntry(entryId!, (e) => e?.title)
+
+ if (!entryId || !entryTitle) {
+ return {fallback}
+ }
+
+ return {entryTitle}
+}
+
+const FeedTitle: React.FC<{ feedId?: string; fallback: string }> = ({ feedId, fallback }) => {
+ const feed = useFeedById(feedId, (feed) => ({ title: feed?.title }))
+ if (!feedId || !feed) {
+ return {fallback}
+ }
+
+ return {feed.title}
+}
+
+// Data Block Component
+export const AIDataBlockPart: React.FC = React.memo(({ blocks }) => {
+ const getBlockIcon = (type: AIChatContextBlock["type"]) => {
+ switch (type) {
+ case "mainEntry": {
+ return "i-mgc-star-cute-fi"
+ }
+ case "referEntry": {
+ return "i-mgc-paper-cute-fi"
+ }
+ case "referFeed": {
+ return "i-mgc-rss-cute-fi"
+ }
+ case "selectedText": {
+ return "i-mgc-quill-pen-cute-re"
+ }
+ default: {
+ return "i-mgc-paper-cute-fi"
+ }
+ }
+ }
+
+ const getBlockLabel = (type: AIChatContextBlock["type"]) => {
+ switch (type) {
+ case "mainEntry": {
+ return "Current"
+ }
+ case "referEntry": {
+ return "Ref"
+ }
+ case "referFeed": {
+ return "Feed"
+ }
+ case "selectedText": {
+ return "Text"
+ }
+ default: {
+ return ""
+ }
+ }
+ }
+
+ const getBlockStyles = (type: AIChatContextBlock["type"]) => {
+ switch (type) {
+ case "mainEntry": {
+ return {
+ container: "from-orange/5 to-orange/10 border-orange/20 hover:border-orange/30",
+ icon: "bg-orange/10 text-orange",
+ label: "text-orange",
+ }
+ }
+ case "referEntry": {
+ return {
+ container: "from-blue/5 to-blue/10 border-blue/20 hover:border-blue/30",
+ icon: "bg-blue/10 text-blue",
+ label: "text-blue",
+ }
+ }
+ case "referFeed": {
+ return {
+ container: "from-green/5 to-green/10 border-green/20 hover:border-green/30",
+ icon: "bg-green/10 text-green",
+ label: "text-green",
+ }
+ }
+ case "selectedText": {
+ return {
+ container: "from-purple/5 to-purple/10 border-purple/20 hover:border-purple/30",
+ icon: "bg-purple/10 text-purple",
+ label: "text-purple",
+ }
+ }
+ default: {
+ return {
+ container: "from-gray/5 to-gray/10 border-gray/20 hover:border-gray/30",
+ icon: "bg-gray/10 text-gray",
+ label: "text-gray",
+ }
+ }
+ }
+ }
+
+ const getDisplayContent = (block: AIChatContextBlock) => {
+ switch (block.type) {
+ case "mainEntry":
+ case "referEntry": {
+ return
+ }
+ case "referFeed": {
+ return
+ }
+ case "selectedText": {
+ return `"${block.value}"`
+ }
+ default: {
+ return block.value
+ }
+ }
+ }
+
+ if (!blocks || blocks.length === 0) {
+ return null
+ }
+
+ return (
+
+ {/* Context indicator */}
+
+
+ Context:
+
+
+ {/* Blocks */}
+ {blocks.map((block, index) => {
+ const styles = getBlockStyles(block.type)
+
+ return (
+
+ {/* Icon */}
+
+
+
+
+ {/* Label and content */}
+
+
+ {getBlockLabel(block.type)}
+
+ ยท
+
+ {getDisplayContent(block)}
+
+
+
+ )
+ })}
+
+ )
+})
+
+AIDataBlockPart.displayName = "AIDataBlockPart"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMarkdownMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMarkdownMessage.tsx
new file mode 100644
index 000000000..b32a20d72
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMarkdownMessage.tsx
@@ -0,0 +1,472 @@
+import type { LinkProps } from "@follow/components/ui/link/LinkWithTooltip.js"
+import { parseMarkdown } from "@follow/components/utils/parse-markdown.js"
+import { cn, isBizId } from "@follow/utils"
+import {
+ createElement,
+ isValidElement,
+ memo,
+ useCallback,
+ useDeferredValue,
+ useEffect,
+ useMemo,
+ useRef,
+ useSyncExternalStore,
+} from "react"
+
+import { ShikiHighLighter } from "~/components/ui/code-highlighter"
+import { MarkdownLink } from "~/components/ui/markdown/renderers/MarkdownLink"
+import { usePeekModal } from "~/hooks/biz/usePeekModal"
+
+import { animatedPlugin } from "./animatedPlugin"
+
+// Buffer configuration interface
+interface BufferConfig {
+ minBufferSize: number
+ maxBufferSize: number // Maximum buffer size to prevent OOM
+ maxBufferTime: number
+ semanticTimeout: number
+ emergencyTimeout: number
+}
+
+// Buffer endpoint patterns by priority
+const BUFFER_ENDPOINTS = {
+ HIGH_PRIORITY: [
+ /\n\n/g, // Paragraph breaks
+ /\n```\w*\n/g, // Code block boundaries
+ /\n-{2,}\n/g, // Horizontal rules
+ /[.!?]\s+/g, // Sentence endings with space
+ /\n[-*+]\s/g, // List items
+ /\n\d+\.\s/g, // Numbered lists
+ ],
+ MEDIUM_PRIORITY: [
+ /[,:;]\s/g, // Clause boundaries
+ /[)\]]\s/g, // Closing brackets with space
+ /\n(?!\n)/g, // Single line breaks
+ ],
+ LOW_PRIORITY: [/\s/g], // Any whitespace
+} as const
+
+// Streaming message buffer class for external state management
+class StreamingMessageBuffer {
+ private displayedText = ""
+ private bufferedText = ""
+ private lastFlushTime = Date.now()
+ private flushTimeoutId: ReturnType | null = null
+ private subscribers = new Set<() => void>()
+ private config: BufferConfig
+
+ constructor(config: BufferConfig) {
+ this.config = config
+ }
+
+ // Subscribe to state changes
+ subscribe = (callback: () => void) => {
+ this.subscribers.add(callback)
+ return () => {
+ this.subscribers.delete(callback)
+ }
+ }
+
+ // Get current displayed text snapshot
+ getSnapshot = () => {
+ return this.displayedText
+ }
+
+ // Notify all subscribers of state change
+ private notify = () => {
+ this.subscribers.forEach((callback) => callback())
+ }
+
+ // Find last endpoint of given priority in text
+ private findLastEndpoint = (text: string, priority: keyof typeof BUFFER_ENDPOINTS): number => {
+ const patterns = BUFFER_ENDPOINTS[priority]
+ let lastIndex = -1
+
+ for (const pattern of patterns) {
+ const matches = [...text.matchAll(pattern)]
+ if (matches.length > 0) {
+ const lastMatch = matches.at(-1)
+ if (lastMatch?.index !== undefined) {
+ lastIndex = Math.max(lastIndex, lastMatch.index + lastMatch[0].length)
+ }
+ }
+ }
+
+ return lastIndex
+ }
+
+ // Determine optimal flush point in buffered text
+ private determineFlushPoint = (bufferedText: string): number => {
+ // Try high priority endpoints first
+ const highPriorityPoint = this.findLastEndpoint(bufferedText, "HIGH_PRIORITY")
+ if (highPriorityPoint > 0) return highPriorityPoint
+
+ // Try medium priority endpoints
+ const mediumPriorityPoint = this.findLastEndpoint(bufferedText, "MEDIUM_PRIORITY")
+ if (mediumPriorityPoint > 0) return mediumPriorityPoint
+
+ // Try low priority endpoints
+ const lowPriorityPoint = this.findLastEndpoint(bufferedText, "LOW_PRIORITY")
+ if (lowPriorityPoint > 0) return lowPriorityPoint
+
+ // Flush entire buffer if no endpoints found
+ return bufferedText.length
+ }
+
+ // Check if buffer should be flushed
+ private shouldFlushBuffer = (bufferedText: string): boolean => {
+ const now = Date.now()
+ const timeSinceLastFlush = now - this.lastFlushTime
+
+ // Emergency timeout - always flush
+ if (timeSinceLastFlush > this.config.emergencyTimeout) return true
+
+ // Buffer size limit - prevent OOM
+ if (bufferedText.length > this.config.maxBufferSize) return true
+
+ // Minimum buffer size not met
+ if (bufferedText.length < this.config.minBufferSize) return false
+
+ // Check for high priority endpoints (immediate flush)
+ if (this.findLastEndpoint(bufferedText, "HIGH_PRIORITY") > 0) return true
+
+ // Check for medium priority endpoints with time condition
+ if (
+ this.findLastEndpoint(bufferedText, "MEDIUM_PRIORITY") > 0 &&
+ timeSinceLastFlush > this.config.maxBufferTime
+ ) {
+ return true
+ }
+
+ // Semantic timeout for incomplete sentences
+ if (timeSinceLastFlush > this.config.semanticTimeout) {
+ return this.findLastEndpoint(bufferedText, "LOW_PRIORITY") > 0
+ }
+
+ return false
+ }
+
+ // Emergency flush timer
+ private scheduleEmergencyFlush = () => {
+ if (this.flushTimeoutId) return
+
+ this.flushTimeoutId = setTimeout(() => {
+ this.displayedText += this.bufferedText
+ this.bufferedText = ""
+ this.lastFlushTime = Date.now()
+ this.flushTimeoutId = null
+ this.notify()
+ }, this.config.emergencyTimeout)
+ }
+
+ // Clear emergency flush timer
+ private clearEmergencyFlush = () => {
+ if (this.flushTimeoutId) {
+ clearTimeout(this.flushTimeoutId)
+ this.flushTimeoutId = null
+ }
+ }
+
+ // Update text content
+ updateText = (newText: string, isProcessing: boolean) => {
+ // Safety check for undefined/null newText
+ if (typeof newText !== "string") {
+ return
+ }
+
+ if (!isProcessing) {
+ // Immediate update when not processing
+ this.displayedText = newText
+ this.bufferedText = ""
+ this.lastFlushTime = Date.now()
+ this.clearEmergencyFlush()
+ this.notify()
+ return
+ }
+
+ // Calculate delta and update buffer
+ const deltaText = newText.slice(this.displayedText.length + this.bufferedText.length)
+ if (!deltaText) return
+
+ const newBufferedText = this.bufferedText + deltaText
+
+ // Check if we should flush
+ if (this.shouldFlushBuffer(newBufferedText)) {
+ const flushPoint = this.determineFlushPoint(newBufferedText)
+ const textToFlush = newBufferedText.slice(0, flushPoint)
+ const remainingBuffer = newBufferedText.slice(flushPoint)
+
+ this.displayedText += textToFlush
+ this.bufferedText = remainingBuffer
+ this.lastFlushTime = Date.now()
+ this.clearEmergencyFlush()
+
+ if (remainingBuffer.length > 0) {
+ this.scheduleEmergencyFlush()
+ }
+
+ this.notify()
+ } else {
+ this.bufferedText = newBufferedText
+ this.scheduleEmergencyFlush()
+ }
+ }
+
+ // Cleanup resources
+ destroy = () => {
+ this.clearEmergencyFlush()
+ this.subscribers.clear()
+ }
+}
+
+// Buffer configurations
+const BUFFER_CONFIG = {
+ minBufferSize: 10,
+ maxBufferSize: 10000, // Prevent OOM with 10KB limit
+ maxBufferTime: 100,
+ semanticTimeout: 300,
+ emergencyTimeout: 500,
+} as const
+
+// Hook to use streaming text buffer
+const useStreamingTextBuffer = (text: string, isProcessing: boolean) => {
+ const bufferRef = useRef(null)
+
+ // Initialize buffer if needed (only during processing)
+ if (isProcessing && !bufferRef.current) {
+ bufferRef.current = new StreamingMessageBuffer(BUFFER_CONFIG)
+ }
+
+ // Clean up buffer when not processing
+ if (!isProcessing && bufferRef.current) {
+ bufferRef.current.destroy()
+ bufferRef.current = null
+ }
+
+ // Update buffer when text changes (only if processing)
+ if (isProcessing && bufferRef.current) {
+ bufferRef.current.updateText(text, isProcessing)
+ }
+
+ // Subscribe to buffer changes - always call the hook
+ const displayedText = useSyncExternalStore(
+ bufferRef.current?.subscribe || (() => () => {}),
+ bufferRef.current?.getSnapshot || (() => text),
+ )
+
+ // Cleanup on unmount to prevent memory leaks
+ useEffect(() => {
+ return () => {
+ bufferRef.current?.destroy()
+ bufferRef.current = null
+ }
+ }, [])
+
+ // Return text directly when not processing, buffered text when processing
+ return isProcessing ? displayedText : text
+}
+
+// Custom hook for throttled markdown parsing during streaming
+const useThrottledMarkdownParsing = (text: string, isProcessing: boolean) => {
+ const lastParsedTextRef = useRef("")
+ const cachedResultRef = useRef(null)
+ const lastParseTimeRef = useRef(0)
+
+ const parseWithCache = useCallback(
+ (content: string, shouldProcess: boolean) => {
+ const now = Date.now()
+
+ // During streaming, throttle parsing
+ if (shouldProcess && cachedResultRef.current) {
+ const timeSinceLastParse = now - lastParseTimeRef.current
+ if (timeSinceLastParse < 16) {
+ // Return cached result if within throttle window
+ return cachedResultRef.current
+ }
+ }
+
+ // If content hasn't changed, return cached result
+ if (content === lastParsedTextRef.current && cachedResultRef.current) {
+ return cachedResultRef.current
+ }
+
+ // Parse and cache the result
+ const result = baseAIMarkdownParser(content, isProcessing)
+
+ lastParsedTextRef.current = content
+ cachedResultRef.current = result
+ lastParseTimeRef.current = now
+ return result
+ },
+ [isProcessing],
+ )
+
+ return useMemo(() => {
+ // For non-processing state, always parse immediately
+ if (!isProcessing) {
+ return parseWithCache(text, false)
+ }
+
+ // During processing, apply throttling logic
+ return parseWithCache(text, true)
+ }, [text, isProcessing, parseWithCache])
+}
+
+export const AIMarkdownStreamingMessage = memo(
+ ({
+ text,
+ className: classNameProp,
+ isProcessing,
+ }: {
+ text: string
+ className?: string
+ isProcessing?: boolean
+ }) => {
+ const className = `prose dark:prose-invert text-sm
+ prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg prose-h4:text-base prose-h5:text-base prose-h6:text-sm
+ prose-li:list-disc prose-li:marker:text-accent prose-hr:border-border prose-hr:mx-8`
+
+ // Use intelligent streaming buffer for semantic text rendering
+ const bufferedText = useStreamingTextBuffer(text, isProcessing ?? false)
+
+ // Use deferred value for lower priority rendering during streaming
+ const deferredText = useDeferredValue(bufferedText)
+
+ // Use our optimized parsing hook with buffered text
+ const parsedContent = useThrottledMarkdownParsing(
+ // During streaming, use deferred buffered text for optimal rendering
+ isProcessing ? deferredText : text,
+ isProcessing ?? false,
+ )
+
+ return {parsedContent}
+ },
+ // Enhanced memo comparison for better performance
+ (prevProps, nextProps) => {
+ // If not processing, do normal comparison
+ if (!nextProps.isProcessing && !prevProps.isProcessing) {
+ return (
+ prevProps.text === nextProps.text &&
+ prevProps.className === nextProps.className &&
+ prevProps.isProcessing === nextProps.isProcessing
+ )
+ }
+
+ // During processing, be more lenient with text changes to reduce re-renders
+ if (nextProps.isProcessing) {
+ // Only re-render if there's a significant change or processing state changes
+ return (
+ prevProps.text === nextProps.text &&
+ prevProps.className === nextProps.className &&
+ prevProps.isProcessing === nextProps.isProcessing
+ )
+ }
+
+ // Default comparison
+ return false
+ },
+)
+
+export const AIMarkdownMessage = memo(
+ ({ text, className }: { text: string; className?: string }) => {
+ return (
+ {useMemo(() => baseAIMarkdownParser(text, false), [text])}
+ )
+ },
+)
+
+const RelatedEntryLink = (props: LinkProps) => {
+ const { href, children } = props
+ const entryId = isBizId(href) ? href : null
+
+ const peekModal = usePeekModal()
+ if (!entryId) {
+ return
+ }
+ return (
+ {
+ peekModal(entryId, "modal")
+ }}
+ >
+ {children}
+
+
+ )
+}
+
+function baseAIMarkdownParser(content: string, isProcessing: boolean) {
+ return parseMarkdown(content, {
+ rehypePlugins: isProcessing ? [animatedPlugin] : undefined,
+ components: {
+ pre: ({ children }) => {
+ const props = isValidElement(children) && "props" in children && children.props
+
+ if (props) {
+ const { className, children } = props as any
+
+ if (className && className.includes("language-") && typeof children === "string") {
+ const language = className.replace("language-", "")
+ const code = children
+
+ return
+ }
+ }
+
+ return {children}
+ },
+ a: ({ node, ...props }) => {
+ return createElement(RelatedEntryLink, { ...props } as any)
+ },
+ table: ({ children, ref, node, ...props }) => {
+ return (
+
+ )
+ },
+ thead: ({ children, ref, node, ...props }) => {
+ return (
+
+ {children}
+
+ )
+ },
+ th: ({ children, ref, node, ...props }) => {
+ return (
+
+ {children}
+
+ )
+ },
+ tbody: ({ children, ref, node, ...props }) => {
+ return (
+
+ {children}
+
+ )
+ },
+ tr: ({ children, ref, node, ...props }) => {
+ return (
+
+ {children}
+
+ )
+ },
+ td: ({ children, ref, node, ...props }) => {
+ return (
+
+ {children}
+
+ )
+ },
+ },
+ }).content
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx
new file mode 100644
index 000000000..8e8f851ca
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIMessageParts.tsx
@@ -0,0 +1,145 @@
+import "@xyflow/react/dist/style.css"
+
+import type { ToolUIPart } from "ai"
+import type { SerializedEditorState } from "lexical"
+import { m } from "motion/react"
+import * as React from "react"
+
+import type {
+ AIChatContextBlock,
+ AIDisplayAnalyticsTool,
+ AIDisplayEntriesTool,
+ AIDisplayFeedsTool,
+ AIDisplayFlowTool,
+ AIDisplaySubscriptionsTool,
+ BizUIMessage,
+} from "~/modules/ai-chat/store/types"
+
+import {
+ AIDisplayAnalyticsPart,
+ AIDisplayEntriesPart,
+ AIDisplayFeedsPart,
+ AIDisplaySubscriptionsPart,
+} from "../displays"
+// import { AIDisplayFlowPart } from "../displays/AIDisplayFlowPart"
+import { AIDataBlockPart } from "./AIDataBlockPart"
+import { AIMarkdownMessage, AIMarkdownStreamingMessage } from "./AIMarkdownMessage"
+import { AIRichTextMessage } from "./AIRichTextMessage"
+import { ToolInvocationComponent } from "./ToolInvocationComponent"
+
+const LazyAIDisplayFlowPart = React.lazy(() =>
+ import("../displays/AIDisplayFlowPart").then((mod) => ({ default: mod.AIDisplayFlowPart })),
+)
+
+interface MessagePartsProps {
+ message: BizUIMessage
+}
+const ThinkingIndicator: React.FC = () => {
+ return (
+
+
+
+ Thinking...
+
+
+
+ )
+}
+
+export const AIMessageParts: React.FC = React.memo(({ message }) => {
+ if (!message.parts || message.parts.length === 0) {
+ // In AI SDK v5, messages should always have parts
+ if (message.role === "assistant") {
+ return
+ }
+ return null
+ }
+ const isUser = message.role === "user"
+
+ return message.parts.map((part, index) => {
+ const partKey = `${message.id}-${index}`
+
+ switch (part.type) {
+ case "text": {
+ if (message.role === "assistant")
+ return (
+
+ )
+ return
+ }
+
+ case "data-block": {
+ return
+ }
+
+ case "data-rich-text": {
+ return (
+
+ )
+ }
+
+ case "tool-displayAnalytics": {
+ return
+ }
+ case "tool-displayEntries": {
+ return
+ }
+ case "tool-displaySubscriptions": {
+ return (
+
+ )
+ }
+ case "tool-displayFeeds": {
+ return
+ }
+
+ case "tool-displayFlowChart": {
+ const loadingElement = (
+
+
+
+
+
+ Generating Flow Chart...
+
+
+
+
+ )
+ return (
+
+
+
+ )
+ }
+
+ default: {
+ if (part.type.startsWith("tool-")) {
+ if (part.type.startsWith("tool-chunkBreak")) {
+ return null
+ }
+ return
+ }
+ return null
+ }
+ }
+ })
+})
+
+AIMessageParts.displayName = "AIMessageParts"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIRichTextMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIRichTextMessage.tsx
new file mode 100644
index 000000000..3227f698b
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/AIRichTextMessage.tsx
@@ -0,0 +1,51 @@
+import { LexicalRichEditorNodes } from "@follow/components/ui/lexical-rich-editor/nodes.js"
+import { defaultLexicalTheme } from "@follow/components/ui/lexical-rich-editor/theme.js"
+import { cn } from "@follow/utils"
+import type { InitialConfigType } from "@lexical/react/LexicalComposer"
+import { LexicalComposer } from "@lexical/react/LexicalComposer"
+import { ContentEditable } from "@lexical/react/LexicalContentEditable"
+import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary"
+import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin"
+import type { SerializedEditorState } from "lexical"
+import * as React from "react"
+
+import { MentionNode } from "../../editor/plugins/mention/MentionNode"
+
+function onError(error: Error) {
+ console.error("Lexical Read-Only Editor Error:", error)
+}
+
+interface AIRichTextMessageProps {
+ data: {
+ state: SerializedEditorState
+ text: string
+ }
+ className?: string
+}
+
+export const AIRichTextMessage: React.FC = React.memo(
+ ({ data, className }) => {
+ const initialConfig: InitialConfigType = {
+ namespace: "AIRichTextDisplay",
+ theme: defaultLexicalTheme,
+ onError,
+ editable: false, // Read-only mode
+ editorState: JSON.stringify(data.state),
+ nodes: [...LexicalRichEditorNodes, MentionNode],
+ }
+
+ return (
+
+
+
+ }
+ ErrorBoundary={LexicalErrorBoundary}
+ placeholder={null}
+ />
+
+
+ )
+ },
+)
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/EditableMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/EditableMessage.tsx
new file mode 100644
index 000000000..f1f5ef6ba
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/EditableMessage.tsx
@@ -0,0 +1,160 @@
+import type { LexicalRichEditorRef } from "@follow/components/ui/lexical-rich-editor/index.js"
+import { LexicalRichEditor } from "@follow/components/ui/lexical-rich-editor/index.js"
+import { ScrollArea } from "@follow/components/ui/scroll-area/ScrollArea.js"
+import { cn, nextFrame } from "@follow/utils"
+import type { BizUIMessage } from "@folo-services/ai-tools"
+import { isEqual } from "es-toolkit"
+import type { EditorState, LexicalEditor, SerializedEditorState } from "lexical"
+import { $getRoot } from "lexical"
+import { useCallback, useEffect, useMemo, useRef, useState } from "react"
+
+import { useEditingMessageId, useSetEditingMessageId } from "~/modules/ai-chat/atoms/session"
+import { useChatStatus } from "~/modules/ai-chat/store/hooks"
+
+import { MentionPlugin } from "../../editor"
+
+interface EditableMessageProps {
+ messageId: string
+ parts: BizUIMessage["parts"]
+ onSave: (content: SerializedEditorState, editor: LexicalEditor) => void
+ onCancel: () => void
+ className?: string
+}
+
+export const EditableMessage = ({
+ messageId,
+ parts,
+ onSave,
+ onCancel,
+ className,
+}: EditableMessageProps) => {
+ const status = useChatStatus()
+ const editingMessageId = useEditingMessageId()
+ const setEditingMessageId = useSetEditingMessageId()
+ const [isEmpty, setIsEmpty] = useState(false)
+ const editorRef = useRef(null)
+ const [currentEditor, setCurrentEditor] = useState(null)
+
+ const initialEditorState = useMemo(() => {
+ return (parts.find((part) => part.type === "data-rich-text") as any)?.data
+ .state as SerializedEditorState
+ }, [])
+
+ const isEditing = editingMessageId === messageId
+ const isProcessing = status === "submitted" || status === "streaming"
+
+ // Initialize editor with initial content
+ useEffect(() => {
+ if (isEditing && editorRef.current && currentEditor) {
+ // Focus the editor
+ editorRef.current.focus()
+ }
+ }, [isEditing, currentEditor])
+
+ const setInitialEditorStateOnceRef = useRef(false)
+
+ useEffect(() => {
+ return nextFrame(() => {
+ if (setInitialEditorStateOnceRef.current) return
+ const editor = editorRef.current?.getEditor()
+
+ if (!editor) return
+ editor.setEditorState(editor.parseEditorState(initialEditorState))
+ setInitialEditorStateOnceRef.current = true
+ })
+ }, [initialEditorState])
+
+ const handleSave = useCallback(() => {
+ if (currentEditor && editorRef.current && !editorRef.current.isEmpty()) {
+ const serializedEditorState = currentEditor.getEditorState().toJSON()
+
+ if (!isEqual(serializedEditorState, initialEditorState)) {
+ onSave(serializedEditorState, currentEditor)
+ }
+ }
+ }, [currentEditor, initialEditorState, onSave])
+
+ const handleCancel = useCallback(() => {
+ setEditingMessageId(null)
+ onCancel()
+ }, [onCancel, setEditingMessageId])
+
+ const handleKeyDown = useCallback(
+ (event: KeyboardEvent) => {
+ if (event.key === "Enter" && !event.shiftKey) {
+ event.preventDefault()
+ if (!isProcessing) {
+ handleSave()
+ }
+ return true
+ } else if (event.key === "Escape") {
+ event.preventDefault()
+ handleCancel()
+ return true
+ }
+ return false
+ },
+ [handleSave, handleCancel, isProcessing],
+ )
+
+ const handleEditorChange = useCallback((editorState: EditorState, editor: LexicalEditor) => {
+ setCurrentEditor(editor)
+ // Update isEmpty state based on editor content
+ editorState.read(() => {
+ const root = $getRoot()
+ const textContent = root.getTextContent().trim()
+ setIsEmpty(textContent === "")
+ })
+ }, [])
+
+ if (!isEditing) {
+ return null
+ }
+
+ return (
+
+ {/* Edit input */}
+
+
+
+
+
+ {/* Action buttons */}
+
+
+
+
+
+
+
+
+
+
+ {/* Helper text */}
+
+ Press Enter to save,{" "}
+ Esc to cancel
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ToolInvocationComponent.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ToolInvocationComponent.tsx
new file mode 100644
index 000000000..f37b7e27e
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/ToolInvocationComponent.tsx
@@ -0,0 +1,62 @@
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@follow/components/ui/accordion/index.js"
+import { JsonHighlighter } from "@follow/components/ui/json-highlighter/index.js"
+import type { ToolUIPart } from "ai"
+import { getToolName } from "ai"
+import * as React from "react"
+
+interface ToolInvocationComponentProps {
+ part: ToolUIPart
+}
+
+export const ToolInvocationComponent: React.FC = React.memo(
+ ({ part }) => {
+ const toolName = getToolName(part)
+
+ return (
+
+
+
+
+
+ {/* Tool Info */}
+
+
+
+ Tool Calling:
+
{toolName}
+
+
+
+
+
+
+ {"input" in part && (
+
+ )}
+
+ {"output" in part && (
+
+ )}
+
+
+
+
+
+ )
+ },
+)
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/animatedPlugin.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/animatedPlugin.ts
new file mode 100644
index 000000000..21a2d4013
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/message/animatedPlugin.ts
@@ -0,0 +1,36 @@
+import type { Element, ElementContent, Root } from "hast"
+import type { BuildVisitor } from "unist-util-visit"
+import { visit } from "unist-util-visit"
+
+export const animatedPlugin = () => {
+ return (tree: Root) => {
+ visit(tree, "element", ((node: Element) => {
+ if (
+ ["p", "h1", "h2", "h3", "h4", "h5", "h6", "li", "strong"].includes(node.tagName) &&
+ node.children
+ ) {
+ const newChildren: Array = []
+ for (const child of node.children) {
+ if (child.type === "text") {
+ const segmenter = new Intl.Segmenter("zh", { granularity: "word" })
+ const segments = segmenter.segment(child.value)
+ const words = [...segments].map((segment) => segment.segment).filter(Boolean)
+ words.forEach((word: string) => {
+ newChildren.push({
+ children: [{ type: "text", value: word }],
+ properties: {
+ className: tw`fade-in duration-1000 ease-in-out animate-in`,
+ },
+ tagName: "span",
+ type: "element",
+ })
+ })
+ } else {
+ newChildren.push(child)
+ }
+ }
+ node.children = newChildren
+ }
+ }) as BuildVisitor)
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/common-states.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/shared/common-states.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/components/common-states.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/components/shared/common-states.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/index.ts
new file mode 100644
index 000000000..8ea7bb21d
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/index.ts
@@ -0,0 +1 @@
+export * from "./plugins"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/index.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/index.tsx
new file mode 100644
index 000000000..880d97c42
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/index.tsx
@@ -0,0 +1 @@
+export * from "./mention"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/MentionNode.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/MentionNode.tsx
new file mode 100644
index 000000000..adddc587a
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/MentionNode.tsx
@@ -0,0 +1,166 @@
+import type {
+ DOMConversionMap,
+ DOMConversionOutput,
+ DOMExportOutput,
+ EditorConfig,
+ LexicalEditor,
+ LexicalNode,
+ NodeKey,
+ SerializedLexicalNode,
+ Spread,
+} from "lexical"
+import { $applyNodeReplacement, DecoratorNode } from "lexical"
+import * as React from "react"
+
+import { MentionComponent } from "./components/MentionComponent"
+import type { MentionData } from "./types"
+
+export type SerializedMentionNode = Spread<
+ {
+ mentionData: MentionData
+ },
+ SerializedLexicalNode
+>
+
+export class MentionNode extends DecoratorNode {
+ __mentionData: MentionData
+
+ static override getType(): string {
+ return "mention"
+ }
+
+ static override clone(node: MentionNode): MentionNode {
+ return new MentionNode(node.__mentionData, node.__key)
+ }
+
+ constructor(mentionData: MentionData, key?: NodeKey) {
+ super(key)
+ this.__mentionData = mentionData
+ }
+
+ override createDOM(config: EditorConfig): HTMLElement {
+ const dom = document.createElement("span")
+ dom.className = config.theme.mention || "mention-node"
+ dom.dataset.lexicalMention = "true"
+ dom.dataset.mentionType = this.__mentionData.type
+ dom.dataset.mentionId = this.__mentionData.id
+ return dom
+ }
+
+ override updateDOM(): false {
+ return false
+ }
+
+ static override importDOM(): DOMConversionMap | null {
+ return {
+ span: (domNode: HTMLElement) => {
+ if (!Object.hasOwn(domNode.dataset, "lexicalMention")) {
+ return null
+ }
+ return {
+ conversion: convertMentionElement,
+ priority: 1,
+ }
+ },
+ }
+ }
+
+ static override importJSON(serializedNode: SerializedMentionNode): MentionNode {
+ const { mentionData } = serializedNode
+ const node = $createMentionNode(mentionData)
+ return node
+ }
+
+ override exportDOM(): DOMExportOutput {
+ const element = document.createElement("span")
+ element.dataset.lexicalMention = "true"
+ element.dataset.mentionType = this.__mentionData.type
+ element.dataset.mentionId = this.__mentionData.id
+ element.textContent = `@${this.__mentionData.name}`
+ element.className = "mention-node"
+ return { element }
+ }
+
+ override exportJSON(): SerializedMentionNode {
+ return {
+ mentionData: this.__mentionData,
+ type: "mention",
+ version: 1,
+ }
+ }
+
+ /**
+ * For export markdown conversion
+ */
+ override getTextContent(): string {
+ return `[[ref:${this.__mentionData.type}:${this.__mentionData.value}]]`
+ }
+
+ override decorate(_editor: LexicalEditor): React.JSX.Element {
+ return (
+
+
+
+ )
+ }
+
+ override isInline(): boolean {
+ return true
+ }
+
+ override isKeyboardSelectable(): boolean {
+ return false
+ }
+
+ canInsertTextBefore(): boolean {
+ return false
+ }
+
+ canInsertTextAfter(): boolean {
+ return true
+ }
+
+ canBeEmpty(): boolean {
+ return false
+ }
+
+ isSegmented(): boolean {
+ return true
+ }
+
+ extractWithChild(): boolean {
+ return false
+ }
+}
+
+function convertMentionElement(domNode: HTMLElement): DOMConversionOutput {
+ const mentionType = domNode.dataset.mentionType as MentionData["type"] | null
+ const { mentionId } = domNode.dataset
+ const textContent = domNode.textContent || ""
+
+ if (!mentionType || !mentionId) {
+ return { node: null }
+ }
+
+ // Extract name from text content (remove @ prefix)
+ const name = textContent.startsWith("@") ? textContent.slice(1) : textContent
+
+ const mentionData: MentionData = {
+ id: mentionId,
+ name,
+ type: mentionType,
+ value: null,
+ }
+
+ const node = $createMentionNode(mentionData)
+ return { node }
+}
+
+export function $createMentionNode(mentionData: MentionData): MentionNode {
+ const mentionNode = new MentionNode(mentionData)
+ return $applyNodeReplacement(mentionNode)
+}
+
+export function $isMentionNode(node: LexicalNode | null | undefined): node is MentionNode {
+ return node instanceof MentionNode
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/MentionPlugin.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/MentionPlugin.tsx
new file mode 100644
index 000000000..a89816920
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/MentionPlugin.tsx
@@ -0,0 +1,129 @@
+import * as React from "react"
+import { Suspense, useMemo } from "react"
+
+import { MentionDropdown } from "./components/MentionDropdown"
+import { DEFAULT_MAX_SUGGESTIONS } from "./constants"
+import { useMentionIntegration } from "./hooks/useMentionIntegration"
+import { useMentionKeyboard } from "./hooks/useMentionKeyboard"
+import { useMentionSearch } from "./hooks/useMentionSearch"
+import { useMentionSelection } from "./hooks/useMentionSelection"
+import { useMentionTrigger } from "./hooks/useMentionTrigger"
+import { MentionNode } from "./MentionNode"
+import { defaultTriggerFn } from "./utils/triggerDetection"
+
+export function MentionPlugin() {
+ // Get integrated search and context block handling
+ const { searchMentions, handleMentionInsert } = useMentionIntegration()
+
+ // Hook for detecting mention triggers
+ const { mentionMatch, isActive, clearMentionMatch } = useMentionTrigger({
+ triggerFn: defaultTriggerFn,
+ })
+
+ // Hook for searching mentions
+ const {
+ suggestions,
+ selectedIndex,
+ isLoading,
+ searchMentions: performSearch,
+ clearSuggestions,
+ setSelectedIndex,
+ hasResults,
+ } = useMentionSearch({
+ onSearch: searchMentions,
+ maxSuggestions: DEFAULT_MAX_SUGGESTIONS,
+ })
+
+ // Hook for handling mention selection
+ const { selectMention } = useMentionSelection({
+ mentionMatch,
+ onMentionInsert: handleMentionInsert,
+ onSelectionComplete: () => {
+ clearMentionMatch()
+ clearSuggestions()
+ },
+ })
+
+ // Hook for keyboard navigation
+ const handleArrowKey = React.useCallback(
+ (isUp: boolean) => {
+ if (!hasResults) return
+
+ const newIndex = isUp
+ ? selectedIndex <= 0
+ ? suggestions.length - 1
+ : selectedIndex - 1
+ : selectedIndex >= suggestions.length - 1
+ ? 0
+ : selectedIndex + 1
+
+ setSelectedIndex(newIndex)
+ },
+ [hasResults, suggestions.length, selectedIndex, setSelectedIndex],
+ )
+
+ const handleEnterKey = React.useCallback(() => {
+ if (hasResults && selectedIndex >= 0 && selectedIndex < suggestions.length) {
+ const mention = suggestions[selectedIndex]
+ if (mention) {
+ selectMention(mention)
+ }
+ }
+ }, [hasResults, selectedIndex, suggestions, selectMention])
+
+ const handleEscapeKey = React.useCallback(() => {
+ clearMentionMatch()
+ clearSuggestions()
+ }, [clearMentionMatch, clearSuggestions])
+
+ useMentionKeyboard({
+ isActive,
+ suggestions,
+ selectedIndex,
+ onArrowKey: handleArrowKey,
+ onEnterKey: handleEnterKey,
+ onEscapeKey: handleEscapeKey,
+ })
+
+ // Search when mention match changes
+ React.useEffect(() => {
+ if (mentionMatch) {
+ performSearch(mentionMatch.matchingString)
+ } else {
+ clearSuggestions()
+ }
+ }, [mentionMatch, performSearch, clearSuggestions])
+
+ // Calculate dropdown props
+ const dropdownProps = useMemo(() => {
+ if (!isActive || !hasResults) return null
+
+ return {
+ isVisible: true,
+ suggestions,
+ selectedIndex,
+ isLoading,
+ onSelect: selectMention,
+ onClose: handleEscapeKey,
+ query: mentionMatch?.matchingString || "",
+ }
+ }, [
+ isActive,
+ hasResults,
+ suggestions,
+ selectedIndex,
+ isLoading,
+ selectMention,
+ handleEscapeKey,
+ mentionMatch,
+ ])
+
+ return dropdownProps ? (
+
+
+
+ ) : null
+}
+
+MentionPlugin.id = "mention"
+MentionPlugin.nodes = [MentionNode]
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/MentionComponent.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/MentionComponent.tsx
new file mode 100644
index 000000000..296cf4d09
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/MentionComponent.tsx
@@ -0,0 +1,88 @@
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipPortal,
+ TooltipRoot,
+ TooltipTrigger,
+} from "@follow/components/ui/tooltip/index.js"
+import { cn } from "@follow/utils"
+import * as React from "react"
+
+import type { MentionData } from "../types"
+import { MentionTypeIcon } from "./shared/MentionTypeIcon"
+
+interface MentionComponentProps {
+ mentionData: MentionData
+ className?: string
+}
+
+const MentionTooltipContent = ({ mentionData }: { mentionData: MentionData }) => (
+
+
+
+
+
+
@{mentionData.name}
+
+ {mentionData.type}
+
+
+
+)
+
+const getMentionStyles = (type: MentionData["type"]) => {
+ const baseStyles = tw`
+ inline-flex items-center gap-1 px-2 py-0.5 rounded-md
+ font-medium text-sm cursor-pointer select-none
+ `
+
+ switch (type) {
+ case "entry": {
+ return cn(
+ baseStyles,
+ "bg-blue/10 text-blue border-blue/20",
+ "hover:bg-blue/20 hover:border-blue/30",
+ )
+ }
+ case "feed": {
+ return cn(
+ baseStyles,
+ "bg-orange/10 text-orange border-orange/20",
+ "hover:bg-orange/20 hover:border-orange/30",
+ )
+ }
+ }
+}
+export const MentionComponent: React.FC = ({ mentionData, className }) => {
+ const handleClick = (e: React.MouseEvent) => {
+ e.preventDefault()
+ // Handle mention click - could navigate to user profile, topic page, etc.
+ // TODO: Implement navigation logic for mentions
+ }
+
+ return (
+
+
+
+
+
+ @{mentionData.name}
+
+
+
+
+
+
+
+
+
+ )
+}
+
+MentionComponent.displayName = "MentionComponent"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/MentionDropdown.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/MentionDropdown.tsx
new file mode 100644
index 000000000..b49fbaccf
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/MentionDropdown.tsx
@@ -0,0 +1,266 @@
+import {
+ autoUpdate,
+ flip,
+ offset,
+ shift,
+ useDismiss,
+ useFloating,
+ useInteractions,
+ useRole,
+} from "@floating-ui/react"
+import { RootPortal } from "@follow/components/ui/portal/index.js"
+import { cn, thenable } from "@follow/utils"
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
+import * as React from "react"
+import { useCallback, useEffect, useRef, useState } from "react"
+
+import { MENTION_TRIGGER_PATTERN } from "../constants"
+import type { MentionData } from "../types"
+import { calculateDropdownPosition } from "../utils/positioning"
+import { MentionTypeIcon } from "./shared/MentionTypeIcon"
+
+interface MentionDropdownProps {
+ isVisible: boolean
+ suggestions: MentionData[]
+ selectedIndex: number
+ isLoading: boolean
+ onSelect: (mention: MentionData) => void
+ onClose: () => void
+ query: string
+ anchor?: HTMLElement | null
+}
+
+const MentionSuggestionItem = React.memo(
+ ({
+ mention,
+ isSelected,
+ onClick,
+ query,
+ }: {
+ mention: MentionData
+ isSelected: boolean
+ onClick: (mention: MentionData) => void
+ query: string
+ }) => {
+ const handleClick = useCallback(() => {
+ onClick(mention)
+ }, [mention, onClick])
+
+ // Highlight matching text
+ const highlightText = (text: string, query: string) => {
+ const cleanQuery = query.replace(MENTION_TRIGGER_PATTERN, "").toLowerCase()
+ if (!cleanQuery) return text
+
+ const parts = text.split(new RegExp(`(${cleanQuery})`, "gi"))
+ return parts.map((part) => {
+ const isMatch = part.toLowerCase() === cleanQuery
+
+ return (
+
+ {part}
+
+ )
+ })
+ }
+
+ return (
+
+ {/* Icon */}
+
+
+
+
+ {/* Content */}
+ {highlightText(mention.name, query)}
+
+ {/* Selection Indicator */}
+ {isSelected && (
+
+
+
+ )}
+
+ )
+ },
+)
+
+MentionSuggestionItem.displayName = "MentionSuggestionItem"
+
+export const MentionDropdown: React.FC = ({
+ isVisible,
+ suggestions,
+ selectedIndex,
+ isLoading,
+ onSelect,
+ onClose,
+ query,
+}) => {
+ if (!isVisible) throw thenable
+
+ const [editor] = useLexicalComposerContext()
+ const dropdownRef = useRef(null)
+ const [referenceWidth, setReferenceWidth] = useState(320)
+
+ // Create virtual reference element based on cursor position
+ const virtualReference = useRef({
+ getBoundingClientRect: () => {
+ const position = calculateDropdownPosition(editor)
+ const editorElement = editor.getRootElement()
+
+ if (!position || !editorElement) {
+ // Fallback to editor element
+ return (
+ editorElement?.getBoundingClientRect() || {
+ top: 0,
+ left: 0,
+ bottom: 0,
+ right: 0,
+ width: 0,
+ height: 0,
+ x: 0,
+ y: 0,
+ }
+ )
+ }
+
+ const editorRect = editorElement.getBoundingClientRect()
+
+ return {
+ top: editorRect.top + position.top,
+ left: editorRect.left + position.left,
+ bottom: editorRect.top + position.top,
+ right: editorRect.left + position.left,
+ width: 0,
+ height: 0,
+ x: editorRect.left + position.left,
+ y: editorRect.top + position.top,
+ }
+ },
+ })
+
+ const { refs, floatingStyles, context } = useFloating({
+ open: isVisible,
+ onOpenChange: (open) => {
+ if (!open) onClose()
+ },
+ middleware: [
+ offset(8),
+ flip({ fallbackPlacements: ["bottom-start", "top-start", "bottom-end", "top-end"] }),
+ shift({ padding: 8 }),
+ ],
+ whileElementsMounted: autoUpdate,
+ placement: "bottom-start",
+ })
+
+ const dismiss = useDismiss(context, {
+ enabled: isVisible,
+ })
+
+ const role = useRole(context, {
+ role: "listbox",
+ })
+
+ const { getFloatingProps } = useInteractions([dismiss, role])
+
+ // Handle scroll to keep selected item in view
+ useEffect(() => {
+ if (isVisible && dropdownRef.current && selectedIndex >= 0) {
+ const listContainer = dropdownRef.current.querySelector('[role="listbox"]')
+ if (listContainer) {
+ const selectedElement = listContainer.children[selectedIndex] as HTMLElement
+ if (selectedElement) {
+ selectedElement.scrollIntoView({
+ block: "nearest",
+ behavior: "smooth",
+ })
+ }
+ }
+ }
+ }, [selectedIndex, isVisible])
+
+ // Set virtual reference element based on cursor position and calculate width
+ useEffect(() => {
+ if (isVisible) {
+ refs.setReference(virtualReference.current)
+
+ const editorElement = editor.getRootElement()
+ if (editorElement) {
+ const rect = editorElement.getBoundingClientRect()
+ setReferenceWidth(rect.width || 320)
+ }
+ }
+ }, [editor, refs, isVisible, query]) // Add query as dependency to update position when typing
+
+ return (
+
+ {isVisible && (
+
+
+ {isLoading ? (
+
+
+ Searching...
+
+ ) : suggestions.length === 0 ? (
+
+
No matches found
+ {query && (
+
+ Try a different search term
+
+ )}
+
+ ) : (
+
+ {suggestions.map((mention, index) => (
+
+ ))}
+
+ )}
+
+
+ )}
+
+ )
+}
+
+MentionDropdown.displayName = "MentionDropdown"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/shared/MentionTypeIcon.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/shared/MentionTypeIcon.tsx
new file mode 100644
index 000000000..c1e91dfdc
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/components/shared/MentionTypeIcon.tsx
@@ -0,0 +1,24 @@
+import * as React from "react"
+
+import type { MentionType } from "../../types"
+
+interface MentionTypeIconProps {
+ type: MentionType
+ className?: string
+}
+
+export const MentionTypeIcon: React.FC = ({ type, className = "size-3" }) => {
+ switch (type) {
+ case "entry": {
+ return
+ }
+ case "feed": {
+ return
+ }
+ default: {
+ return
+ }
+ }
+}
+
+MentionTypeIcon.displayName = "MentionTypeIcon"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/constants.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/constants.ts
new file mode 100644
index 000000000..238ded1ab
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/constants.ts
@@ -0,0 +1,16 @@
+import { createCommand } from "lexical"
+
+import type { MentionData } from "./types"
+
+// Commands
+export const MENTION_COMMAND = createCommand("MENTION_COMMAND")
+export const MENTION_TYPEAHEAD_COMMAND = createCommand("MENTION_TYPEAHEAD_COMMAND")
+
+// Default configuration
+
+export const DEFAULT_MAX_SUGGESTIONS = 10
+
+// Trigger patterns
+// Support CJK characters (Chinese, Japanese, Korean) in addition to ASCII
+export const MENTION_TRIGGER_PATTERN =
+ /(?:^|\s)(@[#+]?[\w\u4e00-\u9fff\u3400-\u4dbf\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af-]*)$/
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionBlockSync.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionBlockSync.ts
new file mode 100644
index 000000000..f58d78eb4
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionBlockSync.ts
@@ -0,0 +1,249 @@
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
+import { $getNodeByKey } from "lexical"
+import { useCallback, useEffect, useRef } from "react"
+
+import { useAIChatStore } from "~/modules/ai-chat/store/AIChatContext"
+import { useChatBlockActions } from "~/modules/ai-chat/store/hooks"
+import type { AIChatContextBlock } from "~/modules/ai-chat/store/types"
+
+import { $isMentionNode, MentionNode } from "../MentionNode"
+import type { MentionData } from "../types"
+
+interface MentionBlockReference {
+ mentionNodeKey: string
+ blockId: string
+ resourceId: string // `${type}:${value}`
+ mentionData: MentionData
+}
+
+const getResourceId = (type: string, value: string) => `${type}:${value}`
+
+const getBlockType = (mentionType: string): AIChatContextBlock["type"] => {
+ return mentionType === "feed" ? "referFeed" : "referEntry"
+}
+
+/**
+ * Hook that manages bidirectional synchronization between mention nodes and context blocks
+ * - When a mention is added, corresponding block is created
+ * - When a block is removed, corresponding mentions are removed
+ * - When a mention is removed, corresponding block is removed (if no other mentions reference it)
+ */
+export const useMentionBlockSync = () => {
+ const [editor] = useLexicalComposerContext()
+ const blockActions = useChatBlockActions()
+ const blocks = useAIChatStore()((state) => state.blocks)
+
+ // Reference tracking maps
+ const mentionToBlockRef = useRef(new Map()) // mentionNodeKey -> reference
+ const resourceToMentionsRef = useRef(new Map>()) // resourceId -> Set
+ const blockToResourceRef = useRef(new Map()) // blockId -> resourceId
+
+ // Add mention-block reference
+ const addMentionReference = useCallback(
+ (mentionData: MentionData, mentionNodeKey: string, blockId: string) => {
+ const resourceId = getResourceId(mentionData.type, mentionData.value as string)
+
+ const reference: MentionBlockReference = {
+ mentionNodeKey,
+ blockId,
+ resourceId,
+ mentionData,
+ }
+
+ // Update tracking maps
+ mentionToBlockRef.current.set(mentionNodeKey, reference)
+
+ if (!resourceToMentionsRef.current.has(resourceId)) {
+ resourceToMentionsRef.current.set(resourceId, new Set())
+ }
+ resourceToMentionsRef.current.get(resourceId)!.add(mentionNodeKey)
+
+ blockToResourceRef.current.set(blockId, resourceId)
+ },
+ [],
+ )
+
+ // Remove mention reference
+ const removeMentionReference = useCallback((mentionNodeKey: string) => {
+ const reference = mentionToBlockRef.current.get(mentionNodeKey)
+ if (!reference) return null
+
+ const { resourceId, blockId } = reference
+
+ // Clean up tracking maps
+ mentionToBlockRef.current.delete(mentionNodeKey)
+
+ const mentionSet = resourceToMentionsRef.current.get(resourceId)
+ if (mentionSet) {
+ mentionSet.delete(mentionNodeKey)
+ if (mentionSet.size === 0) {
+ resourceToMentionsRef.current.delete(resourceId)
+ }
+ }
+
+ blockToResourceRef.current.delete(blockId)
+
+ return reference
+ }, [])
+
+ // Handle mention insertion - create block and track reference
+ const handleMentionInsert = useCallback(
+ (mentionData: MentionData, mentionNodeKey: string) => {
+ const resourceId = getResourceId(mentionData.type, mentionData.value as string)
+
+ // Check if block already exists for this resource
+ const existingBlock = blocks.find(
+ (block) => blockToResourceRef.current.get(block.id) === resourceId,
+ )
+
+ let blockId: string
+ if (existingBlock) {
+ // Use existing block
+ blockId = existingBlock.id
+ } else {
+ // Create new block
+ const blockType = getBlockType(mentionData.type)
+
+ // Generate block ID (mimicking the block slice logic)
+ const newBlock: Omit = {
+ type: blockType,
+ value: mentionData.value as string,
+ }
+
+ blockActions.addBlock(newBlock)
+
+ // Use current blocks state directly from store instead of stale closure
+ const currentBlocks = blockActions.getBlocks()
+ const addedBlock = currentBlocks.find(
+ (block) => block.type === blockType && block.value === mentionData.value,
+ )
+
+ if (addedBlock) {
+ blockId = addedBlock.id
+ } else {
+ // Fallback to a predictable ID pattern if we can't find the block immediately
+ blockId = `${blockType}-${mentionData.value}-${mentionNodeKey}`
+ }
+ }
+
+ // Track the reference
+ addMentionReference(mentionData, mentionNodeKey, blockId)
+ },
+ [blocks, blockActions, addMentionReference],
+ )
+
+ // Handle mention removal - remove block if no other mentions reference it
+ const handleMentionRemove = useCallback(
+ (mentionNodeKey: string) => {
+ const reference = removeMentionReference(mentionNodeKey)
+ if (!reference) return
+
+ const { resourceId, blockId } = reference
+
+ // Check if any other mentions still reference this resource
+ const remainingMentions = resourceToMentionsRef.current.get(resourceId)
+ if (!remainingMentions || remainingMentions.size === 0) {
+ // No more mentions reference this resource, remove the block
+
+ blockActions.removeBlock(blockId)
+ }
+ },
+ [blockActions, removeMentionReference],
+ )
+
+ // Handle block removal - remove corresponding mentions
+ const handleBlockRemove = useCallback(
+ (blockId: string) => {
+ const resourceId = blockToResourceRef.current.get(blockId)
+ if (!resourceId) return
+
+ const mentionKeys = resourceToMentionsRef.current.get(resourceId)
+ if (!mentionKeys) return
+
+ // Remove all mention nodes for this resource
+ editor.update(() => {
+ Array.from(mentionKeys).forEach((mentionKey) => {
+ const node = $getNodeByKey(mentionKey)
+ if (node && $isMentionNode(node)) {
+ node.remove()
+ }
+ })
+ })
+
+ // Clean up references
+ Array.from(mentionKeys).forEach((mentionKey) => {
+ removeMentionReference(mentionKey)
+ })
+ },
+ [editor, removeMentionReference],
+ )
+
+ // Monitor block changes
+ useEffect(() => {
+ const currentBlockIds = new Set(blocks.map((block) => block.id))
+ const trackedBlockIds = new Set(blockToResourceRef.current.keys())
+
+ // Find removed blocks
+ for (const trackedBlockId of trackedBlockIds) {
+ if (!currentBlockIds.has(trackedBlockId)) {
+ handleBlockRemove(trackedBlockId)
+ }
+ }
+ }, [blocks, handleBlockRemove])
+
+ // Monitor mention node changes using mutation observer
+ useEffect(() => {
+ const removedMentionKeys = new Set()
+
+ const unregisterMutationListener = editor.registerMutationListener(
+ MentionNode,
+ (mutatedNodes) => {
+ for (const [nodeKey, mutation] of mutatedNodes) {
+ // Only track destroyed mutations for mentions we're actually tracking
+ if (mutation === "destroyed" && mentionToBlockRef.current.has(nodeKey)) {
+ removedMentionKeys.add(nodeKey)
+ }
+ }
+
+ // Process removed mentions in next tick to avoid state conflicts
+ if (removedMentionKeys.size > 0) {
+ const timeoutId = setTimeout(() => {
+ Array.from(removedMentionKeys).forEach((mentionKey) => {
+ handleMentionRemove(mentionKey)
+ })
+ removedMentionKeys.clear()
+ }, 100) // Increase delay to avoid race conditions
+
+ // Store timeout ID for potential cleanup
+ return () => clearTimeout(timeoutId)
+ }
+ },
+ )
+
+ return unregisterMutationListener
+ }, [editor, handleMentionRemove])
+
+ // Cleanup on unmount
+ useEffect(() => {
+ const mentionToBlock = mentionToBlockRef.current
+ const resourceToMentions = resourceToMentionsRef.current
+ const blockToResource = blockToResourceRef.current
+
+ return () => {
+ mentionToBlock.clear()
+ resourceToMentions.clear()
+ blockToResource.clear()
+ }
+ }, [])
+
+ return {
+ handleMentionInsert,
+ handleMentionRemove,
+ // Debug helpers
+ getMentionReferences: () => ({
+ mentionToBlock: new Map(mentionToBlockRef.current),
+ resourceToMentions: new Map(resourceToMentionsRef.current),
+ blockToResource: new Map(blockToResourceRef.current),
+ }),
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionIntegration.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionIntegration.ts
new file mode 100644
index 000000000..27f1e477d
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionIntegration.ts
@@ -0,0 +1,29 @@
+import { useCallback } from "react"
+
+import type { MentionData } from "../types"
+import { useMentionBlockSync } from "./useMentionBlockSync"
+import { useMentionSearchService } from "./useMentionSearchService"
+
+/**
+ * Hook that integrates mention search with context block management
+ * Provides search functionality and handles bidirectional synchronization
+ */
+export const useMentionIntegration = () => {
+ const { searchMentions } = useMentionSearchService()
+ const { handleMentionInsert: syncMentionInsert } = useMentionBlockSync()
+
+ // Handle mention insertion with node key tracking
+ const handleMentionInsert = useCallback(
+ (mention: MentionData, nodeKey?: string) => {
+ if (nodeKey) {
+ syncMentionInsert(mention, nodeKey)
+ }
+ },
+ [syncMentionInsert],
+ )
+
+ return {
+ searchMentions,
+ handleMentionInsert,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionKeyboard.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionKeyboard.ts
new file mode 100644
index 000000000..e0efc9307
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionKeyboard.ts
@@ -0,0 +1,161 @@
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
+import {
+ COMMAND_PRIORITY_HIGH,
+ COMMAND_PRIORITY_LOW,
+ KEY_ARROW_DOWN_COMMAND,
+ KEY_ARROW_UP_COMMAND,
+ KEY_ENTER_COMMAND,
+ KEY_ESCAPE_COMMAND,
+ KEY_TAB_COMMAND,
+} from "lexical"
+import { useCallback, useEffect } from "react"
+
+import type { MentionData } from "../types"
+
+interface UseMentionKeyboardOptions {
+ isActive: boolean
+ suggestions: MentionData[]
+ selectedIndex: number
+ onArrowKey: (isUp: boolean) => void
+ onEnterKey: () => void
+ onEscapeKey: () => void
+}
+
+export const useMentionKeyboard = ({
+ isActive,
+ suggestions,
+ selectedIndex,
+ onArrowKey,
+ onEnterKey,
+ onEscapeKey,
+}: UseMentionKeyboardOptions) => {
+ const [editor] = useLexicalComposerContext()
+
+ // Handle keyboard navigation
+ const handleArrowKey = useCallback(
+ (isUp: boolean) => {
+ if (!isActive || suggestions.length === 0) return false
+ onArrowKey(isUp)
+ return true
+ },
+ [isActive, suggestions.length, onArrowKey],
+ )
+
+ // Handle enter key
+ const handleEnterKey = useCallback(() => {
+ if (
+ !isActive ||
+ suggestions.length === 0 ||
+ selectedIndex < 0 ||
+ selectedIndex >= suggestions.length
+ ) {
+ return false
+ }
+ onEnterKey()
+ return true
+ }, [isActive, suggestions.length, selectedIndex, onEnterKey])
+
+ // Handle escape key
+ const handleEscapeKey = useCallback(() => {
+ if (!isActive) return false
+ onEscapeKey()
+ return true
+ }, [isActive, onEscapeKey])
+
+ // Register keyboard commands
+ useEffect(() => {
+ const removeCommands = [
+ // Arrow key navigation
+ editor.registerCommand(
+ KEY_ARROW_UP_COMMAND,
+ (event) => {
+ if (isActive && suggestions.length > 0) {
+ event.preventDefault()
+ return handleArrowKey(true)
+ }
+ return false
+ },
+ COMMAND_PRIORITY_LOW,
+ ),
+
+ editor.registerCommand(
+ KEY_ARROW_DOWN_COMMAND,
+ (event) => {
+ if (isActive && suggestions.length > 0) {
+ event.preventDefault()
+ return handleArrowKey(false)
+ }
+ return false
+ },
+ COMMAND_PRIORITY_LOW,
+ ),
+
+ // Enter key
+ editor.registerCommand(
+ KEY_ENTER_COMMAND,
+ (event) => {
+ if (
+ isActive &&
+ suggestions.length > 0 &&
+ selectedIndex >= 0 &&
+ selectedIndex < suggestions.length
+ ) {
+ event?.preventDefault()
+ return handleEnterKey()
+ }
+ return false
+ },
+ COMMAND_PRIORITY_HIGH,
+ ),
+
+ // Tab key (same as enter)
+ editor.registerCommand(
+ KEY_TAB_COMMAND,
+ (event) => {
+ if (
+ isActive &&
+ suggestions.length > 0 &&
+ selectedIndex >= 0 &&
+ selectedIndex < suggestions.length
+ ) {
+ event.preventDefault()
+ return handleEnterKey()
+ }
+ return false
+ },
+ COMMAND_PRIORITY_HIGH,
+ ),
+
+ // Escape key
+ editor.registerCommand(
+ KEY_ESCAPE_COMMAND,
+ (event) => {
+ if (isActive) {
+ event.preventDefault()
+ return handleEscapeKey()
+ }
+ return false
+ },
+ COMMAND_PRIORITY_LOW,
+ ),
+ ]
+
+ return () => {
+ removeCommands.forEach((remove) => remove())
+ }
+ }, [
+ editor,
+ isActive,
+ suggestions.length,
+ selectedIndex,
+ handleArrowKey,
+ handleEnterKey,
+ handleEscapeKey,
+ ])
+
+ return {
+ handleArrowKey,
+ handleEnterKey,
+ handleEscapeKey,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSearch.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSearch.ts
new file mode 100644
index 000000000..685bc3125
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSearch.ts
@@ -0,0 +1,119 @@
+import { useCallback, useRef, useState, useTransition } from "react"
+
+import { DEFAULT_MAX_SUGGESTIONS } from "../constants"
+import type { MentionData, MentionSearchState, MentionType } from "../types"
+import { getMentionType, shouldTriggerMention } from "../utils/triggerDetection"
+
+interface UseMentionSearchOptions {
+ onSearch?: (
+ query: string,
+ type: MentionType | undefined,
+ ) => Promise | MentionData[]
+ maxSuggestions?: number
+}
+
+// Default search function
+const defaultSearchFn = async (): Promise => []
+
+export const useMentionSearch = ({
+ onSearch = defaultSearchFn,
+ maxSuggestions = DEFAULT_MAX_SUGGESTIONS,
+}: UseMentionSearchOptions = {}) => {
+ const [searchState, setSearchState] = useState({
+ suggestions: [],
+ selectedIndex: -1,
+ isLoading: false,
+ })
+
+ const [isPending, startTransition] = useTransition()
+ const onSearchRef = useRef(onSearch)
+ const maxSuggestionsRef = useRef(maxSuggestions)
+ const abortControllerRef = useRef(null)
+
+ // Update refs when props change to avoid stale closures
+ onSearchRef.current = onSearch
+ maxSuggestionsRef.current = maxSuggestions
+
+ const searchMentions = useCallback(
+ async (query: string) => {
+ // Cancel any pending search
+ if (abortControllerRef.current) {
+ abortControllerRef.current.abort()
+ }
+
+ if (!shouldTriggerMention(query)) {
+ setSearchState((prev) => ({
+ ...prev,
+ suggestions: [],
+ selectedIndex: -1,
+ isLoading: false,
+ }))
+ return
+ }
+
+ // Create new abort controller for this search
+ const abortController = new AbortController()
+ abortControllerRef.current = abortController
+
+ // Use transition to defer search as low-priority update
+ startTransition(() => {
+ setSearchState((prev) => ({ ...prev, isLoading: true }))
+ })
+
+ try {
+ const [mentionType, cleanQuery] = getMentionType(query)
+
+ const results = await onSearchRef.current(cleanQuery, mentionType)
+
+ // Check if this search was aborted
+ if (abortController.signal.aborted) {
+ return
+ }
+
+ startTransition(() => {
+ setSearchState({
+ suggestions: results.slice(0, maxSuggestionsRef.current),
+ selectedIndex: results.length > 0 ? 0 : -1,
+ isLoading: false,
+ })
+ })
+ } catch (error) {
+ // Check if this search was aborted
+ if (abortController.signal.aborted) {
+ return
+ }
+
+ console.error("Error searching mentions:", error)
+ startTransition(() => {
+ setSearchState({
+ suggestions: [],
+ selectedIndex: -1,
+ isLoading: false,
+ })
+ })
+ }
+ },
+ [], // Empty deps array - we use refs to avoid dependency issues
+ )
+
+ const clearSuggestions = useCallback(() => {
+ setSearchState({
+ suggestions: [],
+ selectedIndex: -1,
+ isLoading: false,
+ })
+ }, [])
+
+ const setSelectedIndex = useCallback((index: number) => {
+ setSearchState((prev) => ({ ...prev, selectedIndex: index }))
+ }, [])
+
+ return {
+ ...searchState,
+ searchMentions,
+ clearSuggestions,
+ setSelectedIndex,
+ hasResults: searchState.suggestions.length > 0,
+ isLoading: searchState.isLoading || isPending,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSearchService.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSearchService.ts
new file mode 100644
index 000000000..91603a943
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSearchService.ts
@@ -0,0 +1,34 @@
+import { useMemo } from "react"
+
+import { useFeedEntrySearchService } from "~/modules/ai-chat/services/feedEntrySearchService"
+
+import type { MentionData, MentionType } from "../types"
+
+/**
+ * Hook that provides search functionality for mentions
+ * Uses the shared feed/entry search service
+ */
+export const useMentionSearchService = () => {
+ const { search } = useFeedEntrySearchService({
+ maxRecentEntries: 50,
+ })
+
+ // Search function that converts search results to MentionData format
+ const searchMentions = useMemo(() => {
+ return async (query: string, type?: MentionType | undefined): Promise => {
+ const searchResults = search(query, type, 10)
+
+ // Convert to MentionData format
+ return searchResults.map(
+ (item): MentionData => ({
+ id: item.id,
+ name: item.title,
+ type: item.type as MentionType,
+ value: item.id,
+ }),
+ )
+ }
+ }, [search])
+
+ return { searchMentions }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSelection.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSelection.ts
new file mode 100644
index 000000000..9582f528a
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionSelection.ts
@@ -0,0 +1,68 @@
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
+import { COMMAND_PRIORITY_LOW } from "lexical"
+import { useCallback, useEffect } from "react"
+
+import { MENTION_COMMAND } from "../constants"
+import type { MentionData, MentionMatch } from "../types"
+import { insertMentionNode } from "../utils/textReplacement"
+
+interface UseMentionSelectionOptions {
+ mentionMatch: MentionMatch | null
+ onMentionInsert?: (mention: MentionData, nodeKey?: string) => void
+ onSelectionComplete?: () => void
+}
+
+export const useMentionSelection = ({
+ mentionMatch,
+ onMentionInsert,
+ onSelectionComplete,
+}: UseMentionSelectionOptions) => {
+ const [editor] = useLexicalComposerContext()
+
+ const selectMention = useCallback(
+ (mentionData: MentionData) => {
+ if (!mentionMatch) return false
+
+ let result: ReturnType = {
+ success: false,
+ nodeKey: undefined as string | undefined,
+ }
+ editor.update(() => {
+ result = insertMentionNode(mentionData, mentionMatch)
+
+ if (result.success && result.nodeKey) {
+ // Call onMentionInsert immediately within the same editor update
+ // to ensure the node tracking happens before any mutations
+ onMentionInsert?.(mentionData, result.nodeKey)
+ }
+ })
+
+ // Call onSelectionComplete after the editor update is complete
+ if (result.success) {
+ setTimeout(() => {
+ onSelectionComplete?.()
+ }, 0)
+ }
+
+ return result.success
+ },
+ [editor, mentionMatch, onMentionInsert, onSelectionComplete],
+ )
+
+ // Register mention command
+ useEffect(() => {
+ const removeMentionCommand = editor.registerCommand(
+ MENTION_COMMAND,
+ (mentionData: MentionData) => {
+ return selectMention(mentionData)
+ },
+ COMMAND_PRIORITY_LOW,
+ )
+
+ return removeMentionCommand
+ }, [editor, selectMention])
+
+ return {
+ selectMention,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionTrigger.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionTrigger.ts
new file mode 100644
index 000000000..7b35b8da1
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/hooks/useMentionTrigger.ts
@@ -0,0 +1,65 @@
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
+import type { LexicalEditor } from "lexical"
+import { $getSelection, $isRangeSelection, $isTextNode } from "lexical"
+import { useCallback, useEffect, useState } from "react"
+
+import type { MentionMatch } from "../types"
+import { defaultTriggerFn } from "../utils/triggerDetection"
+
+interface UseMentionTriggerOptions {
+ triggerFn?: (text: string, editor: LexicalEditor) => MentionMatch | null
+ onTrigger?: (match: MentionMatch | null) => void
+}
+
+export const useMentionTrigger = ({
+ triggerFn = defaultTriggerFn,
+ onTrigger,
+}: UseMentionTriggerOptions = {}) => {
+ const [editor] = useLexicalComposerContext()
+ const [mentionMatch, setMentionMatch] = useState(null)
+
+ const updateMentionMatch = useCallback(
+ (match: MentionMatch | null) => {
+ setMentionMatch(match)
+ onTrigger?.(match)
+ },
+ [onTrigger],
+ )
+
+ const clearMentionMatch = useCallback(() => {
+ updateMentionMatch(null)
+ }, [updateMentionMatch])
+
+ // Monitor text changes for mention triggers
+ useEffect(() => {
+ const removeUpdateListener = editor.registerUpdateListener(({ editorState }) => {
+ editorState.read(() => {
+ const selection = $getSelection()
+ if (!$isRangeSelection(selection) || !selection.isCollapsed()) {
+ updateMentionMatch(null)
+ return
+ }
+
+ const { anchor } = selection
+ const anchorNode = anchor.getNode()
+
+ if (!$isTextNode(anchorNode)) {
+ updateMentionMatch(null)
+ return
+ }
+
+ const textContent = anchorNode.getTextContent()
+ const match = triggerFn(textContent, editor)
+ updateMentionMatch(match)
+ })
+ })
+
+ return removeUpdateListener
+ }, [editor, triggerFn, updateMentionMatch])
+
+ return {
+ mentionMatch,
+ isActive: mentionMatch !== null,
+ clearMentionMatch,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/index.ts
new file mode 100644
index 000000000..35bb92ef1
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/index.ts
@@ -0,0 +1,18 @@
+// Public API exports
+export { MentionComponent } from "./components/MentionComponent"
+export { MentionDropdown } from "./components/MentionDropdown"
+export { $createMentionNode, $isMentionNode, MentionNode } from "./MentionNode"
+export { MentionPlugin } from "./MentionPlugin"
+
+// Commands
+export { MENTION_COMMAND, MENTION_TYPEAHEAD_COMMAND } from "./constants"
+
+// Types
+export type {
+ MentionData,
+ MentionDropdownPosition,
+ MentionMatch,
+ MentionSearchState,
+ MentionTriggerState,
+ MentionType,
+} from "./types"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/types.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/types.ts
new file mode 100644
index 000000000..582902b88
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/types.ts
@@ -0,0 +1,30 @@
+export type MentionType = "entry" | "feed"
+
+export interface MentionData {
+ id: string
+ name: string
+ type: MentionType
+ value: unknown
+}
+
+export interface MentionMatch {
+ leadOffset: number
+ matchingString: string
+ replaceableString: string
+}
+
+export interface MentionDropdownPosition {
+ top: number
+ left: number
+}
+
+export interface MentionSearchState {
+ suggestions: MentionData[]
+ selectedIndex: number
+ isLoading: boolean
+}
+
+export interface MentionTriggerState {
+ mentionMatch: MentionMatch | null
+ isActive: boolean
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/positioning.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/positioning.ts
new file mode 100644
index 000000000..96615def5
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/positioning.ts
@@ -0,0 +1,38 @@
+import type { LexicalEditor } from "lexical"
+
+import type { MentionDropdownPosition } from "../types"
+
+export const calculateDropdownPosition = (
+ editor: LexicalEditor,
+): MentionDropdownPosition | null => {
+ const selection = window.getSelection()
+ if (!selection || selection.rangeCount === 0) return null
+
+ const range = selection.getRangeAt(0)
+ const rect = range.getBoundingClientRect()
+ const editorElement = editor.getRootElement()
+
+ if (!editorElement) return null
+
+ const editorRect = editorElement.getBoundingClientRect()
+
+ return {
+ top: rect.bottom - editorRect.top + 8, // 8px offset below cursor
+ left: rect.left - editorRect.left,
+ }
+}
+
+export const scrollSelectedItemIntoView = (
+ containerRef: React.RefObject,
+ selectedIndex: number,
+): void => {
+ if (!containerRef.current || selectedIndex < 0) return
+
+ const selectedElement = containerRef.current.children[selectedIndex] as HTMLElement
+ if (selectedElement) {
+ selectedElement.scrollIntoView({
+ block: "nearest",
+ behavior: "smooth",
+ })
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/textReplacement.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/textReplacement.ts
new file mode 100644
index 000000000..a94735bbc
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/textReplacement.ts
@@ -0,0 +1,54 @@
+import { $createTextNode, $getSelection, $isRangeSelection, $isTextNode } from "lexical"
+
+import { $createMentionNode } from "../MentionNode"
+import type { MentionData, MentionMatch } from "../types"
+
+export const insertMentionNode = (
+ mentionData: MentionData,
+ mentionMatch: MentionMatch,
+): { success: boolean; nodeKey?: string } => {
+ const selection = $getSelection()
+ if (!$isRangeSelection(selection) || !selection.isCollapsed()) return { success: false }
+
+ const { anchor } = selection
+ const anchorNode = anchor.getNode()
+
+ if (!$isTextNode(anchorNode)) return { success: false }
+
+ // Replace the mention text with the mention node
+ const textContent = anchorNode.getTextContent()
+ const { leadOffset, replaceableString } = mentionMatch
+
+ // Split the text node
+ const beforeText = textContent.slice(0, leadOffset)
+ const afterText = textContent.slice(leadOffset + replaceableString.length)
+
+ // Create new nodes
+ const beforeNode = beforeText ? $createTextNode(beforeText) : null
+ const mentionNode = $createMentionNode(mentionData)
+ const afterNode = afterText ? $createTextNode(afterText) : null
+
+ // Replace the current node
+ if (beforeNode) {
+ anchorNode.insertBefore(beforeNode)
+ }
+ anchorNode.insertBefore(mentionNode)
+ if (afterNode) {
+ anchorNode.insertBefore(afterNode)
+ }
+
+ // Remove the original node
+ anchorNode.remove()
+
+ // Position cursor after the mention
+ if (afterNode) {
+ afterNode.select(0, 0)
+ } else {
+ // Create a space after the mention if there's no following text
+ const spaceNode = $createTextNode(" ")
+ mentionNode.insertAfter(spaceNode)
+ spaceNode.select(1, 1)
+ }
+
+ return { success: true, nodeKey: mentionNode.getKey() }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/triggerDetection.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/triggerDetection.ts
new file mode 100644
index 000000000..9edf14ed5
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/editor/plugins/mention/utils/triggerDetection.ts
@@ -0,0 +1,56 @@
+import { $getSelection, $isRangeSelection, $isTextNode } from "lexical"
+
+import { MENTION_TRIGGER_PATTERN } from "../constants"
+import type { MentionMatch, MentionType } from "../types"
+
+export const defaultTriggerFn = (): MentionMatch | null => {
+ const selection = $getSelection()
+ if (!$isRangeSelection(selection) || !selection.isCollapsed()) {
+ return null
+ }
+
+ const { anchor } = selection
+ const { focus } = selection
+ const anchorNode = anchor.getNode()
+
+ // Only trigger on text nodes
+ if (!$isTextNode(anchorNode) || anchor.key !== focus.key || anchor.offset !== focus.offset) {
+ return null
+ }
+
+ const textContent = anchorNode.getTextContent()
+ const cursorOffset = anchor.offset
+
+ // Look for @ symbol followed by text
+ const mentionMatch = textContent.slice(0, cursorOffset).match(MENTION_TRIGGER_PATTERN)
+
+ if (!mentionMatch) {
+ return null
+ }
+
+ const matchingString = mentionMatch[1] || ""
+ const replaceableString = matchingString
+ const leadOffset = (mentionMatch.index ?? 0) + (mentionMatch[0]?.startsWith(" ") ? 1 : 0)
+
+ return {
+ leadOffset,
+ matchingString,
+ replaceableString,
+ }
+}
+
+export const getMentionType = (query: string): [MentionType | undefined, string] => {
+ // Simple heuristic - could be enhanced with more sophisticated detection
+ if (query.startsWith("@#")) return ["feed", query.slice(2)]
+ if (query.startsWith("@+")) return ["entry", query.slice(2)]
+ // Return undefined for general @ trigger to search both types
+ return [undefined, query.slice(1)]
+}
+
+export const cleanQuery = (query: string): string => {
+ return query.replace(/^@[#+]?/, "").toLowerCase()
+}
+
+export const shouldTriggerMention = (query: string): boolean => {
+ return query.startsWith("@") && query.length > 0
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useAutoScroll.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useAutoScroll.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useAutoScroll.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useAutoScroll.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useChatHistory.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useChatHistory.ts
similarity index 65%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useChatHistory.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useChatHistory.ts
index 11841b736..129e4f6a5 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useChatHistory.ts
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useChatHistory.ts
@@ -1,7 +1,6 @@
-import { nanoid } from "nanoid"
import { useCallback, useState } from "react"
-import { AIPersistService } from "~/modules/ai/chat/services/index"
+import { AIPersistService } from "~/modules/ai-chat/services/index"
import type { ChatSession } from "../types/ChatSession"
@@ -14,7 +13,7 @@ export const useChatHistory = () => {
try {
const result = await AIPersistService.getChatSessions()
const sessions: ChatSession[] = result.map((row) => ({
- roomId: row.roomId,
+ chatId: row.chatId,
title: row.title || "New Chat",
createdAt: new Date(row.createdAt),
messageCount: row.messageCount,
@@ -28,20 +27,9 @@ export const useChatHistory = () => {
}
}, [])
- const createNewSession = (shouldPersist = false) => {
- const roomId = nanoid()
- if (shouldPersist) {
- AIPersistService.createSession(roomId, "New Chat").catch((error) => {
- console.error("Failed to create new session:", error)
- })
- }
- return roomId
- }
-
return {
sessions,
loading,
loadHistory,
- createNewSession,
}
}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useLoadMessages.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useLoadMessages.ts
similarity index 55%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useLoadMessages.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useLoadMessages.ts
index 4d1bb2c67..6f55885f9 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useLoadMessages.ts
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useLoadMessages.ts
@@ -1,18 +1,15 @@
-import { use, useEffect, useState } from "react"
+import { useEffect, useState } from "react"
import { useEventCallback } from "usehooks-ts"
-import { AIChatContext } from "../__internal__/AIChatContext"
-import type { BizUIMessage } from "../__internal__/types"
import { AIPersistService } from "../services"
+import { useChatActions } from "../store/hooks"
+import type { BizUIMessage, BizUIMetadata } from "../store/types"
export const useLoadMessages = (
- roomId: string,
+ chatId: string,
options?: { onLoad?: (messages: BizUIMessage[]) => void },
) => {
- const { setMessages } = use(AIChatContext)
- const setMessageEventCallback = useEventCallback((messages: BizUIMessage[]) => {
- setMessages(messages)
- })
+ const chatActions = useChatActions()
const [isLoading, setIsLoading] = useState(true)
@@ -23,11 +20,16 @@ export const useLoadMessages = (
useEffect(() => {
let mounted = true
setIsLoading(true)
- AIPersistService.loadMessages(roomId)
+ AIPersistService.loadMessages(chatId)
.then((messages) => {
if (mounted) {
- const messagesToSet = messages.map((message) => message.message) as BizUIMessage[]
- setMessageEventCallback(messagesToSet)
+ const messagesToSet: BizUIMessage[] = messages.map((message) => ({
+ id: message.id,
+ parts: message.messageParts as any[],
+ role: message.role,
+ metadata: message.metadata as BizUIMetadata,
+ }))
+ chatActions.setMessages(messagesToSet)
onLoadEventCallback(messagesToSet)
}
})
@@ -42,6 +44,6 @@ export const useLoadMessages = (
return () => {
mounted = false
}
- }, [setMessageEventCallback, roomId, onLoadEventCallback])
+ }, [chatId, onLoadEventCallback, chatActions])
return { isLoading }
}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useSaveMessages.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSaveMessages.ts
similarity index 54%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useSaveMessages.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSaveMessages.ts
index afcbfd116..e27a265fd 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/hooks/useSaveMessages.ts
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/hooks/useSaveMessages.ts
@@ -1,15 +1,16 @@
-import { use, useEffect } from "react"
+import { useEffect } from "react"
-import { AIChatContext } from "../__internal__/AIChatContext"
import { AIPersistService } from "../services"
+import { useChatStatus, useMessages } from "../store/hooks"
export const useSaveMessages = (
- roomId: string,
+ chatId: string,
options: {
enabled: boolean
},
) => {
- const { messages, status } = use(AIChatContext)
+ const messages = useMessages()
+ const status = useChatStatus()
const isStreaming = status === "streaming"
@@ -18,7 +19,7 @@ export const useSaveMessages = (
return
}
- if (!roomId) {
+ if (!chatId) {
return
}
@@ -27,6 +28,6 @@ export const useSaveMessages = (
return
}
- AIPersistService.replaceAllMessages(roomId, messages)
- }, [roomId, messages, options.enabled, isStreaming])
+ AIPersistService.replaceAllMessages(chatId, messages)
+ }, [chatId, messages, options.enabled, isStreaming])
}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/services/contextBarSearchService.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/services/contextBarSearchService.ts
new file mode 100644
index 000000000..22b4b92b4
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/services/contextBarSearchService.ts
@@ -0,0 +1,69 @@
+import { useMemo } from "react"
+
+import type { SearchItem } from "./feedEntrySearchService"
+import { useFeedEntrySearchService } from "./feedEntrySearchService"
+
+/**
+ * Picker item interface for context bar compatibility
+ */
+export interface PickerItem {
+ id: string
+ title: string
+}
+
+/**
+ * Hook that provides search functionality for context bar
+ * Uses the shared feed/entry search service and converts results to PickerItem format
+ */
+export const useContextBarSearchService = () => {
+ const { search, feedItems, entryItems } = useFeedEntrySearchService({
+ maxRecentEntries: 50,
+ fuseOptions: {
+ keys: ["title", "id"],
+ threshold: 0.3,
+ },
+ })
+
+ // Convert search items to picker items
+ const convertToPickerItems = useMemo(() => {
+ return (items: SearchItem[]): PickerItem[] => {
+ return items.map((item) => ({
+ id: item.id,
+ title: item.title,
+ }))
+ }
+ }, [])
+
+ // Search function for feeds
+ const searchFeeds = useMemo(() => {
+ return (query: string): PickerItem[] => {
+ const results = search(query, "feed", 20)
+ return convertToPickerItems(results)
+ }
+ }, [search, convertToPickerItems])
+
+ // Search function for entries
+ const searchEntries = useMemo(() => {
+ return (query: string): PickerItem[] => {
+ const results = search(query, "entry", 20)
+ return convertToPickerItems(results)
+ }
+ }, [search, convertToPickerItems])
+
+ // Get all feeds as picker items
+ const allFeeds = useMemo(() => {
+ return convertToPickerItems(feedItems)
+ }, [feedItems, convertToPickerItems])
+
+ // Get all recent entries as picker items
+ const allRecentEntries = useMemo(() => {
+ return convertToPickerItems(entryItems)
+ }, [entryItems, convertToPickerItems])
+
+ return {
+ searchFeeds,
+ searchEntries,
+ allFeeds,
+ allRecentEntries,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/services/feedEntrySearchService.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/services/feedEntrySearchService.ts
new file mode 100644
index 000000000..2909dc4e2
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/services/feedEntrySearchService.ts
@@ -0,0 +1,119 @@
+import { useEntryIdsByView } from "@follow/store/entry/hooks"
+import { useEntryStore } from "@follow/store/entry/store"
+import { getFeedById } from "@follow/store/feed/getter"
+import { useAllFeedSubscription } from "@follow/store/subscription/hooks"
+import type { IFuseOptions } from "fuse.js"
+import Fuse from "fuse.js"
+import { useMemo } from "react"
+
+import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
+
+/**
+ * Generic search item interface
+ */
+export interface SearchItem {
+ id: string
+ title: string
+ type: "feed" | "entry"
+}
+
+/**
+ * Search service options
+ */
+export interface SearchServiceOptions {
+ /** Maximum number of recent entries to include */
+ maxRecentEntries?: number
+ /** Fuse.js search options */
+ fuseOptions?: IFuseOptions
+}
+
+const defaultFuseOptions: IFuseOptions = {
+ keys: ["title", "id"],
+ threshold: 0.3,
+ includeScore: true,
+}
+/**
+ * Hook that provides unified search functionality for feeds and entries
+ * Used by both context bar and mention plugin
+ */
+export const useFeedEntrySearchService = (options: SearchServiceOptions = {}) => {
+ const { maxRecentEntries = 50, fuseOptions = defaultFuseOptions } = options
+
+ // Get data sources
+ const allSubscriptions = useAllFeedSubscription()
+ const view = useRouteParamsSelector((route) => route.view)
+ const recentEntryIds = useEntryIdsByView(view, false)
+ const entryStore = useEntryStore((state) => state.data)
+
+ // Prepare feed items
+ const feedItems = useMemo(() => {
+ return allSubscriptions
+ .filter((subscription) => subscription.feedId)
+ .map((subscription) => {
+ const customTitle = subscription.title
+ if (!subscription.feedId) return null
+
+ const feed = getFeedById(subscription.feedId!)
+ return {
+ id: subscription.feedId!,
+ title: customTitle || feed?.title || `Feed ${subscription.feedId}`,
+ type: "feed" as const,
+ }
+ })
+ .filter(Boolean) as SearchItem[]
+ }, [allSubscriptions])
+
+ // Prepare entry items (recent entries, limited for performance)
+ const entryItems = useMemo(() => {
+ if (!recentEntryIds) return []
+
+ return recentEntryIds
+ .slice(0, maxRecentEntries)
+ .map((entryId) => {
+ const entry = entryStore[entryId]
+ return entry
+ ? {
+ id: entryId,
+ title: entry.title || "Untitled",
+ type: "entry" as const,
+ }
+ : null
+ })
+ .filter(Boolean) as SearchItem[]
+ }, [recentEntryIds, entryStore, maxRecentEntries])
+
+ // Combine all search items
+ const allItems = useMemo(() => {
+ return [...feedItems, ...entryItems]
+ }, [feedItems, entryItems])
+
+ // Create Fuse instance for fuzzy search
+ const fuse = useMemo(() => {
+ return new Fuse(allItems, fuseOptions)
+ }, [allItems, JSON.stringify(fuseOptions)])
+
+ // Search function
+ const search = useMemo(() => {
+ return (query: string, type?: "feed" | "entry", maxResults = 10): SearchItem[] => {
+ if (!query.trim()) {
+ // If no query, return recent items of the specified type
+ const filteredItems = allItems.filter((item) => !type || item.type === type)
+ return filteredItems.slice(0, maxResults)
+ }
+
+ // Perform fuzzy search
+ const fuseResults = fuse.search(query)
+ return fuseResults
+ .map((result) => result.item)
+ .filter((item) => !type || item.type === type)
+ .slice(0, maxResults)
+ }
+ }, [allItems, fuse])
+
+ return {
+ search,
+ feedItems,
+ entryItems,
+ allItems,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts
new file mode 100644
index 000000000..245ebf0a1
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/services/index.ts
@@ -0,0 +1,337 @@
+import type { AsyncDb } from "@follow/database/db"
+import { db } from "@follow/database/db"
+import { aiChatMessagesTable, aiChatTable } from "@follow/database/schemas/index"
+import { asc, count, eq, inArray, sql } from "drizzle-orm"
+
+import type { BizUIMessage } from "../store/types"
+
+class AIPersistServiceStatic {
+ // Cache for session existence to avoid repeated queries
+ private sessionExistsCache = new Map()
+
+ // Clear cache when session is created or deleted
+ private markSessionExists(chatId: string, exists: boolean) {
+ this.sessionExistsCache.set(chatId, exists)
+ }
+
+ private getSessionExistsFromCache(chatId: string): boolean | undefined {
+ return this.sessionExistsCache.get(chatId)
+ }
+
+ private clearSessionCache(chatId?: string) {
+ if (chatId) {
+ this.sessionExistsCache.delete(chatId)
+ } else {
+ this.sessionExistsCache.clear()
+ }
+ }
+
+ async loadMessages(chatId: string) {
+ return db.query.aiChatMessagesTable.findMany({
+ where: eq(aiChatMessagesTable.chatId, chatId),
+ orderBy: [asc(aiChatMessagesTable.createdAt)],
+ })
+ }
+
+ /**
+ * Convert enhanced database message to BizUIMessage format for compatibility
+ */
+ private convertToUIMessage(dbMessage: any): BizUIMessage {
+ // Reconstruct UIMessage from database fields
+ const uiMessage: BizUIMessage = {
+ id: dbMessage.id,
+ role: dbMessage.role,
+ parts: [], // AI SDK v5 uses parts array
+ }
+
+ // Add parts based on content format and data
+ if (dbMessage.messageParts && dbMessage.messageParts.length > 0) {
+ // For assistant messages with complex parts (tools, reasoning, etc)
+ uiMessage.parts = dbMessage.messageParts
+ } else {
+ // For simple text messages, create a text part
+ uiMessage.parts = [
+ {
+ type: "text",
+ text: dbMessage.content,
+ },
+ ]
+ }
+
+ return uiMessage
+ }
+
+ /**
+ * Enhanced message loading that converts to UIMessage format
+ */
+ async loadUIMessages(chatId: string): Promise {
+ const dbMessages = await this.loadMessages(chatId)
+ return dbMessages.map((msg) => this.convertToUIMessage(msg))
+ }
+
+ /**
+ * Load session and messages in a single optimized call
+ * Returns both session details and messages to avoid redundant queries
+ */
+ async loadSessionWithMessages(chatId: string): Promise<{
+ session: { chatId: string; title?: string; createdAt: Date } | null
+ messages: BizUIMessage[]
+ }> {
+ // Load both session and messages in parallel
+ const [sessionRaw, messages] = await Promise.all([
+ this.getChatSession(chatId),
+ this.loadUIMessages(chatId),
+ ])
+
+ // Convert null title to undefined for type compatibility
+ const session = sessionRaw
+ ? {
+ ...sessionRaw,
+ title: sessionRaw.title || undefined,
+ }
+ : null
+
+ return { session, messages }
+ }
+
+ async insertMessages(chatId: string, messages: BizUIMessage[]) {
+ if (messages.length === 0) {
+ return
+ }
+
+ await db
+ .insert(aiChatMessagesTable)
+ .values(
+ messages.map((message) => {
+ // Store parts as-is since they're stored as JSON and the UI can handle them
+ const convertedParts = message.parts as any[]
+
+ return {
+ id: message.id,
+ chatId,
+ role: message.role,
+ contentFormat: "plaintext" as const,
+
+ createdAt: new Date(),
+ status: "completed" as const,
+ finishedAt: message.metadata?.finishTime
+ ? new Date(message.metadata.finishTime)
+ : undefined,
+ messageParts: convertedParts,
+ metadata: message.metadata,
+ } as typeof aiChatMessagesTable.$inferInsert
+ }),
+ )
+ .onConflictDoUpdate({
+ target: [aiChatMessagesTable.id],
+ set: {
+ messageParts: sql`excluded.message_parts`,
+ metadata: sql`excluded.metadata`,
+ finishedAt: sql`excluded.finished_at`,
+ createdAt: sql`excluded.created_at`,
+ status: sql`excluded.status`,
+ },
+ })
+ }
+
+ async replaceAllMessages(chatId: string, messages: BizUIMessage[]) {
+ await db.delete(aiChatMessagesTable).where(eq(aiChatMessagesTable.chatId, chatId))
+ await this.insertMessages(chatId, messages)
+ }
+
+ /**
+ * Upsert specific messages (insert new, update existing)
+ * Ensures the chat session exists before inserting messages
+ */
+ async upsertMessages(chatId: string, messages: BizUIMessage[]) {
+ if (messages.length === 0) {
+ return
+ }
+
+ // Ensure the chat session exists first to avoid foreign key constraint failure
+ await this.ensureSession(chatId)
+
+ await db
+ .insert(aiChatMessagesTable)
+ .values(
+ messages.map((message) => {
+ const convertedParts = message.parts as any[]
+
+ return {
+ id: message.id,
+ chatId,
+ role: message.role,
+ contentFormat: "plaintext" as const,
+ createdAt: new Date(),
+ status: "completed" as const,
+ finishedAt: message.metadata?.finishTime
+ ? new Date(message.metadata.finishTime)
+ : undefined,
+ messageParts: convertedParts,
+ metadata: message.metadata,
+ } as typeof aiChatMessagesTable.$inferInsert
+ }),
+ )
+ .onConflictDoUpdate({
+ target: [aiChatMessagesTable.id],
+ set: {
+ messageParts: sql`excluded.message_parts`,
+ metadata: sql`excluded.metadata`,
+ finishedAt: sql`excluded.finished_at`,
+ status: sql`excluded.status`,
+ },
+ })
+ }
+
+ /**
+ * Delete specific messages by ID
+ */
+ async deleteMessages(chatId: string, messageIds: string[]) {
+ if (messageIds.length === 0) {
+ return
+ }
+
+ await db
+ .delete(aiChatMessagesTable)
+ .where(eq(aiChatMessagesTable.chatId, chatId) && inArray(aiChatMessagesTable.id, messageIds))
+ }
+
+ /**
+ * Ensure session exists (idempotent operation)
+ */
+ async ensureSession(chatId: string, title?: string): Promise {
+ // Check cache first to avoid database query
+ const cachedExists = this.getSessionExistsFromCache(chatId)
+
+ if (cachedExists === true) {
+ return
+ }
+
+ // Only query database if not in cache or cache shows it doesn't exist
+ if (cachedExists === undefined) {
+ const existing = await this.getChatSession(chatId)
+
+ if (existing) {
+ this.markSessionExists(chatId, true)
+ return
+ }
+
+ // Mark as not existing before creating
+ this.markSessionExists(chatId, false)
+ }
+
+ // Create new session
+ await this.createSession(chatId, title)
+ this.markSessionExists(chatId, true)
+ }
+
+ async createSession(chatId: string, title?: string) {
+ const now = new Date()
+ await db.insert(aiChatTable).values({
+ chatId,
+ title,
+ createdAt: now,
+ updatedAt: now,
+ })
+ // Mark session as existing in cache
+ this.markSessionExists(chatId, true)
+ }
+
+ async getChatSession(chatId: string) {
+ const result = await db.query.aiChatTable.findFirst({
+ where: eq(aiChatTable.chatId, chatId),
+ columns: {
+ chatId: true,
+ title: true,
+ createdAt: true,
+ },
+ })
+
+ // Explicitly check if the result is valid
+ if (!result || !result.chatId) {
+ // Mark as not existing in cache
+ this.markSessionExists(chatId, false)
+ return null
+ }
+
+ // Mark as existing in cache
+ this.markSessionExists(chatId, true)
+ return result
+ }
+
+ async getChatSessions(limit = 20) {
+ const chats = await db.query.aiChatTable.findMany({
+ columns: {
+ chatId: true,
+ title: true,
+ createdAt: true,
+ },
+ orderBy: (t, { desc }) => desc(t.createdAt),
+ limit,
+ })
+
+ if (chats.length === 0) {
+ return []
+ }
+
+ const chatIds = chats.map((chat) => chat.chatId)
+ const messageCounts = await (db as AsyncDb)
+ .select({
+ chatId: aiChatMessagesTable.chatId,
+ messageCount: count(aiChatMessagesTable.id),
+ })
+ .from(aiChatMessagesTable)
+ .where(inArray(aiChatMessagesTable.chatId, chatIds))
+ .groupBy(aiChatMessagesTable.chatId)
+
+ const messageCountMap = new Map(messageCounts.map((item) => [item.chatId, item.messageCount]))
+
+ return chats
+ .map((chat) => ({
+ chatId: chat.chatId,
+ title: chat.title,
+ createdAt: chat.createdAt,
+ messageCount: messageCountMap.get(chat.chatId) || 0,
+ }))
+ .filter((chat) => chat.messageCount > 0)
+ }
+
+ async deleteSession(chatId: string) {
+ await db.delete(aiChatMessagesTable).where(eq(aiChatMessagesTable.chatId, chatId))
+ await db.delete(aiChatTable).where(eq(aiChatTable.chatId, chatId))
+ // Clear session from cache
+ this.clearSessionCache(chatId)
+ }
+
+ async updateSessionTitle(chatId: string, title: string) {
+ await db
+ .update(aiChatTable)
+ .set({
+ title,
+ updatedAt: new Date(Date.now()),
+ })
+ .where(eq(aiChatTable.chatId, chatId))
+ }
+
+ async cleanupEmptySessions() {
+ const emptySessions = await db.values<[string]>(
+ sql`
+ SELECT ${aiChatTable.chatId}
+ FROM ${aiChatTable}
+ LEFT JOIN ${aiChatMessagesTable} ON ${aiChatTable.chatId} = ${aiChatMessagesTable.chatId}
+ GROUP BY ${aiChatTable.chatId}
+ HAVING COUNT(${aiChatMessagesTable.id}) = 0
+ `,
+ )
+
+ // Delete empty sessions
+ if (emptySessions.length > 0) {
+ const chatIdsToDelete = emptySessions.map((row) => row[0])
+ await db.delete(aiChatTable).where(inArray(aiChatTable.chatId, chatIdsToDelete))
+
+ // Clear deleted sessions from cache
+ chatIdsToDelete.forEach((chatId) => this.clearSessionCache(chatId))
+ }
+ }
+}
+export const AIPersistService = new AIPersistServiceStatic()
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/AIChatContext.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/AIChatContext.ts
new file mode 100644
index 000000000..39e51d9f3
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/AIChatContext.ts
@@ -0,0 +1,24 @@
+import { createContext, use } from "react"
+import type { StoreApi } from "zustand"
+import type { UseBoundStoreWithEqualityFn } from "zustand/traditional"
+
+import type { AiChatStore } from "./store"
+
+export type AIPanelRefs = {
+ panelRef: React.RefObject
+ inputRef: React.RefObject
+}
+
+export const AIPanelRefsContext = createContext(null!)
+
+export const AIChatStoreContext = createContext>>(
+ null!,
+)
+
+export const useAIChatStore = () => {
+ const store = use(AIChatStoreContext)
+ if (!store && import.meta.env.DEV) {
+ throw new Error("useAIChatStore must be used within a AIChatStoreContext")
+ }
+ return store
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-actions.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-actions.ts
new file mode 100644
index 000000000..94e93ae7d
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-actions.ts
@@ -0,0 +1,225 @@
+import { autoBindThis } from "@follow/utils/bind-this"
+import type { ChatStatus } from "ai"
+import { nanoid } from "nanoid"
+import type { StateCreator } from "zustand"
+
+import { AIPersistService } from "../../services"
+import { createChatTransport } from "../transport"
+import type { BizUIMessage } from "../types"
+import { ZustandChat } from "./chat-instance"
+import type { ChatSlice } from "./types"
+
+export class ChatSliceActions {
+ constructor(
+ private params: Parameters>,
+ private chatInstance: ZustandChat,
+ ) {
+ return autoBindThis(this)
+ }
+
+ get set() {
+ return this.params[0]
+ }
+
+ get get() {
+ return this.params[1]
+ }
+
+ // Direct message management methods (delegating to chat instance state)
+ setMessages = (
+ messagesParam: BizUIMessage[] | ((messages: BizUIMessage[]) => BizUIMessage[]),
+ ) => {
+ if (typeof messagesParam === "function") {
+ this.chatInstance.chatState.messages = messagesParam(this.chatInstance.chatState.messages)
+ } else {
+ this.chatInstance.chatState.messages = messagesParam
+ }
+ }
+
+ pushMessage = (message: BizUIMessage) => {
+ this.chatInstance.chatState.pushMessage(message)
+ }
+
+ popMessage = () => {
+ this.chatInstance.chatState.popMessage()
+ }
+
+ replaceMessage = (index: number, message: BizUIMessage) => {
+ this.chatInstance.chatState.replaceMessage(index, message)
+ }
+
+ updateMessage = (id: string, updates: Partial) => {
+ const messageIndex = this.chatInstance.chatState.messages.findIndex(
+ (msg: BizUIMessage) => msg.id === id,
+ )
+ if (messageIndex !== -1) {
+ const message = this.chatInstance.chatState.messages[messageIndex]
+ if (message) {
+ const updatedMessage = { ...message, ...updates }
+ this.replaceMessage(messageIndex, updatedMessage)
+ }
+ }
+ }
+
+ // Getter
+ getMessages = (): BizUIMessage[] => {
+ return this.chatInstance.chatState.messages
+ }
+
+ // Status management (delegating to chat instance state)
+ setStatus = (status: ChatStatus) => {
+ this.chatInstance.chatState.status = status
+ }
+
+ setError = (error: Error | undefined) => {
+ this.chatInstance.chatState.error = error
+ }
+
+ setStreaming = (streaming: boolean) => {
+ this.chatInstance.chatState.status = streaming ? "streaming" : "ready"
+ }
+
+ // Title management
+ setCurrentTitle = (title: string | undefined) => {
+ this.set((state) => ({ ...state, currentTitle: title }))
+ }
+
+ getCurrentTitle = (): string | undefined => {
+ return this.get().currentTitle
+ }
+
+ getCurrentChatId = (): string | null => {
+ return this.get().chatId
+ }
+
+ // Core chat actions using AI SDK AbstractChat methods
+ sendMessage = async (message: string | BizUIMessage) => {
+ try {
+ // Convert string to message object if needed
+ const messageObj =
+ typeof message === "string"
+ ? ({ parts: [{ type: "text", text: message }] } as Parameters<
+ typeof this.chatInstance.sendMessage
+ >[0])
+ : (message as Parameters[0])
+
+ // Use the AI SDK's sendMessage method
+ const response = await this.chatInstance.sendMessage(messageObj)
+ return response
+ } catch (error) {
+ this.setError(error as Error)
+ throw error
+ }
+ }
+
+ regenerate = async ({ messageId }: { messageId: string }) => {
+ try {
+ // Use the AI SDK's regenerate method
+ const response = await this.chatInstance.regenerate({ messageId })
+ return response
+ } catch (error) {
+ this.setError(error as Error)
+ throw error
+ }
+ }
+
+ stop = () => {
+ // Use AI SDK's stop method
+ this.chatInstance.stop()
+ }
+
+ resumeStream = async () => {
+ try {
+ // Use AI SDK's resumeStream method
+ await this.chatInstance.resumeStream()
+ } catch (error) {
+ this.setError(error as Error)
+ throw error
+ }
+ }
+
+ resetChat = () => {
+ // Reset through the chat instance state
+ this.chatInstance.chatState.messages = []
+ this.chatInstance.chatState.error = undefined
+ this.chatInstance.chatState.status = "ready"
+ // Reset title
+ this.setCurrentTitle(undefined)
+ }
+
+ newChat = () => {
+ const newChatId = nanoid()
+ // Cleanup old chat instance
+ this.chatInstance.destroy()
+
+ // Create new chat instance
+ const newChatInstance = new ZustandChat(
+ {
+ id: newChatId,
+ messages: [],
+ transport: createChatTransport(),
+ },
+ this.set,
+ )
+
+ // Update store state
+ this.set((state) => ({
+ ...state,
+ chatId: newChatId,
+ messages: [],
+ status: "ready" as ChatStatus,
+ error: undefined,
+ isStreaming: false,
+ currentTitle: undefined,
+ chatInstance: newChatInstance,
+ }))
+
+ // Update the reference
+ this.chatInstance = newChatInstance
+ }
+
+ switchToChat = async (chatId: string) => {
+ try {
+ // Set loading state (using ready as there's no loading status in ChatStatus)
+ this.setStatus("ready")
+ this.setError(undefined)
+
+ // Load session and messages in parallel to reduce database queries
+ const { session: chatSession, messages } =
+ await AIPersistService.loadSessionWithMessages(chatId)
+
+ // Cleanup old chat instance
+ this.chatInstance.destroy()
+
+ // Create new chat instance with loaded messages
+ const newChatInstance = new ZustandChat(
+ {
+ id: chatId,
+ messages,
+ transport: createChatTransport(),
+ },
+ this.set,
+ )
+
+ // Update store state
+ this.set((state) => ({
+ ...state,
+ chatId,
+ messages: [...messages],
+ status: "ready" as ChatStatus,
+ error: undefined,
+ isStreaming: false,
+ currentTitle: chatSession?.title || undefined,
+ chatInstance: newChatInstance,
+ }))
+
+ // Update the reference
+ this.chatInstance = newChatInstance
+ } catch (error) {
+ console.error("Failed to switch to chat:", error)
+ this.setError(error as Error)
+ this.setStatus("ready")
+ throw error
+ }
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-instance.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-instance.ts
new file mode 100644
index 000000000..84183105c
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-instance.ts
@@ -0,0 +1,41 @@
+import type { ChatInit, ChatStatus } from "ai"
+import { AbstractChat } from "ai"
+
+import type { BizUIMessage } from "../types"
+import { ZustandChatState } from "./chat-state"
+import type { ChatSlice } from "./types"
+
+// Custom Chat class that uses Zustand-integrated state
+export class ZustandChat extends AbstractChat {
+ override state: ZustandChatState
+ #unsubscribeFns: (() => void)[] = []
+
+ constructor(
+ { messages, ...init }: ChatInit,
+ updateZustandState: (updater: (state: ChatSlice) => ChatSlice) => void,
+ ) {
+ const state = new ZustandChatState(messages, updateZustandState, init.id || "")
+ super({ ...init, state })
+ this.state = state
+ }
+
+ // Public getter for state access
+ get chatState() {
+ return this.state
+ }
+
+ // Cleanup method
+ destroy(): void {
+ // Unsubscribe from AI SDK callbacks
+ this.#unsubscribeFns.forEach((unsubscribe) => unsubscribe())
+ this.#unsubscribeFns = []
+
+ this.state.destroy()
+ }
+
+ protected override setStatus({ status, error }: { status: ChatStatus; error?: Error }): void {
+ super.setStatus({ status, error })
+ this.state.status = status
+ this.state.error = error
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-state.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-state.ts
new file mode 100644
index 000000000..03d546981
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/chat-state.ts
@@ -0,0 +1,160 @@
+import type { ChatState, ChatStatus } from "ai"
+import { throttle } from "es-toolkit/compat"
+
+import { AIPersistService } from "../../services"
+import { ChatStateEventEmitter } from "../event-system/event-emitter"
+import type { BizUIMessage } from "../types"
+import type { ChatSlice } from "./types"
+
+// Zustand Chat State that implements AI SDK ChatState interface
+export class ZustandChatState implements ChatState {
+ #messages: UI_MESSAGE[]
+ #status: ChatStatus = "ready"
+ #error: Error | undefined = undefined
+ #eventEmitter = new ChatStateEventEmitter()
+
+ constructor(
+ initialMessages: UI_MESSAGE[] = [],
+ private updateZustandState: (updater: (state: ChatSlice) => ChatSlice) => void,
+ private chatId: string,
+ ) {
+ this.#messages = initialMessages
+ this.#setupEventHandlers()
+ }
+
+ #setupEventHandlers(): void {
+ // Setup event handlers for automatic Zustand synchronization
+ this.#eventEmitter.on("messages", ({ messages }) => {
+ this.updateZustandState((state) => ({
+ ...state,
+ messages: [...messages],
+ }))
+ })
+
+ this.#eventEmitter.on("status", ({ status }) => {
+ this.updateZustandState((state) => ({
+ ...state,
+ status,
+ isStreaming: status === "streaming",
+ }))
+ })
+
+ this.#eventEmitter.on("error", ({ error }) => {
+ this.updateZustandState((state) => ({
+ ...state,
+ error,
+ }))
+ })
+ }
+
+ get status(): ChatStatus {
+ return this.#status
+ }
+
+ set status(newStatus: ChatStatus) {
+ if (this.#status === newStatus) return
+
+ this.#status = newStatus
+ this.#eventEmitter.emit("status", { status: newStatus })
+ }
+
+ get error(): Error | undefined {
+ return this.#error
+ }
+
+ set error(newError: Error | undefined) {
+ if (this.#error === newError) return
+
+ this.#error = newError
+ this.#eventEmitter.emit("error", { error: newError })
+ }
+
+ get messages(): UI_MESSAGE[] {
+ return this.#messages
+ }
+
+ set messages(newMessages: UI_MESSAGE[]) {
+ this.#messages = [...newMessages]
+ this.#eventEmitter.emit("messages", { messages: this.#messages })
+
+ // Auto-persist messages when they change
+ this.#persistMessages()
+ }
+
+ pushMessage = (message: UI_MESSAGE) => {
+ this.messages = this.#messages.concat(message)
+ }
+
+ popMessage = () => {
+ if (this.#messages.length === 0) return
+
+ this.messages = this.#messages.slice(0, -1)
+ }
+
+ replaceMessage = (index: number, message: UI_MESSAGE) => {
+ if (index < 0 || index >= this.#messages.length) return
+
+ this.messages = [
+ ...this.#messages.slice(0, index),
+ // Deep clone the message to ensure React detects changes
+ this.snapshot(message),
+ ...this.#messages.slice(index + 1),
+ ]
+ }
+
+ snapshot = (value: T): T => structuredClone(value)
+
+ // Callback registration methods with proper AI SDK compatibility
+ registerMessagesCallback = (onChange: () => void, throttleWaitMs?: number): (() => void) => {
+ const callback = throttleWaitMs ? throttle(onChange, throttleWaitMs) : onChange
+
+ // Convert payload-based event to AI SDK expected callback format
+ return this.#eventEmitter.on("messages", () => callback())
+ }
+
+ registerStatusCallback = (onChange: () => void): (() => void) => {
+ // Convert payload-based event to AI SDK expected callback format
+ return this.#eventEmitter.on("status", () => onChange())
+ }
+
+ registerErrorCallback = (onChange: () => void): (() => void) => {
+ // Convert payload-based event to AI SDK expected callback format
+ return this.#eventEmitter.on("error", () => onChange())
+ }
+
+ // Internal event subscription with payload access
+ onMessagesChange = (listener: (messages: UI_MESSAGE[]) => void): (() => void) => {
+ return this.#eventEmitter.on("messages", ({ messages }) => listener(messages))
+ }
+
+ onStatusChange = (listener: (status: ChatStatus) => void): (() => void) => {
+ return this.#eventEmitter.on("status", ({ status }) => listener(status))
+ }
+
+ onErrorChange = (listener: (error: Error | undefined) => void): (() => void) => {
+ return this.#eventEmitter.on("error", ({ error }) => listener(error))
+ }
+
+ // Persistence methods
+ #persistMessages = throttle(
+ async () => {
+ // Skip if no messages
+ if (this.#messages.length === 0) return
+
+ try {
+ await AIPersistService.ensureSession(this.chatId, "New Chat")
+ // Save messages using incremental updates
+ await AIPersistService.upsertMessages(this.chatId, this.#messages)
+ } catch (error) {
+ console.error("Failed to persist messages:", error)
+ }
+ },
+ 100,
+ { leading: true, trailing: true },
+ )
+
+ // Cleanup method
+ destroy(): void {
+ this.#eventEmitter.clear()
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/types.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/types.ts
new file mode 100644
index 000000000..ebe673e9b
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/chat-core/types.ts
@@ -0,0 +1,23 @@
+import type { ChatStatus } from "ai"
+
+import type { BizUIMessage } from "../types"
+import type { ChatSliceActions } from "./chat-actions"
+
+// Zustand slice interface
+export interface ChatSlice {
+ // Chat state (mirrored from ChatState)
+ chatId: string
+ messages: BizUIMessage[]
+ status: ChatStatus
+ error: Error | undefined
+ isStreaming: boolean
+
+ // UI state
+ currentTitle: string | undefined
+
+ // AI SDK Chat instance (forward declaration to avoid circular import)
+ chatInstance: any
+
+ // Actions
+ chatActions: ChatSliceActions
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/event-system/event-emitter.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/event-system/event-emitter.ts
new file mode 100644
index 000000000..c35d76a70
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/event-system/event-emitter.ts
@@ -0,0 +1,36 @@
+import type { BizUIMessage } from "../types"
+import type { ChatStateEvents, ChatStateEventType } from "./types"
+
+// Event emitter for AI chat state changes with typed payloads
+export class ChatStateEventEmitter {
+ #listeners = new Map void>>()
+
+ on(
+ event: T,
+ listener: (payload: ChatStateEvents[T]) => void,
+ ): () => void {
+ if (!this.#listeners.has(event)) {
+ this.#listeners.set(event, new Set())
+ }
+ this.#listeners.get(event)!.add(listener)
+
+ // Return unsubscribe function
+ return () => {
+ this.#listeners.get(event)?.delete(listener)
+ }
+ }
+
+ emit(event: T, payload: ChatStateEvents[T]): void {
+ this.#listeners.get(event)?.forEach((listener) => {
+ try {
+ listener(payload)
+ } catch (error) {
+ console.error(`Error in chat state listener for event ${event}:`, error)
+ }
+ })
+ }
+
+ clear(): void {
+ this.#listeners.clear()
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/event-system/types.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/event-system/types.ts
new file mode 100644
index 000000000..9edd506d1
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/event-system/types.ts
@@ -0,0 +1,12 @@
+import type { ChatStatus } from "ai"
+
+import type { BizUIMessage } from "../types"
+
+// Event types and payloads
+export interface ChatStateEvents {
+ messages: { messages: UI_MESSAGE[] }
+ status: { status: ChatStatus }
+ error: { error: Error | undefined }
+}
+
+export type ChatStateEventType = keyof ChatStateEvents
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/hooks.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/hooks.ts
new file mode 100644
index 000000000..b370e100c
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/hooks.ts
@@ -0,0 +1,104 @@
+import { useAIChatStore } from "./AIChatContext"
+
+/**
+ * Hook to get the current room ID (chat ID) from the AI chat store
+ */
+export const useCurrentChatId = () => {
+ const store = useAIChatStore()
+ return store((state) => state.chatId)
+}
+
+/**
+ * Hook to get the current chat title from the AI chat store
+ */
+export const useCurrentTitle = () => {
+ const store = useAIChatStore()
+ return store((state) => state.currentTitle)
+}
+
+/**
+ * Hook to get the setter for current room ID
+ */
+export const useSetCurrentChatId = () => {
+ const store = useAIChatStore()
+ return (chatId: string | null) => {
+ const actions = store.getState().chatActions
+ if (chatId && chatId !== actions.getCurrentChatId()) {
+ // If we need to switch to a different room, create a new chat
+ actions.newChat()
+ }
+ }
+}
+
+/**
+ * Hook to get the setter for current title
+ */
+export const useSetCurrentTitle = () => {
+ const store = useAIChatStore()
+ return store.getState().chatActions.setCurrentTitle
+}
+
+/**
+ * Hook to get the chat actions
+ */
+export const useChatActions = () => {
+ const store = useAIChatStore()
+ return store((state) => state.chatActions)
+}
+
+/**
+ * Hook to get the block actions
+ */
+export const useBlockActions = () => {
+ const store = useAIChatStore()
+ return store((state) => state.blockActions)
+}
+
+/**
+ * Hook to get the chat instance
+ */
+export const useChatInstance = () => {
+ const store = useAIChatStore()
+ return store((state) => state.chatInstance)
+}
+
+/**
+ * Hook to get the current messages
+ */
+export const useMessages = () => {
+ const store = useAIChatStore()
+ return store((state) => state.messages)
+}
+
+/**
+ * Hook to check if the chat has messages
+ */
+export const useHasMessages = () => {
+ const store = useAIChatStore()
+ return store((state) => state.messages.length > 0)
+}
+
+export const useChatBlockActions = () => useAIChatStore()((state) => state.blockActions)
+/**
+ * Hook to get the chat status
+ */
+export const useChatStatus = () => {
+ const store = useAIChatStore()
+ return store((state) => state.status)
+}
+
+/**
+ * Hook to get the chat error
+ */
+export const useChatError = () => {
+ const store = useAIChatStore()
+ return store((state) => state.error)
+}
+
+/**
+ * Hook to get the streaming status
+ */
+export const useIsStreaming = () => {
+ const store = useAIChatStore()
+ return store((state) => state.isStreaming)
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/block.slice.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/block.slice.ts
new file mode 100644
index 000000000..7f0162dfd
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/block.slice.ts
@@ -0,0 +1,106 @@
+import { autoBindThis } from "@follow/utils/bind-this"
+import { produce } from "immer"
+import { nanoid } from "nanoid"
+import type { StateCreator } from "zustand"
+
+import type { AIChatContextBlock } from "../types"
+
+export interface BlockSlice {
+ blocks: AIChatContextBlock[]
+ blockActions: BlockSliceAction
+}
+
+export const createBlockSlice: (
+ initialBlocks?: AIChatContextBlock[],
+) => StateCreator =
+ (initialBlocks?: AIChatContextBlock[]) =>
+ (...params) => {
+ const defaultBlocks: AIChatContextBlock[] = initialBlocks || []
+
+ return {
+ blocks: defaultBlocks,
+ blockActions: new BlockSliceAction(params),
+ }
+ }
+
+export class BlockSliceAction {
+ constructor(private params: Parameters>) {
+ return autoBindThis(this)
+ }
+
+ static SPECIAL_TYPES = {
+ mainEntry: "mainEntry",
+ selectedText: "selectedText",
+ }
+ get set() {
+ return this.params[0]
+ }
+
+ get get() {
+ return this.params[1]
+ }
+ addBlock(block: Omit) {
+ const currentBlocks = this.get().blocks
+
+ // Only allow one SPECIAL_TYPES
+ if (
+ Object.values(BlockSliceAction.SPECIAL_TYPES).includes(block.type) &&
+ currentBlocks.some((b) => b.type === block.type)
+ ) {
+ return
+ }
+
+ this.set(
+ produce((state: BlockSlice) => {
+ state.blocks.push({ ...block, id: BlockSliceAction.SPECIAL_TYPES[block.type] || nanoid(8) })
+ }),
+ )
+ }
+
+ removeBlock(id: string) {
+ this.set(
+ produce((state: BlockSlice) => {
+ state.blocks = state.blocks.filter((block) => block.id !== id)
+ }),
+ )
+ }
+
+ updateBlock(id: string, updates: Partial) {
+ this.set(
+ produce((state: BlockSlice) => {
+ state.blocks = state.blocks.map((block) =>
+ block.id === id ? { ...block, ...updates } : block,
+ )
+ }),
+ )
+ }
+
+ addOrUpdateBlock(block: AIChatContextBlock) {
+ const isExist = this.get().blocks.some((b) => b.id === block.id)
+ if (isExist) {
+ this.updateBlock(block.id, block)
+ } else {
+ this.addBlock(block)
+ }
+ }
+
+ clearBlocks() {
+ this.set(
+ produce((state: BlockSlice) => {
+ state.blocks = []
+ }),
+ )
+ }
+
+ resetContext() {
+ this.set(
+ produce((state: BlockSlice) => {
+ state.blocks = []
+ }),
+ )
+ }
+
+ getBlocks() {
+ return this.get().blocks
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/chat.slice.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/chat.slice.ts
new file mode 100644
index 000000000..800b924b5
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/chat.slice.ts
@@ -0,0 +1,76 @@
+import { nanoid } from "nanoid"
+import type { StateCreator } from "zustand"
+
+import { AIPersistService } from "../../services"
+import { generateChatTitle } from "../../utils/titleGeneration"
+import { ChatSliceActions } from "../chat-core/chat-actions"
+import { ZustandChat } from "../chat-core/chat-instance"
+import type { ChatSlice } from "../chat-core/types"
+import { createChatTransport } from "../transport"
+import type { BizUIMessage } from "../types"
+
+export const createChatSlice: StateCreator = (...params) => {
+ const [set, get] = params
+ const chatId = nanoid()
+
+ // Create chat instance with Zustand integration
+ const chatInstance = new ZustandChat(
+ {
+ id: chatId,
+ messages: [],
+ transport: createChatTransport(),
+ onFinish: async (options) => {
+ const { message } = options
+
+ // Only trigger title generation for assistant messages (AI responses)
+ if (message.role !== "assistant") return
+
+ // Get current messages to check if this is the first AI response
+ const allMessages = chatInstance.chatState.messages
+
+ // Check if we have exactly 2 messages (1 user + 1 assistant = first exchange)
+ // Or if we have 2+ messages and this is the first assistant message
+ const assistantMessages = allMessages.filter((m) => m.role === "assistant")
+ const isFirstAIResponse = assistantMessages.length === 1
+
+ if (isFirstAIResponse && allMessages.length >= 2) {
+ try {
+ // Generate title using the first user message and first AI response
+ const firstExchange = allMessages.slice(0, 2)
+
+ const title = await generateChatTitle(firstExchange)
+
+ if (title && chatId) {
+ try {
+ await AIPersistService.updateSessionTitle(chatId, title)
+ if (get().chatId === chatId) {
+ chatActions.setCurrentTitle(title)
+ }
+ } catch (error) {
+ console.error("Failed to update session title:", error)
+ }
+ }
+ } catch (error) {
+ console.error("Failed to generate chat title:", error)
+ }
+ }
+ },
+ },
+ set, // Pass set function for state updates
+ )
+
+ // Create actions
+ const chatActions = new ChatSliceActions(params, chatInstance)
+
+ return {
+ // Chat state
+ chatId,
+ messages: [],
+ status: "ready",
+ error: undefined,
+ isStreaming: false,
+ currentTitle: undefined,
+ chatInstance,
+ chatActions,
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/index.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/index.ts
new file mode 100644
index 000000000..eb310fc39
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/slices/index.ts
@@ -0,0 +1,7 @@
+export type { ChatSlice } from "../chat-core/types"
+export {
+ type BlockSlice as ContextSlice,
+ createBlockSlice as createContextSlice,
+} from "./block.slice"
+export { createChatSlice } from "./chat.slice"
+export { type ChatStatus } from "ai"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/store.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/store.ts
new file mode 100644
index 000000000..aadec5a1d
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/store.ts
@@ -0,0 +1,29 @@
+import { createWithEqualityFn } from "zustand/traditional"
+
+import type { ChatSlice } from "./chat-core/types"
+import type { BlockSlice } from "./slices/block.slice"
+import { createBlockSlice } from "./slices/block.slice"
+import { createChatSlice } from "./slices/chat.slice"
+import type { AIChatStoreInitial } from "./types"
+
+export type AiChatStore = BlockSlice &
+ ChatSlice & {
+ reset: () => void
+ }
+
+export const createAIChatStore = (initialState?: Partial) => {
+ return createWithEqualityFn((...a) => {
+ const blockSlice = createBlockSlice(initialState?.blocks)(...a)
+ const chatSlice = createChatSlice(...a)
+
+ return {
+ ...blockSlice,
+ ...chatSlice,
+
+ reset: () => {
+ blockSlice.blockActions.resetContext()
+ chatSlice.chatActions.resetChat()
+ },
+ }
+ })
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/store/transport.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/transport.ts
new file mode 100644
index 000000000..664281202
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/transport.ts
@@ -0,0 +1,14 @@
+import { env } from "@follow/shared/env.desktop"
+import { DefaultChatTransport } from "ai"
+
+/**
+ * Create a chat transport for AI SDK
+ * This is used by the AbstractChat instance to communicate with AI providers
+ */
+export function createChatTransport() {
+ return new DefaultChatTransport({
+ // Custom fetch configuration
+ api: `${env.VITE_API_URL}/ai/chat`,
+ credentials: "include",
+ })
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/types.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/store/types.ts
similarity index 82%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/types.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/store/types.ts
index 116611252..b2d9a5adc 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/types.ts
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/store/types.ts
@@ -6,11 +6,8 @@ export interface AIChatContextBlock {
value: string
}
-export interface AIChatContextInfo {
- mainEntryId?: string
- referEntryIds?: string[]
- referFeedIds?: string[]
- selectedText?: string
+export interface AIChatStoreInitial {
+ blocks: AIChatContextBlock[]
}
export interface AIChatContextBlocks {
@@ -21,5 +18,6 @@ export type AIDisplayAnalyticsTool = ToolWithState
export type AIDisplayEntriesTool = ToolWithState
export type AIDisplaySubscriptionsTool = ToolWithState
+export type AIDisplayFlowTool = ToolWithState
export { type BizUIMessage, type BizUIMetadata, type BizUITools } from "@folo-services/ai-tools"
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/types/ChatSession.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/types/ChatSession.ts
new file mode 100644
index 000000000..f145e48e8
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/types/ChatSession.ts
@@ -0,0 +1,16 @@
+import type { SerializedEditorState } from "lexical"
+
+export interface ChatSession {
+ chatId: string
+ title?: string
+ createdAt: Date
+ messageCount: number
+}
+
+export type RichTextPart = {
+ type: "data-rich-text"
+ data: {
+ state: SerializedEditorState
+ text: string
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/utils/export.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/utils/export.ts
similarity index 96%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/utils/export.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/utils/export.ts
index 98baa7a02..c85bdb3c9 100644
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/utils/export.ts
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/utils/export.ts
@@ -1,6 +1,6 @@
import type { UIDataTypes, UIMessage } from "ai"
-import type { BizUIMetadata, BizUITools } from "../__internal__/types"
+import type { BizUIMetadata, BizUITools } from "../store/types"
export const exportChatToMarkdown = (
messages: UIMessage[],
diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/utils/lexical-markdown.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/utils/lexical-markdown.ts
new file mode 100644
index 000000000..16bd2db52
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/ai-chat/utils/lexical-markdown.ts
@@ -0,0 +1,50 @@
+import { $convertToMarkdownString, TRANSFORMERS } from "@lexical/markdown"
+import type { LexicalEditor, SerializedEditorState } from "lexical"
+
+/**
+ * Message format types
+ */
+export type MessageFormat = "plaintext" | "richtext"
+
+/**
+ * Message content with format information
+ */
+export interface MessageContent {
+ /** The content format */
+ format: MessageFormat
+ /** Raw content - markdown string for plaintext, Lexical schema for richtext */
+ content: string | SerializedEditorState
+}
+
+/**
+ * Convert Lexical editor state to markdown string for AI communication
+ */
+export function convertLexicalToMarkdown(editor: LexicalEditor): string {
+ let markdown = ""
+
+ editor.getEditorState().read(() => {
+ markdown = $convertToMarkdownString(TRANSFORMERS)
+ })
+
+ return markdown
+}
+
+/**
+ * Get markdown string for AI communication from any MessageContent
+ */
+export function getMarkdownForAI(message: MessageContent, editor?: LexicalEditor): string {
+ if (message.format === "plaintext") {
+ return message.content as string
+ }
+
+ if (message.format === "richtext" && editor) {
+ // Set editor state from schema and convert to markdown
+ const schema = message.content as SerializedEditorState
+ const editorState = editor.parseEditorState(schema)
+ editor.setEditorState(editorState)
+ return convertLexicalToMarkdown(editor)
+ }
+
+ // Fallback
+ return ""
+}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/utils/titleGeneration.ts b/apps/desktop/layer/renderer/src/modules/ai-chat/utils/titleGeneration.ts
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/chat/utils/titleGeneration.ts
rename to apps/desktop/layer/renderer/src/modules/ai-chat/utils/titleGeneration.ts
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/EntryPlaceholderDaily.tsx b/apps/desktop/layer/renderer/src/modules/ai-daily/EntryPlaceholderDaily.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/EntryPlaceholderDaily.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-daily/EntryPlaceholderDaily.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/FeedDailyModalContent.tsx b/apps/desktop/layer/renderer/src/modules/ai-daily/FeedDailyModalContent.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/FeedDailyModalContent.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-daily/FeedDailyModalContent.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/constants.ts b/apps/desktop/layer/renderer/src/modules/ai-daily/constants.ts
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/constants.ts
rename to apps/desktop/layer/renderer/src/modules/ai-daily/constants.ts
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/daily.tsx b/apps/desktop/layer/renderer/src/modules/ai-daily/daily.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/daily.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-daily/daily.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/plugins/parse-snowflake.ts b/apps/desktop/layer/renderer/src/modules/ai-daily/plugins/parse-snowflake.ts
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/plugins/parse-snowflake.ts
rename to apps/desktop/layer/renderer/src/modules/ai-daily/plugins/parse-snowflake.ts
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/types.tsx b/apps/desktop/layer/renderer/src/modules/ai-daily/types.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/types.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-daily/types.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/useAIDailyReportModal.tsx b/apps/desktop/layer/renderer/src/modules/ai-daily/useAIDailyReportModal.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/useAIDailyReportModal.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-daily/useAIDailyReportModal.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/ai-daily/useParseDailyDate.tsx b/apps/desktop/layer/renderer/src/modules/ai-daily/useParseDailyDate.tsx
similarity index 100%
rename from apps/desktop/layer/renderer/src/modules/ai/ai-daily/useParseDailyDate.tsx
rename to apps/desktop/layer/renderer/src/modules/ai-daily/useParseDailyDate.tsx
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/AIChatContext.ts b/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/AIChatContext.ts
deleted file mode 100644
index 43ad7d9eb..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/AIChatContext.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import type { UIMessage, UseChatHelpers } from "@ai-sdk/react"
-import type { UIDataTypes } from "ai"
-import { createContext, use } from "react"
-import type { StoreApi } from "zustand"
-import type { UseBoundStoreWithEqualityFn } from "zustand/traditional"
-
-import type { AiChatContextStore } from "./store"
-import type { BizUIMetadata, BizUITools } from "./types"
-
-export const AIChatContext = createContext<
- UseChatHelpers>
->(null!)
-
-export type AIPanelRefs = {
- panelRef: React.RefObject
- inputRef: React.RefObject
-}
-
-export const AIPanelRefsContext = createContext(null!)
-
-export const AIChatContextStoreContext = createContext<
- UseBoundStoreWithEqualityFn>
->(null!)
-
-// Hook to access AI chat context information
-export const useAIChatStore = () => {
- const store = use(AIChatContextStoreContext)
- if (!store && import.meta.env.DEV) {
- throw new Error("useAIChatStore must be used within a AIChatContextStoreContext")
- }
- return store
-}
-
-// Session methods context for managing chat session actions
-export interface AIChatSessionMethods {
- handleTitleGenerated: (title: string) => Promise
- handleFirstMessage: () => Promise
- handleNewChat: () => void
- handleSwitchRoom: (roomId: string) => Promise
-}
-
-export const AIChatSessionMethodsContext = createContext(null!)
-
-export const useAIChatSessionMethods = () => {
- const context = use(AIChatSessionMethodsContext)
- if (!context && import.meta.env.DEV) {
- throw new Error("useAIChatSessionMethods must be used within a AIChatSessionMethodsContext")
- }
- return context
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/store.ts b/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/store.ts
deleted file mode 100644
index d623edfbb..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/store.ts
+++ /dev/null
@@ -1,203 +0,0 @@
-import { produce } from "immer"
-import { nanoid } from "nanoid"
-import { createWithEqualityFn } from "zustand/traditional"
-
-import type { AIChatContextBlock, AIChatContextInfo } from "./types"
-import { blocksToContextInfo, contextInfoToBlocks } from "./utils"
-
-export interface AiChatContextStore {
- state: AIChatContextInfo
- blocks: AIChatContextBlock[]
- // Block management methods
- addBlock: (block: Omit) => void
- removeBlock: (id: string) => void
- updateBlock: (id: string, updates: Partial) => void
- clearBlocks: () => void
- // Context info management methods
- setMainEntryId: (entryId?: string) => void
- addReferEntryId: (entryId: string) => void
- removeReferEntryId: (entryId: string) => void
- addReferFeedId: (feedId: string) => void
- removeReferFeedId: (feedId: string) => void
- setSelectedText: (selectedText?: string) => void
- // Legacy compatibility
- setEntryId: (entryId?: string) => void
- setFeedId: (feedId?: string) => void
- reset: () => void
- // Sync methods
- syncBlocksToContext: () => void
- syncContextToBlocks: () => void
-}
-
-export const createAIChatContextStore = (initialState?: Partial) => {
- const defaultState: AIChatContextInfo = {
- mainEntryId: undefined,
- referEntryIds: [],
- referFeedIds: [],
- selectedText: undefined,
- }
-
- const defaultBlocks: AIChatContextBlock[] = []
-
- const state: AIChatContextInfo = {
- mainEntryId: initialState?.mainEntryId,
- referEntryIds: initialState?.referEntryIds || [],
- referFeedIds: initialState?.referFeedIds || [],
- selectedText: initialState?.selectedText,
- }
-
- return createWithEqualityFn((set, get) => ({
- state,
- blocks: defaultBlocks,
-
- // Block management methods
- addBlock: (block: Omit) => {
- // Check for uniqueness constraints
- const currentBlocks = get().blocks
-
- // Only allow one mainEntry
- if (block.type === "mainEntry" && currentBlocks.some((b) => b.type === "mainEntry")) {
- return
- }
-
- // Only allow one selectedText
- if (block.type === "selectedText" && currentBlocks.some((b) => b.type === "selectedText")) {
- return
- }
-
- // Prevent duplicate referEntry or referFeed
- if (
- block.type === "referEntry" &&
- block.value &&
- currentBlocks.some((b) => b.type === "referEntry" && b.value === block.value)
- ) {
- return
- }
-
- if (
- block.type === "referFeed" &&
- block.value &&
- currentBlocks.some((b) => b.type === "referFeed" && b.value === block.value)
- ) {
- return
- }
-
- set(
- produce((s) => {
- s.blocks.push({ ...block, id: nanoid(8) })
- }),
- )
-
- // Sync to context info
- get().syncBlocksToContext()
- },
-
- removeBlock: (id: string) => {
- set(
- produce((s: AiChatContextStore) => {
- s.blocks = s.blocks.filter((block) => block.id !== id)
- }),
- )
-
- // Sync to context info
- get().syncBlocksToContext()
- },
-
- updateBlock: (id: string, updates: Partial) => {
- set(
- produce((s: AiChatContextStore) => {
- s.blocks = s.blocks.map((block) => (block.id === id ? { ...block, ...updates } : block))
- }),
- )
-
- // Sync to context info
- get().syncBlocksToContext()
- },
-
- clearBlocks: () => {
- set(
- produce((s: AiChatContextStore) => {
- s.blocks = defaultBlocks
- }),
- )
- get().syncBlocksToContext()
- },
-
- // Context info management methods
- setMainEntryId: (entryId?: string) => {
- set((s) => ({ state: { ...s.state, mainEntryId: entryId } }))
- get().syncContextToBlocks()
- },
-
- addReferEntryId: (entryId: string) => {
- set((s) => ({
- state: {
- ...s.state,
- referEntryIds: [...(s.state.referEntryIds || []), entryId],
- },
- }))
- get().syncContextToBlocks()
- },
-
- removeReferEntryId: (entryId: string) => {
- set((s) => ({
- state: {
- ...s.state,
- referEntryIds: (s.state.referEntryIds || []).filter((id) => id !== entryId),
- },
- }))
- get().syncContextToBlocks()
- },
-
- addReferFeedId: (feedId: string) => {
- set((s) => ({
- state: {
- ...s.state,
- referFeedIds: [...(s.state.referFeedIds || []), feedId],
- },
- }))
- get().syncContextToBlocks()
- },
-
- removeReferFeedId: (feedId: string) => {
- set((s) => ({
- state: {
- ...s.state,
- referFeedIds: (s.state.referFeedIds || []).filter((id) => id !== feedId),
- },
- }))
- get().syncContextToBlocks()
- },
-
- setSelectedText: (selectedText?: string) => {
- set((s) => ({ state: { ...s.state, selectedText } }))
- get().syncContextToBlocks()
- },
-
- // Legacy compatibility
- setEntryId: (entryId?: string) => {
- get().setMainEntryId(entryId)
- },
-
- setFeedId: (feedId?: string) => {
- if (feedId) {
- get().addReferFeedId(feedId)
- }
- },
-
- reset: () => {
- set(() => ({ state: defaultState, blocks: defaultBlocks }))
- },
-
- // Sync methods
- syncBlocksToContext: () => {
- const contextInfo = blocksToContextInfo(get().blocks)
- set((s) => ({ state: { ...s.state, ...contextInfo } }))
- },
-
- syncContextToBlocks: () => {
- const blocks = contextInfoToBlocks(get().state)
- set(() => ({ blocks }))
- },
- }))
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/utils.ts b/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/utils.ts
deleted file mode 100644
index 3b4bb7e28..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/__internal__/utils.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-import type { AIChatContextBlock, AIChatContextInfo } from "./types"
-
-export const contextInfoToBlocks = (contextInfo: AIChatContextInfo): AIChatContextBlock[] => {
- const blocks: AIChatContextBlock[] = []
-
- // Main entry (single)
- if (contextInfo.mainEntryId) {
- blocks.push({
- id: `main-entry-${contextInfo.mainEntryId}`,
- type: "mainEntry",
- value: contextInfo.mainEntryId,
- })
- }
-
- // Reference entries (multiple)
- contextInfo.referEntryIds?.forEach((entryId) => {
- blocks.push({
- id: `refer-entry-${entryId}`,
- type: "referEntry",
- value: entryId,
- })
- })
-
- // Reference feeds (multiple)
- contextInfo.referFeedIds?.forEach((feedId) => {
- blocks.push({
- id: `refer-feed-${feedId}`,
- type: "referFeed",
- value: feedId,
- })
- })
-
- // Selected text (single, auto-detected)
- if (contextInfo.selectedText) {
- blocks.push({
- id: "selected-text",
- type: "selectedText",
- value: contextInfo.selectedText,
- })
- }
-
- return blocks
-}
-
-export const blocksToContextInfo = (blocks: AIChatContextBlock[]): AIChatContextInfo => {
- const contextInfo: AIChatContextInfo = {}
-
- blocks.forEach((block) => {
- switch (block.type) {
- case "mainEntry": {
- contextInfo.mainEntryId = block.value
- break
- }
- case "referEntry": {
- if (!contextInfo.referEntryIds) contextInfo.referEntryIds = []
- contextInfo.referEntryIds.push(block.value)
- break
- }
- case "referFeed": {
- if (!contextInfo.referFeedIds) contextInfo.referFeedIds = []
- contextInfo.referFeedIds.push(block.value)
- break
- }
- case "selectedText": {
- contextInfo.selectedText = block.value
- break
- }
- }
- })
-
- return contextInfo
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/atoms/session.ts b/apps/desktop/layer/renderer/src/modules/ai/chat/atoms/session.ts
deleted file mode 100644
index b7f3e9502..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/atoms/session.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { atom } from "jotai"
-import { useCallback } from "react"
-
-import { createAtomHooks } from "~/lib/jotai"
-
-// Session state atoms with hooks
-export const [, , useCurrentRoomId, useSetCurrentRoomId, , setCurrentRoomId] = createAtomHooks(
- atom(null),
-)
-
-export const [, , useCurrentTitle, useSetCurrentTitle, , setCurrentTitle] =
- createAtomHooks(atom())
-
-export const [, , useSessionPersisted, useSetSessionPersisted, , setSessionPersisted] =
- createAtomHooks(atom(false))
-
-// Edit state management for messages
-export const [, , useEditingMessageId, useSetEditingMessageId, , setEditingMessageId] =
- createAtomHooks(atom(null))
-
-// Combined hook for all session state
-export const useSessionState = () => {
- return {
- currentRoomId: useCurrentRoomId(),
- currentTitle: useCurrentTitle(),
- sessionPersisted: useSessionPersisted(),
- editingMessageId: useEditingMessageId(),
- }
-}
-
-// Hook for session state setters
-export const useSessionSetters = () => {
- const setCurrentRoomIdAtom = useSetCurrentRoomId()
- const setCurrentTitleAtom = useSetCurrentTitle()
- const setSessionPersistedAtom = useSetSessionPersisted()
-
- return useCallback(
- (updates: {
- currentRoomId?: string | null
- currentTitle?: string | undefined
- sessionPersisted?: boolean
- }) => {
- if (updates.currentRoomId !== undefined) setCurrentRoomIdAtom(updates.currentRoomId)
- if (updates.currentTitle !== undefined) setCurrentTitleAtom(updates.currentTitle)
- if (updates.sessionPersisted !== undefined) setSessionPersistedAtom(updates.sessionPersisted)
- },
- [setCurrentRoomIdAtom, setCurrentTitleAtom, setSessionPersistedAtom],
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatRoot.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatRoot.tsx
deleted file mode 100644
index ffbc0fc59..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/AIChatRoot.tsx
+++ /dev/null
@@ -1,247 +0,0 @@
-import { Chat, useChat } from "@ai-sdk/react"
-import { env } from "@follow/shared/env.desktop"
-import type { UIDataTypes, UIMessage } from "ai"
-import { DefaultChatTransport } from "ai"
-import type { FC, PropsWithChildren } from "react"
-import { useCallback, useMemo, useRef } from "react"
-import { toast } from "sonner"
-import { useEventCallback } from "usehooks-ts"
-
-import { Focusable } from "~/components/common/Focusable"
-import { HotkeyScope } from "~/constants"
-
-import type { AIChatSessionMethods, AIPanelRefs } from "../__internal__/AIChatContext"
-import {
- AIChatContext,
- AIChatContextStoreContext,
- AIChatSessionMethodsContext,
- AIPanelRefsContext,
-} from "../__internal__/AIChatContext"
-import { createAIChatContextStore } from "../__internal__/store"
-import type { BizUIMetadata, BizUITools } from "../__internal__/types"
-import {
- useCurrentRoomId,
- useSessionPersisted,
- useSetCurrentRoomId,
- useSetCurrentTitle,
- useSetSessionPersisted,
-} from "../atoms/session"
-import { useChatHistory } from "../hooks/useChatHistory"
-import { AIPersistService } from "../services"
-import { generateChatTitle } from "../utils/titleGeneration"
-
-interface AIChatRootProps extends PropsWithChildren {
- wrapFocusable?: boolean
- roomId?: string
-}
-
-export const AIChatRoot: FC = ({
- children,
- wrapFocusable = true,
- roomId: externalRoomId,
-}) => {
- const currentRoomId = useCurrentRoomId()
- const sessionPersisted = useSessionPersisted()
- const setCurrentRoomId = useSetCurrentRoomId()
- const setCurrentTitle = useSetCurrentTitle()
- const setSessionPersisted = useSetSessionPersisted()
-
- const { createNewSession } = useChatHistory()
- const useAiContextStore = useMemo(createAIChatContextStore, [])
-
- // Initialize room ID on mount
- useMemo(() => {
- if (!currentRoomId && !externalRoomId) {
- const newRoomId = createNewSession(false)
- setCurrentRoomId(newRoomId)
- } else if (externalRoomId && externalRoomId !== currentRoomId) {
- setCurrentRoomId(externalRoomId)
- }
- }, [currentRoomId, externalRoomId, createNewSession, setCurrentRoomId])
-
- const handleTitleGenerated = useCallback(
- async (title: string) => {
- if (currentRoomId) {
- try {
- await AIPersistService.updateSessionTitle(currentRoomId, title)
- setCurrentTitle(title)
- } catch (error) {
- console.error("Failed to update session title:", error)
- }
- }
- },
- [currentRoomId, setCurrentTitle],
- )
-
- const handleFirstMessage = useCallback(async () => {
- if (!sessionPersisted && currentRoomId) {
- try {
- await AIPersistService.createSession(currentRoomId, "New Chat")
- setSessionPersisted(true)
- } catch (error) {
- console.error("Failed to persist session:", error)
- }
- }
- }, [sessionPersisted, currentRoomId, setSessionPersisted])
-
- // Handle AI response completion - this is where we generate title
- const handleChatFinish = useEventCallback(
- async (options: { message: UIMessage }) => {
- const { message } = options
-
- // Only trigger title generation for assistant messages (AI responses)
- if (message.role !== "assistant") return
-
- // Get current messages to check if this is the first AI response
-
- const allMessages = chatInstance.messages
-
- // Check if we have exactly 2 messages (1 user + 1 assistant = first exchange)
- // Or if we have 2+ messages and this is the first assistant message
- const assistantMessages = allMessages.filter((m) => m.role === "assistant")
- const isFirstAIResponse = assistantMessages.length === 1
-
- if (isFirstAIResponse && allMessages.length >= 2) {
- try {
- // Generate title using the first user message and first AI response
- const firstExchange = allMessages.slice(0, 2)
-
- const title = await generateChatTitle(firstExchange)
-
- if (title) {
- await handleTitleGenerated(title)
- }
- } catch (error) {
- console.error("Failed to generate chat title:", error)
- }
- }
- },
- )
- const chatInstance = useMemo(() => {
- return new Chat>({
- // FIXME: this id can't modify after init, so used a fixed id
- id: "ai-room",
- transport: new DefaultChatTransport({
- api: `${env.VITE_API_URL}/ai/chat`,
- credentials: "include",
- fetch: (url: string | Request | URL, options?: RequestInit) => {
- if (!options?.body) return fetch(url, options)
- try {
- const state = useAiContextStore.getState()
- state.syncBlocksToContext()
-
- options.body = JSON.stringify({
- ...JSON.parse(options.body as string),
- context: state.state,
- blocks: state.blocks,
- })
- } catch (error) {
- console.error(error)
- }
-
- return fetch(url, options)
- },
- }),
- onError: (error) => {
- console.error(error)
- },
- onFinish: handleChatFinish,
- })
- }, [useAiContextStore, handleChatFinish])
-
- const ctx = useChat>({
- chat: chatInstance,
- })
-
- const handleNewChat = useCallback(() => {
- // Create a new session without persistence initially
- const newRoomId = createNewSession(false)
- setCurrentRoomId(newRoomId)
- setSessionPersisted(false)
- setCurrentTitle(undefined)
- // Clear messages
- ctx.setMessages([])
- }, [createNewSession, ctx, setCurrentRoomId, setSessionPersisted, setCurrentTitle])
-
- const handleSwitchRoom = useCallback(
- async (roomId: string) => {
- try {
- // First check if we need to save current messages
- if (sessionPersisted && currentRoomId && ctx.messages.length > 0) {
- // Messages are automatically saved by useSaveMessages hook
- }
-
- // Clear current messages before switching
- ctx.setMessages([])
-
- // Switch to new room
- setCurrentRoomId(roomId)
-
- // Load session info
- const sessionData = await AIPersistService.getChatSessions()
- const session = sessionData.find((s) => s.roomId === roomId)
-
- if (session) {
- setCurrentTitle(session.title || "New Chat")
- setSessionPersisted(true)
- } else {
- setCurrentTitle(undefined)
- setSessionPersisted(false)
- }
-
- // Messages will be loaded automatically by useLoadMessages in ChatInterface
- } catch (error) {
- console.error("Failed to switch room:", error)
- toast.error("Failed to switch chat session")
- }
- },
- [sessionPersisted, currentRoomId, ctx, setCurrentRoomId, setCurrentTitle, setSessionPersisted],
- )
-
- const panelRef = useRef(null!)
- const inputRef = useRef(null!)
- const refsContext = useMemo(() => ({ panelRef, inputRef }), [panelRef, inputRef])
-
- // Provide session methods through context
- const sessionMethods = useMemo(
- () => ({
- handleTitleGenerated,
- handleFirstMessage,
- handleNewChat,
- handleSwitchRoom,
- }),
- [handleTitleGenerated, handleFirstMessage, handleNewChat, handleSwitchRoom],
- )
-
- if (!currentRoomId || !ctx) {
- return (
-
-
-
- Initializing chat...
-
-
- )
- }
-
- const Element = (
-
-
-
-
- {children}
-
-
-
-
- )
-
- if (wrapFocusable) {
- return (
-
- {Element}
-
- )
- }
- return Element
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/ChatInput.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/ChatInput.tsx
deleted file mode 100644
index 1f6eb7dce..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/ChatInput.tsx
+++ /dev/null
@@ -1,112 +0,0 @@
-import { useInputComposition } from "@follow/hooks"
-import { cn, stopPropagation } from "@follow/utils"
-import type { VariantProps } from "class-variance-authority"
-import { cva } from "class-variance-authority"
-import { memo, use, useCallback, useState } from "react"
-
-import { AIChatContext, AIPanelRefsContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-import { AIChatContextBar } from "~/modules/ai/chat/components/AIChatContextBar"
-import { AIChatSendButton } from "~/modules/ai/chat/components/AIChatSendButton"
-
-import { CollapsibleError } from "./CollapsibleError"
-
-const chatInputVariants = cva(
- [
- "bg-background/60 focus-within:ring-accent/20 focus-within:border-accent/80 border-border/80",
- "relative overflow-hidden rounded-2xl border backdrop-blur-xl duration-200 focus-within:ring-2",
- ],
- {
- variants: {
- variant: {
- default: "shadow-2xl shadow-black/5 dark:shadow-zinc-800",
- minimal: "shadow shadow-zinc-100 dark:shadow-black/5",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- },
-)
-
-interface ChatInputProps extends VariantProps {
- onSend: (message: string) => void
-}
-
-export const ChatInput = memo(({ onSend, variant }: ChatInputProps) => {
- const { inputRef } = use(AIPanelRefsContext)
- const { status, stop, error } = use(AIChatContext)
- const [isEmpty, setIsEmpty] = useState(true)
-
- const isProcessing = status === "submitted" || status === "streaming"
-
- const handleSend = useCallback(() => {
- if (inputRef.current && inputRef.current.value.trim()) {
- const message = inputRef.current.value.trim()
- onSend(message)
- inputRef.current.value = ""
- setIsEmpty(true)
- }
- }, [onSend, inputRef])
- const handleKeyPress = useCallback(
- (e: React.KeyboardEvent) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault()
- if (isProcessing) {
- stop?.()
- } else {
- handleSend()
- }
- }
- },
- [handleSend, isProcessing, stop],
- )
- const inputProps = useInputComposition({
- onKeyDown: handleKeyPress,
- })
-
- const handleChange = useCallback((e: React.ChangeEvent) => {
- setIsEmpty(e.target.value.trim() === "")
- }, [])
-
- return (
-
- {/* Error Display */}
- {error &&
}
-
- {/* Integrated Input Container with Context Bar */}
-
- {/* Input Area */}
-
-
- {/* Context Bar - Always shown, positioned below the input area */}
-
-
-
- )
-})
-
-ChatInput.displayName = "ChatInput"
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/CollapsibleError.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/CollapsibleError.tsx
deleted file mode 100644
index 732ab8ae7..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/CollapsibleError.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-import { Spring } from "@follow/components/constants/spring.js"
-import { cn } from "@follow/utils"
-import { m } from "motion/react"
-import * as React from "react"
-
-interface CollapsibleErrorProps {
- error: Error | string
- title?: string
- className?: string
- collapsedHeight?: string
- icon?: string
-}
-
-export const CollapsibleError: React.FC = ({
- error,
- title = "Error occurred",
- className,
- collapsedHeight = "48px",
- icon = "i-mgc-alert-cute-fi",
-}) => {
- const [isExpanded, setIsExpanded] = React.useState(false)
-
- const errorMessage = typeof error === "string" ? error : error.message
-
- return (
- setIsExpanded(true)}
- onMouseLeave={() => setIsExpanded(false)}
- >
-
-
- {/* Glass effect overlay */}
-
-
- {/* Collapsed Content */}
-
-
-
-
-
-
- hover to expand
-
-
-
- {/* Expanded Content */}
-
-
-
-
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/ToolInvocationComponent.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/ToolInvocationComponent.tsx
deleted file mode 100644
index fd2e322d3..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/ToolInvocationComponent.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
-} from "@follow/components/ui/accordion/index.js"
-import type { ToolUIPart } from "ai"
-import { getToolName } from "ai"
-import * as React from "react"
-
-interface ToolInvocationComponentProps {
- part: ToolUIPart
-}
-
-export const ToolInvocationComponent: React.FC = ({ part }) => {
- const toolName = getToolName(part)
- return (
-
-
-
-
-
- {/* Tool Info */}
-
-
-
- Tool Calling:
-
{toolName}
-
-
-
-
-
-
- {"input" in part && (
-
-
- Arguments
-
-
- {JSON.stringify(part.input, null, 2)}
-
-
- )}
-
- {"output" in part && (
-
-
- Result
-
-
- {JSON.stringify(part.output, null, 2)}
-
-
- )}
-
-
-
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/AIDisplayFeedsPart.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/AIDisplayFeedsPart.tsx
deleted file mode 100644
index f0bdc76fe..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/AIDisplayFeedsPart.tsx
+++ /dev/null
@@ -1,173 +0,0 @@
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@follow/components/ui/card/index.js"
-import dayjs from "dayjs"
-
-import { FeedIcon } from "~/modules/feed/feed-icon"
-
-import type { AIDisplayFeedsTool } from "../../__internal__/types"
-import { ErrorState, LoadingState } from "../common-states"
-import { AnalyticsMetrics, EmptyState, GridContainer, StatCard } from "./shared"
-
-type FeedData = AIDisplayFeedsTool["output"]["feeds"]
-
-const FeedsGrid = ({ data, showAnalytics }: { data: FeedData; showAnalytics: boolean }) => {
- if (!data?.length) {
- return
- }
-
- return (
-
- {data.map((item) => (
-
-
-
-
-
-
- {item.feed.title || "Unknown Feed"}
-
- {item.feed.description && (
-
- {item.feed.description}
-
- )}
-
-
-
-
-
- {item.feed.errorMessage && (
-
- Error: {item.feed.errorMessage}
-
- )}
-
-
- Last checked: {dayjs(item.feed.checkedAt).format("MMM DD, YYYY HH:mm")}
-
-
- {item.feed.language && (
- Language: {item.feed.language}
- )}
-
- {showAnalytics && item.analytics && (
-
- )}
-
-
- ))}
-
- )
-}
-
-export const AIDisplayFeedsPart = ({ part }: { part: AIDisplayFeedsTool }) => {
- // Handle loading state
- if (part.state === "input-streaming" || part.state === "input-available") {
- return (
-
- )
- }
-
- // Handle error state
- if (part.state === "output-error") {
- return (
-
- )
- }
-
- // Handle no output or invalid state
- if (part.state !== "output-available" || !part.output) {
- return (
-
- )
- }
-
- // Extract output with proper typing
- const output = part.output as NonNullable
-
- const { feeds, displayType = "list", showAnalytics = true, title } = output
-
- // Calculate statistics
- const totalFeeds = feeds.length
- const activeFeeds = feeds.filter((f) => !f.feed.errorMessage).length
- const errorFeeds = feeds.filter((f) => f.feed.errorMessage).length
- const totalSubscriptions = feeds.reduce(
- (acc, f) => acc + (f.analytics?.subscriptionCount || 0),
- 0,
- )
- const totalViews = feeds.reduce((acc, f) => acc + (f.analytics?.view || 0), 0)
-
- const renderFeeds = () => {
- switch (displayType) {
- default: {
- return
- }
- }
- }
-
- return (
-
-
-
-
- ๐ก
- {title || "RSS Feeds"}
-
- {totalFeeds} feeds
-
-
- {/* Statistics Overview */}
-
-
-
- {showAnalytics && (
- <>
-
-
- >
- )}
-
-
- {/* Feeds Display */}
- {renderFeeds()}
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/ChartPlaceholder.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/ChartPlaceholder.tsx
deleted file mode 100644
index 6c51e5b58..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/ChartPlaceholder.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { Card, CardContent, CardHeader, CardTitle } from "@follow/components/ui/card/index.js"
-import { cn } from "@follow/utils/utils"
-
-export interface ChartPlaceholderProps {
- title: string
- data: any[]
- height?: string
- className?: string
-}
-
-export const ChartPlaceholder = ({
- title,
- data,
- height = "h-32",
- className,
-}: ChartPlaceholderProps) => (
-
-
- {title}
-
-
-
- Chart visualization ({data.length} data points)
-
-
-
-)
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/GridContainer.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/GridContainer.tsx
deleted file mode 100644
index 493ef2094..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/GridContainer.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { cn } from "@follow/utils/utils"
-import type { ReactNode } from "react"
-
-export interface GridContainerProps {
- columns?: {
- base: number
- md: number
- lg?: number
- }
- gap?: number
- children: ReactNode
- className?: string
-}
-
-export const GridContainer = ({
- columns = { base: 1, md: 2 },
- gap = 4,
- children,
- className,
-}: GridContainerProps) => (
-
- {children}
-
-)
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/StatisticsOverview.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/StatisticsOverview.tsx
deleted file mode 100644
index c93cf151e..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/displays/shared/StatisticsOverview.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { cn } from "@follow/utils/utils"
-
-import type { StatCardProps } from "./StatCard"
-import { StatCard } from "./StatCard"
-
-export interface StatisticsOverviewProps {
- stats: StatCardProps[]
- columns?: {
- base: number
- md: number
- lg?: number
- }
- className?: string
-}
-
-export const StatisticsOverview = ({
- stats,
- columns = { base: 2, md: 4 },
- className,
-}: StatisticsOverviewProps) => (
-
- {stats.map((stat, index) => (
-
- ))}
-
-)
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIMarkdownMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIMarkdownMessage.tsx
deleted file mode 100644
index ea780107e..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIMarkdownMessage.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-import type { LinkProps } from "@follow/components/ui/link/LinkWithTooltip.js"
-import { parseMarkdown } from "@follow/components/utils/parse-markdown.js"
-import { cn, isBizId } from "@follow/utils"
-import { createElement, isValidElement, memo, useMemo } from "react"
-
-import { ShikiHighLighter } from "~/components/ui/code-highlighter"
-import { MermaidDiagram } from "~/components/ui/diagrams"
-import { MarkdownLink } from "~/components/ui/markdown/renderers/MarkdownLink"
-import { usePeekModal } from "~/hooks/biz/usePeekModal"
-
-export const AIMarkdownMessage = memo(
- ({
- text,
- className: classNameProp,
- isProcessing,
- }: {
- text: string
- className?: string
- isProcessing?: boolean
- }) => {
- const className = tw`prose dark:prose-invert text-sm
- prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg prose-h4:text-base prose-h5:text-base prose-h6:text-sm
- prose-li:list-disc prose-li:marker:text-accent prose-hr:border-border prose-hr:mx-8
-`
-
- return (
-
- {useMemo(
- () =>
- parseMarkdown(text, {
- components: {
- pre: ({ children }) => {
- // props
- const props = isValidElement(children) && "props" in children && children.props
-
- if (props) {
- const { className, children } = props as any
-
- if (
- className &&
- className.includes("language-") &&
- typeof children === "string"
- ) {
- const language = className.replace("language-", "")
- const code = children
-
- // Render Mermaid diagrams
- if (language === "mermaid") {
- return
- }
-
- return
- }
- }
-
- return
{children}
- },
- a: ({ node, ...props }) => {
- return createElement(RelatedEntryLink, { ...props } as any)
- },
- },
- }).content,
- [isProcessing, text],
- )}
-
- )
- },
-)
-
-const RelatedEntryLink = (props: LinkProps) => {
- const { href, children } = props
- const entryId = isBizId(href) ? href : null
-
- const peekModal = usePeekModal()
- if (!entryId) {
- return
- }
- return (
- {
- peekModal(entryId, "modal")
- }}
- >
- {children}
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIMessageParts.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIMessageParts.tsx
deleted file mode 100644
index a7888a8fd..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/AIMessageParts.tsx
+++ /dev/null
@@ -1,132 +0,0 @@
-import type { ToolUIPart } from "ai"
-import { m } from "motion/react"
-import * as React from "react"
-
-import type {
- AIDisplayAnalyticsTool,
- AIDisplayEntriesTool,
- AIDisplayFeedsTool,
- AIDisplaySubscriptionsTool,
- BizUIMessage,
-} from "~/modules/ai/chat/__internal__/types"
-
-import {
- AIDisplayAnalyticsPart,
- AIDisplayEntriesPart,
- AIDisplayFeedsPart,
- AIDisplaySubscriptionsPart,
-} from "../displays"
-import { ToolInvocationComponent } from "../ToolInvocationComponent"
-import { AIMarkdownMessage } from "./AIMarkdownMessage"
-
-interface MessagePartsProps {
- message: BizUIMessage
-}
-const ThinkingIndicator: React.FC = () => {
- const text = "Thinking..."
- const [displayedText, setDisplayedText] = React.useState("")
- const [currentIndex, setCurrentIndex] = React.useState(0)
-
- React.useEffect(() => {
- if (currentIndex < text.length) {
- const timer = setTimeout(() => {
- setDisplayedText(text.slice(0, currentIndex + 1))
- setCurrentIndex(currentIndex + 1)
- }, 100)
-
- return () => clearTimeout(timer)
- }
- }, [currentIndex, text])
-
- return (
-
-
- {displayedText}
-
- |
-
-
-
- )
-}
-export const AIMessageParts: React.FC = React.memo(({ message }) => {
- if (!message.parts || message.parts.length === 0) {
- // In AI SDK v5, messages should always have parts
- if (message.role === "assistant") {
- return
- }
- return null
- }
- const isUser = message.role === "user"
-
- return (
- <>
- {message.parts.map((part, index) => {
- const partKey = `${message.id}-part-${index}`
-
- switch (part.type) {
- case "text": {
- return (
-
- )
- }
-
- case "tool-displayAnalytics": {
- return
- }
- case "tool-displayEntries": {
- return
- }
- case "tool-displaySubscriptions": {
- return (
-
- )
- }
- case "tool-displayFeeds": {
- return
- }
-
- // case "reasoning": {
- // return (
- //
- //
- //
- // Show reasoning
- //
- //
- // {parseMarkdown(part.reasoning).content}
- //
- //
- // )
- // }
-
- default: {
- if (part.type.startsWith("tool-")) {
- return
- }
- return null
- }
- }
- })}
- >
- )
-})
-
-AIMessageParts.displayName = "AIMessageParts"
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/EditableMessage.tsx b/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/EditableMessage.tsx
deleted file mode 100644
index 0c3ed4be7..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/components/message/EditableMessage.tsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import { useInputComposition } from "@follow/hooks"
-import { cn } from "@follow/utils"
-import { use, useCallback, useEffect, useRef, useState } from "react"
-
-import { AIChatContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-import { useEditingMessageId, useSetEditingMessageId } from "~/modules/ai/chat/atoms/session"
-
-interface EditableMessageProps {
- messageId: string
- initialContent: string
- onSave: (content: string) => void
- onCancel: () => void
- className?: string
-}
-
-export const EditableMessage = ({
- messageId,
- initialContent,
- onSave,
- onCancel,
- className,
-}: EditableMessageProps) => {
- const { status } = use(AIChatContext)
- const editingMessageId = useEditingMessageId()
- const setEditingMessageId = useSetEditingMessageId()
- const [content, setContent] = useState(initialContent)
- const [isEmpty, setIsEmpty] = useState(false)
- const textareaRef = useRef(null)
-
- const isEditing = editingMessageId === messageId
- const isProcessing = status === "submitted" || status === "streaming"
-
- // Auto-resize textarea and maintain minimum height to prevent CLS
- useEffect(() => {
- if (textareaRef.current && isEditing) {
- const textarea = textareaRef.current
- textarea.style.height = "auto"
- const newHeight = Math.max(56, textarea.scrollHeight) // Minimum height of 56px
- textarea.style.height = `${newHeight}px`
- }
- }, [content, isEditing])
-
- // Focus on edit start
- useEffect(() => {
- if (isEditing && textareaRef.current) {
- textareaRef.current.focus()
- textareaRef.current.setSelectionRange(
- textareaRef.current.value.length,
- textareaRef.current.value.length,
- )
- }
- }, [isEditing])
-
- const handleSave = useCallback(() => {
- if (content.trim() && content.trim() !== initialContent) {
- onSave(content.trim())
- }
- setEditingMessageId(null)
- }, [content, initialContent, onSave, setEditingMessageId])
-
- const handleCancel = useCallback(() => {
- setContent(initialContent)
- setEditingMessageId(null)
- onCancel()
- }, [initialContent, onCancel, setEditingMessageId])
-
- const handleKeyPress = useCallback(
- (e: React.KeyboardEvent) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault()
- if (!isProcessing) {
- handleSave()
- }
- } else if (e.key === "Escape") {
- e.preventDefault()
- handleCancel()
- }
- },
- [handleSave, handleCancel, isProcessing],
- )
-
- const handleChange = useCallback((e: React.ChangeEvent) => {
- const newContent = e.target.value
- setContent(newContent)
- setIsEmpty(newContent.trim() === "")
- }, [])
-
- const inputProps = useInputComposition({
- onKeyDown: handleKeyPress,
- })
-
- if (!isEditing) {
- return null
- }
-
- return (
-
- {/* Edit input */}
-
-
-
- {/* Action buttons */}
-
-
-
-
-
-
-
-
-
-
- {/* Helper text */}
-
- Press Enter to save,{" "}
- Esc to cancel
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/services/index.ts b/apps/desktop/layer/renderer/src/modules/ai/chat/services/index.ts
deleted file mode 100644
index 0b3f4ebfe..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/services/index.ts
+++ /dev/null
@@ -1,104 +0,0 @@
-import { db } from "@follow/database/db"
-import { aiChatMessagesTable, aiChatTable } from "@follow/database/schemas/index"
-import { asc, eq, inArray, sql } from "drizzle-orm"
-
-import type { BizUIMessage } from "../__internal__/types"
-
-class AIPersistServiceStatic {
- async loadMessages(roomId: string) {
- return db.query.aiChatMessagesTable.findMany({
- where: eq(aiChatMessagesTable.roomId, roomId),
- orderBy: [asc(aiChatMessagesTable.createdAt)],
- })
- }
-
- async insertMessages(roomId: string, messages: BizUIMessage[]) {
- if (messages.length === 0) {
- return
- }
-
- await db.insert(aiChatMessagesTable).values(
- messages.map((message) => ({
- roomId,
- id: message.id,
- message,
- createdAt: message.metadata?.finishTime ? new Date(message.metadata.finishTime) : undefined,
- })),
- )
- }
-
- async replaceAllMessages(roomId: string, messages: BizUIMessage[]) {
- await db.delete(aiChatMessagesTable).where(eq(aiChatMessagesTable.roomId, roomId))
- await this.insertMessages(roomId, messages)
- }
-
- async createSession(roomId: string, title?: string) {
- await db.insert(aiChatTable).values({
- roomId,
- title,
- createdAt: new Date(),
- })
- }
-
- async getChatSessions(limit = 20) {
- const chats = await db.query.aiChatTable.findMany({
- columns: {
- roomId: true,
- title: true,
- createdAt: true,
- },
- orderBy: (t, { desc }) => desc(t.createdAt),
- limit,
- })
-
- const result = await Promise.all(
- chats.map(async (chat) => {
- // Use raw SQL count query
- const messageCountResult = await db.values<[number]>(
- sql`SELECT COUNT(*) FROM ${aiChatMessagesTable} WHERE ${aiChatMessagesTable.roomId} = ${chat.roomId}`,
- )
-
- const messageCount = messageCountResult[0]?.[0] || 0
-
- return {
- roomId: chat.roomId,
- title: chat.title,
- createdAt: chat.createdAt,
- messageCount,
- }
- }),
- )
-
- // Filter out chats with 0 messages
- return result.filter((chat) => chat.messageCount > 0)
- }
-
- async deleteSession(roomId: string) {
- await db.delete(aiChatMessagesTable).where(eq(aiChatMessagesTable.roomId, roomId))
- await db.delete(aiChatTable).where(eq(aiChatTable.roomId, roomId))
- }
-
- async updateSessionTitle(roomId: string, title: string) {
- await db.update(aiChatTable).set({ title }).where(eq(aiChatTable.roomId, roomId))
- }
-
- async cleanupEmptySessions() {
- // Use raw SQL to find empty sessions
- const emptySessions = await db.values<[string]>(
- sql`
- SELECT ${aiChatTable.roomId}
- FROM ${aiChatTable}
- LEFT JOIN ${aiChatMessagesTable} ON ${aiChatTable.roomId} = ${aiChatMessagesTable.roomId}
- GROUP BY ${aiChatTable.roomId}
- HAVING COUNT(${aiChatMessagesTable.id}) = 0
- `,
- )
-
- // Delete empty sessions
- if (emptySessions.length > 0) {
- const roomIdsToDelete = emptySessions.map((row) => row[0])
- await db.delete(aiChatTable).where(inArray(aiChatTable.roomId, roomIdsToDelete))
- }
- }
-}
-export const AIPersistService = new AIPersistServiceStatic()
diff --git a/apps/desktop/layer/renderer/src/modules/ai/chat/types/ChatSession.ts b/apps/desktop/layer/renderer/src/modules/ai/chat/types/ChatSession.ts
deleted file mode 100644
index ae9c009bf..000000000
--- a/apps/desktop/layer/renderer/src/modules/ai/chat/types/ChatSession.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export interface ChatSession {
- roomId: string
- title?: string
- createdAt: Date
- messageCount: number
-}
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx
index 944d9eb75..d1cbf1dca 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app-layout/ai/AIChatLayout.tsx
@@ -1,21 +1,21 @@
+import type { FC } from "react"
+
import { Focusable } from "~/components/common/Focusable"
import { HotkeyScope } from "~/constants"
-import { AIChatRoot } from "~/modules/ai/chat/components/AIChatRoot"
+import { ChatHeader } from "~/modules/ai-chat/components/layouts/ChatHeader"
+import { ChatInterface } from "~/modules/ai-chat/components/layouts/ChatInterface"
-import { ChatHeader } from "./components/ChatHeader"
-import { ChatInterface } from "./components/ChatInterface"
-
-export const AIChatLayout = ({ style }: { style?: React.CSSProperties }) => {
+export const AIChatLayout: FC<
+ React.DetailedHTMLProps, HTMLDivElement>
+> = ({ ...props }) => {
return (
-
-
-
-
-
-
+
+
+
+
)
}
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatInterface.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatInterface.tsx
deleted file mode 100644
index e801cba75..000000000
--- a/apps/desktop/layer/renderer/src/modules/app-layout/ai/components/ChatInterface.tsx
+++ /dev/null
@@ -1,169 +0,0 @@
-import { ScrollArea } from "@follow/components/ui/scroll-area/ScrollArea.js"
-import { cn, nextFrame } from "@follow/utils"
-import { springScrollTo } from "@follow/utils/scroller"
-import { use, useCallback, useEffect, useRef, useState } from "react"
-import { useEventCallback } from "usehooks-ts"
-
-import {
- AIChatContext,
- useAIChatSessionMethods,
-} from "~/modules/ai/chat/__internal__/AIChatContext"
-import { useCurrentRoomId } from "~/modules/ai/chat/atoms/session"
-import { ChatInput } from "~/modules/ai/chat/components/ChatInput"
-import {
- AIChatMessage,
- AIChatTypingIndicator,
-} from "~/modules/ai/chat/components/message/AIChatMessage"
-import { WelcomeScreen } from "~/modules/ai/chat/components/WelcomeScreen"
-import { useAutoScroll } from "~/modules/ai/chat/hooks/useAutoScroll"
-import { useLoadMessages } from "~/modules/ai/chat/hooks/useLoadMessages"
-import { useSaveMessages } from "~/modules/ai/chat/hooks/useSaveMessages"
-
-const SCROLL_BOTTOM_THRESHOLD = 50
-
-export const ChatInterface = () => {
- const { messages, status, sendMessage, error } = use(AIChatContext)
-
- const currentRoomId = useCurrentRoomId()
-
- const { handleFirstMessage } = useAIChatSessionMethods()
- const scrollAreaRef = useRef(null)
- const [hasHandledFirstMessage, setHasHandledFirstMessage] = useState(false)
- const [isAtBottom, setIsAtBottom] = useState(true)
-
- // Reset handlers when roomId changes
- useEffect(() => {
- setHasHandledFirstMessage(false)
- setIsAtBottom(true)
- }, [currentRoomId])
-
- const { isLoading: isLoadingHistory } = useLoadMessages(currentRoomId || "", {
- onLoad: () => {
- nextFrame(() => {
- const $scrollArea = scrollAreaRef.current
- const scrollHeight = $scrollArea?.scrollHeight
-
- if (scrollHeight) {
- $scrollArea?.scrollTo({
- top: scrollHeight,
- })
- }
- setIsAtBottom(true)
- })
- },
- })
- useSaveMessages(currentRoomId || "", { enabled: !isLoadingHistory })
-
- const { resetScrollState } = useAutoScroll(scrollAreaRef.current, status === "streaming")
-
- useEffect(() => {
- const scrollElement = scrollAreaRef.current
- if (!scrollElement) return
-
- const handleScroll = () => {
- const { scrollTop, scrollHeight, clientHeight } = scrollElement
- const distanceFromBottom = scrollHeight - scrollTop - clientHeight
- const atBottom = distanceFromBottom <= SCROLL_BOTTOM_THRESHOLD
- setIsAtBottom(atBottom)
- }
-
- scrollElement.addEventListener("scroll", handleScroll, { passive: true })
-
- handleScroll()
-
- return () => {
- scrollElement.removeEventListener("scroll", handleScroll)
- }
- }, [])
-
- const scrollToBottom = useCallback(() => {
- const scrollElement = scrollAreaRef.current
- if (!scrollElement) return
-
- springScrollTo(scrollElement.scrollHeight, scrollElement)
- }, [])
-
- const handleSendMessage = useEventCallback((message: string) => {
- resetScrollState()
-
- // Handle first message persistence
- if (messages.length === 0 && !hasHandledFirstMessage) {
- handleFirstMessage()
- setHasHandledFirstMessage(true)
- }
-
- sendMessage({
- text: message,
- metadata: {
- finishTime: new Date().toISOString(),
- },
- })
- })
-
- useEffect(() => {
- if (status === "submitted") {
- resetScrollState()
- }
- }, [status, resetScrollState])
-
- const hasMessages = messages.length > 0
-
- const shouldShowScrollToBottom = hasMessages && !isAtBottom && !isLoadingHistory
-
- return (
-
-
- {!hasMessages && !isLoadingHistory ? (
-
- ) : (
-
- {isLoadingHistory ? (
-
-
-
- ) : (
-
- {messages.map((message) => (
-
- ))}
- {status === "submitted" &&
}
-
- )}
-
- )}
-
-
- {shouldShowScrollToBottom && (
-
-
-
- {/* Glass effect overlay */}
-
-
- {/* Content */}
-
-
-
- Scroll to Bottom
-
-
-
-
- )}
-
- {hasMessages && (
-
-
-
- )}
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholder.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholder.tsx
index e50254b94..02987c65b 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholder.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholder.tsx
@@ -8,10 +8,10 @@ import * as React from "react"
import { GlassButton } from "~/components/ui/button/GlassButton"
import { ROUTE_FEED_PENDING } from "~/constants"
import { useRouteParams } from "~/hooks/biz/useRouteParams"
-import { DayOf } from "~/modules/ai/ai-daily/constants"
-import { DailyItem } from "~/modules/ai/ai-daily/daily"
-import { EntryPlaceholderDaily } from "~/modules/ai/ai-daily/EntryPlaceholderDaily"
-import type { DailyView } from "~/modules/ai/ai-daily/types"
+import { DayOf } from "~/modules/ai-daily/constants"
+import { DailyItem } from "~/modules/ai-daily/daily"
+import { EntryPlaceholderDaily } from "~/modules/ai-daily/EntryPlaceholderDaily"
+import type { DailyView } from "~/modules/ai-daily/types"
import { EntryPlaceholderLogo } from "~/modules/entry-content/components/EntryPlaceholderLogo"
import type { EntryContentPlaceholderContextValue } from "./EntryContentPlaceholderContext"
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholderContext.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholderContext.tsx
index 3b1bd6dac..7934d7561 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholderContext.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryContentPlaceholderContext.tsx
@@ -1,7 +1,7 @@
import type { PrimitiveAtom } from "jotai"
import { createContext } from "react"
-import type { DayOf } from "~/modules/ai/ai-daily/constants"
+import type { DayOf } from "~/modules/ai-daily/constants"
export const EntryContentPlaceholderContext = createContext(
null!,
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryLayoutContent.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryLayoutContent.tsx
index bd1d2c4a9..624197fe2 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryLayoutContent.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app-layout/entry-content/EntryLayoutContent.tsx
@@ -3,11 +3,11 @@ import { views } from "@follow/constants"
import { clsx, cn } from "@follow/utils/utils"
import { easeOut } from "motion/react"
import type { FC, PropsWithChildren } from "react"
-import { useMemo, useRef } from "react"
+import { useMemo } from "react"
import { useResizable } from "react-resizable-layout"
import { useParams } from "react-router"
-import { setAIChatPinned, useAIChatPinned } from "~/atoms/settings/ai"
+import { useAIChatPinned } from "~/atoms/settings/ai"
import { useRealInWideMode } from "~/atoms/settings/ui"
import { useTimelineColumnShow, useTimelineColumnTempShow } from "~/atoms/sidebar"
import { m } from "~/components/common/Motion"
@@ -16,12 +16,9 @@ import { ROUTE_ENTRY_PENDING } from "~/constants"
import { useFeature } from "~/hooks/biz/useFeature"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
import { useRouteParams } from "~/hooks/biz/useRouteParams"
-import { AIChatRoot } from "~/modules/ai/chat/components/AIChatRoot"
import { EntryContent } from "~/modules/entry-content/components/entry-content"
-import { AIChatPanelContainer } from "~/modules/entry-content/components/entry-content/ai"
import { AppLayoutGridContainerProvider } from "~/providers/app-grid-layout-container-provider"
-import { AIChatLayout } from "../ai/AIChatLayout"
import { EntryContentPlaceholder } from "./EntryContentPlaceholder"
const EntryLayoutContentLegacy = () => {
@@ -86,11 +83,7 @@ export const EntryLayoutContentWithAI = () => {
onClick={() => navigate({ entryId: null })}
/>
)}
- {realEntryId && !isWideView ? (
-
- ) : (
- !isWideView &&
- )}
+ {realEntryId && !isWideView ? : null}
)
@@ -119,50 +112,42 @@ const Grid = ({ entryId }) => {
initial: 400,
reverse: true,
})
- const handleAIChatPanelClose = useRef(() => setAIChatPinned(false)).current
return (
-
-
-
-
{
- return {
- header: shouldHeaderPaddingLeft
- ? "ml-[calc(theme(width.feed-col)+theme(width.8))]"
- : wideMode
- ? "ml-12"
- : "",
- }
- }, [shouldHeaderPaddingLeft, wideMode])}
+
+
+ {
+ return {
+ header: shouldHeaderPaddingLeft
+ ? "ml-[calc(theme(width.feed-col)+theme(width.8))]"
+ : wideMode
+ ? "ml-12"
+ : "",
+ }
+ }, [shouldHeaderPaddingLeft, wideMode])}
+ />
+
+ {aiPinned && (
+
- {aiPinned && (
-
- )}
-
-
+ )}
+
)
}
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/CenterColumnLayout.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/TimelineColumnLayout.tsx
similarity index 98%
rename from apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/CenterColumnLayout.tsx
rename to apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/TimelineColumnLayout.tsx
index 6cf5cc9ca..3b32a00f6 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/CenterColumnLayout.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/TimelineColumnLayout.tsx
@@ -16,7 +16,7 @@ import { useRouteParams } from "~/hooks/biz/useRouteParams"
import { EntryColumn } from "~/modules/entry-column"
import { AppLayoutGridContainerProvider } from "~/providers/app-grid-layout-container-provider"
-export function CenterColumnLayout() {
+export function TimelineColumnLayout() {
const containerRef = useRef
(null)
// Memo this initial value to avoid re-render
diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/index.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/index.tsx
index c8c7a2c59..0b53adf4f 100644
--- a/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/index.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app-layout/timeline-column/index.tsx
@@ -1 +1 @@
-export { CenterColumnLayout } from "./CenterColumnLayout"
+export { TimelineColumnLayout as CenterColumnLayout } from "./TimelineColumnLayout"
diff --git a/apps/desktop/layer/renderer/src/modules/app/EnvironmentIndicator.tsx b/apps/desktop/layer/renderer/src/modules/app/EnvironmentIndicator.tsx
index a710d7fff..324e38228 100644
--- a/apps/desktop/layer/renderer/src/modules/app/EnvironmentIndicator.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app/EnvironmentIndicator.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable @eslint-react/dom/no-missing-iframe-sandbox */
import { Button } from "@follow/components/ui/button/index.js"
import {
Tooltip,
@@ -5,10 +6,12 @@ import {
TooltipPortal,
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
+import { getDBFile } from "@follow/database/db"
import { DEV, MODE } from "@follow/shared/constants"
import { env } from "@follow/shared/env.desktop"
import { useUserRole } from "@follow/store/user/hooks"
+import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
import { DebugRegistry } from "../debug/registry"
@@ -64,3 +67,59 @@ export const EnvironmentIndicator = () => {
)
}
+
+if (DEV) {
+ const sqliteOnlineWebsite = "https://sqlite-online.vercel.app"
+
+ DebugRegistry.add("SQLite Online", () => {
+ window.presentModal({
+ title: "SQLite Online",
+ content: ({ dismiss }) => (
+
+
+ ),
+
+ CustomModalComponent: PlainModal,
+ })
+ })
+}
diff --git a/apps/desktop/layer/renderer/src/modules/app/NetworkStatusIndicator.tsx b/apps/desktop/layer/renderer/src/modules/app/NetworkStatusIndicator.tsx
index 89f35e019..6a823df9e 100644
--- a/apps/desktop/layer/renderer/src/modules/app/NetworkStatusIndicator.tsx
+++ b/apps/desktop/layer/renderer/src/modules/app/NetworkStatusIndicator.tsx
@@ -2,19 +2,16 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/t
import { cn } from "@follow/utils/utils"
import { NetworkStatus, useApiStatus, useNetworkStatus } from "~/atoms/network"
-import { useGeneralSettingKey } from "~/atoms/settings/general"
export const NetworkStatusIndicator = () => {
const networkStatus = useNetworkStatus()
const apiStatus = useApiStatus()
- const canUseLocalData = useGeneralSettingKey("dataPersist")
if (networkStatus === NetworkStatus.ONLINE && apiStatus === NetworkStatus.ONLINE) {
return null
}
const canAccessAnyData =
- canUseLocalData ||
- (networkStatus === NetworkStatus.ONLINE && apiStatus === NetworkStatus.ONLINE)
+ networkStatus === NetworkStatus.ONLINE && apiStatus === NetworkStatus.ONLINE
return (
@@ -29,9 +26,7 @@ export const NetworkStatusIndicator = () => {
{networkStatus === NetworkStatus.OFFLINE
- ? canUseLocalData
- ? "Local Mode (alpha)"
- : "Offline"
+ ? "Local Mode (alpha)"
: apiStatus === NetworkStatus.OFFLINE
? "API Error"
: ""}
@@ -40,9 +35,7 @@ export const NetworkStatusIndicator = () => {
{networkStatus === NetworkStatus.OFFLINE
- ? canUseLocalData
- ? "Currently in Local data mode due to current network connection failure."
- : "Your network environment is abnormal and you are unable to request a remote server."
+ ? "Currently in Local data mode due to current network connection failure."
: apiStatus === NetworkStatus.OFFLINE
? "Your network connection is normal, there may be an error on the remote server and the API interface is temporarily unreachable."
: ""}
diff --git a/apps/desktop/layer/renderer/src/modules/claim/feed-claim-modal.tsx b/apps/desktop/layer/renderer/src/modules/claim/feed-claim-modal.tsx
index 739eb926d..5cc2d061e 100644
--- a/apps/desktop/layer/renderer/src/modules/claim/feed-claim-modal.tsx
+++ b/apps/desktop/layer/renderer/src/modules/claim/feed-claim-modal.tsx
@@ -101,7 +101,7 @@ export const FeedClaimModalContent: FC<{
@@ -111,7 +111,7 @@ export const FeedClaimModalContent: FC<{
@@ -128,7 +128,7 @@ export const FeedClaimModalContent: FC<{
variant={isSuccess ? "outline" : "primary"}
>
{isSuccess && }
- {t("feed_claim_modal.claim_button")}
+ {t("feed_claim_modal.claim_button")}
diff --git a/apps/desktop/layer/renderer/src/modules/command/commands/id.ts b/apps/desktop/layer/renderer/src/modules/command/commands/id.ts
index 8293ca0dd..853dc78c9 100644
--- a/apps/desktop/layer/renderer/src/modules/command/commands/id.ts
+++ b/apps/desktop/layer/renderer/src/modules/command/commands/id.ts
@@ -28,6 +28,8 @@ export const COMMAND_ID = {
saveToCubox: "integration:save-to-cubox",
saveToZotero: "integration:save-to-zotero",
saveToQBittorrent: "integration:save-to-qbittorrent",
+
+ custom: "integration:custom",
},
list: {
edit: "list:edit",
diff --git a/apps/desktop/layer/renderer/src/modules/command/commands/integration.tsx b/apps/desktop/layer/renderer/src/modules/command/commands/integration.tsx
index 091319b5c..b52c894e1 100644
--- a/apps/desktop/layer/renderer/src/modules/command/commands/integration.tsx
+++ b/apps/desktop/layer/renderer/src/modules/command/commands/integration.tsx
@@ -16,6 +16,7 @@ import { tracker } from "@follow/tracker"
import { useMutation, useQuery } from "@tanstack/react-query"
import type { FetchError } from "ofetch"
import { ofetch } from "ofetch"
+import { useMemo } from "react"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
@@ -25,10 +26,11 @@ import { getIntegrationSettings, useIntegrationSettingKey } from "~/atoms/settin
import { useRouteParams } from "~/hooks/biz/useRouteParams"
import { ipcServices } from "~/lib/client"
import { parseHtml } from "~/lib/parse-html"
+import { CustomIntegrationManager } from "~/modules/integration/custom-integration-manager"
import { useRegisterCommandEffect } from "../hooks/use-register-command"
import { defineFollowCommand } from "../registry/command"
-import type { Command, CommandCategory } from "../types"
+import type { Command, CommandCategory, FollowCommandId } from "../types"
import { COMMAND_ID } from "./id"
export const useRegisterIntegrationCommands = () => {
@@ -41,6 +43,7 @@ export const useRegisterIntegrationCommands = () => {
useRegisterCuboxCommands()
useRegisterZoteroCommands()
useRegisterQBittorrentCommands()
+ useRegisterCustomIntegrationCommands()
}
const category: CommandCategory = "category.integration"
@@ -781,6 +784,64 @@ const useRegisterQBittorrentCommands = () => {
)
}
+const useRegisterCustomIntegrationCommands = () => {
+ const customIntegrations = useIntegrationSettingKey("customIntegration")
+ const enableCustomIntegration = useIntegrationSettingKey("enableCustomIntegration")
+
+ // Register main custom integration command
+ useRegisterCommandEffect(
+ !enableCustomIntegration || !customIntegrations || customIntegrations.length === 0
+ ? []
+ : defineFollowCommand({
+ id: COMMAND_ID.integration.custom,
+ label: "Custom Integration",
+ icon: ,
+ category,
+ run: async () => {},
+ }),
+ {
+ deps: [customIntegrations, enableCustomIntegration],
+ },
+ )
+
+ useRegisterCustomIntegrationVisualCommands()
+}
+
+const useRegisterCustomIntegrationVisualCommands = () => {
+ const customIntegrations = useIntegrationSettingKey("customIntegration")
+ const enableCustomIntegration = useIntegrationSettingKey("enableCustomIntegration")
+
+ const visualCommands = useMemo(() => {
+ if (!enableCustomIntegration || !customIntegrations || customIntegrations.length === 0) {
+ return []
+ }
+ return customIntegrations.map((integration) => {
+ return defineFollowCommand({
+ id: `integration:custom:${integration.id}` as FollowCommandId,
+ label: integration.name,
+ icon: ,
+
+ category,
+ run: async ({ entryId }: { entryId: string }) => {
+ const entry = getEntry(entryId)
+ if (!entry) {
+ toast.error(`Failed to save to ${integration.name}: entry is not available`, {
+ duration: 3000,
+ })
+ return
+ }
+
+ await CustomIntegrationManager.executeWithToast(integration, entry)
+ },
+ })
+ })
+ }, [customIntegrations, enableCustomIntegration])
+
+ useRegisterCommandEffect(visualCommands, {
+ deps: [visualCommands],
+ })
+}
+
export type SaveToEagleCommand = Command<{
id: typeof COMMAND_ID.integration.saveToEagle
fn: (payload: { entryId: string }) => void
@@ -826,6 +887,11 @@ export type SaveToQBittorrentCommand = Command<{
fn: (payload: { entryId: string }) => void
}>
+export type CustomIntegrationCommand = Command<{
+ id: typeof COMMAND_ID.integration.custom
+ fn: (payload: { entryId: string }) => void
+}>
+
export type IntegrationCommand =
| SaveToEagleCommand
| SaveToReadwiseCommand
@@ -836,3 +902,4 @@ export type IntegrationCommand =
| SaveToCuboxCommand
| SaveToZoteroCommand
| SaveToQBittorrentCommand
+ | CustomIntegrationCommand
diff --git a/apps/desktop/layer/renderer/src/modules/customize-toolbar/constant.ts b/apps/desktop/layer/renderer/src/modules/customize-toolbar/constant.ts
index c7c397626..7e06fdab8 100644
--- a/apps/desktop/layer/renderer/src/modules/customize-toolbar/constant.ts
+++ b/apps/desktop/layer/renderer/src/modules/customize-toolbar/constant.ts
@@ -10,6 +10,7 @@ export interface ToolbarActionOrder {
export const ENTRY_ITEM_HIDE_IN_HEADER = new Set([
COMMAND_ID.entry.readAbove,
COMMAND_ID.entry.readBelow,
+ COMMAND_ID.settings.customizeToolbar,
])
const MAIN_ACTIONS = [
@@ -30,6 +31,5 @@ export const DEFAULT_ACTION_ORDER: ToolbarActionOrder = {
more: [
...Object.values(COMMAND_ID.integration),
...Object.values(COMMAND_ID.entry).filter((id) => !MAIN_ACTIONS_SET.has(id)),
- COMMAND_ID.settings.customizeToolbar,
],
}
diff --git a/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx b/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx
index 2b3e7948e..5e9c82ae0 100644
--- a/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx
+++ b/apps/desktop/layer/renderer/src/modules/discover/FeedForm.tsx
@@ -15,11 +15,10 @@ import { ScrollArea } from "@follow/components/ui/scroll-area/index.js"
import { Switch } from "@follow/components/ui/switch/index.jsx"
import { FeedViewType } from "@follow/constants"
import type { EntryModelSimple, FeedAnalyticsModel, FeedModel } from "@follow/models/types"
-import { invalidateEntriesQuery } from "@follow/store/entry/hooks"
import { useFeedByIdOrUrl } from "@follow/store/feed/hooks"
import { useCategories, useSubscriptionByFeedId } from "@follow/store/subscription/hooks"
import { subscriptionSyncService } from "@follow/store/subscription/store"
-import { unreadActions } from "@follow/store/unread/store"
+import { whoami } from "@follow/store/user/getters"
import { tracker } from "@follow/tracker"
import { cn } from "@follow/utils/utils"
import { zodResolver } from "@hookform/resolvers/zod"
@@ -30,12 +29,10 @@ import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { z } from "zod"
-import { getGeneralSettings } from "~/atoms/settings/general"
import { Autocomplete } from "~/components/ui/auto-completion"
import { useCurrentModal, useIsInModal } from "~/components/ui/modal/stacked/hooks"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { useI18n } from "~/hooks/common"
-import { apiClient } from "~/lib/api-fetch"
import { toastFetchError } from "~/lib/error-parser"
import { feed as feedQuery, useFeedQuery } from "~/queries/feed"
@@ -239,34 +236,27 @@ const FeedInnerForm = ({
const followMutation = useMutation({
mutationFn: async (values: z.infer) => {
+ const userId = whoami()?.id || ""
const body = {
url: feed.url,
view: Number.parseInt(values.view),
category: values.category,
- isPrivate: values.isPrivate,
+ isPrivate: values.isPrivate || false,
hideFromTimeline: values.hideFromTimeline,
title: values.title,
feedId: feed.id,
- }
- const $method = isSubscribed ? apiClient.subscriptions.$patch : apiClient.subscriptions.$post
+ userId,
+ type: "feed",
+ listId: undefined,
+ } as const
- return $method({
- json: body,
- }) as unknown as Promise<
- | ReturnType
- | ReturnType
- >
+ if (isSubscribed) {
+ return subscriptionSyncService.edit(body)
+ } else {
+ return subscriptionSyncService.subscribe(body)
+ }
},
- onSuccess: (data, variables) => {
- if (getGeneralSettings().hidePrivateSubscriptionsInTimeline) {
- invalidateEntriesQuery({ views: [Number(variables.view)] })
- }
-
- if ("unread" in data) {
- unreadActions.upsertMany(data.unread)
- }
- subscriptionSyncService.fetch()
-
+ onSuccess: () => {
const feedId = feed.id
if (feedId) {
feedQuery.byId({ id: feedId }).invalidate()
@@ -275,10 +265,6 @@ const FeedInnerForm = ({
duration: 1000,
})
- if (!isSubscribed) {
- tracker.subscribe({ feedId: feed.id, view: Number.parseInt(variables.view) })
- }
-
onSuccess?.()
},
onError(err) {
diff --git a/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx b/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx
index 5708842d1..e1499a4d5 100644
--- a/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx
+++ b/apps/desktop/layer/renderer/src/modules/discover/ListForm.tsx
@@ -13,12 +13,11 @@ import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
import { Switch } from "@follow/components/ui/switch/index.jsx"
import { FeedViewType } from "@follow/constants"
import type { ListAnalyticsModel } from "@follow/models/types"
-import { invalidateEntriesQuery } from "@follow/store/entry/hooks"
import { useListById, usePrefetchListById } from "@follow/store/list/hooks"
import type { ListModel } from "@follow/store/list/types"
import { useSubscriptionByFeedId } from "@follow/store/subscription/hooks"
import { subscriptionSyncService } from "@follow/store/subscription/store"
-import { unreadActions } from "@follow/store/unread/store"
+import { whoami } from "@follow/store/user/getters"
import { tracker } from "@follow/tracker"
import { cn } from "@follow/utils/utils"
import { zodResolver } from "@hookform/resolvers/zod"
@@ -29,10 +28,8 @@ import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { z } from "zod"
-import { getGeneralSettings } from "~/atoms/settings/general"
import { useCurrentModal } from "~/components/ui/modal/stacked/hooks"
import { useI18n } from "~/hooks/common"
-import { apiClient } from "~/lib/api-fetch"
import { getFetchErrorMessage, toastFetchError } from "~/lib/error-parser"
import { getNewIssueUrl } from "~/lib/issues"
@@ -213,47 +210,32 @@ const ListInnerForm = ({
const followMutation = useMutation({
mutationFn: async (values: z.infer & { TOTPCode?: string }) => {
+ const userId = whoami()?.id || ""
const body = {
listId: list.id,
view: Number.parseInt(values.view),
category: values.category,
- isPrivate: values.isPrivate,
+ isPrivate: values.isPrivate || false,
hideFromTimeline: values.hideFromTimeline,
title: values.title,
TOTPCode: values.TOTPCode,
- }
- const $method = isSubscribed ? apiClient.subscriptions.$patch : apiClient.subscriptions.$post
+ userId,
+ type: "list",
+ url: undefined,
+ feedId: undefined,
+ } as const
- return $method({
- json: body,
- }) as unknown as Promise<
- | ReturnType
- | ReturnType
- >
+ if (isSubscribed) {
+ return subscriptionSyncService.edit(body)
+ } else {
+ return subscriptionSyncService.subscribe(body)
+ }
},
- onSuccess: (data, variables) => {
- if (getGeneralSettings().hidePrivateSubscriptionsInTimeline) {
- invalidateEntriesQuery({ views: [Number(variables.view)] })
- }
-
- if ("unread" in data) {
- const { unread } = data
- unreadActions.upsertMany(unread)
- }
- subscriptionSyncService.fetch()
-
- const listId = list.id
- if (listId) {
- // listsQuery.byId({ id: listId }).invalidate()
- }
+ onSuccess: () => {
toast(isSubscribed ? t("feed_form.updated") : t("feed_form.followed"), {
duration: 1000,
})
- if (!isSubscribed) {
- tracker.subscribe({ listId: list.id, view: Number.parseInt(variables.view) })
- }
-
onSuccess?.()
},
async onError(err) {
diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/EntryColumnLayout.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/AIEntryLayout.tsx
similarity index 94%
rename from apps/desktop/layer/renderer/src/modules/entry-column/EntryColumnLayout.tsx
rename to apps/desktop/layer/renderer/src/modules/entry-column/AIEntryLayout.tsx
index 07982c15a..276df7b9a 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-column/EntryColumnLayout.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-column/AIEntryLayout.tsx
@@ -14,9 +14,10 @@ import { AIChatLayout } from "~/modules/app-layout/ai/AIChatLayout"
import { EntryContent } from "~/modules/entry-content/components/entry-content"
import { AppLayoutGridContainerProvider } from "~/providers/app-grid-layout-container-provider"
+import { AIChatRoot } from "../ai-chat/components/layouts/AIChatRoot"
import { EntryColumn } from "./index"
-export const EntryColumnLayout = () => {
+const AIEntryLayoutImpl = () => {
const { entryId } = useParams()
const navigate = useNavigateEntry()
@@ -112,7 +113,7 @@ export const EntryColumnLayout = () => {
const { position, separatorProps, isDragging, separatorCursor, setPosition } = useResizable({
axis: "x",
min: 300,
- max: 600,
+ max: 1200,
initial: aiColWidth,
reverse: true,
onResizeStart({ position }) {
@@ -187,7 +188,19 @@ export const EntryColumnLayout = () => {
setPosition(defaultUISettings.aiColWidth)
}}
/>
-
+
)
}
+
+export const AIEntryLayout = () => {
+ return (
+
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/Items/audio-item.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/Items/audio-item.tsx
index 8d11b750a..0c598a4eb 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-column/Items/audio-item.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-column/Items/audio-item.tsx
@@ -5,12 +5,15 @@ import { Media } from "~/components/ui/media/Media"
import { ListItem } from "~/modules/entry-column/templates/list-item-template"
import { FeedTitle } from "~/modules/feed/feed-title"
+import { readableContentMaxWidth } from "../styles"
import type { EntryItemStatelessProps, UniversalItemProps } from "../types"
export function AudioItem({ entryId, entryPreview, translation }: UniversalItemProps) {
return
}
+AudioItem.wrapperClassName = readableContentMaxWidth
+
export function AudioItemStateLess({ entry, feed }: EntryItemStatelessProps) {
return (
diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/components/DateItem.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/components/DateItem.tsx
index b8ebc888c..da1a93010 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-column/components/DateItem.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-column/components/DateItem.tsx
@@ -158,17 +158,23 @@ const SocialMediaDateItem = ({
isSticky?: boolean
}) => {
const { startOfDay, endOfDay, dateObj } = useParseDate(date)
+ const aiEnabled = useFeature("ai")
return (
(
-
+
{children}
),
- [],
+ [aiEnabled],
)}
className={className}
date={dateObj}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/hooks/useEntriesByView.ts b/apps/desktop/layer/renderer/src/modules/entry-column/hooks/useEntriesByView.ts
index ce5e8de04..384e280ad 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-column/hooks/useEntriesByView.ts
+++ b/apps/desktop/layer/renderer/src/modules/entry-column/hooks/useEntriesByView.ts
@@ -182,6 +182,7 @@ const useLocalEntries = (): UseEntriesReturn => {
entryIdsByInboxId,
entryIdsByListId,
entryIdsByView,
+ isCollection,
showEntriesByView,
unreadOnly,
],
diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx
index 8a086aaa7..85de56387 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx
@@ -217,7 +217,7 @@ export const EntryItemWrapper: FC<
to={navigationPath}
className={cn(
"hover:bg-theme-item-hover cursor-button relative block overflow-visible duration-200",
- isWide ? "rounded-md" : "",
+ isWide ? "@[650px]:rounded-md rounded-none" : "",
(isActive || isContextMenuOpen) && "!bg-theme-item-active",
itemClassName,
)}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/buttons/DailyReportButton.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/buttons/DailyReportButton.tsx
index f0d707a68..2187f5a5f 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/buttons/DailyReportButton.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/buttons/DailyReportButton.tsx
@@ -3,7 +3,7 @@ import { tracker } from "@follow/tracker"
import type { FC } from "react"
import { useTranslation } from "react-i18next"
-import { useAIDailyReportModal } from "~/modules/ai/ai-daily/useAIDailyReportModal"
+import { useAIDailyReportModal } from "~/modules/ai-daily/useAIDailyReportModal"
export const DailyReportButton: FC = () => {
const present = useAIDailyReportModal()
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/actions/header-actions.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/actions/header-actions.tsx
index 8e5c0dc8e..e96b0f827 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-content/actions/header-actions.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-content/actions/header-actions.tsx
@@ -1,8 +1,18 @@
+import { RootPortal } from "@follow/components/ui/portal/index.js"
import type { FeedViewType } from "@follow/constants"
+import { memo } from "react"
import { MenuItemText } from "~/atoms/context-menu"
import { CommandActionButton } from "~/components/ui/button/CommandActionButton"
-import { useSortedEntryActions } from "~/hooks/biz/useEntryActions"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "~/components/ui/dropdown-menu/dropdown-menu"
+import { EntryActionDropdownItem, useSortedEntryActions } from "~/hooks/biz/useEntryActions"
+import { useCommand } from "~/modules/command/hooks/use-command"
+import type { FollowCommandId } from "~/modules/command/types"
export const EntryHeaderActions = ({
entryId,
@@ -16,9 +26,9 @@ export const EntryHeaderActions = ({
const { mainAction: actionConfigs } = useSortedEntryActions({ entryId, view, compact })
return actionConfigs
- .filter((item) => item instanceof MenuItemText)
+ .filter((item) => item instanceof MenuItemText || item instanceof EntryActionDropdownItem)
.map((config) => {
- return (
+ const baseTrigger = (
)
+
+ if (config instanceof EntryActionDropdownItem && config.hasChildren) {
+ return (
+
+ {baseTrigger}
+
+
+ {config.enabledChildren.map((child) => (
+
+ ))}
+
+
+
+ )
+ }
+
+ if (config instanceof MenuItemText) {
+ return baseTrigger
+ }
+
+ return null
})
}
+
+const CommandDropdownMenuItem = memo(
+ ({
+ commandId,
+ onClick,
+ active,
+ }: {
+ commandId: FollowCommandId
+ onClick: () => void
+ active?: boolean
+ }) => {
+ const command = useCommand(commandId)
+
+ if (!command) return null
+
+ return (
+
+ {command.label.title}
+
+ )
+ },
+)
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/actions/more-actions.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/actions/more-actions.tsx
index 6a1280c6e..849a41c6b 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-content/actions/more-actions.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-content/actions/more-actions.tsx
@@ -9,11 +9,18 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "~/components/ui/dropdown-menu/dropdown-menu"
-import { useSortedEntryActions } from "~/hooks/biz/useEntryActions"
+import {
+ EntryActionDropdownItem,
+ EntryActionMenuItem,
+ useSortedEntryActions,
+} from "~/hooks/biz/useEntryActions"
import { COMMAND_ID } from "~/modules/command/commands/id"
-import { hasCommand, useCommand } from "~/modules/command/hooks/use-command"
+import { hasCommand, useCommand, useRunCommandFn } from "~/modules/command/hooks/use-command"
import type { FollowCommandId } from "~/modules/command/types"
export const MoreActions = ({
@@ -28,24 +35,35 @@ export const MoreActions = ({
const { moreAction } = useSortedEntryActions({ entryId, view })
const actionConfigs = useMemo(
- () => moreAction.filter((action) => action instanceof MenuItemText && hasCommand(action.id)),
+ () =>
+ moreAction.filter(
+ (action) =>
+ (action instanceof MenuItemText || action instanceof EntryActionDropdownItem) &&
+ hasCommand(action.id),
+ ),
[moreAction],
)
const availableActions = useMemo(
() =>
actionConfigs.filter(
- (item) => item instanceof MenuItemText && item.id !== COMMAND_ID.settings.customizeToolbar,
+ (item) =>
+ (item instanceof MenuItemText || item instanceof EntryActionDropdownItem) &&
+ item.id !== COMMAND_ID.settings.customizeToolbar,
),
[actionConfigs],
)
- const extraAction = useMemo(
- () =>
- actionConfigs.filter(
- (item) => item instanceof MenuItemText && item.id === COMMAND_ID.settings.customizeToolbar,
- ),
- [actionConfigs],
+ const runCmdFn = useRunCommandFn()
+ const extraAction: EntryActionMenuItem[] = useMemo(
+ () => [
+ new EntryActionMenuItem({
+ id: COMMAND_ID.settings.customizeToolbar,
+ onClick: runCmdFn(COMMAND_ID.settings.customizeToolbar, []),
+ entryId,
+ }),
+ ],
+ [entryId, runCmdFn],
)
if (availableActions.length === 0 && extraAction.length === 0) {
@@ -62,16 +80,47 @@ export const MoreActions = ({
- {availableActions
- .filter((item) => item instanceof MenuItemText)
- .map((config) => (
-
- ))}
+ {availableActions.map((config) => {
+ // Handle EntryActionI with sub-menu
+ if (config instanceof EntryActionDropdownItem && config.hasChildren) {
+ return (
+
+
+
+
+
+ {config.enabledChildren.map((child) => (
+
+ ))}
+
+
+ )
+ }
+
+ // Handle regular MenuItemText
+ if (config instanceof MenuItemText) {
+ return (
+
+ )
+ }
+
+ return null
+ })}
{availableActions.length > 0 && }
{extraAction
.filter((item) => item instanceof MenuItemText)
@@ -93,13 +142,48 @@ export const CommandDropdownMenuItem = ({
commandId,
onClick,
active,
+ asSubTrigger = false,
}: {
- commandId: FollowCommandId
+ commandId: FollowCommandId | string
onClick: () => void
active?: boolean
+ asSubTrigger?: boolean
}) => {
- const command = useCommand(commandId)
+ const command = useCommand(commandId as any)
+
+ // For custom integration items
+ if (typeof commandId === "string" && commandId.startsWith("integration:custom:")) {
+ const content = (
+ <>
+
+ Custom Integration
+ >
+ )
+
+ if (asSubTrigger) {
+ return content
+ }
+
+ return (
+
+ {content}
+
+ )
+ }
+
if (!command) return null
+
+ const content = (
+ <>
+ {command.icon}
+ {command.label.title}
+ >
+ )
+
+ if (asSubTrigger) {
+ return content
+ }
+
return (
= ({
return { feedId, inboxId: inboxHandle, title, url }
})
- useTitle(entry?.title)
+ if (!entry) throw thenable
- const feed = useFeedById(entry?.feedId)
+ useTitle(entry.title)
+ const feed = useFeedById(entry.feedId)
- const isInbox = useIsInbox(entry?.inboxId)
+ const isInbox = useIsInbox(entry.inboxId)
const isInReadabilityMode = useEntryIsInReadability(entryId)
const { error, content, isPending } = useEntryContent(entryId)
@@ -95,10 +99,21 @@ const EntryContentImpl: Component = ({
FeedViewType.SocialMedia,
FeedViewType.Videos,
].includes(view)
- if (!entry) return null
+
+ const { addOrUpdateBlock, removeBlock } = useBlockActions()
+ useEffect(() => {
+ addOrUpdateBlock({
+ id: BlockSliceAction.SPECIAL_TYPES.mainEntry,
+ type: "mainEntry",
+ value: entryId,
+ })
+ return () => {
+ removeBlock(BlockSliceAction.SPECIAL_TYPES.mainEntry)
+ }
+ }, [addOrUpdateBlock, entryId, removeBlock])
return (
-
+
{!isInPeekModal && (
= ({
return { feedId, inboxId: inboxHandle, title, url }
})
+ if (!entry) throw thenable
+
useTitle(entry?.title)
const feed = useFeedById(entry?.feedId)
@@ -110,7 +113,6 @@ const EntryContentImpl: Component = ({
FeedViewType.SocialMedia,
FeedViewType.Videos,
].includes(view)
- if (!entry) return null
return (
<>
@@ -235,8 +237,6 @@ const EntryContentImpl: Component = ({
-
- {/* {!isInPeekModal && } */}
>
)
}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/EntryContent.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/EntryContent.tsx
index 98a99a4b3..4eb7b61cb 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/EntryContent.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/EntryContent.tsx
@@ -1,6 +1,8 @@
+import { withSuspense } from "@follow/utils"
+
import { withFeature } from "~/lib/features"
import { EntryContent as EntryContentAI } from "./EntryContent.ai"
import { EntryContent as EntryContentLegacy } from "./EntryContent.legacy"
-export const EntryContent = withFeature("ai")(EntryContentAI, EntryContentLegacy)
+export const EntryContent = withSuspense(withFeature("ai")(EntryContentAI, EntryContentLegacy))
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatBottom.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatBottom.tsx
deleted file mode 100644
index 73a3fe4dd..000000000
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatBottom.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { use } from "react"
-
-import { AIChatContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-import { AIChatContextBar } from "~/modules/ai/chat/components/AIChatContextBar"
-
-export const AIChatBottom: React.FC<{ children: React.ReactNode }> = (props) => {
- return (
-
-
-
- {/* Context Bar */}
-
-
- {props.children}
-
- )
-}
-
-const AIChatErrorIndicator = () => {
- const { error } = use(AIChatContext)
-
- if (!error) return null
-
- return (
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatContainer.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatContainer.tsx
deleted file mode 100644
index 83aabe8c3..000000000
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatContainer.tsx
+++ /dev/null
@@ -1,198 +0,0 @@
-import { ScrollArea } from "@follow/components/ui/scroll-area/ScrollArea.js"
-import { cn, nextFrame } from "@follow/utils"
-import * as React from "react"
-
-import { useDialog } from "~/components/ui/modal/stacked/hooks"
-import { AISpline } from "~/modules/ai/AISpline"
-import { AIChatContext, AIPanelRefsContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-import {
- AIChatMessage,
- AIChatTypingIndicator,
-} from "~/modules/ai/chat/components/message/AIChatMessage"
-import { useAutoScroll } from "~/modules/ai/chat/hooks/useAutoScroll"
-import { useLoadMessages } from "~/modules/ai/chat/hooks/useLoadMessages"
-import { useSaveMessages } from "~/modules/ai/chat/hooks/useSaveMessages"
-
-import { AIChatBottom } from "./AIChatBottom"
-import { AIChatInput } from "./AIChatInput"
-
-declare const APP_NAME: string
-
-interface AIChatContainerProps {
- onSendMessage?: (message: string) => void
-}
-
-const Welcome: React.FC = () => {
- const { inputRef } = React.use(AIPanelRefsContext)
-
- const { ask } = useDialog()
- const guardChangeValue = (toValue: string) => {
- const { value } = inputRef.current
-
- const fn = () => {
- inputRef.current.value = toValue
- nextFrame(() => {
- inputRef.current.focus()
-
- inputRef.current.selectionStart = inputRef.current.selectionEnd = toValue.length
- })
- }
- if (value) {
- ask({
- title: "Confirm Change",
- message:
- "Are you sure you want to change the value to recommend? This will overwrite the current value.",
- confirmText: "Change",
- cancelText: "Cancel",
- variant: "warning",
-
- onConfirm: () => {
- fn()
- },
- })
- } else {
- fn()
- }
- }
- const items = [
- {
- tag: "Content analysis",
- onClick: () => {
- guardChangeValue("Analyze the content of this entry")
- },
- },
- {
- tag: "Summaries",
- onClick: () => {
- guardChangeValue("Summarize the content of this entry")
- },
- },
- {
- tag: "Insights",
- onClick: () => {
- guardChangeValue("Provide insights about the content of this entry")
- },
- },
- ]
-
- return (
-
-
-
-
-
-
Welcome to {APP_NAME} AI
-
- I can help you analyze content, answer questions, and provide insights about your feeds.
-
-
-
-
-
Ask me anything about:
-
- {items.map((item) => (
-
- {item.tag}
-
- ))}
-
-
-
-
- )
-}
-
-export const AIChatContainer: React.FC = React.memo(({ onSendMessage }) => {
- const { inputRef } = React.use(AIPanelRefsContext)
- const scrollAreaRef = React.useRef(null)
- const { messages, status, id: roomId } = React.use(AIChatContext)
-
- const scrollToBottom = React.useCallback(() => {
- if (scrollAreaRef.current) {
- scrollAreaRef.current.scrollTop = scrollAreaRef.current.scrollHeight
- }
- }, [])
- // Auto-scroll logic
- const { resetScrollState, scrollToBottom: scrollToBottomAnimated } = useAutoScroll(
- scrollAreaRef.current,
- status === "streaming",
- )
- const { isLoading: isLoadingHistory } = useLoadMessages(roomId, {
- onLoad: scrollToBottom,
- })
- useSaveMessages(roomId, { enabled: !isLoadingHistory })
-
- // Auto-scroll to bottom when initial messages are loaded
- React.useEffect(() => {
- nextFrame(() => {
- scrollToBottom()
- })
- }, [scrollToBottom])
-
- const handleSendMessage = (message: string) => {
- if (inputRef.current) {
- inputRef.current.value = ""
- }
-
- // Call the actual sending logic
- if (onSendMessage) {
- onSendMessage(message)
- } else {
- // Demo fallback for no onSendMessage
- console.info("Sending message:", message)
- }
-
- // Reset scroll state when sending a new message
- resetScrollState()
-
- // Scroll to bottom after new message
- requestAnimationFrame(() => {
- scrollToBottomAnimated()
- })
- }
-
- // Show welcome screen if no messages
- const showWelcome = messages.length === 0 && !isLoadingHistory
-
- return (
- <>
-
- {showWelcome &&
}
- {isLoadingHistory && (
-
-
-
- )}
-
-
-
- {messages.map((message) => (
-
- ))}
- {status === "submitted" &&
}
-
-
-
- {/* Input area */}
-
-
- >
- )
-})
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatInput.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatInput.tsx
deleted file mode 100644
index 83b1a973e..000000000
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIChatInput.tsx
+++ /dev/null
@@ -1,128 +0,0 @@
-import { cn } from "@follow/utils"
-import * as React from "react"
-
-import { AIChatContext, AIPanelRefsContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-import { AIChatSendButton } from "~/modules/ai/chat/components/AIChatSendButton"
-
-interface AIChatInputProps {
- value?: string
- onChange?: (value: string) => void
- onSend: (message: string) => void
- placeholder?: string
- disabled?: boolean
-}
-
-const minHeight = 120
-const maxHeight = 200
-
-export const AIChatInput = ({
- value,
- onChange,
- onSend,
- placeholder = "Ask me anything about your feeds, or describe a task...",
- disabled = false,
-}: AIChatInputProps) => {
- const { inputRef: textareaRef } = React.use(AIPanelRefsContext)
- const [height, setHeight] = React.useState(minHeight)
- const [isEmpty, setIsEmpty] = React.useState(true)
-
- const { status, stop } = React.use(AIChatContext)
-
- // Determine if we should show stop button
- const isProcessing = status === "submitted" || status === "streaming"
-
- const handleSend = () => {
- if (textareaRef.current && textareaRef.current.value.trim()) {
- const message = textareaRef.current.value.trim()
-
- onSend(message)
- setIsEmpty(true)
-
- requestAnimationFrame(() => {
- textareaRef.current?.focus()
- })
- }
- }
-
- const handleButtonClick = () => {
- if (isProcessing) {
- // Stop the AI processing
- stop?.()
- } else {
- // Send the message
- handleSend()
- }
- }
-
- const handleKeyPress = (e: React.KeyboardEvent) => {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault()
- handleButtonClick()
- }
- }
-
- // Auto-resize function
- const autoResize = React.useCallback(() => {
- if (textareaRef.current) {
- textareaRef.current.style.height = "auto"
- const { scrollHeight } = textareaRef.current
- const newHeight = Math.min(Math.max(scrollHeight, minHeight), maxHeight)
- setHeight(newHeight)
- textareaRef.current.style.height = `${newHeight}px`
- }
- }, [textareaRef])
-
- // Auto-resize when value changes
- React.useEffect(() => {
- autoResize()
- }, [value, autoResize])
-
- React.useEffect(() => {
- if (textareaRef.current) {
- autoResize()
- textareaRef.current.focus()
- }
- }, [])
-
- const handleChange = (e: React.ChangeEvent) => {
- onChange?.(e.target.value)
- setTimeout(autoResize, 0)
- setIsEmpty(e.target.value.trim() === "")
- }
-
- return (
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIPanelHeader.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIPanelHeader.tsx
deleted file mode 100644
index 7fb9eccc8..000000000
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/AIPanelHeader.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-import { ActionButton } from "@follow/components/ui/button/action-button.js"
-import * as React from "react"
-import { useTranslation } from "react-i18next"
-
-import { setAIChatPinned, useAIChatPinned } from "~/atoms/settings/ai"
-import { useDialog } from "~/components/ui/modal/stacked/hooks"
-import { AIChatContext } from "~/modules/ai/chat/__internal__/AIChatContext"
-
-export const AIPanelHeader: React.FC<{ onClose: () => void }> = ({ onClose }) => {
- const { setMessages, messages } = React.use(AIChatContext)
- const isAiChatPinned = useAIChatPinned()
- const { ask } = useDialog()
- const { t } = useTranslation("ai")
- return (
-
-
-
-
-
-
-
{APP_NAME} AI
-
-
-
-
}
- onClick={() => {
- if (messages.length === 0) {
- return
- }
-
- ask({
- title: t("clear_chat"),
- message: t("clear_chat_message"),
- variant: "danger",
- onConfirm: () => {
- setMessages([])
- },
- })
- }}
- />
- {!isAiChatPinned && (
-
}
- onClick={() => {
- setAIChatPinned(true)
- onClose()
- }}
- />
- )}
-
-
-
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/context.ts b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/context.ts
deleted file mode 100644
index 14bccc70b..000000000
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/context.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { createContext, use } from "react"
-import type { StoreApi, UseBoundStore } from "zustand"
-
-export interface IEntryAIContext {
- entryId?: Nullable
- selectedText?: Nullable
-}
-
-export const EntryAIContext = createContext>>(null!)
-
-export const useEntryAIContextStore = () => {
- return use(EntryAIContext)
-}
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/index.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/index.tsx
deleted file mode 100644
index edd9cc98f..000000000
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/entry-content/ai/index.tsx
+++ /dev/null
@@ -1,326 +0,0 @@
-import { useGlobalFocusableScopeSelector } from "@follow/components/common/Focusable/hooks.js"
-import { Spring } from "@follow/components/constants/spring.js"
-import { useMousePosition } from "@follow/components/hooks/useMouse.js"
-import { cn, combineCleanupFunctions } from "@follow/utils"
-import { EventBus } from "@follow/utils/event-bus"
-import { AnimatePresence, m } from "motion/react"
-import type { FC } from "react"
-import * as React from "react"
-import { useEffect, useState } from "react"
-import { create } from "zustand"
-
-import { getAIChatPinned, setAIChatPinned, useAIChatPinned } from "~/atoms/settings/ai"
-import { Focusable, FocusablePresets } from "~/components/common/Focusable"
-import { HotkeyScope } from "~/constants"
-import { AIChatContext, useAIChatStore } from "~/modules/ai/chat/__internal__/AIChatContext"
-import { COMMAND_ID } from "~/modules/command/commands/id"
-import { useCommandBinding } from "~/modules/command/hooks/use-command-binding"
-
-import { AIChatContainer } from "./AIChatContainer"
-import { AIPanelHeader } from "./AIPanelHeader"
-import type { IEntryAIContext } from "./context"
-import { EntryAIContext, useEntryAIContextStore } from "./context"
-
-const AIChat: React.FC = () => {
- const { sendMessage } = React.use(AIChatContext)
- const handleSendMessage = React.useCallback(
- (message: string) => {
- sendMessage({
- text: message,
- metadata: {
- finishTime: new Date().toISOString(),
- },
- })
- },
- [sendMessage],
- )
-
- const store = useEntryAIContextStore()()
-
- // const setContextInfo = useAIChatStore((s) => s.setContextInfo)
- const useAiContextStore = useAIChatStore()
- useEffect(() => {
- const aiContextStore = useAiContextStore.getState()
- aiContextStore.setEntryId(store.entryId ?? undefined)
- aiContextStore.setSelectedText(store.selectedText ?? undefined)
- }, [store.entryId, store.selectedText, useAiContextStore])
-
- return
-}
-
-const AIAmbientSidebar: React.FC<{ onExpand: () => void }> = ({ onExpand }) => {
- const [intensity, setIntensity] = useState(0)
- const [showPrompt, setShowPrompt] = useState(false)
-
- const isShowPromptRef = React.useRef(false)
-
- const mousePosition = useMousePosition()
-
- // Calculate the distance between the mouse and the right edge of the screen
- useEffect(() => {
- const rightEdgeDistance = window.innerWidth - mousePosition.x
- const maxDistance = 500 // Maximum sensing distance
- const threshold = 80 // Threshold distance for showing prompt
- const showedThreshold = 300
- const topBoundary = 100 // Top boundary to avoid toolbar area
-
- // Don't trigger if mouse is in the toolbar area (top 100px)
- if (mousePosition.y <= topBoundary) {
- setIntensity(0)
- setShowPrompt(false)
- isShowPromptRef.current = false
- return
- }
-
- if (isShowPromptRef.current && rightEdgeDistance <= showedThreshold) {
- return
- }
- if (rightEdgeDistance <= maxDistance) {
- const newIntensity = Math.max(0, (maxDistance - rightEdgeDistance) / maxDistance)
- setIntensity(newIntensity)
- const showPrompt = rightEdgeDistance <= threshold
- setShowPrompt(showPrompt)
- isShowPromptRef.current = showPrompt
- } else {
- setIntensity(0)
- setShowPrompt(false)
- isShowPromptRef.current = false
- }
- }, [mousePosition])
-
- const selectedText = useEntryAIContextStore()((s) => s.selectedText)
-
- return (
- <>
- {/* Blurred gradient bar - Adheres to the right edge */}
- 0 ? 8 + intensity * 40 : 2,
- // Breathing effect - Starts breathing when intensity is greater than 0.3
- scale: intensity > 0.3 ? [1, 1.1, 1] : 1,
- }}
- transition={{
- duration: 0.3,
- ease: "easeOut",
- // Breathing animation configuration
- scale: {
- repeat: intensity > 0.3 ? Infinity : 0,
- duration: 2,
- ease: "easeInOut",
- },
- }}
- style={{
- background: `linear-gradient(to left,
- rgba(255, 92, 0, ${intensity * 0.4}) 0%,
- rgba(255, 140, 0, ${intensity * 0.3}) 50%,
- transparent 100%)`,
- transformOrigin: "right center",
- }}
- />
-
-
- {showPrompt && (
- <>
- 0 ? -10 - intensity * 30 : 0,
- }}
- transition={Spring.presets.smooth}
- exit={{
- opacity: 0,
- scale: 0.5,
- x: 0,
- }}
- style={{
- width: 100,
- height: 100,
- background: `radial-gradient(circle,
- rgba(255, 92, 0, ${intensity * 0.3}) 0%,
- rgba(255, 140, 0, ${intensity * 0.2}) 40%,
- transparent 70%)`,
- }}
- />
-
- {/* Text prompt */}
-
-
-
- {selectedText ? "Ask AI about selection" : "Ask AI anything"}
-
-
- {selectedText
- ? `"${selectedText.slice(0, 30)}..."`
- : "Get insights about this article"}
-
-
-
-
- {/* Clickable area */}
-
-
-
- Open AI Chat
-
-
-
- >
- )}
-
- >
- )
-}
-
-// AI Chat Panel Component - Expanded chat panel
-const AIChatSidePanel: React.FC<{ onClose: () => void }> = ({ onClose }) => (
-
- {/* Panel header */}
-
-
- {/* AI Chat content */}
-
-
-)
-
-const useCreateEntryAIContext = (entryId: string) => {
- const ctxStore = React.useMemo(() => {
- return create(() => ({
- entryId,
- selectedText: "",
- }))
- }, [entryId])
- // Listen for text selection
- useEffect(() => {
- const handleSelection = () => {
- const selection = window.getSelection()
-
- if (
- selection?.anchorNode?.firstChild?.nodeName === "INPUT" ||
- selection?.anchorNode?.firstChild?.nodeName === "TEXTAREA"
- ) {
- return
- }
-
- const text = selection?.toString().trim()
-
- if (text)
- ctxStore.setState({
- selectedText: text || "",
- })
- }
-
- document.addEventListener("selectionchange", handleSelection)
- return () => document.removeEventListener("selectionchange", handleSelection)
- }, [ctxStore])
-
- return ctxStore
-}
-// eslint-disable-next-line unicorn/no-thenable
-const infiniteThenable = { then() {} }
-export const AISmartSidebar = ({ entryId }: { entryId: string }) => {
- const [isExpanded, setIsExpanded] = useState(false)
-
- const hasAi = React.use(AIChatContext)
- if (!hasAi) {
- throw infiniteThenable
- }
-
- const ctxStore = useCreateEntryAIContext(entryId)
-
- const when = useGlobalFocusableScopeSelector(FocusablePresets.isNotFloatingLayerScope)
- useCommandBinding({
- commandId: COMMAND_ID.global.toggleAIChat,
- when,
- })
-
- useCommandBinding({
- commandId: COMMAND_ID.global.toggleAIChatPinned,
- when,
- })
-
- useEffect(() => {
- return combineCleanupFunctions(
- EventBus.subscribe(COMMAND_ID.global.toggleAIChat, () => {
- setIsExpanded((state) => !state)
- }),
- EventBus.subscribe(COMMAND_ID.global.toggleAIChatPinned, () => {
- const current = getAIChatPinned()
- setIsExpanded(false)
- setAIChatPinned(!current)
- }),
- )
- }, [])
-
- if (useAIChatPinned()) return null
-
- return (
-
- {!isExpanded && setIsExpanded(true)} />}
-
- {isExpanded && setIsExpanded(false)} />}
-
-
- )
-}
-
-export const AIChatPanelContainer: FC<{
- className?: string
- entryId: string
- onClose: () => void
-}> = React.memo(({ className, entryId, onClose }) => {
- const ctxStore = useCreateEntryAIContext(entryId)
-
- return (
-
-
- {/* Panel header */}
-
-
- {/* AI Chat content */}
-
-
-
- )
-})
diff --git a/apps/desktop/layer/renderer/src/modules/entry-content/components/layouts/ArticleLayout.tsx b/apps/desktop/layer/renderer/src/modules/entry-content/components/layouts/ArticleLayout.tsx
index edce5c24b..7b0a588d2 100644
--- a/apps/desktop/layer/renderer/src/modules/entry-content/components/layouts/ArticleLayout.tsx
+++ b/apps/desktop/layer/renderer/src/modules/entry-content/components/layouts/ArticleLayout.tsx
@@ -5,15 +5,17 @@ import { useFeedById } from "@follow/store/feed/hooks"
import { useIsInbox } from "@follow/store/inbox/hooks"
import { cn } from "@follow/utils"
import { ErrorBoundary } from "@sentry/react"
-import { useMemo, useRef } from "react"
+import { useCallback, useMemo, useRef } from "react"
-import { useEntryIsInReadability } from "~/atoms/readability"
import { useUISettingKey } from "~/atoms/settings/ui"
import { ShadowDOM } from "~/components/common/ShadowDOM"
import type { TocRef } from "~/components/ui/markdown/components/Toc"
import { useInPeekModal } from "~/components/ui/modal/inspire/InPeekModal"
import { readableContentMaxWidthClassName } from "~/constants/ui"
import { useRenderStyle } from "~/hooks/biz/useRenderStyle"
+import type { TextSelectionEvent } from "~/lib/simple-text-selection"
+import { useBlockActions } from "~/modules/ai-chat/store/hooks"
+import { BlockSliceAction } from "~/modules/ai-chat/store/slices/block.slice"
import { EntryContentHTMLRenderer } from "~/modules/renderer/html"
import { WrappedElementProvider } from "~/providers/wrapped-element-provider"
@@ -49,11 +51,24 @@ export const ArticleLayout: React.FC = ({
}))
const feed = useFeedById(entry?.feedId)
const isInbox = useIsInbox(entry?.inboxId)
- const _isInReadabilityMode = useEntryIsInReadability(entryId)
+
const { content } = useEntryContent(entryId)
const customCSS = useUISettingKey("customCSS")
- const _isInPeekModal = useInPeekModal()
+ const { addOrUpdateBlock, removeBlock } = useBlockActions()
+ const handleTextSelect = useCallback(
+ (event: TextSelectionEvent) => {
+ addOrUpdateBlock({
+ id: BlockSliceAction.SPECIAL_TYPES.selectedText,
+ type: "selectedText",
+ value: event.selectedText,
+ })
+ },
+ [addOrUpdateBlock],
+ )
+ const handleSelectionClear = useCallback(() => {
+ removeBlock(BlockSliceAction.SPECIAL_TYPES.selectedText)
+ }, [removeBlock])
if (!entry) return null
return (
@@ -66,7 +81,12 @@ export const ArticleLayout: React.FC = ({
-
+
{!!customCSS && {customCSS} }
void
+ onSelectionClear?: (entryId: string) => void
+ textSelectionEnabled?: boolean
}> = ({ entryId, view, feedId, noMedia = false, content = "", translation }) => {
const mediaInfo = useEntryMediaInfo(entryId)
const readerRenderInlineStyle = useUISettingKey("readerRenderInlineStyle")
diff --git a/apps/desktop/layer/renderer/src/modules/feed/feed-certification.tsx b/apps/desktop/layer/renderer/src/modules/feed/feed-certification.tsx
index 4b53ddae5..59f22e7e5 100644
--- a/apps/desktop/layer/renderer/src/modules/feed/feed-certification.tsx
+++ b/apps/desktop/layer/renderer/src/modules/feed/feed-certification.tsx
@@ -30,13 +30,15 @@ export const FeedCertification = ({
(feed.ownerUserId === me?.id ? (
-
+
-
+
{type === "feed" ? t("feed_item.claimed_feed") : t("feed_item.claimed_list")}
{t("feed_item.claimed_by_you")}
diff --git a/apps/desktop/layer/renderer/src/modules/feed/feed-title.tsx b/apps/desktop/layer/renderer/src/modules/feed/feed-title.tsx
index 172c853cf..9af9f9808 100644
--- a/apps/desktop/layer/renderer/src/modules/feed/feed-title.tsx
+++ b/apps/desktop/layer/renderer/src/modules/feed/feed-title.tsx
@@ -27,8 +27,7 @@ export const FeedTitle = ({
return (
- {getPreferredTitle(feed) || title}
- {/* {title?.repeat(222)} */}
+ {title || getPreferredTitle(feed)}
{!hideExtraBadge && (
<>
diff --git a/apps/desktop/layer/renderer/src/modules/integration/CustomIntegrationPreview.tsx b/apps/desktop/layer/renderer/src/modules/integration/CustomIntegrationPreview.tsx
new file mode 100644
index 000000000..d83df331e
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/CustomIntegrationPreview.tsx
@@ -0,0 +1,139 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import type { FetchTemplate } from "@follow/shared/settings/interface"
+import { cn } from "@follow/utils"
+import { useState } from "react"
+import { useTranslation } from "react-i18next"
+
+import { CustomIntegrationManager } from "./custom-integration-manager"
+
+interface CustomIntegrationPreviewProps {
+ fetchTemplate: FetchTemplate
+ className?: string
+}
+
+export const CustomIntegrationPreview = ({
+ fetchTemplate,
+ className,
+}: CustomIntegrationPreviewProps) => {
+ const { t } = useTranslation("settings")
+ const [preview, setPreview] = useState<{
+ url: string
+ headers: Record
+ body?: string
+ method: string
+ } | null>(null)
+ const [isOpen, setIsOpen] = useState(false)
+ const [isLoading, setIsLoading] = useState(false)
+
+ const generatePreview = async (fetchTemplate: FetchTemplate) => {
+ setIsLoading(true)
+ try {
+ const previewData = await CustomIntegrationManager.getTemplatePreview(fetchTemplate)
+
+ setPreview(previewData)
+ } catch (error) {
+ console.error("Failed to generate preview:", error)
+ setPreview(null)
+ } finally {
+ setIsLoading(false)
+ }
+ }
+
+ return (
+
+
{
+ setIsOpen(!isOpen)
+ if (!isOpen) {
+ generatePreview(fetchTemplate)
+ }
+ }}
+ >
+
+
+ {t("integration.custom_integrations.preview.title", "Preview Request")}
+
+
+
+
+ {isOpen && (
+
+ {isLoading ? (
+
+
+
+ Generating preview...
+
+
+ ) : preview ? (
+
+ {/* Method and URL */}
+
+
Request
+
+
+ {preview.method}
+
+ {preview.url}
+
+
+
+ {/* Headers */}
+ {Object.keys(preview.headers).length > 0 && (
+
+
Headers
+
+ {Object.entries(preview.headers).map(([key, value]) => (
+
+
+ {key}:
+
+ {value}
+
+ ))}
+
+
+ )}
+
+ {/* Body */}
+ {preview.body && (
+
+ )}
+
+ {/* Placeholders Info */}
+
+
+ Available Placeholders
+
+
+ {CustomIntegrationManager.getAvailablePlaceholders().map((placeholder) => (
+
+
{placeholder.key}
+
{placeholder.description}
+
+ ))}
+
+
+
+ ) : (
+
+ Failed to generate preview
+
+ )}
+
+ )}
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/integration/CustomIntegrationValidator.tsx b/apps/desktop/layer/renderer/src/modules/integration/CustomIntegrationValidator.tsx
new file mode 100644
index 000000000..86cc5d574
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/CustomIntegrationValidator.tsx
@@ -0,0 +1,48 @@
+import type { FetchTemplate } from "@follow/shared/settings/interface"
+import { cn } from "@follow/utils"
+import { useTranslation } from "react-i18next"
+
+import { CustomIntegrationManager } from "./custom-integration-manager"
+
+interface CustomIntegrationValidatorProps {
+ fetchTemplate: FetchTemplate
+ className?: string
+}
+
+export const CustomIntegrationValidator = ({
+ fetchTemplate,
+ className,
+}: CustomIntegrationValidatorProps) => {
+ const { t } = useTranslation("settings")
+
+ const validation = CustomIntegrationManager.validateFetchTemplate(fetchTemplate)
+
+ if (validation.valid) {
+ return (
+
+
+
+ {t("integration.custom_integrations.validation.valid", "Template is valid")}
+
+
+ )
+ }
+
+ return (
+
+
+
+
+ {t("integration.custom_integrations.validation.invalid", "Template has errors")}
+
+
+
+ {validation.errors.map((error, index) => (
+
+ {error}
+
+ ))}
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/integration/PlaceholderHelp.tsx b/apps/desktop/layer/renderer/src/modules/integration/PlaceholderHelp.tsx
new file mode 100644
index 000000000..d72a11a84
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/PlaceholderHelp.tsx
@@ -0,0 +1,90 @@
+import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.js"
+import { cn } from "@follow/utils"
+import { useState } from "react"
+import { useTranslation } from "react-i18next"
+
+import { CustomIntegrationManager } from "./custom-integration-manager"
+
+interface PlaceholderHelpProps {
+ className?: string
+ onPlaceholderClick?: (placeholder: string) => void
+}
+
+export const PlaceholderHelp = ({ className, onPlaceholderClick }: PlaceholderHelpProps) => {
+ const { t } = useTranslation("settings")
+ const [isOpen, setIsOpen] = useState(false)
+
+ const placeholders = CustomIntegrationManager.getAvailablePlaceholders()
+
+ return (
+
+
setIsOpen(!isOpen)}
+ className="text-text-tertiary hover:text-text p-0 transition-colors"
+ >
+
+
+ {t("integration.custom_integrations.placeholders.help", "Available Placeholders")}
+
+
+
+
+ {isOpen && (
+
+
+
+ {t(
+ "integration.custom_integrations.placeholders.description",
+ "Click on any placeholder to copy it to your clipboard",
+ )}
+
+
+
+ {placeholders.map((placeholder) => (
+
+
+ {
+ if (onPlaceholderClick) {
+ onPlaceholderClick(placeholder.key)
+ } else {
+ navigator.clipboard?.writeText(placeholder.key)
+ }
+ }}
+ className="bg-fill hover:bg-fill-secondary group flex items-start gap-2 rounded p-2 text-left transition-colors"
+ >
+
+ {placeholder.key}
+
+
+
+ {placeholder.description}
+
+ {placeholder.example && (
+
+ Example: {placeholder.example}
+
+ )}
+
+
+
+
+
+
+ {t(
+ "integration.custom_integrations.placeholders.click_to_copy",
+ "Click to copy",
+ )}
+
+
+
+ ))}
+
+
+
+ )}
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/integration/URLSchemePreview.tsx b/apps/desktop/layer/renderer/src/modules/integration/URLSchemePreview.tsx
new file mode 100644
index 000000000..4a0d04b0d
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/URLSchemePreview.tsx
@@ -0,0 +1,141 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import type { URLSchemeTemplate } from "@follow/shared/settings/interface"
+import { cn } from "@follow/utils"
+import { useState } from "react"
+import { useTranslation } from "react-i18next"
+
+import { CustomIntegrationManager } from "./custom-integration-manager"
+
+interface URLSchemePreviewProps {
+ urlSchemeTemplate: URLSchemeTemplate
+ className?: string
+}
+
+export const URLSchemePreview = ({ urlSchemeTemplate, className }: URLSchemePreviewProps) => {
+ const { t } = useTranslation("settings")
+ const [preview, setPreview] = useState(null)
+ const [isOpen, setIsOpen] = useState(false)
+ const [isLoading, setIsLoading] = useState(false)
+
+ const generatePreview = async (template: URLSchemeTemplate) => {
+ setIsLoading(true)
+ try {
+ const previewScheme = CustomIntegrationManager.getURLSchemePreview(template)
+ setPreview(previewScheme)
+ } catch (error) {
+ console.error("Failed to generate URL scheme preview:", error)
+ setPreview(null)
+ } finally {
+ setIsLoading(false)
+ }
+ }
+
+ return (
+
+
{
+ setIsOpen(!isOpen)
+ if (!isOpen) {
+ generatePreview(urlSchemeTemplate)
+ }
+ }}
+ >
+
+
+ {t("integration.custom_integrations.preview.title", "Preview URL Scheme")}
+
+
+
+
+ {isOpen && (
+
+ {isLoading ? (
+
+
+
+ Generating preview...
+
+
+ ) : preview ? (
+
+ {/* URL Scheme Preview */}
+
+
+ Generated URL Scheme
+
+
+
+ SCHEME
+
+ {preview}
+
+
+
+ {/* Protocol Info */}
+
+
+ Protocol Information
+
+
+
+
+ Protocol:
+
+
+ {preview.split("://")[0]}://
+
+
+
+ Action:
+
+ {preview.includes("?") ? "Open with parameters" : "Direct open"}
+
+
+
+
+
+ {/* Placeholders Info */}
+
+
+ Available Placeholders for URL Schemes
+
+
+ {CustomIntegrationManager.getAvailablePlaceholders().map((placeholder) => (
+
+
{placeholder.key}
+
{placeholder.description}
+
+ ))}
+
+
+
+ {/* Usage Note */}
+
+
+
+
+
URL Scheme Behavior
+
+ URL schemes will attempt to open the target application with the provided
+ data. Make sure the application is installed and registered for the URL scheme
+ on your system.
+
+
+
+
+
+ ) : (
+
+ Failed to generate preview
+
+ )}
+
+ )}
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/integration/custom-integration-manager.ts b/apps/desktop/layer/renderer/src/modules/integration/custom-integration-manager.ts
new file mode 100644
index 000000000..90c2d7e1f
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/custom-integration-manager.ts
@@ -0,0 +1,482 @@
+import type {
+ CustomIntegration,
+ FetchTemplate,
+ URLSchemeTemplate,
+} from "@follow/shared/settings/interface"
+import type { EntryModel } from "@follow/store/entry/types"
+import { getSummary } from "@follow/store/summary/getters"
+import { tracker } from "@follow/tracker"
+import { toast } from "sonner"
+
+import { getActionLanguage } from "~/atoms/settings/general"
+import { getIntegrationSettings } from "~/atoms/settings/integration"
+import { parseHtml } from "~/lib/parse-html"
+
+import { getFetchAdapter } from "./fetch-adapter"
+import { URLSchemeHandler } from "./url-scheme-handler"
+
+/**
+ * Placeholder values that can be used in custom integration templates
+ */
+export interface PlaceholderContext {
+ title: string
+ url: string
+ contentHtml: string
+ contentMarkdown: string
+ summary: string
+ author: string
+ publishedAt: string
+ description: string
+ [key: string]: string
+}
+
+/**
+ * Manager class for handling custom integrations
+ */
+export class CustomIntegrationManager {
+ /**
+ * Get entry content as markdown
+ */
+ private static async getEntryContentAsMarkdown(entry: EntryModel): Promise {
+ const content = entry.content || ""
+ if (!content) return ""
+
+ try {
+ const [toMarkdown, toMdast, gfmTableToMarkdown] = await Promise.all([
+ import("mdast-util-to-markdown").then((m) => m.toMarkdown),
+ import("hast-util-to-mdast").then((m) => m.toMdast),
+ import("mdast-util-gfm-table").then((m) => m.gfmTableToMarkdown),
+ ])
+ return toMarkdown(toMdast(parseHtml(content).hastTree), {
+ extensions: [gfmTableToMarkdown()],
+ })
+ } catch {
+ return content
+ }
+ }
+
+ /**
+ * Get description with optional summary
+ */
+ private static getDescription(entry: EntryModel): string {
+ const { saveSummaryAsDescription } = getIntegrationSettings()
+ const actionLanguage = getActionLanguage()
+
+ if (!saveSummaryAsDescription) {
+ return entry.description || ""
+ }
+ const summary = getSummary(entry.id, actionLanguage)
+ return summary?.readabilitySummary || summary?.summary || entry.description || ""
+ }
+
+ /**
+ * Build placeholder context from entry
+ */
+ static async buildPlaceholderContext(entry: EntryModel): Promise {
+ const markdownContent = await this.getEntryContentAsMarkdown(entry)
+
+ return {
+ title: entry.title || "",
+ url: entry.url || "",
+ contentHtml: entry.content || "",
+ contentMarkdown: markdownContent,
+ summary: this.getDescription(entry),
+ author: entry.author || "",
+ publishedAt: entry.publishedAt?.toISOString() || "",
+ description: entry.description || "",
+ }
+ }
+
+ /**
+ * Get all available placeholders with their descriptions
+ */
+ static getAvailablePlaceholders(): Array<{ key: string; description: string; example?: string }> {
+ return [
+ { key: "[title]", description: "Entry title", example: "Example Article Title" },
+ { key: "[url]", description: "Entry URL", example: "https://example.com/article" },
+ { key: "[content_html]", description: "Entry content in HTML format" },
+ { key: "[content_markdown]", description: "Entry content in Markdown format" },
+ { key: "[summary]", description: "Entry summary or description" },
+ { key: "[author]", description: "Entry author", example: "John Doe" },
+ {
+ key: "[published_at]",
+ description: "Publication date in ISO format",
+ example: "2024-01-01T12:00:00.000Z",
+ },
+ { key: "[description]", description: "Entry description" },
+ ]
+ }
+
+ /**
+ * Replace placeholders in a string with actual values
+ */
+ static replacePlaceholders(
+ template: string,
+ context: PlaceholderContext,
+ options: {
+ urlEncode?: boolean
+ htmlEscape?: boolean
+ } = {},
+ ): string {
+ let result = template
+
+ // Define placeholder mapping
+ const placeholders: Record = {
+ "[title]": context.title,
+ "[url]": context.url,
+ "[content_html]": context.contentHtml,
+ "[content_markdown]": context.contentMarkdown,
+ "[summary]": context.summary,
+ "[author]": context.author,
+ "[published_at]": context.publishedAt,
+ "[description]": context.description,
+ }
+
+ // Replace each placeholder
+ Object.entries(placeholders).forEach(([placeholder, value]) => {
+ let processedValue = value
+
+ if (options.urlEncode) {
+ processedValue = encodeURIComponent(processedValue)
+ }
+
+ if (options.htmlEscape) {
+ processedValue = processedValue
+ .replaceAll("&", "&")
+ .replaceAll("<", "<")
+ .replaceAll(">", ">")
+ .replaceAll('"', """)
+ .replaceAll("'", "'")
+ }
+
+ result = result.replaceAll(placeholder, processedValue)
+ })
+
+ return result
+ }
+
+ /**
+ * Process a fetch template with placeholder replacement
+ */
+ static async processFetchTemplate(
+ fetchTemplate: FetchTemplate,
+ context: PlaceholderContext,
+ ): Promise<{
+ url: string
+ headers: Record
+ body?: string
+ method: string
+ }> {
+ // Process URL with URL encoding for placeholder values
+ const processedUrl = this.replacePlaceholders(fetchTemplate.url, context, { urlEncode: true })
+
+ // Process headers without URL encoding
+ const processedHeaders: Record = {}
+ Object.entries(fetchTemplate.headers).forEach(([key, value]) => {
+ const processedKey = this.replacePlaceholders(key, context)
+ const processedValue = this.replacePlaceholders(value, context)
+ processedHeaders[processedKey] = processedValue
+ })
+
+ // Process body without URL encoding
+ let processedBody: string | undefined
+ if (fetchTemplate.body) {
+ processedBody = this.replacePlaceholders(fetchTemplate.body, context)
+ }
+
+ return {
+ url: processedUrl,
+ headers: processedHeaders,
+ body: processedBody,
+ method: fetchTemplate.method,
+ }
+ }
+
+ /**
+ * Execute a custom integration
+ */
+ static async executeIntegration(
+ integration: CustomIntegration,
+ entry: EntryModel,
+ ): Promise<{ success: boolean; error?: string }> {
+ if (!integration.enabled) {
+ return { success: false, error: `${integration.name} is disabled` }
+ }
+
+ try {
+ // Track integration usage
+ tracker.integration({
+ type: "custom",
+ event: "save",
+ })
+
+ // Build placeholder context
+ const context = await this.buildPlaceholderContext(entry)
+
+ if (integration.type === "url-scheme" && integration.urlSchemeTemplate) {
+ // Execute URL scheme
+ await URLSchemeHandler.getInstance().executeURLScheme(integration.urlSchemeTemplate, {
+ title: context.title,
+ url: context.url,
+ content_html: context.contentHtml,
+ content_markdown: context.contentMarkdown,
+ summary: context.summary,
+ author: context.author,
+ published_at: context.publishedAt,
+ description: context.description,
+ })
+ return { success: true }
+ } else if ((integration.type === "http" || !integration.type) && integration.fetchTemplate) {
+ // Execute HTTP request (existing logic)
+ const { url, headers, body, method } = await this.processFetchTemplate(
+ integration.fetchTemplate,
+ context,
+ )
+
+ // Prepare request options for fetch adapter
+ const finalHeaders = { ...headers }
+
+ // Set content-type if not already set and we have a body
+ if (
+ body &&
+ ["POST", "PUT", "PATCH"].includes(method) &&
+ !Object.keys(headers).some((key) => key.toLowerCase() === "content-type")
+ ) {
+ finalHeaders["Content-Type"] = "application/json"
+ }
+
+ // Execute the HTTP request using fetch adapter
+ const response = await getFetchAdapter().fetch(url, {
+ method: method as "GET" | "POST" | "PUT" | "PATCH" | "DELETE",
+ headers: finalHeaders,
+ body: body && ["POST", "PUT", "PATCH"].includes(method) ? body : undefined,
+ })
+
+ // Check if request was successful
+ if (!response.ok) {
+ throw new Error(`Request failed with status ${response.status}: ${response.statusText}`)
+ }
+
+ return { success: true }
+ } else {
+ // Handle backward compatibility for integrations without type field
+ if (integration.fetchTemplate) {
+ // Treat as HTTP integration
+ const { url, headers, body, method } = await this.processFetchTemplate(
+ integration.fetchTemplate,
+ context,
+ )
+
+ const finalHeaders = { ...headers }
+ if (
+ body &&
+ ["POST", "PUT", "PATCH"].includes(method) &&
+ !Object.keys(headers).some((key) => key.toLowerCase() === "content-type")
+ ) {
+ finalHeaders["Content-Type"] = "application/json"
+ }
+
+ const response = await getFetchAdapter().fetch(url, {
+ method: method as "GET" | "POST" | "PUT" | "PATCH" | "DELETE",
+ headers: finalHeaders,
+ body: body && ["POST", "PUT", "PATCH"].includes(method) ? body : undefined,
+ })
+
+ if (!response.ok) {
+ throw new Error(`Request failed with status ${response.status}: ${response.statusText}`)
+ }
+
+ return { success: true }
+ }
+ }
+
+ return { success: false, error: "Invalid integration configuration" }
+ } catch (error) {
+ const errorMessage = (error as Error)?.message || "Unknown error"
+ return { success: false, error: errorMessage }
+ }
+ }
+
+ /**
+ * Execute integration with toast notifications
+ */
+ static async executeWithToast(integration: CustomIntegration, entry: EntryModel): Promise {
+ const result = await this.executeIntegration(integration, entry)
+
+ if (result.success) {
+ toast.success(`Saved to ${integration.name} successfully`, {
+ duration: 3000,
+ })
+ } else {
+ toast.error(`Failed to save to ${integration.name}: ${result.error}`, {
+ duration: 3000,
+ })
+ }
+ }
+
+ /**
+ * Validate a fetch template
+ */
+ static validateFetchTemplate(fetchTemplate: FetchTemplate): { valid: boolean; errors: string[] } {
+ const errors: string[] = []
+
+ if (!fetchTemplate.url?.trim()) {
+ errors.push("URL is required")
+ }
+
+ if (!fetchTemplate.method) {
+ errors.push("HTTP method is required")
+ }
+
+ if (
+ fetchTemplate.method &&
+ !["GET", "POST", "PUT", "PATCH", "DELETE"].includes(fetchTemplate.method)
+ ) {
+ errors.push("Invalid HTTP method")
+ }
+
+ try {
+ if (fetchTemplate.url) {
+ new URL(fetchTemplate.url.replaceAll(/\[.*?\]/g, "https://example.com"))
+ }
+ } catch {
+ errors.push("Invalid URL format")
+ }
+
+ return {
+ valid: errors.length === 0,
+ errors,
+ }
+ }
+
+ /**
+ * Validate a URL scheme template
+ */
+ static validateURLSchemeTemplate(template: URLSchemeTemplate): {
+ valid: boolean
+ errors: string[]
+ } {
+ const errors: string[] = []
+
+ if (!template.scheme?.trim()) {
+ errors.push("URL scheme is required")
+ }
+
+ if (template.scheme && !template.scheme.includes("://")) {
+ errors.push("URL scheme must include protocol (e.g., 'app://')")
+ }
+
+ try {
+ if (template.scheme) {
+ // Replace placeholders with sample values for validation
+ const testScheme = template.scheme.replaceAll(/\[.*?\]/g, "test")
+ new URL(testScheme)
+ }
+ } catch {
+ errors.push("Invalid URL scheme format")
+ }
+
+ return {
+ valid: errors.length === 0,
+ errors,
+ }
+ }
+
+ /**
+ * Validate a custom integration
+ */
+ static validateCustomIntegration(integration: Partial): {
+ valid: boolean
+ errors: string[]
+ } {
+ const errors: string[] = []
+
+ if (!integration.name?.trim()) {
+ errors.push("Integration name is required")
+ }
+
+ // Type is optional for backward compatibility, default to "http"
+ const integrationType = integration.type || "http"
+
+ if (integrationType === "http") {
+ if (!integration.fetchTemplate) {
+ errors.push("HTTP template is required for HTTP integrations")
+ } else {
+ const templateValidation = this.validateFetchTemplate(integration.fetchTemplate)
+ errors.push(...templateValidation.errors)
+ }
+ } else if (integrationType === "url-scheme") {
+ if (!integration.urlSchemeTemplate) {
+ errors.push("URL scheme template is required for URL scheme integrations")
+ } else {
+ const templateValidation = this.validateURLSchemeTemplate(integration.urlSchemeTemplate)
+ errors.push(...templateValidation.errors)
+ }
+ } else {
+ errors.push("Invalid integration type. Must be 'http' or 'url-scheme'")
+ }
+
+ return {
+ valid: errors.length === 0,
+ errors,
+ }
+ }
+
+ /**
+ * Get template preview with sample data
+ */
+ static async getTemplatePreview(
+ fetchTemplate: FetchTemplate,
+ sampleEntry?: Partial,
+ ): Promise<{
+ url: string
+ headers: Record
+ body?: string
+ method: string
+ }> {
+ // Create sample context
+ const sampleContext: PlaceholderContext = {
+ title: sampleEntry?.title || "Sample Article Title",
+ url: sampleEntry?.url || "https://example.com/article",
+ contentHtml: sampleEntry?.content || "This is sample HTML content
",
+ contentMarkdown: "# Sample Article\n\nThis is sample markdown content.",
+ summary: "This is a sample summary of the article content.",
+ author: sampleEntry?.author || "John Doe",
+ publishedAt: sampleEntry?.publishedAt?.toISOString() || new Date().toISOString(),
+ description: sampleEntry?.description || "Sample article description",
+ }
+
+ return this.processFetchTemplate(fetchTemplate, sampleContext)
+ }
+
+ /**
+ * Get URL scheme preview with sample data
+ */
+ static getURLSchemePreview(
+ template: URLSchemeTemplate,
+ sampleEntry?: Partial,
+ ): string {
+ // Create sample context
+ const sampleData = {
+ title: sampleEntry?.title || "Sample Article Title",
+ url: sampleEntry?.url || "https://example.com/article",
+ content_html: sampleEntry?.content || "This is sample HTML content
",
+ content_markdown: "# Sample Article\n\nThis is sample markdown content.",
+ summary: "This is a sample summary of the article content.",
+ author: sampleEntry?.author || "John Doe",
+ published_at: sampleEntry?.publishedAt?.toISOString() || new Date().toISOString(),
+ description: sampleEntry?.description || "Sample article description",
+ }
+
+ let result = template.scheme
+
+ // Replace all placeholders with sample data
+ Object.entries(sampleData).forEach(([key, value]) => {
+ const placeholder = `[${key}]`
+ const encodedValue = encodeURIComponent(value || "")
+ result = result.replaceAll(placeholder, encodedValue)
+ })
+
+ return result
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/integration/fetch-adapter.ts b/apps/desktop/layer/renderer/src/modules/integration/fetch-adapter.ts
new file mode 100644
index 000000000..01ebd23f5
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/fetch-adapter.ts
@@ -0,0 +1,179 @@
+import { IN_ELECTRON } from "@follow/shared/constants"
+import type { FetchError } from "ofetch"
+import { ofetch } from "ofetch"
+
+import { getIntegrationSettings } from "~/atoms/settings/integration"
+import { ipcServices } from "~/lib/client"
+
+/**
+ * HTTP request options for fetch adapters
+ */
+export interface FetchRequestOptions {
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"
+ headers?: Record
+ body?: string
+ timeout?: number
+}
+
+/**
+ * HTTP response from fetch adapters
+ */
+export interface FetchResponse {
+ ok: boolean
+ status: number
+ statusText: string
+ headers: Record
+ data?: any
+ text?: string
+}
+
+/**
+ * Abstract base class for HTTP fetch adapters
+ */
+export abstract class BaseFetchAdapter {
+ abstract fetch(url: string, options?: FetchRequestOptions): Promise
+}
+
+/**
+ * Browser fetch adapter using native fetch or ofetch
+ */
+export class BrowserFetchAdapter extends BaseFetchAdapter {
+ async fetch(url: string, options?: FetchRequestOptions): Promise {
+ const finalOptions = options || { method: "GET" }
+ try {
+ const requestOptions: Parameters[1] = {
+ method: finalOptions.method,
+ headers: finalOptions.headers || {},
+ timeout: finalOptions.timeout || 30000,
+ }
+
+ // Add body for methods that support it
+ if (finalOptions.body && ["POST", "PUT", "PATCH"].includes(finalOptions.method)) {
+ requestOptions.body = finalOptions.body
+ }
+
+ const response = await ofetch.raw(url, requestOptions)
+
+ // Convert Headers object to plain object
+ const headers: Record = {}
+ response.headers.forEach((value, key) => {
+ headers[key] = value
+ })
+
+ return {
+ ok: response.ok,
+ status: response.status,
+ statusText: response.statusText,
+ headers,
+ data: response._data,
+ text: typeof response._data === "string" ? response._data : JSON.stringify(response._data),
+ }
+ } catch (error) {
+ const fetchError = error as FetchError
+ throw new Error(`Browser fetch failed: ${fetchError.message || "Unknown error"}`)
+ }
+ }
+}
+
+/**
+ * Electron fetch adapter using IPC services
+ */
+export class ElectronFetchAdapter extends BaseFetchAdapter {
+ async fetch(url: string, options?: FetchRequestOptions): Promise {
+ const finalOptions = options || { method: "GET" }
+ try {
+ // Check if IPC services are available
+ if (!ipcServices?.integration?.customFetch) {
+ throw new Error("Electron IPC services not available")
+ }
+
+ const response = await ipcServices.integration.customFetch({
+ url,
+ method: finalOptions.method,
+ headers: finalOptions.headers || {},
+ body: finalOptions.body,
+ timeout: finalOptions.timeout || 30000,
+ })
+
+ return {
+ ok: response.ok,
+ status: response.status,
+ statusText: response.statusText || "OK",
+ headers: response.headers || {},
+ data: response.data,
+ text: response.text,
+ }
+ } catch (error) {
+ throw new Error(`Electron fetch failed: ${(error as Error).message || "Unknown error"}`)
+ }
+ }
+}
+
+/**
+ * Fetch adapter factory and configuration
+ */
+export class FetchAdapterManager {
+ private static instance: FetchAdapterManager
+ private adapter: BaseFetchAdapter
+ private preferElectron: boolean
+
+ private constructor() {
+ // Initialize preference based on settings
+ // Default to browser fetch if useBrowserFetch is true, electron otherwise
+ if (IN_ELECTRON) {
+ const settings = getIntegrationSettings()
+ this.preferElectron = !settings.useBrowserFetch
+ } else {
+ this.preferElectron = false // Always use browser fetch in non-Electron environment
+ }
+
+ this.adapter = this.createAdapter()
+ }
+
+ static getInstance(): FetchAdapterManager {
+ if (!FetchAdapterManager.instance) {
+ FetchAdapterManager.instance = new FetchAdapterManager()
+ }
+ return FetchAdapterManager.instance
+ }
+
+ /**
+ * @description Electron only
+ */
+ preferElectronFetch() {
+ this.preferElectron = true
+ this.adapter = this.createAdapter()
+ }
+ /**
+ * @description Electron only
+ */
+ preferClientFetch() {
+ this.preferElectron = false
+ this.adapter = this.createAdapter()
+ }
+
+ /**
+ * Create appropriate adapter based on environment and preferences
+ */
+ private createAdapter(): BaseFetchAdapter {
+ // If in Electron environment and Electron is preferred and available
+ if (IN_ELECTRON && this.preferElectron && ipcServices?.integration?.customFetch) {
+ return new ElectronFetchAdapter()
+ }
+
+ // Fallback to browser adapter
+ return new BrowserFetchAdapter()
+ }
+
+ /**
+ * Execute HTTP request using the current adapter
+ */
+ async fetch(url: string, options?: FetchRequestOptions): Promise {
+ return this.adapter.fetch(url, options)
+ }
+}
+
+/**
+ * Convenience function to get the fetch adapter manager instance
+ */
+export const getFetchAdapter = () => FetchAdapterManager.getInstance()
diff --git a/apps/desktop/layer/renderer/src/modules/integration/url-scheme-handler.ts b/apps/desktop/layer/renderer/src/modules/integration/url-scheme-handler.ts
new file mode 100644
index 000000000..44c24be34
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/integration/url-scheme-handler.ts
@@ -0,0 +1,129 @@
+import type { URLSchemeTemplate } from "@follow/shared/settings/interface"
+import { toast } from "sonner"
+
+import { ipcServices } from "~/lib/client"
+
+export class URLSchemeHandler {
+ private static instance: URLSchemeHandler
+
+ static getInstance(): URLSchemeHandler {
+ if (!URLSchemeHandler.instance) {
+ URLSchemeHandler.instance = new URLSchemeHandler()
+ }
+ return URLSchemeHandler.instance
+ }
+
+ /**
+ * Replace placeholders in URL scheme with actual values
+ */
+ private replacePlaceholders(template: string, data: Record): string {
+ let result = template
+
+ // Replace all placeholders like [title], [url], etc.
+ Object.entries(data).forEach(([key, value]) => {
+ const placeholder = `[${key}]`
+ const encodedValue = encodeURIComponent(value || "")
+ result = result.replaceAll(placeholder, encodedValue)
+ })
+
+ return result
+ }
+
+ /**
+ * Execute URL scheme with data placeholders
+ */
+ async executeURLScheme(
+ template: URLSchemeTemplate,
+ data: {
+ title?: string
+ url?: string
+ content_html?: string
+ content_markdown?: string
+ summary?: string
+ author?: string
+ published_at?: string
+ description?: string
+ },
+ ): Promise {
+ try {
+ const finalScheme = this.replacePlaceholders(template.scheme, data)
+
+ // Validate URL scheme format
+ if (!finalScheme.includes("://")) {
+ throw new Error("Invalid URL scheme format. Must include protocol (e.g., 'app://')")
+ }
+
+ await this.openURLScheme(finalScheme)
+
+ // Since URL schemes don't return responses, we assume success
+ toast.success("URL scheme executed successfully")
+ } catch (error) {
+ console.error("URL scheme execution failed:", error)
+ toast.error(`URL scheme failed: ${error instanceof Error ? error.message : String(error)}`)
+ }
+ }
+
+ /**
+ * Platform-specific URL scheme opening
+ */
+ private async openURLScheme(scheme: string): Promise {
+ if (window.electron && ipcServices) {
+ // Electron environment - use IPC service
+ await ipcServices.integration.openURLScheme(scheme)
+ } else {
+ // Browser environment - use window.open
+ // Note: This may be blocked by popup blockers for non-user-initiated actions
+ const opened = window.open(scheme, "_blank")
+ if (!opened) {
+ throw new Error("Failed to open URL scheme. This may be blocked by popup blockers.")
+ }
+ }
+ }
+
+ /**
+ * Check if URL scheme is supported on current platform
+ */
+ canExecuteURLScheme(): boolean {
+ // URL schemes work in both Electron and browser contexts
+ // Browser support depends on registered protocol handlers
+ return true
+ }
+
+ /**
+ * Get common URL scheme examples for different app types
+ */
+ static getExamples(): { name: string; scheme: string; description: string }[] {
+ return [
+ {
+ name: "Obsidian",
+ scheme: "obsidian://new?vault=MyVault&name=[title]&content=[content_markdown]",
+ description: "Create new note in Obsidian vault",
+ },
+ {
+ name: "Bear",
+ scheme: "bear://x-callback-url/create?title=[title]&text=[content_markdown]&tags=follow",
+ description: "Create new note in Bear with tags",
+ },
+ {
+ name: "Drafts",
+ scheme: "drafts://x-callback-url/create?text=[title]%0A%0A[content_markdown]",
+ description: "Create new draft with title and content",
+ },
+ {
+ name: "Things 3",
+ scheme: "things:///add?title=[title]¬es=[summary]&list=Reading",
+ description: "Add item to Things 3 reading list",
+ },
+ {
+ name: "Notion",
+ scheme: "notion://new?title=[title]&content=[content_markdown]",
+ description: "Create new Notion page",
+ },
+ {
+ name: "DEVONthink",
+ scheme: "x-devonthink://createText?title=[title]&text=[content_markdown]&destination=Inbox",
+ description: "Create new text document in DEVONthink",
+ },
+ ]
+ }
+}
diff --git a/apps/desktop/layer/renderer/src/modules/renderer/components/TimeStamp.tsx b/apps/desktop/layer/renderer/src/modules/renderer/components/TimeStamp.tsx
index cc5ed1ce2..29f9abccd 100644
--- a/apps/desktop/layer/renderer/src/modules/renderer/components/TimeStamp.tsx
+++ b/apps/desktop/layer/renderer/src/modules/renderer/components/TimeStamp.tsx
@@ -1,6 +1,6 @@
import { useEntry } from "@follow/store/entry/hooks"
import { nextFrame } from "@follow/utils/dom"
-import { formatTimeToSeconds } from "@follow/utils/utils"
+import { formatTimeToSeconds, timeStringToSeconds } from "@follow/utils/utils"
import { use } from "react"
import { AudioPlayer } from "~/atoms/player"
@@ -101,17 +101,3 @@ const CircleProgress: React.FC = ({
)
}
-
-function timeStringToSeconds(time: string): number | null {
- const timeParts = time.split(":").map(Number)
-
- if (timeParts.length === 2) {
- const [minutes, seconds] = timeParts
- return minutes! * 60 + seconds!
- } else if (timeParts.length === 3) {
- const [hours, minutes, seconds] = timeParts
- return hours! * 3600 + minutes! * 60 + seconds!
- } else {
- return null
- }
-}
diff --git a/apps/desktop/layer/renderer/src/modules/settings/helper/builder.ts b/apps/desktop/layer/renderer/src/modules/settings/helper/builder.ts
index e71df395e..67a8505e2 100644
--- a/apps/desktop/layer/renderer/src/modules/settings/helper/builder.ts
+++ b/apps/desktop/layer/renderer/src/modules/settings/helper/builder.ts
@@ -11,10 +11,11 @@ export const createDefineSettingItem =
label: string
description?: string | JSX.Element
onChange?: (value: T[K]) => void
+ onAfterChange?: (value: T[K]) => void
hide?: boolean
} & Omit, "onChange" | "description" | "label" | "hide" | "key">,
): any => {
- const { label, description, onChange, hide, ...rest } = options
+ const { label, description, onChange, hide, onAfterChange, ...rest } = options
if (hide) return null
return {
@@ -22,8 +23,12 @@ export const createDefineSettingItem =
label,
description,
onChange: (value: any) => {
- if (onChange) return onChange(value as any)
- setSetting(key, value as any)
+ try {
+ if (onChange) return onChange(value as any)
+ setSetting(key, value as any)
+ } finally {
+ onAfterChange?.(value as any)
+ }
},
disabled: hide,
...rest,
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx
index fa5c9080e..a8f881ed7 100644
--- a/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx
+++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/ai.tsx
@@ -9,7 +9,6 @@ import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { setAISetting, useAISettingValue } from "~/atoms/settings/ai"
-import { KeyRecorder } from "~/components/ui/keyboard-recorder"
import { SettingActionItem, SettingDescription } from "../control"
import { createSettingBuilder } from "../helper/setting-builder"
@@ -279,9 +278,8 @@ const ShortcutEditor = ({ shortcut, onSave, onCancel }: ShortcutEditorProps) =>
const { t } = useTranslation("ai")
const [name, setName] = useState(shortcut?.name || "")
const [prompt, setPrompt] = useState(shortcut?.prompt || "")
- const [hotkey, setHotkey] = useState(shortcut?.hotkey || "")
+
const [enabled, setEnabled] = useState(shortcut?.enabled ?? true)
- const [isRecording, setIsRecording] = useState(false)
const handleSave = () => {
if (!name.trim() || !prompt.trim()) {
@@ -292,7 +290,6 @@ const ShortcutEditor = ({ shortcut, onSave, onCancel }: ShortcutEditorProps) =>
onSave({
name: name.trim(),
prompt: prompt.trim(),
- hotkey: hotkey.trim() || undefined,
enabled,
})
}
@@ -308,7 +305,7 @@ const ShortcutEditor = ({ shortcut, onSave, onCancel }: ShortcutEditorProps) =>
placeholder={t("shortcuts.name_placeholder")}
/>
-
+ {/*
{t("shortcuts.hotkey")}
)}
-
+ */}
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/data-control.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/data-control.tsx
index 42698adea..4c6b3d684 100644
--- a/apps/desktop/layer/renderer/src/modules/settings/tabs/data-control.tsx
+++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/data-control.tsx
@@ -33,10 +33,7 @@ import { SettingActionItem, SettingDescription } from "../control"
import { createSetting } from "../helper/builder"
import { SettingItemGroup } from "../section"
-const { defineSettingItem, SettingBuilder } = createSetting(
- useGeneralSettingValue,
- setGeneralSetting,
-)
+const { SettingBuilder } = createSetting(useGeneralSettingValue, setGeneralSetting)
export const SettingDataControl = () => {
const { t } = useTranslation("settings")
@@ -53,11 +50,6 @@ export const SettingDataControl = () => {
value: t("general.data"),
},
- defineSettingItem("dataPersist", {
- label: t("general.data_persist.label"),
- description: t("general.data_persist.description"),
- }),
-
{
type: "title",
value: t("general.export_data.title"),
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration.tsx
deleted file mode 100644
index af71345aa..000000000
--- a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration.tsx
+++ /dev/null
@@ -1,322 +0,0 @@
-import { Divider } from "@follow/components/ui/divider/index.js"
-import {
- SimpleIconsCubox,
- SimpleIconsEagle,
- SimpleIconsInstapaper,
- SimpleIconsObsidian,
- SimpleIconsOutline,
- SimpleIconsReadeck,
- SimpleIconsReadwise,
- SimpleIconsZotero,
-} from "@follow/components/ui/platform-icon/icons.js"
-import { useEffect } from "react"
-import { useTranslation } from "react-i18next"
-
-import { setIntegrationSetting, useIntegrationSettingValue } from "~/atoms/settings/integration"
-
-import { createSetting } from "../helper/builder"
-import { useSetSettingCanSync } from "../modal/hooks"
-
-const { defineSettingItem, SettingBuilder } = createSetting(
- useIntegrationSettingValue,
- setIntegrationSetting,
-)
-export const SettingIntegration = () => {
- const { t } = useTranslation("settings")
- const setSync = useSetSettingCanSync()
- useEffect(() => {
- setSync(false)
- return () => {
- setSync(true)
- }
- }, [setSync])
- return (
-
-
-
- {t("integration.cubox.title")}
-
- ),
- },
- defineSettingItem("enableCubox", {
- label: t("integration.cubox.enable.label"),
- description: t("integration.cubox.enable.description"),
- }),
- defineSettingItem("cuboxToken", {
- label: t("integration.cubox.token.label"),
- vertical: true,
- type: "password",
- description: (
- <>
- {t("integration.cubox.token.description")}{" "}
-
- https://cubox.pro/my/settings/extensions
-
- >
- ),
- }),
- defineSettingItem("enableCuboxAutoMemo", {
- label: t("integration.cubox.autoMemo.label"),
- description: t("integration.cubox.autoMemo.description"),
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.eagle.title")}
-
- ),
- },
- defineSettingItem("enableEagle", {
- label: t("integration.eagle.enable.label"),
- description: t("integration.eagle.enable.description"),
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.instapaper.title")}
-
- ),
- },
- defineSettingItem("enableInstapaper", {
- label: t("integration.instapaper.enable.label"),
- description: t("integration.instapaper.enable.description"),
- }),
- defineSettingItem("instapaperUsername", {
- label: t("integration.instapaper.username.label"),
- vertical: true,
- }),
- defineSettingItem("instapaperPassword", {
- label: t("integration.instapaper.password.label"),
- vertical: true,
- type: "password",
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.readeck.title")}
-
- ),
- },
- defineSettingItem("enableReadeck", {
- label: t("integration.readeck.enable.label"),
- description: t("integration.readeck.enable.description"),
- }),
- defineSettingItem("readeckEndpoint", {
- label: t("integration.readeck.endpoint.label"),
- vertical: true,
- description: t("integration.readeck.endpoint.description"),
- }),
- defineSettingItem("readeckToken", {
- label: t("integration.readeck.token.label"),
- vertical: true,
- type: "password",
- description: t("integration.readeck.token.description"),
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.readwise.title")}
-
- ),
- },
- defineSettingItem("enableReadwise", {
- label: t("integration.readwise.enable.label"),
- description: t("integration.readwise.enable.description"),
- }),
- defineSettingItem("readwiseToken", {
- label: t("integration.readwise.token.label"),
- vertical: true,
- type: "password",
- description: (
- <>
- {t("integration.readwise.token.description")}{" "}
-
- readwise.io/access_token
-
- .
- >
- ),
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.obsidian.title")}
-
- ),
- },
- defineSettingItem("enableObsidian", {
- label: t("integration.obsidian.enable.label"),
- description: t("integration.obsidian.enable.description"),
- }),
- defineSettingItem("obsidianVaultPath", {
- label: t("integration.obsidian.vaultPath.label"),
- vertical: true,
- description: t("integration.obsidian.vaultPath.description"),
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.outline.title")}
-
- ),
- },
- defineSettingItem("enableOutline", {
- label: t("integration.outline.enable.label"),
- description: t("integration.outline.enable.description"),
- }),
- defineSettingItem("outlineEndpoint", {
- label: t("integration.outline.endpoint.label"),
- vertical: true,
- description: t("integration.outline.endpoint.description"),
- }),
- defineSettingItem("outlineToken", {
- label: t("integration.outline.token.label"),
- vertical: true,
- type: "password",
- description: t("integration.outline.token.description"),
- }),
- defineSettingItem("outlineCollection", {
- label: t("integration.outline.collection.label"),
- vertical: true,
- description: t("integration.outline.collection.description"),
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.zotero.title")}
-
- ),
- },
- defineSettingItem("enableZotero", {
- label: t("integration.zotero.enable.label"),
- description: t("integration.zotero.enable.description"),
- }),
- defineSettingItem("zoteroUserID", {
- // https://www.zotero.org/settings/keys
- label: t("integration.zotero.userID.label"),
- description: (
- <>
- {t("integration.zotero.userID.description")}{" "}
-
- https://www.zotero.org/settings/keys
-
- >
- ),
- vertical: true,
- type: "password",
- }),
- defineSettingItem("zoteroToken", {
- // https://www.zotero.org/settings/keys/new
- label: t("integration.zotero.token.label"),
- description: (
- <>
- {t("integration.zotero.token.description")}{" "}
-
- https://www.zotero.org/settings/keys/new
-
- >
- ),
- vertical: true,
- type: "password",
- }),
-
- {
- type: "title",
- value: (
-
-
- {t("integration.qbittorrent.title")}
-
- ),
- },
- defineSettingItem("enableQBittorrent", {
- label: t("integration.qbittorrent.enable.label"),
- description: t("integration.qbittorrent.enable.description"),
- }),
- defineSettingItem("qbittorrentHost", {
- label: t("integration.qbittorrent.host.label"),
- vertical: true,
- description: t("integration.qbittorrent.host.description"),
- }),
- defineSettingItem("qbittorrentUsername", {
- label: t("integration.qbittorrent.username.label"),
- vertical: true,
- }),
- defineSettingItem("qbittorrentPassword", {
- label: t("integration.qbittorrent.password.label"),
- vertical: true,
- type: "password",
- }),
-
- BottomTip,
- ]}
- />
-
- )
-}
-
-const BottomTip = () => {
- const { t } = useTranslation("settings")
- return (
-
-
-
- {t("integration.tip")}
-
-
- )
-}
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationModal.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationModal.tsx
new file mode 100644
index 000000000..07568710e
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationModal.tsx
@@ -0,0 +1,631 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@follow/components/ui/form/index.jsx"
+import { Input, TextArea } from "@follow/components/ui/input/index.js"
+import { KeyValueEditor } from "@follow/components/ui/key-value-editor/index.js"
+import { ScrollArea } from "@follow/components/ui/scroll-area/index.js"
+import { ResponsiveSelect } from "@follow/components/ui/select/responsive.js"
+import type {
+ CustomIntegration,
+ FetchTemplate,
+ URLSchemeTemplate,
+} from "@follow/shared/settings/interface"
+import { nextFrame } from "@follow/utils"
+import { zodResolver } from "@hookform/resolvers/zod"
+import { memo, useCallback, useEffect, useMemo } from "react"
+import { useForm } from "react-hook-form"
+import { useTranslation } from "react-i18next"
+import { toast } from "sonner"
+import { z } from "zod"
+
+import { useCurrentModal } from "~/components/ui/modal/stacked/hooks"
+import { CustomIntegrationPreview } from "~/modules/integration/CustomIntegrationPreview"
+import { PlaceholderHelp } from "~/modules/integration/PlaceholderHelp"
+import { URLSchemePreview } from "~/modules/integration/URLSchemePreview"
+
+const httpTemplateSchema = z.object({
+ method: z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]),
+ url: z.string().url("URL is required"),
+ headers: z.record(z.string()),
+ body: z.string().optional(),
+})
+
+const urlSchemeTemplateSchema = z.object({
+ scheme: z.string().url("URL scheme is required"),
+})
+
+const createFormSchema = () =>
+ z
+ .object({
+ name: z.string().min(1, "Name is required"),
+ icon: z.string().min(1, "Icon is required"),
+ type: z.enum(["http", "url-scheme"]),
+ fetchTemplate: z.any().optional(),
+ urlSchemeTemplate: z.any().optional(),
+ enabled: z.boolean(),
+ })
+ .superRefine((data, ctx) => {
+ try {
+ if (data.type === "http") {
+ httpTemplateSchema.parse(data.fetchTemplate)
+ } else if (data.type === "url-scheme") {
+ urlSchemeTemplateSchema.parse(data.urlSchemeTemplate)
+ }
+ } catch (error) {
+ if (error instanceof z.ZodError) {
+ error.errors.forEach((zodError) => {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: zodError.message,
+ path:
+ data.type === "http"
+ ? ["fetchTemplate", ...zodError.path]
+ : ["urlSchemeTemplate", ...zodError.path],
+ })
+ })
+ }
+ }
+ })
+
+type FormData = z.infer
>
+
+interface CustomIntegrationModalProps {
+ integration?: CustomIntegration
+ onSave: (integration: Omit & { id?: string }) => void
+}
+
+// Constants
+const HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"] as const
+const INTEGRATION_TYPES = [
+ { value: "http", icon: "i-mgc-world-2-cute-re" },
+ { value: "url-scheme", icon: "i-mgc-link-cute-re" },
+] as const
+
+const ICON_OPTIONS = [
+ { value: "i-mgc-bookmark-cute-re", key: "bookmark" },
+ { value: "i-mgc-pic-cute-re", key: "picture" },
+ { value: "i-mgc-share-forward-cute-re", key: "share" },
+ { value: "i-mgc-external-link-cute-re", key: "external_link" },
+ { value: "i-mgc-save-cute-re", key: "save" },
+ { value: "i-mgc-documents-cute-re", key: "document" },
+ { value: "i-mgc-link-cute-re", key: "link" },
+ { value: "i-mgc-star-cute-re", key: "star" },
+ { value: "i-mgc-download-2-cute-re", key: "download" },
+ { value: "i-mgc-send-plane-cute-re", key: "send" },
+] as const
+
+// Helper functions
+const getDefaultFetchTemplate = (): FetchTemplate => ({
+ method: "GET",
+ url: "",
+ headers: {},
+ body: "",
+})
+
+const getDefaultURLSchemeTemplate = (): URLSchemeTemplate => ({
+ scheme: "",
+})
+
+// Memoized icon selector component
+const IconSelector = memo(
+ ({
+ value,
+ onChange,
+ icons,
+ }: {
+ value: string
+ onChange: (value: string) => void
+ icons: Array<{ value: string; label: string; icon: string }>
+ }) => (
+ ({
+ label: icon.label,
+ value: icon.value,
+ }))}
+ renderItem={(item) => (
+
+
+ {item.label}
+
+ )}
+ />
+ ),
+)
+
+// Memoized type selector component
+const TypeSelector = memo(
+ ({
+ value,
+ onChange,
+ items,
+ getTypeIcon,
+ }: {
+ value: string
+ onChange: (value: string) => void
+ items: Array<{ label: string; value: string }>
+ getTypeIcon: (type: string) => string
+ }) => (
+ (
+
+
+ {item.label}
+
+ )}
+ />
+ ),
+)
+
+// Memoized method selector component
+const MethodSelector = memo(
+ ({
+ value,
+ onChange,
+ items,
+ }: {
+ value: string
+ onChange: (value: string) => void
+ items: Array<{ label: string; value: string }>
+ }) => ,
+)
+
+// Memoized input field component
+const MemoizedInput = memo(Input)
+const MemoizedTextArea = memo(TextArea)
+const MemoizedKeyValueEditor = memo(KeyValueEditor)
+
+export const CustomIntegrationModalContent = ({
+ integration,
+ onSave,
+}: CustomIntegrationModalProps) => {
+ const { dismiss } = useCurrentModal()
+ const { t } = useTranslation("settings")
+
+ const getCommonIcons = useCallback(
+ () =>
+ ICON_OPTIONS.map((icon) => ({
+ value: icon.value,
+ label: t(`integration.custom_integrations.icons.${icon.key}`),
+ icon: icon.value,
+ })),
+ [t],
+ )
+
+ // Memoized values
+ const commonIcons = useMemo(
+ (): Array<{ value: string; label: string; icon: string }> => getCommonIcons(),
+ [getCommonIcons],
+ )
+
+ const defaultValues = useMemo((): FormData => {
+ const integrationType = (integration?.type as "http" | "url-scheme") || "http"
+
+ return {
+ name: integration?.name || "",
+ icon: integration?.icon || commonIcons[0]?.value || ICON_OPTIONS[0].value,
+ type: integrationType,
+
+ fetchTemplate:
+ integrationType === "http"
+ ? integration?.fetchTemplate || getDefaultFetchTemplate()
+ : getDefaultFetchTemplate(),
+
+ urlSchemeTemplate:
+ integrationType === "url-scheme"
+ ? integration?.urlSchemeTemplate || getDefaultURLSchemeTemplate()
+ : getDefaultURLSchemeTemplate(),
+ enabled: integration?.enabled ?? true,
+ }
+ }, [integration, commonIcons])
+
+ const formSchema = useMemo(() => createFormSchema(), [])
+
+ const form = useForm({
+ resolver: zodResolver(formSchema),
+ defaultValues,
+ })
+
+ const onSubmit = useCallback(
+ (values: FormData) => {
+ try {
+ // Clean up data based on type - only include relevant template
+ const cleanedValues = {
+ id: integration?.id,
+ name: values.name,
+ icon: values.icon,
+ type: values.type,
+ enabled: values.enabled,
+ ...(values.type === "http"
+ ? { fetchTemplate: values.fetchTemplate }
+ : { urlSchemeTemplate: values.urlSchemeTemplate }),
+ }
+
+ onSave(cleanedValues)
+ toast.success(
+ integration
+ ? t("integration.custom_integrations.edit.success")
+ : t("integration.custom_integrations.create.success"),
+ )
+ dismiss()
+ } catch {
+ toast.error(
+ integration
+ ? t("integration.custom_integrations.edit.error")
+ : t("integration.custom_integrations.create.error"),
+ )
+ }
+ },
+ [onSave, integration, t, dismiss],
+ )
+
+ // Only watch essential fields for conditional rendering to minimize re-renders
+ const selectedType = form.watch("type")
+ const selectedMethod = form.watch("fetchTemplate.method") // Only watch method for body field display
+
+ // Computed values with minimal dependencies
+ const showBodyField = useMemo(
+ () => selectedMethod && ["POST", "PUT", "PATCH"].includes(selectedMethod),
+ [selectedMethod],
+ )
+
+ const shouldShowHTTPPreview = useMemo(() => selectedType === "http", [selectedType])
+
+ const shouldShowURLSchemePreview = useMemo(() => selectedType === "url-scheme", [selectedType])
+
+ // Get templates only when needed for preview
+ const getWatchedFetchTemplate = useCallback(() => {
+ if (!shouldShowHTTPPreview) return null
+ const template = form.getValues("fetchTemplate")
+ return template?.url ? template : null
+ }, [form, shouldShowHTTPPreview])
+
+ const getWatchedURLSchemeTemplate = useCallback(() => {
+ if (!shouldShowURLSchemePreview) return null
+ const template = form.getValues("urlSchemeTemplate")
+ return template?.scheme ? template : null
+ }, [form, shouldShowURLSchemePreview])
+
+ // Event handlers
+ const handleTypeChange = useCallback(
+ (onChange: (value: string) => void) => (value: string) => {
+ onChange(value)
+
+ // Clear templates for the type we're switching away from
+ if (value === "http") {
+ form.setValue("urlSchemeTemplate", getDefaultURLSchemeTemplate())
+
+ const currentFetchTemplate = form.getValues("fetchTemplate")
+ if (!currentFetchTemplate?.url && !currentFetchTemplate?.method) {
+ form.setValue("fetchTemplate", getDefaultFetchTemplate())
+ }
+ } else if (value === "url-scheme") {
+ form.setValue("fetchTemplate", getDefaultFetchTemplate())
+
+ const currentUrlSchemeTemplate = form.getValues("urlSchemeTemplate")
+ if (!currentUrlSchemeTemplate?.scheme) {
+ form.setValue("urlSchemeTemplate", getDefaultURLSchemeTemplate())
+ }
+ }
+
+ // Clear any existing validation errors
+ form.clearErrors()
+ },
+ [form],
+ )
+
+ // Memoized items
+ const integrationTypeItems = useMemo(
+ () => [
+ {
+ label: t("integration.custom_integrations.form.type.http"),
+ value: "http" as const,
+ },
+ {
+ label: t("integration.custom_integrations.form.type.url_scheme"),
+ value: "url-scheme" as const,
+ },
+ ],
+ [t],
+ )
+
+ const httpMethodItems = useMemo(
+ () =>
+ HTTP_METHODS.map((method) => ({
+ label: method,
+ value: method,
+ })),
+ [],
+ )
+
+ // Helper functions
+ const getTypeIcon = (type: string) => {
+ const typeConfig = INTEGRATION_TYPES.find((t) => t.value === type)
+ return typeConfig?.icon || "i-mgc-world-2-cute-re"
+ }
+
+ useEffect(() => {
+ nextFrame(() => {
+ form.setFocus("name")
+ })
+ }, [form])
+
+ return (
+
+ {/* Scrollable Content */}
+
+
+
+
+ {t("integration.custom_integrations.modal.description")}
+
+
+
+
+
+
+
+
+
+
+
+ {/* Static Footer */}
+
+
+ {t("words.cancel", { ns: "common" })}
+
+
+ {integration ? t("words.save", { ns: "common" }) : t("words.create", { ns: "common" })}
+
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx
new file mode 100644
index 000000000..af5878f5a
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/CustomIntegrationSection.tsx
@@ -0,0 +1,303 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import type { CustomIntegration } from "@follow/shared/settings/interface"
+import { nanoid } from "nanoid"
+import { memo, useCallback, useMemo } from "react"
+import { useTranslation } from "react-i18next"
+import { toast } from "sonner"
+
+import { setIntegrationSetting, useIntegrationSettingValue } from "~/atoms/settings/integration"
+import { useModalStack } from "~/components/ui/modal/stacked/hooks"
+
+import { createSetting } from "../../helper/builder"
+import { SettingSectionTitle } from "../../section"
+import { CustomIntegrationModalContent } from "./CustomIntegrationModal"
+
+const { defineSettingItem, SettingBuilder } = createSetting(
+ useIntegrationSettingValue,
+ setIntegrationSetting,
+)
+
+interface CustomIntegrationSectionProps {
+ searchQuery: string
+}
+
+export const CustomIntegrationSection = memo(({ searchQuery }: CustomIntegrationSectionProps) => {
+ const settings = useIntegrationSettingValue()
+ const { present } = useModalStack()
+
+ const { t } = useTranslation("settings")
+
+ // Check if custom integrations match search
+ const customIntegrationsMatchesSearch = useMemo(() => {
+ if (!searchQuery) return true
+
+ const query = searchQuery.toLowerCase()
+
+ // Check section title and related translations
+ const sectionTitle = t("integration.custom_integrations.title") as string
+ const enableLabel = t("integration.custom_integrations.enable.label") as string
+ const enableDescription = t("integration.custom_integrations.enable.description") as string
+
+ // Check if query matches section-related content
+ if (
+ sectionTitle.includes(query) ||
+ enableLabel.includes(query) ||
+ enableDescription.includes(query) ||
+ "custom".includes(query) ||
+ "action".includes(query) ||
+ "actions".includes(query) ||
+ "integration".includes(query) ||
+ "url".includes(query) ||
+ "template".includes(query) ||
+ "share".includes(query) ||
+ "sharing".includes(query)
+ ) {
+ return true
+ }
+
+ // Check existing custom integrations
+ const customIntegrations = settings.customIntegration || []
+ return customIntegrations.some(
+ (integration) =>
+ integration.name.toLowerCase().includes(query) ||
+ integration.fetchTemplate?.url?.toLowerCase().includes(query) ||
+ integration.fetchTemplate?.method?.toLowerCase().includes(query) ||
+ Object.keys(integration.fetchTemplate?.headers || {}).some(
+ (key) =>
+ key.toLowerCase().includes(query) ||
+ integration.fetchTemplate?.headers?.[key]?.toLowerCase().includes(query) ||
+ false,
+ ) ||
+ (integration.fetchTemplate?.body &&
+ integration.fetchTemplate.body.toLowerCase().includes(query)) ||
+ (integration.type === "url-scheme" &&
+ integration.urlSchemeTemplate?.scheme?.toLowerCase().includes(query)),
+ )
+ }, [searchQuery, t, settings.customIntegration])
+
+ const handleCreateCustomIntegration = useCallback(() => {
+ present({
+ title: t("integration.custom_integrations.create.title"),
+ content: () => (
+ {
+ const newIntegration: CustomIntegration = {
+ ...integrationData,
+ id: nanoid(),
+ }
+
+ const currentIntegrations = settings.customIntegration || []
+ setIntegrationSetting("customIntegration", [...currentIntegrations, newIntegration])
+ }}
+ />
+ ),
+ })
+ }, [present, settings.customIntegration, t])
+
+ const handleEditCustomIntegration = useCallback(
+ (integration: CustomIntegration) => {
+ present({
+ title: t("integration.custom_integrations.edit.title"),
+ content: () => (
+ {
+ const currentIntegrations = settings.customIntegration || []
+ const updatedIntegrations = currentIntegrations.map((i) =>
+ i.id === integration.id ? { ...i, ...integrationData } : i,
+ )
+ setIntegrationSetting("customIntegration", updatedIntegrations)
+ }}
+ />
+ ),
+ })
+ },
+ [present, settings.customIntegration, t],
+ )
+
+ const handleDeleteCustomIntegration = useCallback(
+ (integrationId: string) => {
+ const currentIntegrations = settings.customIntegration || []
+ const updatedIntegrations = currentIntegrations.filter((i) => i.id !== integrationId)
+ setIntegrationSetting("customIntegration", updatedIntegrations)
+ toast.success(t("integration.custom_integrations.delete.success"))
+ },
+ [settings.customIntegration, t],
+ )
+
+ const handleToggleCustomIntegration = useCallback(
+ (integrationId: string, enabled: boolean) => {
+ const currentIntegrations = settings.customIntegration || []
+ const updatedIntegrations = currentIntegrations.map((i) =>
+ i.id === integrationId ? { ...i, enabled } : i,
+ )
+ setIntegrationSetting("customIntegration", updatedIntegrations)
+ },
+ [settings.customIntegration],
+ )
+
+ if (settings.enableCustomIntegration && !customIntegrationsMatchesSearch) {
+ return (
+
+
+
No custom integration found
+
+ )
+ }
+
+ return (
+
+
+
+
+
+
+
+
+ {settings.enableCustomIntegration && (
+
+ )}
+
+
+ )
+})
+
+interface CustomIntegrationsSectionProps {
+ integrations: CustomIntegration[]
+ onCreateIntegration: () => void
+ onEditIntegration: (integration: CustomIntegration) => void
+ onDeleteIntegration: (integrationId: string) => void
+ onToggleIntegration: (integrationId: string, enabled: boolean) => void
+}
+
+const CustomIntegrationsSection = ({
+ integrations,
+ onCreateIntegration,
+ onEditIntegration,
+ onDeleteIntegration,
+ onToggleIntegration,
+}: CustomIntegrationsSectionProps) => {
+ const { t } = useTranslation("settings")
+
+ return (
+
+
+
+ {t("integration.custom_integrations.list.title")}
+
+
+
+ {t("integration.custom_integrations.add.button")}
+
+
+
+ {integrations.length === 0 ? (
+
+
+
+ {t("integration.custom_integrations.list.empty.title")}
+
+
+ {t("integration.custom_integrations.list.empty.description")}
+
+
+
+ {t("integration.custom_integrations.list.empty.button")}
+
+
+ ) : (
+
+ {integrations.map((integration) => (
+
+
+
+
+
+
+ {integration.name}
+ {integration.enabled ? (
+
+
+ {t("integration.status.enabled")}
+
+ ) : (
+
+
+ {t("integration.custom_integrations.status.disabled")}
+
+ )}
+
+
+
+ {integration.type === "url-scheme"
+ ? "URL"
+ : integration.fetchTemplate?.method || "GET"}
+
+ {integration.type === "url-scheme"
+ ? integration.urlSchemeTemplate?.scheme
+ : integration.fetchTemplate?.url}
+
+
+
+ onToggleIntegration(integration.id, !integration.enabled)}
+ buttonClassName="size-8 p-0"
+ aria-label={
+ integration.enabled
+ ? t("integration.custom_integrations.actions.disable")
+ : t("integration.custom_integrations.actions.enable")
+ }
+ >
+
+
+ onEditIntegration(integration)}
+ buttonClassName="size-8 p-0"
+ aria-label={t("integration.custom_integrations.actions.edit")}
+ >
+
+
+ onDeleteIntegration(integration.id)}
+ buttonClassName="size-8 p-0"
+ aria-label={t("integration.custom_integrations.actions.delete")}
+ >
+
+
+
+
+ ))}
+
+ )}
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx
new file mode 100644
index 000000000..0260a1f94
--- /dev/null
+++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/integration/index.tsx
@@ -0,0 +1,582 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import { Collapse, CollapseGroup } from "@follow/components/ui/collapse/index.js"
+import { Divider } from "@follow/components/ui/divider/index.js"
+import { InputV2 } from "@follow/components/ui/input/index.js"
+import {
+ SimpleIconsCubox,
+ SimpleIconsEagle,
+ SimpleIconsInstapaper,
+ SimpleIconsObsidian,
+ SimpleIconsOutline,
+ SimpleIconsReadeck,
+ SimpleIconsReadwise,
+ SimpleIconsZotero,
+} from "@follow/components/ui/platform-icon/icons.js"
+import { IN_ELECTRON } from "@follow/shared/constants"
+import { useCallback, useEffect, useMemo, useState } from "react"
+import { useTranslation } from "react-i18next"
+import { toast } from "sonner"
+
+import {
+ getIntegrationSettings,
+ setIntegrationSetting,
+ useIntegrationSettingValue,
+} from "~/atoms/settings/integration"
+import { downloadJsonFile, selectJsonFile } from "~/lib/export"
+import { getFetchAdapter } from "~/modules/integration/fetch-adapter"
+
+import { createSetting } from "../../helper/builder"
+import { useSetSettingCanSync } from "../../modal/hooks"
+import { SettingSectionTitle } from "../../section"
+import { CustomIntegrationSection } from "./CustomIntegrationSection"
+
+const { defineSettingItem, SettingBuilder } = createSetting(
+ useIntegrationSettingValue,
+ setIntegrationSetting,
+)
+export const SettingIntegration = () => {
+ const { t } = useTranslation("settings")
+ const setSync = useSetSettingCanSync()
+ const [searchQuery, setSearchQuery] = useState("")
+ const settings = useIntegrationSettingValue()
+
+ useEffect(() => {
+ setSync(false)
+ return () => {
+ setSync(true)
+ }
+ }, [setSync])
+
+ const integrationCategories = useMemo(() => {
+ const knowledgeManagement = {
+ id: "knowledge",
+ title: t("integration.categories.knowledge_management"),
+ icon: ,
+ integrations: [
+ {
+ key: "cubox",
+ title: t("integration.cubox.title"),
+ icon: ,
+ enabled: settings.enableCubox,
+ configured: Boolean(settings.cuboxToken),
+ settings: [
+ defineSettingItem("enableCubox", {
+ label: t("integration.cubox.enable.label"),
+ description: t("integration.cubox.enable.description"),
+ }),
+ defineSettingItem("cuboxToken", {
+ label: t("integration.cubox.token.label"),
+ vertical: true,
+ type: "password",
+ description: (
+ <>
+ {t("integration.cubox.token.description")}{" "}
+
+ https://cubox.pro/my/settings/extensions
+
+ >
+ ),
+ }),
+ defineSettingItem("enableCuboxAutoMemo", {
+ label: t("integration.cubox.autoMemo.label"),
+ description: t("integration.cubox.autoMemo.description"),
+ }),
+ ],
+ },
+ {
+ key: "obsidian",
+ title: t("integration.obsidian.title"),
+ icon: ,
+ enabled: settings.enableObsidian,
+ configured: Boolean(settings.obsidianVaultPath),
+ settings: [
+ defineSettingItem("enableObsidian", {
+ label: t("integration.obsidian.enable.label"),
+ description: t("integration.obsidian.enable.description"),
+ }),
+ defineSettingItem("obsidianVaultPath", {
+ label: t("integration.obsidian.vaultPath.label"),
+ vertical: true,
+ description: t("integration.obsidian.vaultPath.description"),
+ }),
+ ],
+ },
+ {
+ key: "outline",
+ title: t("integration.outline.title"),
+ icon: ,
+ enabled: settings.enableOutline,
+ configured: Boolean(settings.outlineEndpoint && settings.outlineToken),
+ settings: [
+ defineSettingItem("enableOutline", {
+ label: t("integration.outline.enable.label"),
+ description: t("integration.outline.enable.description"),
+ }),
+ defineSettingItem("outlineEndpoint", {
+ label: t("integration.outline.endpoint.label"),
+ vertical: true,
+ description: t("integration.outline.endpoint.description"),
+ }),
+ defineSettingItem("outlineToken", {
+ label: t("integration.outline.token.label"),
+ vertical: true,
+ type: "password",
+ description: t("integration.outline.token.description"),
+ }),
+ defineSettingItem("outlineCollection", {
+ label: t("integration.outline.collection.label"),
+ vertical: true,
+ description: t("integration.outline.collection.description"),
+ }),
+ ],
+ },
+ {
+ key: "readwise",
+ title: t("integration.readwise.title"),
+ icon: ,
+ enabled: settings.enableReadwise,
+ configured: Boolean(settings.readwiseToken),
+ settings: [
+ defineSettingItem("enableReadwise", {
+ label: t("integration.readwise.enable.label"),
+ description: t("integration.readwise.enable.description"),
+ }),
+ defineSettingItem("readwiseToken", {
+ label: t("integration.readwise.token.label"),
+ vertical: true,
+ type: "password",
+ description: (
+ <>
+ {t("integration.readwise.token.description")}{" "}
+
+ readwise.io/access_token
+
+ .
+ >
+ ),
+ }),
+ ],
+ },
+ {
+ key: "zotero",
+ title: t("integration.zotero.title"),
+ icon: ,
+ enabled: settings.enableZotero,
+ configured: Boolean(settings.zoteroUserID && settings.zoteroToken),
+ settings: [
+ defineSettingItem("enableZotero", {
+ label: t("integration.zotero.enable.label"),
+ description: t("integration.zotero.enable.description"),
+ }),
+ defineSettingItem("zoteroUserID", {
+ label: t("integration.zotero.userID.label"),
+ description: (
+ <>
+ {t("integration.zotero.userID.description")}{" "}
+
+ https://www.zotero.org/settings/keys
+
+ >
+ ),
+ vertical: true,
+ type: "password",
+ }),
+ defineSettingItem("zoteroToken", {
+ label: t("integration.zotero.token.label"),
+ description: (
+ <>
+ {t("integration.zotero.token.description")}{" "}
+
+ https://www.zotero.org/settings/keys/new
+
+ >
+ ),
+ vertical: true,
+ type: "password",
+ }),
+ ],
+ },
+ ],
+ }
+
+ const readingServices = {
+ id: "reading",
+ title: t("integration.categories.reading_services"),
+ icon: ,
+ integrations: [
+ {
+ key: "instapaper",
+ title: t("integration.instapaper.title"),
+ icon: ,
+ enabled: settings.enableInstapaper,
+ configured: Boolean(settings.instapaperUsername && settings.instapaperPassword),
+ settings: [
+ defineSettingItem("enableInstapaper", {
+ label: t("integration.instapaper.enable.label"),
+ description: t("integration.instapaper.enable.description"),
+ }),
+ defineSettingItem("instapaperUsername", {
+ label: t("integration.instapaper.username.label"),
+ vertical: true,
+ }),
+ defineSettingItem("instapaperPassword", {
+ label: t("integration.instapaper.password.label"),
+ vertical: true,
+ type: "password",
+ }),
+ ],
+ },
+ {
+ key: "readeck",
+ title: t("integration.readeck.title"),
+ icon: ,
+ enabled: settings.enableReadeck,
+ configured: Boolean(settings.readeckEndpoint && settings.readeckToken),
+ settings: [
+ defineSettingItem("enableReadeck", {
+ label: t("integration.readeck.enable.label"),
+ description: t("integration.readeck.enable.description"),
+ }),
+ defineSettingItem("readeckEndpoint", {
+ label: t("integration.readeck.endpoint.label"),
+ vertical: true,
+ description: t("integration.readeck.endpoint.description"),
+ }),
+ defineSettingItem("readeckToken", {
+ label: t("integration.readeck.token.label"),
+ vertical: true,
+ type: "password",
+ description: t("integration.readeck.token.description"),
+ }),
+ ],
+ },
+ ],
+ }
+
+ const mediaTools = {
+ id: "media",
+ title: t("integration.categories.media_tools"),
+ icon: ,
+ integrations: [
+ {
+ key: "eagle",
+ title: t("integration.eagle.title"),
+ icon: ,
+ enabled: settings.enableEagle,
+ configured: settings.enableEagle,
+ settings: [
+ defineSettingItem("enableEagle", {
+ label: t("integration.eagle.enable.label"),
+ description: t("integration.eagle.enable.description"),
+ }),
+ ],
+ },
+ ],
+ }
+
+ const downloadTools = {
+ id: "download",
+ title: t("integration.categories.download_tools"),
+ icon: ,
+ integrations: [
+ {
+ key: "qbittorrent",
+ title: t("integration.qbittorrent.title"),
+ icon: ,
+ enabled: settings.enableQBittorrent,
+ configured: Boolean(settings.qbittorrentHost && settings.qbittorrentUsername),
+ settings: [
+ defineSettingItem("enableQBittorrent", {
+ label: t("integration.qbittorrent.enable.label"),
+ description: t("integration.qbittorrent.enable.description"),
+ }),
+ defineSettingItem("qbittorrentHost", {
+ label: t("integration.qbittorrent.host.label"),
+ vertical: true,
+ description: t("integration.qbittorrent.host.description"),
+ }),
+ defineSettingItem("qbittorrentUsername", {
+ label: t("integration.qbittorrent.username.label"),
+ vertical: true,
+ }),
+ defineSettingItem("qbittorrentPassword", {
+ label: t("integration.qbittorrent.password.label"),
+ vertical: true,
+ type: "password",
+ }),
+ ],
+ },
+ ],
+ }
+
+ return [knowledgeManagement, readingServices, mediaTools, downloadTools]
+ }, [t, settings])
+
+ const filteredCategories = useMemo(() => {
+ if (!searchQuery) return integrationCategories
+
+ return integrationCategories
+ .map((category) => ({
+ ...category,
+ integrations: category.integrations.filter((integration) => {
+ const matchesSearch = searchQuery
+ ? (integration.title as string).toLowerCase().includes(searchQuery.toLowerCase()) ||
+ integration.key.toString().toLowerCase().includes(searchQuery.toLowerCase())
+ : true
+ return matchesSearch
+ }),
+ }))
+ .filter((category) => category.integrations.length > 0)
+ }, [integrationCategories, searchQuery])
+
+ const shouldDefaultOpen = useCallback((category: (typeof integrationCategories)[0]) => {
+ return category.integrations.some((integration) => integration.configured)
+ }, [])
+
+ return (
+
+ {/* Search Bar */}
+
+ }
+ canClear
+ placeholder={t("integration.search.placeholder")}
+ value={searchQuery}
+ onChange={useCallback((e: React.ChangeEvent) => {
+ setSearchQuery(e.target.value)
+ }, [])}
+ className="h-9"
+ aria-label="Search integrations"
+ />
+
+
+ {/* General Section */}
+
+
+ {
+ if (value) {
+ getFetchAdapter().preferClientFetch()
+ } else {
+ getFetchAdapter().preferElectronFetch()
+ }
+ },
+ }),
+ ]
+ : []),
+ ]}
+ />
+
+
+
+
+ {/* Built-in Integration Section */}
+ {filteredCategories.length > 0 ? (
+ <>
+
+
+
+
+
+ {filteredCategories.reduce(
+ (acc, cat) => acc + cat.integrations.filter((i) => i.configured).length,
+ 0,
+ )}
+ /{filteredCategories.reduce((acc, cat) => acc + cat.integrations.length, 0)}{" "}
+ configured
+
+
+
+
+ {filteredCategories.map((category) => (
+
+
+
+ {category.icon}
+
+ {category.title as string}
+
+
+ {category.integrations.filter((i) => i.configured).length}/
+ {category.integrations.length}
+
+
+ }
+ defaultOpen={shouldDefaultOpen(category)}
+ className="border-border bg-background rounded-lg border px-4 py-2 shadow-sm"
+ contentClassName="px-4 pb-4 pt-8"
+ >
+
+ {category.integrations.map((integration) => (
+
+
+
+ {integration.icon}
+
+
{integration.title as string}
+
+ {integration.configured && (
+
+
+ {t("integration.status.configured")}
+
+ )}
+ {integration.enabled && (
+
+
+ {t("integration.status.enabled")}
+
+ )}
+
+
+
+
+
+
+ ))}
+
+
+
+ ))}
+
+
+ >
+ ) : (
+
+
+
+ No built-in integration found
+
+
+ )}
+
+
+
+ {/* Custom Integration Section */}
+
+
+
+
+ )
+}
+
+const BottomTip = () => {
+ const { t } = useTranslation("settings")
+
+ const handleExport = useCallback(() => {
+ try {
+ const settings = getIntegrationSettings()
+ const jsonData = JSON.stringify(settings, null, 2)
+ const filename = `follow-integration-settings-${new Date().toISOString().split("T")[0]}.json`
+ downloadJsonFile(jsonData, filename)
+ toast.success(t("integration.export.success"))
+ } catch (error) {
+ console.error("Failed to export integration settings:", error)
+ toast.error(t("integration.export.error"))
+ }
+ }, [t])
+
+ const handleImport = useCallback(async () => {
+ try {
+ const jsonData = await selectJsonFile()
+ const settings = JSON.parse(jsonData)
+
+ // Validate the imported settings structure
+ if (typeof settings !== "object" || settings === null) {
+ throw new Error("Invalid settings format")
+ }
+
+ // Get current settings to use as a base for validation
+ const currentSettings = getIntegrationSettings()
+
+ // Only apply settings that exist in the current schema
+ let importCount = 0
+ Object.entries(settings).forEach(([key, value]) => {
+ if (key in currentSettings) {
+ setIntegrationSetting(key as any, value)
+ importCount++
+ }
+ })
+
+ if (importCount === 0) {
+ throw new Error("No valid settings found in the imported file")
+ }
+
+ toast.success(t("integration.import.success"))
+ } catch (error) {
+ if (error instanceof Error && error.message === "No file selected") {
+ // User cancelled file selection, don't show error
+ return
+ }
+ console.error("Failed to import integration settings:", error)
+ if (error instanceof SyntaxError) {
+ toast.error(t("integration.import.invalid"))
+ } else {
+ toast.error(t("integration.import.error"))
+ }
+ }
+ }, [t])
+
+ return (
+
+
+
+
+ {t("integration.tip")}
+
+
+
+
+ {t("integration.export.button")}
+
+
+
+ {t("integration.import.button")}
+
+
+
+
+ )
+}
diff --git a/apps/desktop/layer/renderer/src/modules/subscription-column/FeedItem.tsx b/apps/desktop/layer/renderer/src/modules/subscription-column/FeedItem.tsx
index 33608a59a..c7b3562a5 100644
--- a/apps/desktop/layer/renderer/src/modules/subscription-column/FeedItem.tsx
+++ b/apps/desktop/layer/renderer/src/modules/subscription-column/FeedItem.tsx
@@ -193,7 +193,7 @@ const FeedItemImpl = ({ view, feedId, className, isPreview }: FeedItemProps) =>
{isFeed && (
-
+
)}
{subscription?.isPrivate && (
diff --git a/apps/desktop/layer/renderer/src/modules/subscription-column/SubscriptionColumnHeader.tsx b/apps/desktop/layer/renderer/src/modules/subscription-column/SubscriptionColumnHeader.tsx
index 7386d7322..f29d0f2d3 100644
--- a/apps/desktop/layer/renderer/src/modules/subscription-column/SubscriptionColumnHeader.tsx
+++ b/apps/desktop/layer/renderer/src/modules/subscription-column/SubscriptionColumnHeader.tsx
@@ -13,7 +13,6 @@ import { Link } from "react-router"
import { toast } from "sonner"
import { setAppSearchOpen } from "~/atoms/app"
-import { useGeneralSettingKey } from "~/atoms/settings/general"
import { useIsZenMode, useSetZenMode } from "~/atoms/settings/ui"
import { setTimelineColumnShow, useTimelineColumnShow } from "~/atoms/sidebar"
import {
@@ -158,14 +157,12 @@ const LogoContextMenu: FC = ({ children }) => {
}
const SearchTrigger = () => {
- const canSearch = useGeneralSettingKey("dataPersist")
-
useHotkeys(
"meta+k,ctrl+k",
() => {
setAppSearchOpen(true)
},
- { enabled: canSearch, preventDefault: true },
+ { preventDefault: true },
)
return null
diff --git a/apps/desktop/layer/renderer/src/pages/(main)/(layer)/timeline/[timelineId]/[feedId]/layout.tsx b/apps/desktop/layer/renderer/src/pages/(main)/(layer)/timeline/[timelineId]/[feedId]/layout.tsx
index 0cbaccecb..0e1a2695d 100644
--- a/apps/desktop/layer/renderer/src/pages/(main)/(layer)/timeline/[timelineId]/[feedId]/layout.tsx
+++ b/apps/desktop/layer/renderer/src/pages/(main)/(layer)/timeline/[timelineId]/[feedId]/layout.tsx
@@ -1,5 +1,5 @@
import { withFeature } from "~/lib/features"
import { CenterColumnLayout } from "~/modules/app-layout/timeline-column/index"
-import { EntryColumnLayout } from "~/modules/entry-column/EntryColumnLayout"
+import { AIEntryLayout } from "~/modules/entry-column/AIEntryLayout"
-export const Component = withFeature("ai")(EntryColumnLayout, CenterColumnLayout)
+export const Component = withFeature("ai")(AIEntryLayout, CenterColumnLayout)
diff --git a/apps/desktop/layer/renderer/src/store/utils/clear.ts b/apps/desktop/layer/renderer/src/store/utils/clear.ts
index a2bc2a25d..cb1c5d7fa 100644
--- a/apps/desktop/layer/renderer/src/store/utils/clear.ts
+++ b/apps/desktop/layer/renderer/src/store/utils/clear.ts
@@ -1,14 +1,10 @@
import { deleteDB } from "@follow/database/db"
import { getStorageNS } from "@follow/utils/ns"
-import { clearUISettings } from "~/atoms/settings/ui"
-
import { clearImageDimensionsDb } from "../image/db"
export const clearLocalPersistStoreData = async () => {
await Promise.all([deleteDB(), clearImageDimensionsDb()])
-
- clearUISettings()
}
const storedUserId = getStorageNS("user_id")
diff --git a/apps/desktop/package.json b/apps/desktop/package.json
index aae910b76..74cbbcaae 100644
--- a/apps/desktop/package.json
+++ b/apps/desktop/package.json
@@ -1,7 +1,7 @@
{
"name": "Folo",
"type": "module",
- "version": "0.6.4",
+ "version": "0.7.0",
"private": true,
"description": "Follow everything in one place",
"author": "Folo Team",
@@ -74,7 +74,7 @@
"hono": "4.8.1",
"html-minifier-terser": "7.2.0",
"js-yaml": "4.1.0",
- "nbump": "2.1.3",
+ "nbump": "2.1.5",
"pathe": "2.0.3",
"react": "19.0.0",
"react-dom": "19.0.0",
@@ -89,5 +89,5 @@
"vite-tsconfig-paths": "5.1.4"
},
"productName": "Folo",
- "mainHash": "7247ff064ca9ecceac8fbc3da936ff92a4d3470aff141f0f8e0a00b67812d123"
+ "mainHash": "397ca1830dc371c7a6e7014ede2734a38a88d1265c8a2ccbf61070b4c789f36b"
}
diff --git a/apps/desktop/plugins/vite/compress.ts b/apps/desktop/plugins/vite/compress.ts
index c9a6b370f..dfe5ca5cf 100644
--- a/apps/desktop/plugins/vite/compress.ts
+++ b/apps/desktop/plugins/vite/compress.ts
@@ -44,7 +44,7 @@ function compressAndFingerprintPlugin(outDir: string): Plugin {
// Get the current git tag version
let version = "unknown"
try {
- version = execSync("git describe --tags").toString().trim()
+ version = execSync("git describe --tags").toString().trim().replace("desktop/", "")
} catch (error) {
console.warn("Could not retrieve git tag version:", error)
}
diff --git a/apps/desktop/tailwind.config.ts b/apps/desktop/tailwind.config.ts
index 20cc134b9..93eb0d13c 100644
--- a/apps/desktop/tailwind.config.ts
+++ b/apps/desktop/tailwind.config.ts
@@ -76,6 +76,14 @@ export default extendConfig({
backgroundPosition: "100% 50%",
},
},
+ shimmer: {
+ "0%": {
+ backgroundPosition: "200% 0",
+ },
+ "100%": {
+ backgroundPosition: "-200% 0",
+ },
+ },
},
animation: {
"caret-blink": "caret-blink 1.25s ease-out infinite",
@@ -83,6 +91,7 @@ export default extendConfig({
"accordion-up": "accordion-up 0.2s ease-out",
"gradient-x": "gradient-x 3s linear infinite",
glow: "glow 1.5s ease-in-out infinite",
+ shimmer: "shimmer 2s linear infinite",
},
},
},
diff --git a/apps/mobile/changelog/next.md b/apps/mobile/changelog/next.md
index 000f858e3..e59e74d12 100644
--- a/apps/mobile/changelog/next.md
+++ b/apps/mobile/changelog/next.md
@@ -2,6 +2,8 @@
## Shiny new things
+- Add option for independent content font size and presets
+
## Improvements
## No longer broken
diff --git a/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift b/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift
index 93d4e3a4b..d02c221a8 100644
--- a/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift
+++ b/apps/mobile/native/ios/Modules/SharedWebView/FOWebView.swift
@@ -203,6 +203,14 @@ extension FOWebView: WKNavigationDelegate, WKScriptMessageHandler, WKUIDelegate
self.state.previewImages(urls: urls, index: index)
}
}
+ case "audio:seekTo":
+ let data = try? JSONDecoder().decode(
+ AudioSeekPayload.self, from: decode
+ )
+ guard let data = data else { return }
+ DispatchQueue.main.async {
+ self.state.seekAudio(time: data.payload.time)
+ }
default:
break
diff --git a/apps/mobile/native/ios/Modules/SharedWebView/Injected/at_start.js b/apps/mobile/native/ios/Modules/SharedWebView/Injected/at_start.js
index 869e00170..895a672b0 100644
--- a/apps/mobile/native/ios/Modules/SharedWebView/Injected/at_start.js
+++ b/apps/mobile/native/ios/Modules/SharedWebView/Injected/at_start.js
@@ -32,5 +32,13 @@
},
})
},
+ seekAudio: (time) => {
+ send({
+ type: "audio:seekTo",
+ payload: {
+ time,
+ },
+ })
+ },
}
})()
diff --git a/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView+BridgeData.swift b/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView+BridgeData.swift
index 4cf8e5a62..0dcc8b4c0 100644
--- a/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView+BridgeData.swift
+++ b/apps/mobile/native/ios/Modules/SharedWebView/SharedWebView+BridgeData.swift
@@ -5,6 +5,7 @@
// Created by Innei on 2025/2/7.
//
import Foundation
+import UIKit
private protocol BasePayload {
var type: String { get }
@@ -28,3 +29,12 @@ struct PreviewImagePayload: Codable, BasePayload {
var type: String
var payload: PreviewImagePayloadProps
}
+
+struct AudioSeekPayloadProps: Codable {
+ let time: Double
+}
+
+struct AudioSeekPayload: Codable, BasePayload {
+ var type: String
+ var payload: AudioSeekPayloadProps
+}
\ No newline at end of file
diff --git a/apps/mobile/native/ios/Modules/SharedWebView/SharedWebViewModule.swift b/apps/mobile/native/ios/Modules/SharedWebView/SharedWebViewModule.swift
index 9dd2d246b..d755a3ac7 100644
--- a/apps/mobile/native/ios/Modules/SharedWebView/SharedWebViewModule.swift
+++ b/apps/mobile/native/ios/Modules/SharedWebView/SharedWebViewModule.swift
@@ -10,6 +10,7 @@ import WebKit
let onContentHeightChanged = "onContentHeightChanged"
let onImagePreview = "onImagePreview"
+let onSeekAudio = "onSeekAudio"
public class SharedWebViewModule: Module {
private var pendingJavaScripts: [String] = []
@@ -36,6 +37,7 @@ public class SharedWebViewModule: Module {
View(WebViewView.self) {
Events("onContentHeightChange")
+ Events("onSeekAudio")
Prop("url") { (_: UIView, urlString: String) in
DispatchQueue.main.async {
@@ -46,6 +48,7 @@ public class SharedWebViewModule: Module {
Events(onContentHeightChanged)
Events(onImagePreview)
+ Events(onSeekAudio)
OnStartObserving {
// Monitor content height changes
@@ -64,6 +67,14 @@ public class SharedWebViewModule: Module {
self?.sendEvent(onImagePreview, ["imageUrls": event.imageUrls, "index": event.index])
}
.store(in: &self.cancellables)
+
+ WebViewManager.state.$audioSeekEvent
+ .receive(on: DispatchQueue.main)
+ .compactMap { $0 }
+ .sink { [weak self] event in
+ self?.sendEvent(onSeekAudio, ["time": event.time])
+ }
+ .store(in: &self.cancellables)
}
OnStopObserving {
diff --git a/apps/mobile/native/ios/Modules/SharedWebView/WebViewState.swift b/apps/mobile/native/ios/Modules/SharedWebView/WebViewState.swift
index 5488af7ee..dae437bc0 100644
--- a/apps/mobile/native/ios/Modules/SharedWebView/WebViewState.swift
+++ b/apps/mobile/native/ios/Modules/SharedWebView/WebViewState.swift
@@ -13,11 +13,20 @@ struct ImagePreviewEvent {
let index: Int
}
+struct AudioSeekEvent {
+ let time: Double
+}
+
class WebViewState: ObservableObject {
@Published var contentHeight: CGFloat = UIWindow().bounds.height
@Published var imagePreviewEvent: ImagePreviewEvent?
+ @Published var audioSeekEvent: AudioSeekEvent?
func previewImages(urls: [String], index: Int) {
imagePreviewEvent = ImagePreviewEvent(imageUrls: urls, index: index)
}
+
+ func seekAudio(time: Double) {
+ audioSeekEvent = AudioSeekEvent(time: time)
+ }
}
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 2205116d7..0369461ee 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -6,6 +6,7 @@
"scripts": {
"android": "expo run:android",
"bump": "vv",
+ "changelog:generate": "tsx ../../packages/changelog-cli/index.ts",
"dev": "npm run start",
"eas-build-post-install": "rm -rf $TMPDIR/metro-cache",
"eas-build-pre-install": "command -v pod >/dev/null 2>&1 && pod repo update || echo 'CocoaPods not found, skipping pod repo update'",
@@ -44,7 +45,7 @@
"@react-native-masked-view/masked-view": "0.3.2",
"@react-native-menu/menu": "1.2.3",
"@react-native-picker/picker": "2.11.1",
- "@shopify/flash-list": "1.8.3",
+ "@shopify/flash-list": "2.0.0",
"@tanstack/query-sync-storage-persister": "5.81.5",
"@tanstack/react-query": "5.81.5",
"@tanstack/react-query-persist-client": "5.81.5",
@@ -142,7 +143,7 @@
"babel-plugin-inline-import": "3.0.0",
"eas-cli": "16.13.4",
"expo-drizzle-studio-plugin": "0.2.0",
- "nbump": "2.1.3",
+ "nbump": "2.1.5",
"postcss": "8.5.6",
"sf-symbols-typescript": "2.1.0",
"typescript": "catalog:"
diff --git a/apps/mobile/scripts/changelog-cli/config.json b/apps/mobile/scripts/changelog-cli/config.json
new file mode 100644
index 000000000..57c8fea5d
--- /dev/null
+++ b/apps/mobile/scripts/changelog-cli/config.json
@@ -0,0 +1,54 @@
+{
+ "internalTeamMembers": [
+ "Innei",
+ "DIYgod",
+ "hyoban",
+ "renovate[bot]",
+ "github-actions[bot]",
+ "dependabot[bot]",
+ "vercel[bot]",
+ "whitewater"
+ ],
+ "aiModel": {
+ "provider": "openai",
+ "model": "gpt-4o-mini",
+ "temperature": 0.3,
+ "maxTokens": 1000,
+ "apiKey": "",
+ "baseURL": "https://openrouter.ai/v1",
+ "customEndpoint": ""
+ },
+ "commitAnalysis": {
+ "categories": {
+ "features": {
+ "keywords": ["feat", "feature", "add", "implement", "introduce"],
+ "section": "Shiny new things"
+ },
+ "improvements": {
+ "keywords": ["improve", "enhance", "optimize", "refactor", "update", "perf"],
+ "section": "Improvements"
+ },
+ "fixes": {
+ "keywords": ["fix", "bug", "patch", "resolve", "correct"],
+ "section": "No longer broken"
+ }
+ },
+ "ignorePatterns": [
+ "^chore:",
+ "^docs:",
+ "^test:",
+ "^ci:",
+ "^build:",
+ "Merge pull request",
+ "Merge branch",
+ "version bump",
+ "changelog",
+ "Update dependencies"
+ ]
+ },
+ "changelog": {
+ "maxCommitsPerSection": 5,
+ "includeCommitHash": true,
+ "includePullRequestLinks": true
+ }
+}
diff --git a/apps/mobile/src/atoms/settings/general.ts b/apps/mobile/src/atoms/settings/general.ts
index f4a6be281..521d30adb 100644
--- a/apps/mobile/src/atoms/settings/general.ts
+++ b/apps/mobile/src/atoms/settings/general.ts
@@ -33,7 +33,6 @@ export const generalServerSyncWhiteListKeys: (keyof GeneralSettings)[] = [
"sendAnonymousData",
"language",
"appLaunchOnStartup",
- "dataPersist",
"voice",
]
diff --git a/apps/mobile/src/atoms/settings/ui.ts b/apps/mobile/src/atoms/settings/ui.ts
index 343396cb2..59c8c9fe7 100644
--- a/apps/mobile/src/atoms/settings/ui.ts
+++ b/apps/mobile/src/atoms/settings/ui.ts
@@ -8,6 +8,8 @@ import { createSettingAtom } from "./internal/helper"
export interface UISettings extends BaseUISettings {
fontScale: number
useSystemFontScaling: boolean
+ useDifferentFontSizeForContent: boolean
+ mobileContentFontSize: number
}
export const createDefaultSettings = (): UISettings => ({
...defaultUISettings,
@@ -15,6 +17,8 @@ export const createDefaultSettings = (): UISettings => ({
fontScale: 1,
useSystemFontScaling: true,
+ useDifferentFontSizeForContent: false,
+ mobileContentFontSize: 16,
})
export const {
diff --git a/apps/mobile/src/components/native/webview/EntryContentWebView.tsx b/apps/mobile/src/components/native/webview/EntryContentWebView.tsx
index c9b81553b..fef5b728b 100644
--- a/apps/mobile/src/components/native/webview/EntryContentWebView.tsx
+++ b/apps/mobile/src/components/native/webview/EntryContentWebView.tsx
@@ -3,16 +3,19 @@ import { EventBus } from "@follow/utils/event-bus"
import { Portal } from "@gorhom/portal"
import { useAtom } from "jotai"
import * as React from "react"
-import { useEffect } from "react"
+import { useCallback, useEffect } from "react"
import { TouchableOpacity, View } from "react-native"
import { runOnJS, runOnUI } from "react-native-reanimated"
+import TrackPlayer from "react-native-track-player"
import { BugCuteReIcon } from "@/src/icons/bug_cute_re"
+import { player } from "@/src/lib/player"
import { useLightboxControls } from "../../ui/lightbox/lightboxState"
import { PlatformActivityIndicator } from "../../ui/loading/PlatformActivityIndicator"
import { sharedWebViewHeightAtom } from "./atom"
import { useWebViewEntry, useWebViewMode } from "./hooks"
+import type { AudioSeekEvent } from "./index"
import { prepareEntryRenderWebView } from "./index"
import { NativeWebView } from "./native-webview"
import { WebViewManager } from "./webview-manager"
@@ -34,6 +37,35 @@ export function EntryContentWebView(props: EntryContentWebViewProps) {
const { entryInWebview, isLoading } = useWebViewEntry(props)
const { handleModeSwitch, mode } = useWebViewMode()
+ const handleSeekAudio = useCallback(
+ async (e: AudioSeekEvent) => {
+ const activeTrack = await TrackPlayer.getActiveTrack()
+ const entryAudio = entryInWebview?.attachments?.find((attachment) =>
+ attachment.mime_type?.startsWith("audio/"),
+ )
+ if (!entryAudio) {
+ console.warn("Failed to seek audio! No audio attachment found")
+ return
+ }
+ if (activeTrack?.url !== entryAudio.url) {
+ await player.play({
+ url: entryAudio.url || "",
+ title: entryInWebview?.title || "Unknown Title",
+ artist: entryInWebview?.author || "Unknown Artist",
+ })
+ }
+ await player.seekTo(e.time)
+ },
+ [entryInWebview?.attachments, entryInWebview?.author, entryInWebview?.title],
+ )
+
+ // Handle audio seek events
+ useEffect(() => {
+ return EventBus.subscribe("SEEK_AUDIO", (event) => {
+ handleSeekAudio(event)
+ })
+ }, [handleSeekAudio])
+
// Handle image preview events
useEffect(() => {
return EventBus.subscribe("PREVIEW_IMAGE", (event) => {
@@ -82,6 +114,7 @@ export function EntryContentWebView(props: EntryContentWebViewProps) {
onContentHeightChange={(e) => {
setContentHeight(e.nativeEvent.height)
}}
+ onSeekAudio={handleSeekAudio}
/>
diff --git a/apps/mobile/src/components/native/webview/hooks.ts b/apps/mobile/src/components/native/webview/hooks.ts
index 33bbe2639..31bfab0a1 100644
--- a/apps/mobile/src/components/native/webview/hooks.ts
+++ b/apps/mobile/src/components/native/webview/hooks.ts
@@ -61,12 +61,25 @@ export function useWebViewEntry({
const readerRenderInlineStyle = useUISettingKey("readerRenderInlineStyle")
const useSystemFontScaling = useUISettingKey("useSystemFontScaling")
const customFontScale = useUISettingKey("fontScale")
+ const useDifferentFontSizeForContent = useUISettingKey("useDifferentFontSizeForContent")
+ const mobileContentFontSize = useUISettingKey("mobileContentFontSize")
useEffect(() => {
const fontScale = useSystemFontScaling ? PixelRatio.getFontScale() : customFontScale
WebViewManager.setRootFontSize(fontScale * 16)
}, [useSystemFontScaling, customFontScale])
+ // Handle content-specific font size
+ useEffect(() => {
+ if (useDifferentFontSizeForContent) {
+ WebViewManager.setRootFontSize(mobileContentFontSize)
+ } else {
+ // Reset to use the global font scaling
+ const fontScale = useSystemFontScaling ? PixelRatio.getFontScale() : customFontScale
+ WebViewManager.setRootFontSize(fontScale * 16)
+ }
+ }, [useDifferentFontSizeForContent, mobileContentFontSize, useSystemFontScaling, customFontScale])
+
// Prepare entry data for WebView
const entryInWebview = useMemo(() => {
if (!entry) return null
diff --git a/apps/mobile/src/components/native/webview/index.ts b/apps/mobile/src/components/native/webview/index.ts
index 86d6b52c6..a182acad6 100644
--- a/apps/mobile/src/components/native/webview/index.ts
+++ b/apps/mobile/src/components/native/webview/index.ts
@@ -9,15 +9,21 @@ export interface ImagePreviewEvent {
index: number
}
+export interface AudioSeekEvent {
+ time: number
+}
+
declare module "@follow/utils/event-bus" {
export interface CustomEvent {
PREVIEW_IMAGE: ImagePreviewEvent
+ SEEK_AUDIO: AudioSeekEvent
}
}
declare class ISharedWebViewModule extends NativeModule<{
onContentHeightChanged: ({ height }: { height: number }) => void
onImagePreview: (event: ImagePreviewEvent) => void
+ onSeekAudio?: (e: { time: number }) => void
}> {
load(url: string): void
evaluateJavaScript(js: string): void
@@ -51,6 +57,9 @@ export const prepareEntryRenderWebView = () => {
SharedWebViewModule.addListener("onImagePreview", (event: ImagePreviewEvent) => {
EventBus.dispatch("PREVIEW_IMAGE", event)
})
+ SharedWebViewModule.addListener("onSeekAudio", (event: AudioSeekEvent) => {
+ EventBus.dispatch("SEEK_AUDIO", event)
+ })
} catch (error) {
console.error("Failed to prepare entry render WebView:", error)
}
diff --git a/apps/mobile/src/components/native/webview/injected-js.ts b/apps/mobile/src/components/native/webview/injected-js.ts
index 4d2c7439d..86abd2e18 100644
--- a/apps/mobile/src/components/native/webview/injected-js.ts
+++ b/apps/mobile/src/components/native/webview/injected-js.ts
@@ -30,6 +30,14 @@ export const atStart = `
},
})
},
+ seekAudio: (time) => {
+ send({
+ type: "audio:seekTo",
+ payload: {
+ time,
+ },
+ })
+ }
}
})()
`
diff --git a/apps/mobile/src/components/native/webview/native-webview.android.tsx b/apps/mobile/src/components/native/webview/native-webview.android.tsx
index 4786af169..716410444 100644
--- a/apps/mobile/src/components/native/webview/native-webview.android.tsx
+++ b/apps/mobile/src/components/native/webview/native-webview.android.tsx
@@ -1,3 +1,4 @@
+import { useTypeScriptHappyCallback } from "@follow/hooks"
import { jotaiStore } from "@follow/utils"
import { atom } from "jotai"
import type * as React from "react"
@@ -36,9 +37,10 @@ const onLoadEnd = () => {
export const NativeWebView: React.ComponentType<
ViewProps & {
onContentHeightChange?: (e: { nativeEvent: { height: number } }) => void
+ onSeekAudio?: (e: { time: number }) => void
url?: string
}
-> = ({ onContentHeightChange }) => {
+> = ({ onContentHeightChange, onSeekAudio }) => {
const webViewRef = useRef(null)
const { onNavigationStateChange } = useWebViewNavigation({ webViewRef })
const { openLightbox } = useLightboxControls()
@@ -70,34 +72,50 @@ export const NativeWebView: React.ComponentType<
}}
onNavigationStateChange={onNavigationStateChange}
onLoadEnd={onLoadEnd}
- onMessage={(e) => {
- const message = e.nativeEvent.data
- const parsed = JSON.parse(message)
- if (parsed.type === "setContentHeight") {
- onContentHeightChange?.({
- nativeEvent: { height: parsed.payload },
- })
- return
- } else if (parsed.type === "previewImage") {
- const { imageUrls, index } = parsed.payload
- runOnUI(() => {
- "worklet"
- // const rect = measureHandle(aviHandle)
- runOnJS(openLightbox)({
- images: (imageUrls as string[]).map((url: string) => ({
- uri: url,
- dimensions: null,
- thumbUri: url,
- thumbDimensions: null,
- thumbRect: null,
- type: "image",
- })),
- index,
- })
- })()
- return
- }
- }}
+ onMessage={useTypeScriptHappyCallback(
+ (e) => {
+ const message = e.nativeEvent.data
+ const parsed = JSON.parse(message)
+ switch (parsed.type) {
+ case "setContentHeight": {
+ onContentHeightChange?.({
+ nativeEvent: { height: parsed.payload },
+ })
+ return
+ }
+ case "previewImage": {
+ const { imageUrls, index } = parsed.payload
+ runOnUI(() => {
+ "worklet"
+ // const rect = measureHandle(aviHandle)
+ runOnJS(openLightbox)({
+ images: (imageUrls as string[]).map((url: string) => ({
+ uri: url,
+ dimensions: null,
+ thumbUri: url,
+ thumbDimensions: null,
+ thumbRect: null,
+ type: "image",
+ })),
+ index,
+ })
+ })()
+ return
+ }
+ case "audio:seekTo": {
+ const { time } = parsed.payload
+ if (typeof time !== "number") {
+ console.warn("Failed to seek audio! Invalid time", time)
+ return
+ }
+ onSeekAudio?.({ time })
+ break
+ }
+ // No default
+ }
+ },
+ [onContentHeightChange, onSeekAudio, openLightbox],
+ )}
/>
)
}
diff --git a/apps/mobile/src/components/native/webview/native-webview.tsx b/apps/mobile/src/components/native/webview/native-webview.tsx
index 5c5486988..03178d40d 100644
--- a/apps/mobile/src/components/native/webview/native-webview.tsx
+++ b/apps/mobile/src/components/native/webview/native-webview.tsx
@@ -5,6 +5,7 @@ import type { ViewProps } from "react-native"
export const NativeWebView: React.ComponentType<
ViewProps & {
onContentHeightChange?: (e: { nativeEvent: { height: number } }) => void
+ onSeekAudio?: (e: { time: number }) => void
url?: string
}
> = requireNativeView("FOSharedWebView")
diff --git a/apps/mobile/src/hooks/useMessaging.ts b/apps/mobile/src/hooks/useMessaging.ts
index 3ea04e48b..aa71223db 100644
--- a/apps/mobile/src/hooks/useMessaging.ts
+++ b/apps/mobile/src/hooks/useMessaging.ts
@@ -1,4 +1,5 @@
import { useHasNotificationActions } from "@follow/store/action/hooks"
+import { ROUTE_FEED_IN_INBOX } from "@follow/store/constants/app"
import { useWhoami } from "@follow/store/user/hooks"
import { getApp } from "@react-native-firebase/app"
import type { FirebaseMessagingTypes } from "@react-native-firebase/messaging"
@@ -48,6 +49,7 @@ export function useMessaging() {
function navigateToEntry(message: FirebaseMessagingTypes.RemoteMessage) {
if (
!message.data ||
+ message.data.type !== "new-entry" ||
typeof message.data.view !== "string" ||
typeof message.data.entryId !== "string"
) {
@@ -57,6 +59,7 @@ export function useMessaging() {
navigation.pushControllerView(EntryDetailScreen, {
entryId: message.data.entryId,
view: Number.parseInt(message.data.view),
+ isInbox: String(message.data.feedId).startsWith(ROUTE_FEED_IN_INBOX),
})
}
diff --git a/apps/mobile/src/modules/discover/Recommendations.tsx b/apps/mobile/src/modules/discover/Recommendations.tsx
index 33509c038..cc8d76fd5 100644
--- a/apps/mobile/src/modules/discover/Recommendations.tsx
+++ b/apps/mobile/src/modules/discover/Recommendations.tsx
@@ -1,12 +1,12 @@
import { RSSHubCategories } from "@follow/constants"
import type { RSSHubRouteDeclaration } from "@follow/models/rsshub"
import { isASCII } from "@follow/utils"
-import type { ContentStyle } from "@shopify/flash-list"
+import type { FlashListRef } from "@shopify/flash-list"
import { FlashList } from "@shopify/flash-list"
import { useQuery } from "@tanstack/react-query"
import { useEffect, useMemo, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
-import type { ScrollView } from "react-native"
+import type { ScrollView, StyleProp, ViewStyle } from "react-native"
import { Animated, useAnimatedValue, useWindowDimensions, View } from "react-native"
import type { SharedValue } from "react-native-reanimated"
import { useSharedValue } from "react-native-reanimated"
@@ -137,7 +137,7 @@ const LanguageMap = {
cmn: "zh-CN",
} as const
export const RecommendationTab: TabComponent<{
- contentContainerStyle?: ContentStyle
+ contentContainerStyle?: StyleProp
insets?: {
top?: number
bottom?: number
@@ -231,7 +231,7 @@ export const RecommendationTab: TabComponent<{
// Add ref for FlashList
const listRef = useRegisterNavigationScrollView<
- FlashList<{
+ FlashListRef<{
key: string
data: RSSHubRouteDeclaration
}>
@@ -287,7 +287,6 @@ export const RecommendationTab: TabComponent<{
}
}}
scrollEventThrottle={16}
- estimatedItemSize={150}
ref={listRef}
data={alphabetGroups}
keyExtractor={keyExtractor}
diff --git a/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx b/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx
index b25a21a67..97d7f42a2 100644
--- a/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx
+++ b/apps/mobile/src/modules/entry-list/EntryListContentArticle.tsx
@@ -1,6 +1,6 @@
import type { FeedViewType } from "@follow/constants"
import { usePrefetchEntryTranslation } from "@follow/store/translation/hooks"
-import type { FlashList, ListRenderItemInfo } from "@shopify/flash-list"
+import type { FlashListRef, ListRenderItemInfo } from "@shopify/flash-list"
import type { ElementRef } from "react"
import { useCallback, useImperativeHandle, useMemo, useRef } from "react"
import { View } from "react-native"
@@ -43,7 +43,7 @@ export const EntryListContentArticle = ({
[hasNextPage, fetchedTime],
)
- const ref = useRef>(null)
+ const ref = useRef>(null)
const { onViewableItemsChanged, onScroll, viewableItems } = useOnViewableItemsChanged({
disabled: active === false || isFetching,
@@ -82,7 +82,6 @@ export const EntryListContentArticle = ({
data={entryIds}
extraData={extraData}
keyExtractor={defaultKeyExtractor}
- estimatedItemSize={100}
renderItem={renderItem}
onEndReached={fetchNextPage}
onScroll={onScroll}
diff --git a/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx b/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx
index 5448284ce..08ccf0812 100644
--- a/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx
+++ b/apps/mobile/src/modules/entry-list/EntryListContentPicture.tsx
@@ -1,6 +1,6 @@
import { useTypeScriptHappyCallback } from "@follow/hooks"
import { usePrefetchEntryTranslation } from "@follow/store/translation/hooks"
-import type { FlashList, MasonryFlashListProps } from "@shopify/flash-list"
+import type { FlashListProps, FlashListRef } from "@shopify/flash-list"
import type { ElementRef } from "react"
import { useImperativeHandle, useRef } from "react"
import { StyleSheet, View } from "react-native"
@@ -24,10 +24,10 @@ export const EntryListContentPicture = ({
active,
...rest
}: { entryIds: string[] | null; active?: boolean } & Omit<
- MasonryFlashListProps,
+ FlashListProps,
"data" | "renderItem"
> & { ref?: React.Ref | null> }) => {
- const ref = useRef>(null)
+ const ref = useRef>(null)
useImperativeHandle(forwardRef, () => ref.current!)
const { fetchNextPage, refetch, isRefetching, hasNextPage, isFetching, isReady } = useEntries()
@@ -84,7 +84,6 @@ export const EntryListContentPicture = ({
onScroll={onScroll}
onEndReached={fetchNextPage}
numColumns={2}
- estimatedItemSize={100}
contentContainerStyle={styles.contentContainer}
ListFooterComponent={
hasNextPage ? (
diff --git a/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx b/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx
index 33d35f0b6..99639d135 100644
--- a/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx
+++ b/apps/mobile/src/modules/entry-list/EntryListContentSocial.tsx
@@ -1,5 +1,5 @@
import { usePrefetchEntryTranslation } from "@follow/store/translation/hooks"
-import type { FlashList, ListRenderItemInfo } from "@shopify/flash-list"
+import type { FlashListRef, ListRenderItemInfo } from "@shopify/flash-list"
import type { ElementRef } from "react"
import { useCallback, useImperativeHandle, useMemo, useRef } from "react"
import { View } from "react-native"
@@ -25,7 +25,7 @@ export const EntryListContentSocial = ({
const { fetchNextPage, isFetching, refetch, isRefetching, hasNextPage, isReady } = useEntries()
const extraData: EntryExtraData = useMemo(() => ({ entryIds }), [entryIds])
- const ref = useRef>(null)
+ const ref = useRef>(null)
useImperativeHandle(forwardRef, () => ref.current!)
// eslint-disable-next-line @eslint-react/hooks-extra/no-unnecessary-use-callback
const renderItem = useCallback(
@@ -61,7 +61,6 @@ export const EntryListContentSocial = ({
isRefetching={false}
data={Array.from({ length: 5 }).map((_, index) => `skeleton-${index}`)}
keyExtractor={(id) => id}
- estimatedItemSize={5}
renderItem={EntryItemSkeleton}
ItemSeparatorComponent={ItemSeparatorFullWidth}
/>
@@ -78,7 +77,6 @@ export const EntryListContentSocial = ({
data={entryIds}
extraData={extraData}
keyExtractor={(id) => id}
- estimatedItemSize={100}
renderItem={renderItem}
onEndReached={fetchNextPage}
onViewableItemsChanged={onViewableItemsChanged}
diff --git a/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx b/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx
index f9ccbcc5c..d963abaaa 100644
--- a/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx
+++ b/apps/mobile/src/modules/entry-list/EntryListContentVideo.tsx
@@ -1,6 +1,6 @@
import { useTypeScriptHappyCallback } from "@follow/hooks"
import { usePrefetchEntryTranslation } from "@follow/store/translation/hooks"
-import type { FlashList, MasonryFlashListProps } from "@shopify/flash-list"
+import type { FlashListProps, FlashListRef } from "@shopify/flash-list"
import type { ElementRef } from "react"
import { useImperativeHandle, useMemo, useRef } from "react"
import { StyleSheet, View } from "react-native"
@@ -22,10 +22,10 @@ export const EntryListContentVideo = ({
active,
...rest
}: { entryIds: string[] | null; active?: boolean } & Omit<
- MasonryFlashListProps,
+ FlashListProps,
"data" | "renderItem"
> & { ref?: React.Ref | null> }) => {
- const ref = useRef>(null)
+ const ref = useRef>(null)
useImperativeHandle(forwardRef, () => ref.current!)
const { fetchNextPage, refetch, isRefetching, isFetching, hasNextPage, isReady } = useEntries()
const { onViewableItemsChanged, onScroll, viewableItems } = useOnViewableItemsChanged({
@@ -95,7 +95,6 @@ export const EntryListContentVideo = ({
onScroll={onScroll}
onEndReached={fetchNextPage}
numColumns={2}
- estimatedItemSize={100}
ListFooterComponent={ListFooterComponent}
{...rest}
onRefresh={refetch}
diff --git a/apps/mobile/src/modules/entry-list/EntryListSelector.tsx b/apps/mobile/src/modules/entry-list/EntryListSelector.tsx
index 8a19aba00..83949351d 100644
--- a/apps/mobile/src/modules/entry-list/EntryListSelector.tsx
+++ b/apps/mobile/src/modules/entry-list/EntryListSelector.tsx
@@ -1,6 +1,6 @@
import { FeedViewType } from "@follow/constants"
import { useWhoami } from "@follow/store/user/hooks"
-import type { FlashList } from "@shopify/flash-list"
+import type { FlashListRef } from "@shopify/flash-list"
import type { RefObject } from "react"
import { useEffect } from "react"
@@ -30,7 +30,7 @@ type EntryListSelectorProps = {
}
function EntryListSelectorImpl({ entryIds, viewId, active = true }: EntryListSelectorProps) {
- const ref = useRegisterNavigationScrollView>(active)
+ const ref = useRegisterNavigationScrollView>(active)
let ContentComponent:
| typeof EntryListContentSocial
@@ -89,7 +89,7 @@ export const EntryListSelector = withErrorBoundary(
)
const useAutoScrollToEntryAfterPullUpToNext = (
- ref: RefObject | null>,
+ ref: RefObject | null>,
entryIds: string[],
) => {
const navigation = useNavigation()
diff --git a/apps/mobile/src/modules/entry-list/hooks.ts b/apps/mobile/src/modules/entry-list/hooks.ts
index 989cbaeb8..63a8d49c2 100644
--- a/apps/mobile/src/modules/entry-list/hooks.ts
+++ b/apps/mobile/src/modules/entry-list/hooks.ts
@@ -1,6 +1,6 @@
import { debouncedFetchEntryContentByStream } from "@follow/store/entry/store"
import { unreadSyncService } from "@follow/store/unread/store"
-import type ViewToken from "@shopify/flash-list/dist/viewability/ViewToken"
+import type { ViewToken } from "@shopify/flash-list"
import { fetch as expoFetch } from "expo/fetch"
import { useCallback, useEffect, useInsertionEffect, useMemo, useRef, useState } from "react"
import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native"
@@ -8,14 +8,14 @@ import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native"
import { useGeneralSettingKey } from "@/src/atoms/settings/general"
import { getCookie } from "@/src/lib/auth"
-const defaultIdExtractor = (item: ViewToken) => item.key
+const defaultIdExtractor = (item: ViewToken) => item.key
export function useOnViewableItemsChanged({
disabled,
idExtractor = defaultIdExtractor,
onScroll: onScrollProp,
}: {
disabled?: boolean
- idExtractor?: (item: ViewToken) => string
+ idExtractor?: (item: ViewToken) => string
onScroll?: (e: NativeSyntheticEvent) => void
} = {}) {
const orientation = useRef<"down" | "up">("down")
@@ -23,15 +23,15 @@ export function useOnViewableItemsChanged({
const markAsReadWhenScrolling = useGeneralSettingKey("scrollMarkUnread")
const markAsReadWhenRendering = useGeneralSettingKey("renderMarkUnread")
- const [viewableItems, setViewableItems] = useState([])
- const [lastViewableItems, setLastViewableItems] = useState()
- const [lastRemovedItems, setLastRemovedItems] = useState(null)
+ const [viewableItems, setViewableItems] = useState[]>([])
+ const [lastViewableItems, setLastViewableItems] = useState[] | null>()
+ const [lastRemovedItems, setLastRemovedItems] = useState[] | null>(null)
const [stableIdExtractor] = useState(() => idExtractor)
const onViewableItemsChanged: (info: {
- viewableItems: ViewToken[]
- changed: ViewToken[]
+ viewableItems: ViewToken[]
+ changed: ViewToken[]
}) => void = useNonReactiveCallback(({ viewableItems, changed }) => {
setViewableItems(viewableItems)
diff --git a/apps/mobile/src/modules/feed/FollowFeed.tsx b/apps/mobile/src/modules/feed/FollowFeed.tsx
index 6e7a2a94c..b4782c602 100644
--- a/apps/mobile/src/modules/feed/FollowFeed.tsx
+++ b/apps/mobile/src/modules/feed/FollowFeed.tsx
@@ -78,7 +78,7 @@ function FollowImpl(props: { feedId: string; defaultView?: FeedViewType }) {
const { t } = useTranslation()
const { t: tCommon } = useTranslation("common")
const textLabelColor = useColor("label")
- const { feedId: id, defaultView } = props
+ const { feedId: id, defaultView = FeedViewType.Articles } = props
const feed = useFeedById(id)
const subscription = useSubscriptionByFeedId(feed?.id)
const isSubscribed = !!subscription
@@ -89,7 +89,7 @@ function FollowImpl(props: { feedId: string; defaultView?: FeedViewType }) {
isPrivate: subscription?.isPrivate ?? undefined,
hideFromTimeline: subscription?.hideFromTimeline ?? undefined,
title: subscription?.title ?? undefined,
- view: subscription?.view ?? defaultView ?? FeedViewType.Articles,
+ view: subscription?.view ?? defaultView,
},
})
useEffect(() => {
@@ -290,7 +290,7 @@ function FollowImpl(props: { feedId: string; defaultView?: FeedViewType }) {
name="view"
control={form.control}
render={({ field: { onChange, value } }) => (
-
+
)}
/>
diff --git a/apps/mobile/src/modules/screen/TimelineSelectorList.tsx b/apps/mobile/src/modules/screen/TimelineSelectorList.tsx
index 7c7994ae5..affac8f9e 100644
--- a/apps/mobile/src/modules/screen/TimelineSelectorList.tsx
+++ b/apps/mobile/src/modules/screen/TimelineSelectorList.tsx
@@ -2,14 +2,9 @@ import { useTypeScriptHappyCallback } from "@follow/hooks"
import { usePrefetchSubscription } from "@follow/store/subscription/hooks"
import { usePrefetchUnread } from "@follow/store/unread/hooks"
import { nextFrame } from "@follow/utils"
-import type {
- FlashListProps,
- MasonryFlashListProps,
- MasonryFlashListRef,
-} from "@shopify/flash-list"
-import { FlashList, MasonryFlashList } from "@shopify/flash-list"
+import type { FlashListProps, FlashListRef } from "@shopify/flash-list"
+import { FlashList } from "@shopify/flash-list"
import * as Haptics from "expo-haptics"
-import type { ElementRef, RefObject } from "react"
import { use, useCallback, useImperativeHandle, useRef } from "react"
import type { NativeScrollEvent, NativeSyntheticEvent } from "react-native"
import { RefreshControl, View } from "react-native"
@@ -32,8 +27,9 @@ export const TimelineSelectorList = ({
onRefresh,
isRefetching,
...props
-}: Props & Omit, "onRefresh"> & { ref?: React.Ref | null> }) => {
- const ref = useRef>(null)
+}: Props &
+ Omit, "onRefresh"> & { ref?: React.Ref | null> }) => {
+ const ref = useRef>(null)
useImperativeHandle(forwardedRef, () => ref.current!)
const { refetch: unreadRefetch } = usePrefetchUnread()
const { refetch: subscriptionRefetch } = usePrefetchSubscription()
@@ -118,8 +114,8 @@ export const TimelineSelectorMasonryList = ({
isRefetching,
...props
}: Props &
- Omit, "onRefresh"> & {
- ref?: React.Ref | null>
+ Omit, "onRefresh"> & {
+ ref?: React.Ref | null>
}) => {
const { refetch: unreadRefetch } = usePrefetchUnread()
const { refetch: subscriptionRefetch } = usePrefetchSubscription()
@@ -147,8 +143,9 @@ export const TimelineSelectorMasonryList = ({
}
return (
- >}
+
}
{...props}
- contentContainerStyle={{
- paddingTop: headerHeight,
- paddingBottom: tabBarHeight,
- ...props.contentContainerStyle,
- }}
+ contentContainerStyle={[
+ {
+ paddingTop: headerHeight,
+ paddingBottom: tabBarHeight,
+ },
+ props.contentContainerStyle,
+ ]}
scrollIndicatorInsets={{
top: headerHeight - insets.top,
bottom: tabBarHeight ? tabBarHeight - insets.bottom : undefined,
diff --git a/apps/mobile/src/modules/settings/routes/Appearance.tsx b/apps/mobile/src/modules/settings/routes/Appearance.tsx
index 194413062..31b41da5e 100644
--- a/apps/mobile/src/modules/settings/routes/Appearance.tsx
+++ b/apps/mobile/src/modules/settings/routes/Appearance.tsx
@@ -40,6 +40,31 @@ const fontSizePresets = [
key: "xl",
},
] as const
+
+// Content font size presets (in px)
+const contentFontSizePresets = [
+ {
+ value: 12,
+ key: "xs",
+ },
+ {
+ value: 14,
+ key: "s",
+ },
+ {
+ value: 16,
+ key: "m",
+ },
+ {
+ value: 18,
+ key: "l",
+ },
+ {
+ value: 20,
+ key: "xl",
+ },
+] as const
+
export const AppearanceScreen = () => {
const { t } = useTranslation("settings")
const showUnreadCountViewAndSubscriptionMobile = useUISettingKey(
@@ -57,6 +82,8 @@ export const AppearanceScreen = () => {
// Font scaling settings
const fontScale = useUISettingKey("fontScale")
const useSystemFontScaling = useUISettingKey("useSystemFontScaling")
+ const useDifferentFontSizeForContent = useUISettingKey("useDifferentFontSizeForContent")
+ const mobileContentFontSize = useUISettingKey("mobileContentFontSize")
return (
{
/>
+
+ {
+ setUISetting("useDifferentFontSizeForContent", val)
+ }}
+ />
+
+ {useDifferentFontSizeForContent && (
+
+
+ ({
+ label: t(`appearance.font_scaling.content_size.${preset.key}`),
+ value: preset.value.toString(),
+ }))}
+ value={mobileContentFontSize.toString()}
+ onValueChange={(val) => {
+ setUISetting("mobileContentFontSize", Number.parseInt(val))
+ }}
+ />
+
+
+ )}
diff --git a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx
index ac5cafafe..c66ea546a 100644
--- a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx
+++ b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx
@@ -9,7 +9,7 @@ import {
useSortedUngroupedSubscription,
} from "@follow/store/subscription/hooks"
import { subscriptionSyncService } from "@follow/store/subscription/store"
-import type { FlashList } from "@shopify/flash-list"
+import type { FlashListRef } from "@shopify/flash-list"
import type { ParseKeys } from "i18next"
import { memo, useCallback, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
@@ -127,7 +127,7 @@ const SubscriptionListImpl = ({
const onRefresh = useEventCallback(() => {
return subscriptionSyncService.fetch(view)
})
- const scrollViewRef = useRegisterNavigationScrollView | null>(active)
+ const scrollViewRef = useRegisterNavigationScrollView | null>(active)
return (
= ({ entryId, entryIds, view: viewType }) => {
- useAutoMarkAsRead(entryId)
+ isInbox?: boolean
+}> = ({ entryId, entryIds, view: viewType, isInbox }) => {
+ usePrefetchEntryDetail(entryId, isInbox)
const entry = useEntry(entryId, (state) => ({
title: state.title,
url: state.url,
@@ -46,6 +47,7 @@ export const EntryDetailScreen: NavigationControllerView<{
translation: state.settings?.translation,
readability: state.settings?.readability,
}))
+ useAutoMarkAsRead(entryId, !!entry)
const insets = useSafeAreaInsets()
const ctxValue = useMemo(
() => ({
diff --git a/apps/mobile/web-app/html-renderer/global.d.ts b/apps/mobile/web-app/html-renderer/global.d.ts
index fffa69fb1..01f011f1c 100644
--- a/apps/mobile/web-app/html-renderer/global.d.ts
+++ b/apps/mobile/web-app/html-renderer/global.d.ts
@@ -6,6 +6,7 @@ interface Bridge {
measure: () => void
setContentHeight: (height: number) => void
previewImage: (data: { imageUrls: string[]; index: number }) => void
+ seekAudio: (time: number) => void
}
declare global {
diff --git a/apps/mobile/web-app/html-renderer/src/components/link.tsx b/apps/mobile/web-app/html-renderer/src/components/link.tsx
index 1c9d71d3d..2b12d7ecc 100644
--- a/apps/mobile/web-app/html-renderer/src/components/link.tsx
+++ b/apps/mobile/web-app/html-renderer/src/components/link.tsx
@@ -4,6 +4,8 @@ import {
TooltipPortal,
TooltipTrigger,
} from "@follow/components/ui/tooltip/index.jsx"
+import { timeStringToSeconds } from "@follow/utils/utils"
+import { useCallback } from "react"
export interface LinkProps {
href: string
@@ -16,6 +18,23 @@ export const MarkdownLink = (props: LinkProps) => {
// TODO should populate the href with the populatedFullHref
const populatedFullHref = props.href
+
+ const childrenText = typeof props.children === "string" ? props.children : null
+ const time = childrenText ? timeStringToSeconds(childrenText) : null
+
+ const handleTimestampClick = useCallback(() => {
+ if (time === null) return
+ bridge.seekAudio(time)
+ }, [time])
+
+ if (time !== null) {
+ return (
+
+ {props.children}
+
+ )
+ }
+
return (
diff --git a/apps/ssr/client/atoms/settings/general.ts b/apps/ssr/client/atoms/settings/general.ts
index f5317b701..f15f527f2 100644
--- a/apps/ssr/client/atoms/settings/general.ts
+++ b/apps/ssr/client/atoms/settings/general.ts
@@ -7,7 +7,6 @@ const createDefaultSettings = (): Partial => ({
appLaunchOnStartup: false,
language: "en",
// Data control
- dataPersist: true,
sendAnonymousData: true,
// view
@@ -38,7 +37,6 @@ export const {
export const generalServerSyncWhiteListKeys: (keyof GeneralSettings)[] = [
"appLaunchOnStartup",
- "dataPersist",
"sendAnonymousData",
"language",
]
diff --git a/changelogithub.config.ts b/changelogithub.config.ts
index 726e583e3..f6c7b0c39 100644
--- a/changelogithub.config.ts
+++ b/changelogithub.config.ts
@@ -1,4 +1,5 @@
export default {
- tagFilter: (tag: string) => tag.startsWith("v") && !tag.includes("nightly"),
+ tagFilter: (tag: string) =>
+ (tag.startsWith("mobile/v") || tag.startsWith("desktop/v")) && !tag.includes("nightly"),
dry: !process.env.CI,
}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 10e6c9150..47e002f14 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -44,6 +44,7 @@ export default defineConfig(
"@eslint-react/hooks-extra/no-unnecessary-use-callback": "warn",
// NOTE: Disable this temporarily
"react-compiler/react-compiler": 0,
+ "unicorn/no-array-callback-reference": 0,
"no-restricted-syntax": 0,
"no-restricted-globals": [
"error",
diff --git a/icons/mgc/at_cute_re.svg b/icons/mgc/at_cute_re.svg
new file mode 100644
index 000000000..129ced2ee
--- /dev/null
+++ b/icons/mgc/at_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/mgc/bookmark_cute_re.svg b/icons/mgc/bookmark_cute_re.svg
new file mode 100644
index 000000000..61411c6b6
--- /dev/null
+++ b/icons/mgc/bookmark_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/mgc/documents_cute_re.svg b/icons/mgc/documents_cute_re.svg
new file mode 100644
index 000000000..992f43c92
--- /dev/null
+++ b/icons/mgc/documents_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/mgc/pic_cute_re.svg b/icons/mgc/pic_cute_re.svg
new file mode 100644
index 000000000..5eee606bf
--- /dev/null
+++ b/icons/mgc/pic_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/mgc/save_cute_re.svg b/icons/mgc/save_cute_re.svg
new file mode 100644
index 000000000..d8bf26017
--- /dev/null
+++ b/icons/mgc/save_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/mgc/search_cute_re.svg b/icons/mgc/search_cute_re.svg
new file mode 100644
index 000000000..ba003daf4
--- /dev/null
+++ b/icons/mgc/search_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/icons/mgc/send_plane_cute_re.svg b/icons/mgc/send_plane_cute_re.svg
new file mode 100644
index 000000000..c2a70c7f6
--- /dev/null
+++ b/icons/mgc/send_plane_cute_re.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/locales/ai/en.json b/locales/ai/en.json
index b7d2ae5f1..de1fc40ac 100644
--- a/locales/ai/en.json
+++ b/locales/ai/en.json
@@ -24,8 +24,6 @@
"shortcuts.empty.description": "Create custom AI shortcuts to quickly perform common tasks and get instant AI assistance.",
"shortcuts.empty.title": "No Shortcuts Yet",
"shortcuts.enabled": "Enabled",
- "shortcuts.hotkey": "Hotkey (Optional)",
- "shortcuts.hotkey_placeholder": "e.g. Cmd+S",
"shortcuts.name": "Name",
"shortcuts.name_placeholder": "e.g. Summarize Article",
"shortcuts.prompt": "Prompt",
diff --git a/locales/ai/ja.json b/locales/ai/ja.json
index d12128b75..658faa1a8 100644
--- a/locales/ai/ja.json
+++ b/locales/ai/ja.json
@@ -24,8 +24,6 @@
"shortcuts.empty.description": "ไธ่ฌ็ใชใฟในใฏใ่ฟ
้ใซๅฎ่กใใๅณๅบงใซAIใขใทในใฟใณในใๅพใใใใฎใซในใฟใ AIใทใงใผใใซใใใไฝๆใใพใใ",
"shortcuts.empty.title": "ใทใงใผใใซใใใฏใพใ ใใใพใใ",
"shortcuts.enabled": "ๆๅน",
- "shortcuts.hotkey": "ใใใใญใผ๏ผใชใใทใงใณ๏ผ",
- "shortcuts.hotkey_placeholder": "ไพ๏ผCmd+S",
"shortcuts.name": "ๅๅ",
"shortcuts.name_placeholder": "ไพ๏ผ่จไบใ่ฆ็ด",
"shortcuts.prompt": "ใใญใณใใ",
diff --git a/locales/app/zh-CN.json b/locales/app/zh-CN.json
index 8e76b9be9..ceb6a9d69 100644
--- a/locales/app/zh-CN.json
+++ b/locales/app/zh-CN.json
@@ -22,6 +22,9 @@
"achievement.product_hunt_vote_description": "ๅจ Product Hunt ไธ็ป Folo ๆ็ฅจ",
"activation.activate": "ๆฟๆดป",
"activation.description": "ๅจๅ
ฌๆต้ถๆฎต๏ผ้ข่ง็็จๆทไฝฟ็จๆญคๅ่ฝไผๅ้ใ",
+ "activation.plan.description": "ๆจๅฝๅๆญฃๅจไฝฟ็จๅ
่ดน็ๆฌใๅ็บงไปฅ่งฃ้ๆดๅคๅ่ฝใ",
+ "activation.plan.title": "ๅ็บง่ฎกๅ",
+ "activation.plan.upgrade": "ๅ็บง",
"activation.title": "้่ฏท็ ",
"ai_daily.header": "AI ๆฅๆฅ",
"ai_daily.no_found": "ๅจๆญคๆ้ดๆชๆพๅฐ AI ๆฐ้ปใ",
@@ -115,11 +118,13 @@
"entry_actions.deleted": "ๅทฒๅ ้ค",
"entry_actions.export_as_pdf": "ๅฏผๅบไธบ PDF",
"entry_actions.failed_to_delete": "ๅ ้คๅคฑ่ดฅ",
+ "entry_actions.failed_to_login_to_qbittorrent": "็ปๅฝ qBittorrent ๅคฑ่ดฅ",
"entry_actions.failed_to_save_to_cubox": "ไฟๅญๅฐ Cubox ๅคฑ่ดฅใ",
"entry_actions.failed_to_save_to_eagle": "ไฟๅญๅฐ Eagle ๅคฑ่ดฅใ",
"entry_actions.failed_to_save_to_instapaper": "ไฟๅญๅฐ Instapaper ๅคฑ่ดฅใ",
"entry_actions.failed_to_save_to_obsidian": "ไฟๅญๅฐ Obsidian ๅคฑ่ดฅใ",
"entry_actions.failed_to_save_to_outline": "ไฟๅญๅฐ Outline ๅคฑ่ดฅใ",
+ "entry_actions.failed_to_save_to_qbittorrent": "ไฝฟ็จ qBittorrent ไธ่ฝฝๅคฑ่ดฅ",
"entry_actions.failed_to_save_to_readeck": "ไฟๅญๅฐ Readeck ๅคฑ่ดฅใ",
"entry_actions.failed_to_save_to_readwise": "ไฟๅญๅฐ Readwise ๅคฑ่ดฅใ",
"entry_actions.failed_to_save_to_zotero": "ไฟๅญๅฐ Zotero ๅคฑ่ดฅ",
@@ -129,6 +134,7 @@
"entry_actions.mark_as_read": "ๆ ่ฎฐไธบๅทฒ่ฏป/ๆช่ฏป",
"entry_actions.mark_as_unread": "ๆ ่ฎฐไธบๆช่ฏป",
"entry_actions.mark_below_as_read": "ๅฐไปฅไธๆ ่ฎฐไธบๅทฒ่ฏป",
+ "entry_actions.no_bittorrent_urls_found": "ๆญคๆก็ฎไธญๆชๆพๅฐ BitTorrent ้พๆฅ",
"entry_actions.open_in_browser": "ๅจ{{which}}ๆๅผ",
"entry_actions.recent_reader": "ๆ่ฟ้
่ฏป่
๏ผ",
"entry_actions.save_media_to_eagle": "ไฟๅญๅฐ Eagle",
@@ -136,6 +142,7 @@
"entry_actions.save_to_instapaper": "ไฟๅญๅฐ Instapaper",
"entry_actions.save_to_obsidian": "ไฟๅญๅฐ Obsidian",
"entry_actions.save_to_outline": "ไฟๅญๅฐ Outline",
+ "entry_actions.save_to_qbittorrent": "ไฝฟ็จ qBittorrent ไธ่ฝฝ",
"entry_actions.save_to_readeck": "ไฟๅญๅฐ Readeck",
"entry_actions.save_to_readwise": "ไฟๅญๅฐ Readwise",
"entry_actions.save_to_zotero": "ไฟๅญๅฐ Zotero",
@@ -144,6 +151,7 @@
"entry_actions.saved_to_instapaper": "ๅทฒไฟๅญๅฐ Instapaperใ",
"entry_actions.saved_to_obsidian": "ๅทฒไฟๅญๅฐ Obsidianใ",
"entry_actions.saved_to_outline": "ๅทฒไฟๅญๅฐ Outlineใ",
+ "entry_actions.saved_to_qbittorrent": "็งๅญๅทฒๆทปๅ ๅฐ qBittorrent",
"entry_actions.saved_to_readeck": "ๅทฒไฟๅญๅฐ Readeckใ",
"entry_actions.saved_to_readwise": "ๅทฒไฟๅญๅฐ Readwiseใ",
"entry_actions.saved_to_zotero": "ๅทฒไฟๅญๅฐ Zoteroใ",
@@ -157,6 +165,7 @@
"entry_actions.unstarred": "ๅๆถๆถ่",
"entry_actions.view_source_content": "ๆฅ็ๅๆ",
"entry_actions.view_source_content_description": "ๅฐ่ฏไปฅๆบ็ฝ็ซ็้ฃๆ ผ้
่ฏปๆญคๆ็ซ ็ๅ
ๅฎน",
+ "entry_actions.warn_info_ai_chat_pinned_tip": "ๆญคๅ่ฝ็ฎๅๅคไปๅคไบๆต่ฏ้ถๆฎต๏ผไป
ๅฐๆฐ็จๆทๅฏไฝฟ็จใ",
"entry_actions.warn_info_for_desktop": "ๆญคๅ่ฝๅชๅจๆก้ข็ซฏๅฏ็จ",
"entry_column.filtered_content_tip": "้จๅๅ
ๅฎนๅทฒ่ขซ่ฟๆปค้่ใ",
"entry_column.filtered_content_tip_2": "้คไบไธ้ขๆพ็คบ็ๅ
ๅฎนๅค๏ผ่ฟๆไธไบ่ขซ่ฟๆปค็ๅ
ๅฎนใ",
@@ -224,6 +233,8 @@
"feed_form.follow": "่ฎข้
",
"feed_form.follow_with_fee": "ไฝฟ็จ {{fee}} Power ่ฎข้
",
"feed_form.followed": "๐ ่ฎข้
ๆๅ",
+ "feed_form.hide_from_timeline": "ๅจๆถ้ด็บฟไธ้่",
+ "feed_form.hide_from_timeline_description": "ๅผๅฏๅ๏ผๆญค่ฎข้
ๅฐไธๅๆพ็คบๅจไธปๆถ้ด็บฟไธญ",
"feed_form.private_follow": "็งๅฏ่ฎข้
",
"feed_form.private_follow_description": "ๅผๅฏๅ๏ผๆญค่ฎข้
ไธๅๆพ็คบๅจไธชไบบ่ตๆ้กต้ขใ",
"feed_form.retry": "้่ฏ",
@@ -322,6 +333,10 @@
"register.email": "้ฎไปถๅฐๅ",
"register.login": "็ปๅฝ",
"register.password": "ๅฏ็ ",
+ "register.referral.days": "ไฝฟ็จๆจ่็ ๆณจๅไปฅ่ทๅพ{{days}}ๅคฉ็ไธไธ็้ข่ง",
+ "register.referral.description": "ไฝฟ็จๆจ่็ ๆณจๅไปฅ่ทๅพๅ ๆฅ้ขๅค็ไธไธ็้ข่ง",
+ "register.referral.invalid": "ๆจ่็ ๆ ๆ",
+ "register.referral.label": "ๆจ่็ ",
"register.submit": "ๅๅปบ่ดฆๆท",
"resize.tooltip.double_click_to_collapse": "ๅๅป ้็ฝฎไธบ้ป่ฎคๅคงๅฐ",
"resize.tooltip.drag_to_resize": "ๆๅจ ไปฅ่ฐๆดๅคงๅฐ",
@@ -431,10 +446,13 @@
"user_button.preferences": "่ฎพ็ฝฎ",
"user_button.profile": "ไธชไบบ่ตๆ",
"user_button.zen_mode": "็ฆ
ๅฎๆจกๅผ",
+ "user_profile.about": "ๅ
ณไบ",
"user_profile.close": "ๅ
ณ้ญ",
+ "user_profile.created_lists": "ๅๅปบ็ๅ่กจ",
"user_profile.edit": "็ผ่พ",
"user_profile.loading": "ๅ ่ฝฝไธญ",
"user_profile.share": "ๅไบซ",
+ "user_profile.subscriptions": "่ฎข้
",
"user_profile.toggle_item_style": "ๅๆขๅ่กจๆ ทๅผ",
"words.achievement": "ๆๅฐฑ",
"words.actions": "่ชๅจๅ",
diff --git a/locales/mobile/default/zh-CN.json b/locales/mobile/default/zh-CN.json
index 884061c4c..4f8117a17 100644
--- a/locales/mobile/default/zh-CN.json
+++ b/locales/mobile/default/zh-CN.json
@@ -63,8 +63,10 @@
"signin.sign_up_to": "ๆณจๅ",
"subscription_form.category": "ๅ็ฑป",
"subscription_form.category_description": "้ป่ฎคๆ
ๅตไธ๏ผไฝ ็่ฎข้
ๅฐๆ็ฝ็ซๅๅๅ็ปใ",
+ "subscription_form.hide_from_timeline": "ๅจๆถ้ด็บฟไธญ้่",
+ "subscription_form.hide_from_timeline_description": "ๅผๅฏๅ๏ผๆญค่ฎข้
ๅฐไธๅๆพ็คบๅจไธปๆถ้ด็บฟไธญ",
"subscription_form.private_follow": "็งๅฏ่ฎข้
",
- "subscription_form.private_follow_description": "ๅผๅฏๅ๏ผๆญค่ฎข้
ไธๅๆพ็คบๅจไธชไบบ่ตๆ้กต้ขใ",
+ "subscription_form.private_follow_description": "ๅผๅฏๅ๏ผๆญค่ฎข้
ๅฐไธๅๆพ็คบๅจไธชไบบ่ตๆ้กต้ขใ",
"subscription_form.title": "ๆ ้ข",
"subscription_form.title_description": "ๆญค่ฎข้
ๆบ็่ชๅฎไนๆ ้ข๏ผ็็ฉบๅไฝฟ็จ้ป่ฎคๆ ้ขใ",
"subscription_form.view": "่งๅพ",
diff --git a/locales/settings/en.json b/locales/settings/en.json
index 7d770b4a1..aca78d263 100644
--- a/locales/settings/en.json
+++ b/locales/settings/en.json
@@ -116,6 +116,15 @@
"appearance.date_format.label": "Date Format",
"appearance.font.custom": "Custom",
"appearance.font.system": "System UI",
+ "appearance.font_scaling.content_different.description": "Set independent font size for article content",
+ "appearance.font_scaling.content_different.label": "Use Different Font Size for Content",
+ "appearance.font_scaling.content_size.description": "Set the font size for article content",
+ "appearance.font_scaling.content_size.l": "Large",
+ "appearance.font_scaling.content_size.label": "Content Font Size",
+ "appearance.font_scaling.content_size.m": "Default",
+ "appearance.font_scaling.content_size.s": "Small",
+ "appearance.font_scaling.content_size.xl": "Larger",
+ "appearance.font_scaling.content_size.xs": "Smaller",
"appearance.font_scaling.scale.description": "Adjust the font size scaling factor",
"appearance.font_scaling.scale.label": "Font Scale",
"appearance.font_scaling.size.l": "Large",
@@ -241,8 +250,6 @@
"general.content": "Content",
"general.data": "Data",
"general.data_file.label": "Data File",
- "general.data_persist.description": "Persist data locally to enable offline access and local search.",
- "general.data_persist.label": "Persist data for offline usage",
"general.dim_read.description": "Dim the color of entries in the timeline that have been read.",
"general.dim_read.label": "Fade Read Items",
"general.enhanced.description": "Enabling the enhanced settings offers more customization options, but may also introduce unforeseen issues. !!! Keep this as the gateway to truly experimental/complex things if needed later, otherwise it might be removable if other settings cover specifics.",
@@ -318,6 +325,12 @@
"general.translation_mode.label": "AI Translation Mode",
"general.translation_mode.translation-only": "Only the translation",
"general.voices": "Voices",
+ "integration.builtin.title": "Built-in Integration",
+ "integration.categories.custom_integrations": "Custom Actions",
+ "integration.categories.download_tools": "Download Tools",
+ "integration.categories.knowledge_management": "Knowledge Management",
+ "integration.categories.media_tools": "Media Tools",
+ "integration.categories.reading_services": "Reading Services",
"integration.cubox.autoMemo.description": "Automatically use Memo mode when text is selected to save to Cubox.",
"integration.cubox.autoMemo.label": "Auto Memo Mode",
"integration.cubox.enable.description": "Show 'Save to Cubox' button if available.",
@@ -325,10 +338,86 @@
"integration.cubox.title": "Cubox",
"integration.cubox.token.description": "Please enter the complete Cubox API URL, format: https://cubox.pro/c/api/save/xxxxxxxxx. You can get it here: ",
"integration.cubox.token.label": "Cubox API URL",
+ "integration.custom_integrations.actions.delete": "Delete integration",
+ "integration.custom_integrations.actions.disable": "Disable integration",
+ "integration.custom_integrations.actions.edit": "Edit integration",
+ "integration.custom_integrations.actions.enable": "Enable integration",
+ "integration.custom_integrations.add.button": "Add New Integration",
+ "integration.custom_integrations.create.error": "Failed to create custom integration",
+ "integration.custom_integrations.create.success": "Custom integration created successfully",
+ "integration.custom_integrations.create.title": "Create Custom Integration",
+ "integration.custom_integrations.delete.success": "Custom integration deleted successfully",
+ "integration.custom_integrations.edit.error": "Failed to update custom integration",
+ "integration.custom_integrations.edit.success": "Custom integration updated successfully",
+ "integration.custom_integrations.edit.title": "Edit Custom Integration",
+ "integration.custom_integrations.enable.description": "Allow creating custom sharing integrations with fetch templates supporting various HTTP methods and configurations.",
+ "integration.custom_integrations.enable.label": "Enable Custom Integrations",
+ "integration.custom_integrations.form.body.description": "Request body for POST/PUT/PATCH methods. Supports placeholders and JSON format.",
+ "integration.custom_integrations.form.body.label": "Request Body",
+ "integration.custom_integrations.form.body.placeholder": "{\"title\": \"[title]\", \"url\": \"[url]\", \"content\": \"[content_markdown]\"}",
+ "integration.custom_integrations.form.fetch_template.label": "Fetch Template",
+ "integration.custom_integrations.form.headers.add": "Add Header",
+ "integration.custom_integrations.form.headers.description": "Add custom headers as key-value pairs. Values support placeholders.",
+ "integration.custom_integrations.form.headers.key_placeholder": "Header name",
+ "integration.custom_integrations.form.headers.label": "Headers",
+ "integration.custom_integrations.form.headers.value_placeholder": "Header value",
+ "integration.custom_integrations.form.icon.description": "Choose an icon to represent this integration",
+ "integration.custom_integrations.form.icon.label": "Icon",
+ "integration.custom_integrations.form.method.description": "Select the HTTP method for the request",
+ "integration.custom_integrations.form.method.label": "HTTP Method",
+ "integration.custom_integrations.form.name.label": "Integration Name",
+ "integration.custom_integrations.form.name.placeholder": "Enter integration name",
+ "integration.custom_integrations.form.scheme.description": "Enter the URL scheme for the external application. Use placeholders like [title], [url], [content_markdown], etc.",
+ "integration.custom_integrations.form.scheme.examples.title": "Common Examples",
+ "integration.custom_integrations.form.scheme.label": "URL Scheme",
+ "integration.custom_integrations.form.scheme.placeholder": "e.g., obsidian://new?vault=MyVault&name=[title]&content=[content_markdown]",
+ "integration.custom_integrations.form.type.description": "Choose between HTTP API requests or URL scheme redirects to external applications",
+ "integration.custom_integrations.form.type.http": "HTTP Request",
+ "integration.custom_integrations.form.type.label": "Integration Type",
+ "integration.custom_integrations.form.type.url_scheme": "URL Scheme",
+ "integration.custom_integrations.form.url.description": "Use placeholders: [title], [url], [content_html], [summary], [content_markdown]",
+ "integration.custom_integrations.form.url.label": "URL",
+ "integration.custom_integrations.form.url.placeholder": "https://example.com/api/share",
+ "integration.custom_integrations.icons.bookmark": "Bookmark",
+ "integration.custom_integrations.icons.document": "Document",
+ "integration.custom_integrations.icons.download": "Download",
+ "integration.custom_integrations.icons.external_link": "External Link",
+ "integration.custom_integrations.icons.link": "Link",
+ "integration.custom_integrations.icons.picture": "Picture",
+ "integration.custom_integrations.icons.save": "Save",
+ "integration.custom_integrations.icons.send": "Send",
+ "integration.custom_integrations.icons.share": "Share",
+ "integration.custom_integrations.icons.star": "Star",
+ "integration.custom_integrations.list.empty.button": "Create First Integration",
+ "integration.custom_integrations.list.empty.description": "Create custom sharing integrations with fetch templates to integrate with any service using HTTP requests.",
+ "integration.custom_integrations.list.empty.title": "No custom integrations yet",
+ "integration.custom_integrations.list.title": "Custom Integrations",
+ "integration.custom_integrations.modal.description": "Create custom sharing integrations using fetch templates with HTTP methods, URLs, headers, and body. Use placeholders like [title], [url], [content_html], [summary], and [content_markdown].",
+ "integration.custom_integrations.placeholders.click_to_copy": "Click to copy",
+ "integration.custom_integrations.placeholders.description": "Click on any placeholder to copy it to your clipboard",
+ "integration.custom_integrations.placeholders.help": "Available Placeholders",
+ "integration.custom_integrations.preview.body": "Request Body",
+ "integration.custom_integrations.preview.failed": "Failed to generate preview",
+ "integration.custom_integrations.preview.generating": "Generating preview...",
+ "integration.custom_integrations.preview.headers": "Headers",
+ "integration.custom_integrations.preview.placeholders": "Available Placeholders",
+ "integration.custom_integrations.preview.request": "Request",
+ "integration.custom_integrations.preview.title": "Preview Request",
+ "integration.custom_integrations.status.disabled": "Disabled",
+ "integration.custom_integrations.title": "Custom Integrations",
+ "integration.custom_integrations.validation.invalid": "Template has errors",
+ "integration.custom_integrations.validation.valid": "Template is valid",
"integration.eagle.enable.description": "Display 'Save media to Eagle' button when available.",
"integration.eagle.enable.label": "Enable",
"integration.eagle.title": "Eagle",
+ "integration.export.button": "Export Settings",
+ "integration.export.error": "Failed to export integration settings",
+ "integration.export.success": "Integration settings exported successfully",
"integration.general": "General",
+ "integration.import.button": "Import Settings",
+ "integration.import.error": "Failed to import integration settings",
+ "integration.import.invalid": "Invalid integration settings file",
+ "integration.import.success": "Integration settings imported successfully",
"integration.instapaper.enable.description": "Display 'Save to Instapaper' button when available.",
"integration.instapaper.enable.label": "Enable",
"integration.instapaper.password.label": "Instapaper Password",
@@ -368,9 +457,14 @@
"integration.readwise.token.description": "You can get it here: ",
"integration.readwise.token.label": "Readwise Access Token",
"integration.save_ai_summary_as_description.label": "Save AI Summary as description",
+ "integration.search.placeholder": "Search integrations...",
"integration.sidebar_title": "Integration",
+ "integration.status.configured": "Configured",
+ "integration.status.enabled": "Enabled",
"integration.tip": "Tip: Your sensitive data is stored locally and is not uploaded to the server.",
"integration.title": "Integration",
+ "integration.use_browser_fetch.description": "Use browser fetch API for custom integrations instead of Electron's native fetch. Enable for better web compatibility, disable for enhanced security.",
+ "integration.use_browser_fetch.label": "Use Browser Fetch",
"integration.zotero.enable.description": "Show 'Save to Zotero' button if avilable.",
"integration.zotero.enable.label": "Enable",
"integration.zotero.title": "Zotero",
diff --git a/locales/settings/ja.json b/locales/settings/ja.json
index d7bfe1580..9a492861a 100644
--- a/locales/settings/ja.json
+++ b/locales/settings/ja.json
@@ -116,6 +116,15 @@
"appearance.date_format.label": "ๆฅไปๅฝขๅผ",
"appearance.font.custom": "ใซในใฟใ ",
"appearance.font.system": "ใทในใใ UI",
+ "appearance.font_scaling.content_different.description": "่จไบใณใณใใณใใซ็ฌ็ซใใใใฉใณใใตใคใบใ่จญๅฎ",
+ "appearance.font_scaling.content_different.label": "ใณใณใใณใใซ็ฌ็ซใใใใฉใณใใตใคใบใไฝฟ็จ",
+ "appearance.font_scaling.content_size.description": "่จไบใณใณใใณใใฎใใฉใณใใตใคใบใ่จญๅฎ",
+ "appearance.font_scaling.content_size.l": "ๅคงใใ",
+ "appearance.font_scaling.content_size.label": "ใณใณใใณใใใฉใณใใตใคใบ",
+ "appearance.font_scaling.content_size.m": "ใใใฉใซใ",
+ "appearance.font_scaling.content_size.s": "ๅฐใใ",
+ "appearance.font_scaling.content_size.xl": "ใใๅคงใใ",
+ "appearance.font_scaling.content_size.xs": "ใใๅฐใใ",
"appearance.font_scaling.scale.description": "ใใฉใณใใตใคใบใฎในใฑใผใซไฟๆฐใ่ชฟๆด",
"appearance.font_scaling.scale.label": "ใใฉใณใในใฑใผใซ",
"appearance.font_scaling.size.l": "ๅคงใใ",
@@ -241,8 +250,6 @@
"general.content": "ใณใณใใณใ",
"general.data": "ใใผใฟ",
"general.data_file.label": "ใใผใฟใใกใคใซ",
- "general.data_persist.description": "ใญใผใซใซใใผใฟใไฟๆใใฆใชใใฉใคใณใขใฏใปในใจใญใผใซใซๆค็ดขใๅฏ่ฝใซใใพใใ",
- "general.data_persist.label": "ใชใใฉใคใณไฝฟ็จใฎใใใซใใผใฟใไฟๆ",
"general.dim_read.description": "ใฟใคใ ใฉใคใณใงๆข่ชญใฎใจใณใใชใฎ่ฒใ่ใใใพใใ",
"general.dim_read.label": "ๆข่ชญใขใคใใ ใใใงใผใ",
"general.enhanced.description": "ๅผทๅใใใ่จญๅฎใๆๅนใซใใใจใใใๅคใใฎใซในใฟใใคใบใชใใทใงใณใๆไพใใใพใใใไบๆใใชใๅ้กใ็บ็ใใๅฏ่ฝๆงใใใใพใใ",
@@ -328,7 +335,14 @@
"integration.eagle.enable.description": "ๅฉ็จๅฏ่ฝใชๅ ดๅใ'Eagle ใซใกใใฃใขใไฟๅญ' ใใฟใณใ่กจ็คบใใพใใ",
"integration.eagle.enable.label": "ๆๅนๅ",
"integration.eagle.title": "Eagle",
+ "integration.export.button": "่จญๅฎใใจใฏในใใผใ",
+ "integration.export.error": "็ตฑๅ่จญๅฎใฎใจใฏในใใผใใซๅคฑๆใใพใใ",
+ "integration.export.success": "็ตฑๅ่จญๅฎใฎใจใฏในใใผใใๆๅใใพใใ",
"integration.general": "ไธ่ฌ",
+ "integration.import.button": "่จญๅฎใใคใณใใผใ",
+ "integration.import.error": "็ตฑๅ่จญๅฎใฎใคใณใใผใใซๅคฑๆใใพใใ",
+ "integration.import.invalid": "็กๅนใช็ตฑๅ่จญๅฎใใกใคใซใงใ",
+ "integration.import.success": "็ตฑๅ่จญๅฎใฎใคใณใใผใใๆๅใใพใใ",
"integration.instapaper.enable.description": "ๅฉ็จๅฏ่ฝใชๅ ดๅใ'Instapaper ใซไฟๅญ' ใใฟใณใ่กจ็คบใใพใใ",
"integration.instapaper.enable.label": "ๆๅนๅ",
"integration.instapaper.password.label": "Instapaper ใในใฏใผใ",
diff --git a/locales/settings/zh-CN.json b/locales/settings/zh-CN.json
index 768a45d3c..85bf10840 100644
--- a/locales/settings/zh-CN.json
+++ b/locales/settings/zh-CN.json
@@ -83,6 +83,10 @@
"actions.saveSuccess": "๐ ่งๅๅทฒไฟๅญ",
"actions.sidebar_title": "่ชๅจๅ",
"actions.title": "่ชๅจๅ",
+ "ai.personalize.prompt.description": "่ชๅฎไน AI ็ๆๅ
ๅฎนๆถ็ๆ็คบ่ฏ",
+ "ai.personalize.prompt.label": "ไธชๆงๅๆ็คบ่ฏ",
+ "ai.personalize.title": "AI ไธชๆงๅ่ฎพ็ฝฎ",
+ "ai.shortcuts.title": "AI ๅฟซๆทๆไฝ",
"appearance.accent_color.description": "้ๆฉๅบ็จ็้ข็ๅผบ่ฐ่ฒ",
"appearance.accent_color.label": "ๅผบ่ฐ่ฒ",
"appearance.code_highlight_theme.description": "่ฐๆดไปฃ็ ้ซไบฎไธป้ข",
@@ -112,6 +116,15 @@
"appearance.date_format.label": "ๆฅๆๆ ผๅผ",
"appearance.font.custom": "่ชๅฎไน",
"appearance.font.system": "็ณป็ปๅญไฝ",
+ "appearance.font_scaling.content_different.description": "ไธบๆ็ซ ๅ
ๅฎน่ฎพ็ฝฎ็ฌ็ซ็ๅญไฝๅคงๅฐ",
+ "appearance.font_scaling.content_different.label": "ๅ
ๅฎนไฝฟ็จ็ฌ็ซๅญไฝๅคงๅฐ",
+ "appearance.font_scaling.content_size.description": "่ฎพ็ฝฎๆ็ซ ๅ
ๅฎน็ๅญไฝๅคงๅฐ",
+ "appearance.font_scaling.content_size.l": "ๅคงๅท",
+ "appearance.font_scaling.content_size.label": "ๅ
ๅฎนๅญไฝๅคงๅฐ",
+ "appearance.font_scaling.content_size.m": "ไธญๅท",
+ "appearance.font_scaling.content_size.s": "ๅฐๅท",
+ "appearance.font_scaling.content_size.xl": "็นๅคงๅท",
+ "appearance.font_scaling.content_size.xs": "ๆๅฐๅท",
"appearance.font_scaling.scale.description": "่ฐๆดๅญไฝๅคงๅฐ็ผฉๆพๆฏไพ",
"appearance.font_scaling.scale.label": "ๅญไฝ็ผฉๆพ",
"appearance.font_scaling.size.l": "ๅคง",
@@ -124,6 +137,7 @@
"appearance.font_scaling.title": "ๅญไฝ็ผฉๆพ",
"appearance.fonts": "ๅญไฝ",
"appearance.general": "้็จ",
+ "appearance.global_font.default": "้ป่ฎค",
"appearance.global_font_size.description": "่ฐๆดๆดไฝๆๅญๅคงๅฐ",
"appearance.global_font_size.label": "ๅ
จๅฑๅญไฝๅคงๅฐ",
"appearance.guess_code_language.description": "ไฝฟ็จๆจกๅๆจๆญๆชๆ ่ฎฐไปฃ็ ๅ็็ผ็จ่ฏญ่จใ",
@@ -236,8 +250,6 @@
"general.content": "ๅ
ๅฎน",
"general.data": "ๆฐๆฎ",
"general.data_file.label": "ๆฐๆฎๆไปถ",
- "general.data_persist.description": "ๅจๆฌๅฐไฟ็ๆฐๆฎไปฅๅฏ็จ็ฆป็บฟ่ฎฟ้ฎๅๆฌๅฐๆ็ดขใ",
- "general.data_persist.label": "ไฟ็ๆฐๆฎไปฅไพ็ฆป็บฟไฝฟ็จ",
"general.dim_read.description": "ๆทกๅๆถ้ด็บฟไธญๅทฒ่ฏปๆก็ฎ็ๆพ็คบ้ข่ฒใ",
"general.dim_read.label": "ๆทกๅๅทฒ่ฏปๆก็ฎ",
"general.enhanced.description": "ๅฏ็จๅขๅผบ่ฎพ็ฝฎๅฏๆไพๆดๅค่ชๅฎไน้้กน๏ผไฝไนๅฏ่ฝๅผๅไธๅฏ้ข่ง็้ฎ้ขใ",
@@ -313,6 +325,12 @@
"general.translation_mode.label": "็ฟป่ฏๅๅฅฝ",
"general.translation_mode.translation-only": "ไป
่ฏๆ",
"general.voices": "ๅฃฐ้ณ",
+ "integration.builtin.title": "ๅ
็ฝฎ้ๆ",
+ "integration.categories.custom_integrations": "่ชๅฎไน้ๆ",
+ "integration.categories.download_tools": "ไธ่ฝฝๅทฅๅ
ท",
+ "integration.categories.knowledge_management": "็ฅ่ฏ็ฎก็",
+ "integration.categories.media_tools": "ๅชไฝๅทฅๅ
ท",
+ "integration.categories.reading_services": "้
่ฏปๆๅก",
"integration.cubox.autoMemo.description": "่ชๅจไฝฟ็จ Memo ๆจกๅผไฟๅญ้ไธญ็ๆๆฌๅฐ Cuboxใ",
"integration.cubox.autoMemo.label": "่ชๅจ Memo ๆจกๅผ",
"integration.cubox.enable.description": "ๆพ็คบใไฟๅญๅฐ Cuboxใๆ้ฎ๏ผๅฆๆๅฏ็จ๏ผใ",
@@ -320,10 +338,86 @@
"integration.cubox.title": "Cubox",
"integration.cubox.token.description": "่ฏท่พๅ
ฅๅฎๆด็ Cubox API URL๏ผๆ ผๅผๅฆ๏ผhttps://cubox.pro/c/api/save/xxxxxxxxxใไฝ ๅฏไปฅๅจๆญค่ทๅ๏ผ",
"integration.cubox.token.label": "Cubox API URL",
+ "integration.custom_integrations.actions.delete": "ๅ ้ค",
+ "integration.custom_integrations.actions.disable": "็ฆ็จ",
+ "integration.custom_integrations.actions.edit": "็ผ่พ",
+ "integration.custom_integrations.actions.enable": "ๅฏ็จ",
+ "integration.custom_integrations.add.button": "ๆทปๅ ",
+ "integration.custom_integrations.create.error": "ๅๅปบๅคฑ่ดฅ",
+ "integration.custom_integrations.create.success": "ๅๅปบๆๅ",
+ "integration.custom_integrations.create.title": "ๅๅปบ่ชๅฎไน้ๆ",
+ "integration.custom_integrations.delete.success": "ๅ ้คๆๅ",
+ "integration.custom_integrations.edit.error": "็ผ่พๅคฑ่ดฅ",
+ "integration.custom_integrations.edit.success": "็ผ่พๆๅ",
+ "integration.custom_integrations.edit.title": "็ผ่พ่ชๅฎไน้ๆ",
+ "integration.custom_integrations.enable.description": "ๅฏ็จๆญค่ชๅฎไน้ๆ",
+ "integration.custom_integrations.enable.label": "ๅฏ็จ",
+ "integration.custom_integrations.form.body.description": "่ฏทๆฑไฝๅ
ๅฎน",
+ "integration.custom_integrations.form.body.label": "่ฏทๆฑไฝ",
+ "integration.custom_integrations.form.body.placeholder": "่พๅ
ฅ่ฏทๆฑไฝๅ
ๅฎน",
+ "integration.custom_integrations.form.fetch_template.label": "่ทๅๆจกๆฟ",
+ "integration.custom_integrations.form.headers.add": "ๆทปๅ ่ฏทๆฑๅคด",
+ "integration.custom_integrations.form.headers.description": "่ชๅฎไน่ฏทๆฑๅคด",
+ "integration.custom_integrations.form.headers.key_placeholder": "้ฎๅ",
+ "integration.custom_integrations.form.headers.label": "่ฏทๆฑๅคด",
+ "integration.custom_integrations.form.headers.value_placeholder": "้ฎๅผ",
+ "integration.custom_integrations.form.icon.description": "้ๆฉ้ๆๅพๆ ",
+ "integration.custom_integrations.form.icon.label": "ๅพๆ ",
+ "integration.custom_integrations.form.method.description": "้ๆฉ HTTP ๆนๆณ",
+ "integration.custom_integrations.form.method.label": "ๆนๆณ",
+ "integration.custom_integrations.form.name.label": "ๅ็งฐ",
+ "integration.custom_integrations.form.name.placeholder": "่พๅ
ฅ้ๆๅ็งฐ",
+ "integration.custom_integrations.form.scheme.description": "URL ๅๆฐๆจกๆฟ",
+ "integration.custom_integrations.form.scheme.examples.title": "็คบไพ",
+ "integration.custom_integrations.form.scheme.label": "URL ๅๆฐ",
+ "integration.custom_integrations.form.scheme.placeholder": "่พๅ
ฅ URL ๅๆฐๆจกๆฟ",
+ "integration.custom_integrations.form.type.description": "้ๆฉ้ๆ็ฑปๅ",
+ "integration.custom_integrations.form.type.http": "HTTP ้ๆ",
+ "integration.custom_integrations.form.type.label": "็ฑปๅ",
+ "integration.custom_integrations.form.type.url_scheme": "URL ๆนๆก",
+ "integration.custom_integrations.form.url.description": "็ฎๆ URL ๅฐๅ",
+ "integration.custom_integrations.form.url.label": "URL",
+ "integration.custom_integrations.form.url.placeholder": "่พๅ
ฅ็ฎๆ URL",
+ "integration.custom_integrations.icons.bookmark": "ไนฆ็ญพ",
+ "integration.custom_integrations.icons.document": "ๆๆกฃ",
+ "integration.custom_integrations.icons.download": "ไธ่ฝฝ",
+ "integration.custom_integrations.icons.external_link": "ๅค้จ้พๆฅ",
+ "integration.custom_integrations.icons.link": "้พๆฅ",
+ "integration.custom_integrations.icons.picture": "ๅพ็",
+ "integration.custom_integrations.icons.save": "ไฟๅญ",
+ "integration.custom_integrations.icons.send": "ๅ้",
+ "integration.custom_integrations.icons.share": "ๅไบซ",
+ "integration.custom_integrations.icons.star": "ๆถ่",
+ "integration.custom_integrations.list.empty.button": "ๅๅปบ้ฆไธช้ๆ",
+ "integration.custom_integrations.list.empty.description": "ๅๅปบ่ชๅฎไน้ๆไปฅๆฉๅฑๅ่ฝ",
+ "integration.custom_integrations.list.empty.title": "ๅฐๆ ่ชๅฎไน้ๆ",
+ "integration.custom_integrations.list.title": "่ชๅฎไน้ๆๅ่กจ",
+ "integration.custom_integrations.modal.description": "้
็ฝฎ่ชๅฎไน้ๆๅๆฐ",
+ "integration.custom_integrations.placeholders.click_to_copy": "็นๅปๅคๅถ",
+ "integration.custom_integrations.placeholders.description": "ๆ่ฟฐๆๆฌ",
+ "integration.custom_integrations.placeholders.help": "ๅธฎๅฉๆๆฌ",
+ "integration.custom_integrations.preview.body": "่ฏทๆฑไฝ",
+ "integration.custom_integrations.preview.failed": "้ข่งๅคฑ่ดฅ",
+ "integration.custom_integrations.preview.generating": "ๆญฃๅจ็ๆ้ข่ง...",
+ "integration.custom_integrations.preview.headers": "่ฏทๆฑๅคด",
+ "integration.custom_integrations.preview.placeholders": "ๅฏ็จๅ ไฝ็ฌฆ",
+ "integration.custom_integrations.preview.request": "่ฏทๆฑ",
+ "integration.custom_integrations.preview.title": "่ฏทๆฑ้ข่ง",
+ "integration.custom_integrations.status.disabled": "ๅทฒ็ฆ็จ",
+ "integration.custom_integrations.title": "่ชๅฎไน้ๆ",
+ "integration.custom_integrations.validation.invalid": "ๆจกๆฟๆ้่ฏฏ",
+ "integration.custom_integrations.validation.valid": "ๆจกๆฟๆๆ",
"integration.eagle.enable.description": "ๆพ็คบใไฟๅญๅฐ Eagleใๆ้ฎ๏ผๅฆๆๅฏ็จ๏ผใ",
"integration.eagle.enable.label": "ๅฏ็จ",
"integration.eagle.title": "Eagle",
+ "integration.export.button": "ๅฏผๅบ่ฎพ็ฝฎ",
+ "integration.export.error": "ๅฏผๅบ้ๆ่ฎพ็ฝฎๅคฑ่ดฅ",
+ "integration.export.success": "้ๆ่ฎพ็ฝฎๅฏผๅบๆๅ",
"integration.general": "้็จ",
+ "integration.import.button": "ๅฏผๅ
ฅ่ฎพ็ฝฎ",
+ "integration.import.error": "ๅฏผๅ
ฅ้ๆ่ฎพ็ฝฎๅคฑ่ดฅ",
+ "integration.import.invalid": "ๆ ๆ็้ๆ่ฎพ็ฝฎๆไปถ",
+ "integration.import.success": "้ๆ่ฎพ็ฝฎๅฏผๅ
ฅๆๅ",
"integration.instapaper.enable.description": "ๆพ็คบใไฟๅญๅฐ Instapaperใๆ้ฎ๏ผๅฆๆๅฏ็จ๏ผใ",
"integration.instapaper.enable.label": "ๅฏ็จ",
"integration.instapaper.password.label": "ๅฏ็ ",
@@ -343,6 +437,13 @@
"integration.outline.title": "Outline",
"integration.outline.token.description": "ๅจไฝ ็ Outline ่ดฆๆท่ฎพ็ฝฎไธญ่ทๅใ",
"integration.outline.token.label": "Outline API ๅฏ้ฅ",
+ "integration.qbittorrent.enable.description": "ๆพ็คบใไฝฟ็จ qBittorrent ไธ่ฝฝใๆ้ฎ๏ผๅฆๆๅฏ็จ๏ผ",
+ "integration.qbittorrent.enable.label": "ๅฏ็จ",
+ "integration.qbittorrent.host.description": "ไฝ ็ qBittorrent WebUI ๅฐๅ๏ผไพๅฆ http://localhost:8080",
+ "integration.qbittorrent.host.label": "qBittorrent ไธปๆบ",
+ "integration.qbittorrent.password.label": "qBittorrent ๅฏ็ ",
+ "integration.qbittorrent.title": "qBittorrent",
+ "integration.qbittorrent.username.label": "qBittorrent ็จๆทๅ",
"integration.readeck.enable.description": "ๆพ็คบใไฟๅญๅฐ Readeckใๆ้ฎ๏ผๅฆๆๅฏ็จ๏ผใ",
"integration.readeck.enable.label": "ๅฏ็จ",
"integration.readeck.endpoint.description": "ๆญคๅฐๅไธบใhttps://<ไฝ ็ READECK ๅๅ>ใใ",
@@ -356,9 +457,14 @@
"integration.readwise.token.description": "ๅจ่ฟ้่ทๅไปค็",
"integration.readwise.token.label": "Readwise ่ฎฟ้ฎไปค็",
"integration.save_ai_summary_as_description.label": "ๅฐ AI ๆป็ปไฟๅญไธบๆ่ฟฐ",
+ "integration.search.placeholder": "ๆ็ดข้ๆ...",
"integration.sidebar_title": "็ฌฌไธๆนๆฅๅ
ฅ",
+ "integration.status.configured": "ๅทฒ้
็ฝฎ",
+ "integration.status.enabled": "ๅทฒๅฏ็จ",
"integration.tip": "ๆ็คบ๏ผๆๆๆฐๆฎไป
ๅจๆฌๅฐๅญๅจ๏ผไธไผ่ขซๆถ้ๆไธไผ ๅฐไบ็ซฏใ",
"integration.title": "็ฌฌไธๆนๆฅๅ
ฅ",
+ "integration.use_browser_fetch.description": "ไธบ่ชๅฎไน้ๆไฝฟ็จๆต่งๅจ fetch API ่ไธๆฏ Electron ๅ็ fetchใๅฏ็จไปฅ่ทๅพๆดๅฅฝ็็ฝ็ปๅ
ผๅฎนๆง๏ผ็ฆ็จไปฅๆ้ซๅฎๅ
จๆงใ",
+ "integration.use_browser_fetch.label": "ไฝฟ็จๆต่งๅจๅ้่ฏทๆฑ",
"integration.zotero.enable.description": "ๆพ็คบใไฟๅญๅฐ Zoteroใๆ้ฎ๏ผๅฆๆๅฏ็จ๏ผ",
"integration.zotero.enable.label": "ๅฏ็จ",
"integration.zotero.title": "Zotero",
@@ -432,6 +538,7 @@
"notifications.test": "ๆต่ฏ้็ฅ",
"notifications.test_success": "ๆต่ฏ้็ฅๅ้ๆๅใ",
"notifications.token": "ๅฎขๆท็ซฏไปค็",
+ "plan.description": "ไป็ฌฌไธๅคฉ่ตทไบซๅๆๆไธไธ็ๅ่ฝโโๆฐ็จๆทๅฏ่ทๅพๅฎๆด่ฏ็จ๏ผๅช้้่ฏทๆๅๆๅฐ้ขๆฏๆ่ดก็ฎๅณๅฏไฟ็่ฟไบๆ็ใ ไบ่งฃๆดๅคใ",
"privacy.privacy": "้็งๆฟ็ญ",
"privacy.terms": "ๆๅกๆกๆฌพ",
"profile.avatar.cropInstructions": "ๆๅจ่ฃๅชๅบๅไปฅ่ฐๆดๅคดๅ",
@@ -505,6 +612,13 @@
"profile.two_factor.no_password": "ๅฏ็จๅ้่บซไปฝ้ช่ฏไนๅ้่ฆ ่ฎพ็ฝฎๅฏ็ ใ",
"profile.updateSuccess": "ไธชไบบ่ตๆๅทฒๆดๆฐใ",
"profile.update_password_success": "ๅฏ็ ๅทฒๆดๆฐใ",
+ "referral.description": "ไธๆๅๅไบซ Folo๏ผๅปถ้ฟไฝ ็ไธไธ็่ฏ็จๆๅๆชๆฅๆ็๏ผไฝ ็ๆๅไนๅฏไปฅ่ทๅพ 45 ๅคฉ็่ฏ็จๆใ ไบ่งฃๆดๅคใ",
+ "referral.invited_friend_status.pending": "ๅพ
้ช่ฏ",
+ "referral.invited_friend_status.valid": "ๅทฒ้ช่ฏ",
+ "referral.link": "ไฝ ็้่ฏท้พๆฅ๏ผ",
+ "referral.pro_status.preview": "ไฝ ็ไธไธ็่ฏ็จ็ถๆ๏ผๅฐไบ {{dateString}} ๅฐๆ๏ผๅฉไฝ {{daysLeft}} ๅคฉ๏ผ",
+ "referral.pro_status.trial": "ๅฝๅ็ญ็บง๏ผๅ
่ดน็",
+ "referral.pro_status.user": "ไฝ ็ไธไธ็่ฏ็จ็ถๆ๏ผๆดป่ทไธญ",
"rsshub.addModal.access_key_label": "่ฎฟ้ฎๅฏ้ฅ๏ผๅฏ้๏ผ",
"rsshub.addModal.add": "ๆทปๅ ",
"rsshub.addModal.base_url_label": "ๆ น URL",
@@ -538,6 +652,7 @@
"titles.about": "ๅ
ณไบ",
"titles.account": "่ดฆๆท",
"titles.actions": "่ชๅจๅ",
+ "titles.ai": "AI",
"titles.appearance": "ๅค่ง",
"titles.data_control": "ๆฐๆฎๆงๅถ",
"titles.feeds": "่ฎข้
ๆบ",
@@ -546,8 +661,12 @@
"titles.invitations": "้่ฏท",
"titles.lists": "ๅ่กจ",
"titles.notifications": "้็ฅ",
+ "titles.plan.long": "ๅ็บงไฝ ็่ฎกๅ",
+ "titles.plan.short": "่ฎกๅ",
"titles.power": "Power",
"titles.privacy": "้็ง",
+ "titles.referral.long": "้่ฏทๅฅฝๅไปฅๅปถ้ฟไธไธ็ๆๆๆ",
+ "titles.referral.short": "้่ฏทๅนถ่ตๅ",
"titles.shortcuts": "ๅฟซๆท้ฎ",
"titles.sign_out": "็ปๅบ",
"wallet.balance.activePoints": "ๆดป่ทๅบฆ",
diff --git a/locales/settings/zh-TW.json b/locales/settings/zh-TW.json
index 3ae0836f2..f4d684e65 100644
--- a/locales/settings/zh-TW.json
+++ b/locales/settings/zh-TW.json
@@ -105,6 +105,15 @@
"appearance.date_format.label": "ๆฅๆๆ ผๅผ",
"appearance.font.custom": "่ช่จ",
"appearance.font.system": "็ณป็ตฑๅญ้ซ",
+ "appearance.font_scaling.content_different.description": "็บๆ็ซ ๅ
งๅฎน่จญๅฎ็จ็ซ็ๅญ้ซๅคงๅฐ",
+ "appearance.font_scaling.content_different.label": "ๅ
งๅฎนไฝฟ็จ็จ็ซๅญ้ซๅคงๅฐ",
+ "appearance.font_scaling.content_size.description": "่จญๅฎๆ็ซ ๅ
งๅฎน็ๅญ้ซๅคงๅฐ",
+ "appearance.font_scaling.content_size.l": "ๅคง",
+ "appearance.font_scaling.content_size.label": "ๅ
งๅฎนๅญ้ซๅคงๅฐ",
+ "appearance.font_scaling.content_size.m": "้ ่จญ",
+ "appearance.font_scaling.content_size.s": "ๅฐ",
+ "appearance.font_scaling.content_size.xl": "่ผๅคง",
+ "appearance.font_scaling.content_size.xs": "่ผๅฐ",
"appearance.font_scaling.scale.description": "่ชฟๆดๅญ้ซๅคงๅฐ็ธฎๆพๆฏไพ",
"appearance.font_scaling.scale.label": "ๅญ้ซ็ธฎๆพ",
"appearance.font_scaling.size.l": "ๅคง",
@@ -212,8 +221,6 @@
"general.content": "ๅ
งๅฎน",
"general.data": "่ณๆ",
"general.data_file.label": "่ณๆๆชๆก",
- "general.data_persist.description": "ๆฌๆฉๅฒๅญ่ณๆไปฅๅ็จ้ข็ท็่ฆฝๅ้ข็ทๆๅฐใ",
- "general.data_persist.label": "ๅฒๅญ่ณๆไปฅไพ้ข็ทไฝฟ็จ",
"general.enhanced.description": "ๅ็จๅขๅผท่จญๅฎๅฏๆไพๆดๅค่ช่จ้ธ้
๏ผไฝไนๅฏ่ฝๅผๅ
ฅไธๅฏ้ ่ฆ็ๅ้กใ",
"general.enhanced.disabled.tip": "ๅขๅผท่จญๅฎๅทฒๅ็จ๏ผๆจๅฏไปฅๅจใไธ่ฌ่จญๅฎ - ้ฒ้ใไธญๅ็จใ",
"general.enhanced.enabled.tip": "ๅขๅผท่จญๅฎๅทฒๅ็จ๏ผๆจๅฏไปฅๅจใไธ่ฌ่จญๅฎ - ้ฒ้ใไธญๅ็จใ",
diff --git a/packages/changelog-cli/README.md b/packages/changelog-cli/README.md
new file mode 100644
index 000000000..24e2257e4
--- /dev/null
+++ b/packages/changelog-cli/README.md
@@ -0,0 +1,186 @@
+# @follow/changelog-cli
+
+AI-driven changelog generator for the Follow project. This package automatically analyzes git commits and generates user-friendly changelog entries using configurable AI models.
+
+## Features
+
+- ๐ค **AI-Powered Analysis**: Uses OpenAI GPT models to analyze commit messages
+- ๐ **Smart Categorization**: Automatically categorizes changes into sections
+- ๐ฅ **Contributor Recognition**: Identifies and thanks external contributors
+- ๐ง **Configurable**: Supports custom AI endpoints and models
+- ๐ **Fallback Support**: Falls back to keyword-based analysis if AI is unavailable
+
+## Installation
+
+This package is part of the Follow monorepo and is not published to npm. It's designed to be used within the monorepo environment.
+
+## Usage
+
+### As a Workspace Script
+
+From the mobile app directory:
+
+```bash
+npm run changelog:generate
+```
+
+### Direct Execution
+
+From the package directory:
+
+```bash
+pnpm run generate
+```
+
+### CLI Command (after building)
+
+```bash
+pnpm run build
+./bin/cli.js
+```
+
+## Configuration
+
+Create or modify `config.json` in the package root:
+
+```json
+{
+ "internalTeamMembers": [
+ "innei",
+ "DIYgod",
+ "hyoban",
+ "renovate[bot]",
+ "github-actions[bot]",
+ "dependabot[bot]",
+ "vercel[bot]"
+ ],
+ "aiModel": {
+ "provider": "openai",
+ "model": "gpt-4o-mini",
+ "temperature": 0.3,
+ "maxTokens": 1000,
+ "apiKey": "",
+ "baseURL": "https://api.openai.com/v1",
+ "customEndpoint": ""
+ },
+ "commitAnalysis": {
+ "categories": {
+ "features": {
+ "keywords": ["feat", "feature", "add", "implement", "introduce"],
+ "section": "Shiny new things"
+ },
+ "improvements": {
+ "keywords": ["improve", "enhance", "optimize", "refactor", "update", "perf"],
+ "section": "Improvements"
+ },
+ "fixes": {
+ "keywords": ["fix", "bug", "patch", "resolve", "correct"],
+ "section": "No longer broken"
+ }
+ },
+ "ignorePatterns": [
+ "^chore:",
+ "^docs:",
+ "^test:",
+ "^ci:",
+ "^build:",
+ "Merge pull request",
+ "Merge branch",
+ "version bump",
+ "changelog",
+ "Update dependencies"
+ ]
+ },
+ "changelog": {
+ "maxCommitsPerSection": 5,
+ "includeCommitHash": true,
+ "includePullRequestLinks": true
+ }
+}
+```
+
+## Custom OpenAI Endpoints
+
+The tool supports custom OpenAI-compatible endpoints:
+
+### Environment Variables
+
+```bash
+export OPENAI_API_KEY="your-api-key"
+export OPENAI_BASE_URL="https://your-custom-endpoint.com/v1"
+```
+
+### Configuration File
+
+```json
+{
+ "aiModel": {
+ "apiKey": "your-api-key",
+ "customEndpoint": "https://your-custom-endpoint.com/v1"
+ }
+}
+```
+
+### Supported Providers
+
+- OpenAI API
+- Azure OpenAI
+- Any OpenAI-compatible API (e.g., Claude via proxy, local models)
+
+## Requirements
+
+- Node.js >= 18.0.0
+- Git repository with proper tag structure (`mobile@x.y.z`)
+- Must be run on a release branch (`release/mobile/*`)
+
+## How It Works
+
+1. **Branch Validation**: Ensures execution on a release branch
+2. **Git Analysis**: Finds commits between latest mobile tag and current HEAD
+3. **Commit Filtering**: Removes noise commits (merges, version bumps, etc.)
+4. **AI Analysis**: Sends filtered commits to AI for categorization
+5. **Contributor Detection**: Identifies external contributors from commit authors
+6. **Changelog Generation**: Formats and writes changelog to target file
+
+## Files Structure
+
+- `index.ts` - Main entry point and orchestration logic
+- `git-tools.ts` - Git command execution and analysis
+- `ai-agent.ts` - AI-powered commit analysis and categorization
+- `openai-client.ts` - OpenAI API client with custom endpoint support
+- `config.json` - Configuration file
+- `bin/cli.js` - CLI executable wrapper
+
+## Development
+
+```bash
+# Install dependencies
+pnpm install
+
+# Run in development mode
+pnpm run dev
+
+# Type checking
+pnpm run typecheck
+
+# Build for production
+pnpm run build
+```
+
+## Integration
+
+This package is designed to integrate with the existing release workflow in the Follow monorepo. It can be called from other apps' package.json scripts or integrated into the bump configuration.
+
+Example integration in mobile app's `package.json`:
+
+```json
+{
+ "scripts": {
+ "changelog:generate": "tsx ../packages/changelog-cli/index.ts"
+ }
+}
+```
+
+## License
+
+This package is part of the Follow project and follows the same license terms.
diff --git a/packages/changelog-cli/USAGE.md b/packages/changelog-cli/USAGE.md
new file mode 100644
index 000000000..248cd3271
--- /dev/null
+++ b/packages/changelog-cli/USAGE.md
@@ -0,0 +1,331 @@
+# Usage Examples
+
+This document provides practical examples of how to use the `@follow/changelog-cli` package in different scenarios.
+
+## Basic Usage
+
+### 1. Generate Changelog for Current Release
+
+Make sure you're on a release branch (e.g., `release/mobile/0.2.5`):
+
+```bash
+# From mobile app directory
+cd apps/mobile
+npm run changelog:generate
+
+# Or from the package directory
+cd packages/changelog-cli
+pnpm run generate
+```
+
+### 2. Using with Custom OpenAI Endpoint
+
+If you're using a custom OpenAI-compatible endpoint (like Azure OpenAI or a local model):
+
+```bash
+# Set environment variables
+export OPENAI_API_KEY="your-api-key"
+export OPENAI_BASE_URL="https://your-endpoint.openai.azure.com/v1"
+
+# Run the generator
+npm run changelog:generate
+```
+
+### 3. Configuration for Different AI Providers
+
+#### Azure OpenAI
+
+```json
+{
+ "aiModel": {
+ "provider": "openai",
+ "model": "gpt-4",
+ "apiKey": "your-azure-key",
+ "customEndpoint": "https://your-resource.openai.azure.com/openai/deployments/gpt-4/chat/completions?api-version=2024-02-15-preview"
+ }
+}
+```
+
+#### Local Model (Ollama)
+
+```json
+{
+ "aiModel": {
+ "provider": "openai",
+ "model": "llama2",
+ "apiKey": "not-needed",
+ "customEndpoint": "http://localhost:11434/v1"
+ }
+}
+```
+
+#### Claude via Proxy
+
+```json
+{
+ "aiModel": {
+ "provider": "openai",
+ "model": "claude-3-sonnet-20240229",
+ "apiKey": "your-anthropic-key",
+ "customEndpoint": "https://api.anthropic.com/v1"
+ }
+}
+```
+
+## Integration Examples
+
+### 1. Auto-generate during Release Process
+
+Add to `apps/mobile/bump.config.ts`:
+
+```typescript
+export default defineConfig({
+ leading: [
+ "git pull --rebase",
+ "npm run changelog:generate", // Add this line
+ "tsx scripts/apply-changelog.ts ${NEW_VERSION}",
+ "git add changelog",
+ // ... rest of config
+ ],
+ // ...
+})
+```
+
+### 2. CI/CD Integration
+
+Example GitHub Actions workflow:
+
+```yaml
+name: Generate Changelog
+on:
+ push:
+ branches:
+ - "release/mobile/*"
+
+jobs:
+ changelog:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # Important: fetch full history
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "18"
+ cache: "pnpm"
+
+ - name: Install dependencies
+ run: pnpm install
+
+ - name: Generate changelog
+ env:
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ run: |
+ cd apps/mobile
+ npm run changelog:generate
+
+ - name: Commit changelog
+ run: |
+ git config --local user.email "action@github.com"
+ git config --local user.name "GitHub Action"
+ git add apps/mobile/changelog/next.md
+ git commit -m "chore: auto-generate changelog" || exit 0
+ git push
+```
+
+### 3. Custom Script Integration
+
+Create a custom script that uses the changelog CLI:
+
+```typescript
+// scripts/release-workflow.ts
+import { execSync } from "node:child_process"
+
+async function releaseWorkflow() {
+ console.log("๐ Starting release workflow...")
+
+ // 1. Generate changelog
+ console.log("๐ Generating changelog...")
+ execSync("npm run changelog:generate", {
+ cwd: "apps/mobile",
+ stdio: "inherit",
+ })
+
+ // 2. Review and edit if needed
+ console.log("๐ Changelog generated. Please review before continuing.")
+
+ // 3. Continue with release process...
+}
+
+releaseWorkflow()
+```
+
+## Configuration Examples
+
+### 1. Team-specific Configuration
+
+For different teams with different internal members:
+
+```json
+{
+ "internalTeamMembers": [
+ "innei",
+ "DIYgod",
+ "hyoban",
+ "team-lead-1",
+ "team-lead-2",
+ "renovate[bot]",
+ "dependabot[bot]"
+ ]
+}
+```
+
+### 2. Project-specific Keywords
+
+Customize keywords for different types of projects:
+
+```json
+{
+ "commitAnalysis": {
+ "categories": {
+ "features": {
+ "keywords": ["feat", "feature", "add", "implement", "new"],
+ "section": "๐ New Features"
+ },
+ "improvements": {
+ "keywords": ["improve", "enhance", "optimize", "perf", "refactor"],
+ "section": "โก Improvements"
+ },
+ "fixes": {
+ "keywords": ["fix", "bug", "patch", "resolve", "hotfix"],
+ "section": "๐ Bug Fixes"
+ }
+ }
+ }
+}
+```
+
+### 3. Strict Filtering
+
+For projects with very specific changelog requirements:
+
+```json
+{
+ "commitAnalysis": {
+ "ignorePatterns": [
+ "^chore:",
+ "^docs:",
+ "^test:",
+ "^ci:",
+ "^build:",
+ "^style:",
+ "^refactor:",
+ "Merge pull request",
+ "Merge branch",
+ "version bump",
+ "changelog",
+ "Update dependencies",
+ "^deps:",
+ "^devDeps:"
+ ]
+ },
+ "changelog": {
+ "maxCommitsPerSection": 3,
+ "includeCommitHash": false,
+ "includePullRequestLinks": true
+ }
+}
+```
+
+## Troubleshooting Examples
+
+### 1. API Rate Limiting
+
+If you hit OpenAI API rate limits:
+
+```json
+{
+ "aiModel": {
+ "temperature": 0.1,
+ "maxTokens": 500
+ }
+}
+```
+
+Or process commits in smaller batches by modifying the batch size in `ai-agent.ts`.
+
+### 2. Custom Git Tag Format
+
+If your project uses a different tag format, modify `git-tools.ts`:
+
+```typescript
+// In git-tools.ts, modify getLatestMobileTag()
+getLatestMobileTag(): GitTag | null {
+ try {
+ // Change this line to match your tag format
+ const tags = this.exec('git tag --sort=-version:refname | grep "^v" | head -1')
+ // ... rest of the method
+ }
+}
+```
+
+### 3. Working with Monorepos
+
+For complex monorepo setups, you might need to adjust the working directory:
+
+```typescript
+// Create a custom git tools instance
+const git = new GitTools("/path/to/your/specific/repo")
+```
+
+## Best Practices
+
+### 1. Review Before Committing
+
+Always review the generated changelog before committing:
+
+```bash
+# Generate changelog
+npm run changelog:generate
+
+# Review the changes
+cat apps/mobile/changelog/next.md
+
+# Edit if necessary
+vim apps/mobile/changelog/next.md
+
+# Commit when satisfied
+git add apps/mobile/changelog/next.md
+git commit -m "chore: update changelog"
+```
+
+### 2. Backup Configuration
+
+Keep your configuration in version control but sensitive data in environment variables:
+
+```json
+{
+ "aiModel": {
+ "apiKey": "", // Leave empty in version control
+ "customEndpoint": "" // Can be committed if not sensitive
+ }
+}
+```
+
+### 3. Testing Configuration
+
+Test your configuration with a small batch first:
+
+```json
+{
+ "changelog": {
+ "maxCommitsPerSection": 1, // Start small
+ "includeCommitHash": true,
+ "includePullRequestLinks": true
+ }
+}
+```
+
+This way you can verify the output format before processing many commits.
diff --git a/packages/changelog-cli/ai-agent.ts b/packages/changelog-cli/ai-agent.ts
new file mode 100644
index 000000000..3f1750665
--- /dev/null
+++ b/packages/changelog-cli/ai-agent.ts
@@ -0,0 +1,250 @@
+import type { GitCommit } from "./git-tools"
+import OpenAIClient from "./openai-client"
+
+export interface ChangelogEntry {
+ section: "Shiny new things" | "Improvements" | "No longer broken"
+ description: string
+ commitHash?: string
+ pullRequest?: string
+}
+
+export interface AIConfig {
+ provider: string
+ model: string
+ temperature: number
+ maxTokens: number
+ apiKey?: string
+}
+
+export interface CommitCategory {
+ keywords: string[]
+ section: "Shiny new things" | "Improvements" | "No longer broken"
+}
+
+export class AIAgent {
+ private config: AIConfig
+ private categories: Record
+ private openaiClient: OpenAIClient
+
+ constructor(config: AIConfig, categories: Record) {
+ this.config = config
+ this.categories = categories
+ this.openaiClient = new OpenAIClient(config)
+ }
+
+ /**
+ * Analyze commits and generate changelog entries using AI
+ */
+ async analyzeCommits(commits: GitCommit[]): Promise {
+ console.info(`Analyzing ${commits.length} commits with AI...`)
+
+ const filteredCommits = this.filterImportantCommits(commits)
+ console.info(`Selected ${filteredCommits.length} important commits`)
+
+ const changelogEntries: ChangelogEntry[] = []
+
+ // Process commits in batches to avoid API limits
+ const batchSize = 10
+ for (let i = 0; i < filteredCommits.length; i += batchSize) {
+ const batch = filteredCommits.slice(i, i + batchSize)
+ const batchEntries = await this.processBatch(batch)
+ changelogEntries.push(...batchEntries)
+ }
+
+ return changelogEntries
+ }
+
+ /**
+ * Filter commits to identify important ones
+ */
+ private filterImportantCommits(commits: GitCommit[]): GitCommit[] {
+ return commits.filter((commit) => {
+ const message = `${commit.subject} ${commit.body}`.toLowerCase()
+
+ // Skip ignored patterns
+ const shouldIgnore = [
+ /^chore:/,
+ /^docs:/,
+ /^test:/,
+ /^ci:/,
+ /^build:/,
+ /merge pull request/,
+ /merge branch/,
+ /version bump/,
+ /changelog/,
+ /update dependencies/,
+ /^\d+\.\d+\.\d+/, // version numbers
+ /^bump /,
+ /^release\(/,
+ ].some((pattern) => pattern.test(message))
+
+ if (shouldIgnore) return false
+
+ // Include commits with significant changes
+ const hasSignificantChange = [
+ /\bfeat\b/,
+ /\bfeature\b/,
+ /\badd\b/,
+ /\bimplement\b/,
+ /\bintroduce\b/,
+ /\bfix\b/,
+ /\bbug\b/,
+ /\bpatch\b/,
+ /\bresolve\b/,
+ /\bcorrect\b/,
+ /\bimprove\b/,
+ /\benhance\b/,
+ /\boptimize\b/,
+ /\brefactor\b/,
+ /\bupdate\b/,
+ /\bperf\b/,
+ /\bbreaking\b/,
+ /\bmajor\b/,
+ /\bminor\b/,
+ /\bui\b/,
+ /\bux\b/,
+ /\bdesign\b/,
+ ].some((pattern) => pattern.test(message))
+
+ return hasSignificantChange || commit.pullRequest
+ })
+ }
+
+ /**
+ * Process a batch of commits using AI
+ */
+ private async processBatch(commits: GitCommit[]): Promise {
+ const prompt = this.buildAnalysisPrompt(commits)
+
+ try {
+ const aiResponse = await this.callAI(prompt)
+ return this.parseAIResponse(aiResponse, commits)
+ } catch (error) {
+ console.warn("AI analysis failed, falling back to keyword-based categorization:", error)
+ return this.fallbackCategorization(commits)
+ }
+ }
+
+ /**
+ * Build the analysis prompt for AI
+ */
+ private buildAnalysisPrompt(commits: GitCommit[]): string {
+ const commitsText = commits
+ .map(
+ (commit, index) =>
+ `${index + 1}. [${commit.shortHash}] ${commit.subject}\n ${commit.body || "No description"}\n ${commit.pullRequest ? `PR #${commit.pullRequest}` : ""}`,
+ )
+ .join("\n\n")
+
+ return `You are a technical writer creating a changelog for a React Native RSS reader app called "Follow".
+
+Analyze these git commits and categorize the most important user-facing changes into these sections:
+
+**Shiny new things**: New features, major additions that users can see/use
+**Improvements**: Enhancements, optimizations, better UX/UI, performance improvements
+**No longer broken**: Bug fixes, crash fixes, issues resolved
+
+For each relevant commit, provide:
+1. A user-friendly description (not technical jargon)
+2. Which section it belongs to
+3. Reference the commit hash or PR number if significant
+
+Focus on changes that impact the user experience. Skip internal refactoring, dependency updates, or development-only changes unless they significantly affect users.
+
+Commits to analyze:
+${commitsText}
+
+Respond in this JSON format:
+{
+ "entries": [
+ {
+ "section": "Shiny new things",
+ "description": "User-friendly description of what changed",
+ "commitHash": "abc123",
+ "pullRequest": "1234"
+ }
+ ]
+}
+
+Only include meaningful user-facing changes. Be selective and focus on quality over quantity.`
+ }
+
+ /**
+ * Call AI API (mock implementation - you need to implement the actual API call)
+ */
+ private async callAI(prompt: string): Promise {
+ // This is a mock implementation. You need to implement the actual AI API call
+ // based on your chosen provider (OpenAI, Anthropic, etc.)
+
+ if (this.config.provider === "openai") {
+ return this.callOpenAI(prompt)
+ }
+
+ throw new Error(`AI provider "${this.config.provider}" not implemented`)
+ }
+
+ /**
+ * OpenAI API call implementation
+ */
+ private async callOpenAI(prompt: string): Promise {
+ if (!this.openaiClient.isAvailable()) {
+ throw new Error("OpenAI API not available")
+ }
+
+ console.info("๐ค Calling OpenAI API...")
+ return await this.openaiClient.chat(prompt)
+ }
+
+ /**
+ * Parse AI response into changelog entries
+ */
+ private parseAIResponse(response: string, commits: GitCommit[]): ChangelogEntry[] {
+ try {
+ const parsed = JSON.parse(response)
+ return parsed.entries || []
+ } catch {
+ console.warn("Failed to parse AI response, using fallback")
+ return this.fallbackCategorization(commits)
+ }
+ }
+
+ /**
+ * Fallback categorization using keywords when AI fails
+ */
+ private fallbackCategorization(commits: GitCommit[]): ChangelogEntry[] {
+ return commits.map((commit) => {
+ const message = `${commit.subject} ${commit.body}`.toLowerCase()
+
+ // Determine category based on keywords
+ let section: ChangelogEntry["section"] = "Improvements"
+
+ if (this.categories.features?.keywords.some((keyword) => message.includes(keyword))) {
+ section = "Shiny new things"
+ } else if (this.categories.fixes?.keywords.some((keyword) => message.includes(keyword))) {
+ section = "No longer broken"
+ }
+
+ // Clean up the description
+ let description = commit.subject
+ if (
+ description.startsWith("feat:") ||
+ description.startsWith("fix:") ||
+ description.startsWith("chore:")
+ ) {
+ description = description.slice(Math.max(0, description.indexOf(":") + 1)).trim()
+ }
+
+ // Capitalize first letter
+ description = description.charAt(0).toUpperCase() + description.slice(1)
+
+ return {
+ section,
+ description,
+ commitHash: commit.shortHash,
+ pullRequest: commit.pullRequest,
+ }
+ })
+ }
+}
+
+export default AIAgent
diff --git a/packages/changelog-cli/bin/cli.js b/packages/changelog-cli/bin/cli.js
new file mode 100644
index 000000000..ea3a32dbe
--- /dev/null
+++ b/packages/changelog-cli/bin/cli.js
@@ -0,0 +1,18 @@
+#!/usr/bin/env node
+
+import { execSync } from "node:child_process"
+import { fileURLToPath } from "node:url"
+
+import { dirname, join } from "pathe"
+
+const __dirname = dirname(fileURLToPath(import.meta.url))
+const indexPath = join(__dirname, "..", "index.ts")
+
+try {
+ execSync(`tsx "${indexPath}"`, {
+ stdio: "inherit",
+ cwd: process.cwd(),
+ })
+} catch (error) {
+ process.exit(error.status || 1)
+}
diff --git a/packages/changelog-cli/config.json b/packages/changelog-cli/config.json
new file mode 100644
index 000000000..35744beaf
--- /dev/null
+++ b/packages/changelog-cli/config.json
@@ -0,0 +1,54 @@
+{
+ "internalTeamMembers": [
+ "Innei",
+ "DIYgod",
+ "hyoban",
+ "renovate[bot]",
+ "github-actions[bot]",
+ "dependabot[bot]",
+ "vercel[bot]",
+ "whitewater"
+ ],
+ "aiModel": {
+ "provider": "openai",
+ "model": "gpt-4o-mini",
+ "temperature": 0.3,
+ "maxTokens": 1000,
+ "apiKey": "",
+ "baseURL": "https://api.openai.com/v1",
+ "customEndpoint": ""
+ },
+ "commitAnalysis": {
+ "categories": {
+ "features": {
+ "keywords": ["feat", "feature", "add", "implement", "introduce"],
+ "section": "Shiny new things"
+ },
+ "improvements": {
+ "keywords": ["improve", "enhance", "optimize", "refactor", "update", "perf"],
+ "section": "Improvements"
+ },
+ "fixes": {
+ "keywords": ["fix", "bug", "patch", "resolve", "correct"],
+ "section": "No longer broken"
+ }
+ },
+ "ignorePatterns": [
+ "^chore:",
+ "^docs:",
+ "^test:",
+ "^ci:",
+ "^build:",
+ "Merge pull request",
+ "Merge branch",
+ "version bump",
+ "changelog",
+ "Update dependencies"
+ ]
+ },
+ "changelog": {
+ "maxCommitsPerSection": 5,
+ "includeCommitHash": true,
+ "includePullRequestLinks": true
+ }
+}
diff --git a/packages/changelog-cli/git-tools.ts b/packages/changelog-cli/git-tools.ts
new file mode 100644
index 000000000..2d60efef8
--- /dev/null
+++ b/packages/changelog-cli/git-tools.ts
@@ -0,0 +1,179 @@
+import { execSync } from "node:child_process"
+import { fileURLToPath } from "node:url"
+
+import { dirname, join } from "pathe"
+
+const __dirname = dirname(fileURLToPath(import.meta.url))
+const projectRoot = join(__dirname, "..", "..")
+
+export interface GitCommit {
+ hash: string
+ shortHash: string
+ subject: string
+ body: string
+ author: string
+ email: string
+ date: string
+ pullRequest?: string
+}
+
+export interface GitTag {
+ name: string
+ hash: string
+ date: string
+}
+
+export class GitTools {
+ private workingDir: string
+
+ constructor(workingDir = projectRoot) {
+ this.workingDir = workingDir
+ }
+
+ /**
+ * Execute git command and return output
+ */
+ private exec(command: string): string {
+ try {
+ return execSync(command, {
+ cwd: this.workingDir,
+ encoding: "utf-8",
+ }).trim()
+ } catch (error) {
+ console.error(`Git command failed: ${command}`)
+ throw error
+ }
+ }
+
+ /**
+ * Get the latest tag for mobile releases
+ */
+ getLatestMobileTag(): GitTag | null {
+ try {
+ const tags = this.exec('git tag --sort=-version:refname | grep "^mobile@" | head -1')
+ if (!tags) return null
+
+ const tagName = tags.trim()
+ const hash = this.exec(`git rev-list -n 1 ${tagName}`)
+ const date = this.exec(`git log -1 --format=%ai ${hash}`)
+
+ return {
+ name: tagName,
+ hash,
+ date,
+ }
+ } catch {
+ return null
+ }
+ }
+
+ /**
+ * Get current branch name
+ */
+ getCurrentBranch(): string {
+ return this.exec("git rev-parse --abbrev-ref HEAD")
+ }
+
+ /**
+ * Get the latest commit hash on current branch
+ */
+ getLatestCommitHash(): string {
+ return this.exec("git rev-parse HEAD")
+ }
+
+ /**
+ * Get commits between two references
+ */
+ getCommitsBetween(fromRef: string, toRef: string): GitCommit[] {
+ const format = [
+ "%H", // full hash
+ "%h", // short hash
+ "%s", // subject
+ "%b", // body
+ "%an", // author name
+ "%ae", // author email
+ "%ai", // author date
+ ].join("%x1f") // use ASCII unit separator
+
+ const command = `git log --format="${format}%x1e" ${fromRef}..${toRef}`
+ const output = this.exec(command)
+
+ if (!output) return []
+
+ return output
+ .split("\x1e")
+ .filter(Boolean)
+ .map((entry) => {
+ const parts = entry.split("\x1f")
+ const [hash, shortHash, subject, body, author, email, date] = parts
+
+ // Ensure all required fields exist
+ if (!hash || !shortHash || !subject || !author || !email || !date) {
+ throw new Error("Invalid git log entry format")
+ }
+
+ // Check if commit is related to a pull request
+ const pullRequest = this.extractPullRequestNumber(subject, body || "")
+
+ return {
+ hash: hash.trim(),
+ shortHash: shortHash.trim(),
+ subject: subject.trim(),
+ body: (body || "").trim(),
+ author: author.trim(),
+ email: email.trim(),
+ date: date.trim(),
+ pullRequest,
+ }
+ })
+ }
+
+ /**
+ * Extract pull request number from commit message
+ */
+ private extractPullRequestNumber(subject: string, body: string): string | undefined {
+ const text = `${subject} ${body}`
+ const prMatch = text.match(/#(\d+)/)
+ return prMatch ? prMatch[1] : undefined
+ }
+
+ /**
+ * Get all unique authors from commits, excluding bots and internal members
+ */
+ getUniqueAuthors(commits: GitCommit[], internalMembers: string[]): string[] {
+ const authors = new Set()
+
+ commits.forEach((commit) => {
+ const author = commit.author.toLowerCase()
+ const isBotOrInternal =
+ author.includes("[bot]") ||
+ author.includes("bot") ||
+ internalMembers.some((member) => author.includes(member.toLowerCase()))
+
+ if (!isBotOrInternal) {
+ authors.add(commit.author)
+ }
+ })
+
+ return Array.from(authors).sort()
+ }
+
+ /**
+ * Check if we're on a release branch
+ */
+ isOnReleaseBranch(): boolean {
+ const currentBranch = this.getCurrentBranch()
+ return currentBranch.startsWith("release/")
+ }
+
+ /**
+ * Get the version from release branch name
+ */
+ getVersionFromBranch(): string | null {
+ const currentBranch = this.getCurrentBranch()
+ const match = currentBranch.match(/release\/mobile\/(.+)/)
+ return match?.[1] ?? null
+ }
+}
+
+export default GitTools
diff --git a/packages/changelog-cli/index.ts b/packages/changelog-cli/index.ts
new file mode 100644
index 000000000..d5ad7fb60
--- /dev/null
+++ b/packages/changelog-cli/index.ts
@@ -0,0 +1,224 @@
+#!/usr/bin/env tsx
+
+import "dotenv/config"
+
+import { readFileSync, writeFileSync } from "node:fs"
+import { fileURLToPath } from "node:url"
+
+import { dirname, join } from "pathe"
+
+import type { ChangelogEntry } from "./ai-agent"
+import AIAgent from "./ai-agent"
+import GitTools from "./git-tools"
+
+// Get current directory
+const __dirname = dirname(fileURLToPath(import.meta.url))
+const changelogDir = join(__dirname, "..", "..", "apps", "mobile", "changelog")
+const configPath = join(__dirname, "config.json")
+
+interface Config {
+ internalTeamMembers: string[]
+ aiModel: {
+ provider: string
+ model: string
+ temperature: number
+ maxTokens: number
+ baseURL?: string
+ customEndpoint?: string
+ }
+ commitAnalysis: {
+ categories: Record<
+ string,
+ {
+ keywords: string[]
+ section: string
+ }
+ >
+ ignorePatterns: string[]
+ }
+ changelog: {
+ maxCommitsPerSection: number
+ includeCommitHash: boolean
+ includePullRequestLinks: boolean
+ }
+}
+
+/**
+ * Load configuration from file
+ */
+function loadConfig(): Config {
+ try {
+ const configContent = readFileSync(configPath, "utf-8")
+ return JSON.parse(configContent)
+ } catch (error) {
+ console.error("Failed to load config file:", error)
+ process.exit(1)
+ }
+}
+
+/**
+ * Format changelog entry for output
+ */
+function formatChangelogEntry(entry: ChangelogEntry, config: Config): string {
+ let line = `- ${entry.description}`
+
+ if (config.changelog.includePullRequestLinks && entry.pullRequest) {
+ line += `(#${entry.pullRequest})`
+ } else if (config.changelog.includeCommitHash && entry.commitHash) {
+ line += `(${entry.commitHash})`
+ }
+
+ return line
+}
+
+/**
+ * Group changelog entries by section
+ */
+function groupEntriesBySection(entries: ChangelogEntry[]): Record {
+ const grouped: Record = {
+ "Shiny new things": [],
+ Improvements: [],
+ "No longer broken": [],
+ }
+
+ entries.forEach((entry) => {
+ if (grouped[entry.section]) {
+ grouped[entry.section]!.push(entry)
+ }
+ })
+
+ return grouped
+}
+
+/**
+ * Generate the changelog content
+ */
+function generateChangelogContent(
+ version: string,
+ entries: ChangelogEntry[],
+ contributors: string[],
+ config: Config,
+): string {
+ const groupedEntries = groupEntriesBySection(entries)
+
+ let content = `# What's New in v${version}\n\n`
+
+ // Add sections with entries
+ Object.entries(groupedEntries).forEach(([section, sectionEntries]) => {
+ content += `## ${section}\n\n`
+
+ if (sectionEntries.length > 0) {
+ // Limit entries per section
+ const limitedEntries = sectionEntries.slice(0, config.changelog.maxCommitsPerSection)
+ limitedEntries.forEach((entry) => {
+ content += `${formatChangelogEntry(entry, config)}\n`
+ })
+ }
+
+ content += "\n"
+ })
+
+ // Add contributors section
+ content += "## Thanks\n\n"
+ if (contributors.length > 0) {
+ const contributorList = contributors.map((name) => `@${name}`).join(" ")
+ content += `Special thanks to volunteer contributors ${contributorList} for their valuable contributions\n`
+ } else {
+ content += "Special thanks to volunteer contributors @ for their valuable contributions\n"
+ }
+
+ return content
+}
+
+/**
+ * Main function to generate changelog
+ */
+async function main() {
+ try {
+ console.info("๐ค Starting AI-driven changelog generation...")
+
+ // Load configuration
+ const config = loadConfig()
+ console.info("โ
Configuration loaded")
+
+ // Initialize Git tools
+ const git = new GitTools()
+
+ // Check if we're on a release branch
+ if (!git.isOnReleaseBranch()) {
+ console.error("โ This script should only be run on a release branch (release/mobile/*)")
+ process.exit(1)
+ }
+
+ // Get version from branch name
+ const version = git.getVersionFromBranch()
+ if (!version) {
+ console.error("โ Could not extract version from branch name")
+ process.exit(1)
+ }
+
+ console.info(`๐ Generating changelog for version: ${version}`)
+
+ // Get the latest mobile tag
+ const latestTag = git.getLatestMobileTag()
+ if (!latestTag) {
+ console.error("โ No previous mobile tags found")
+ process.exit(1)
+ }
+
+ console.info(`๐ Latest tag: ${latestTag.name}`)
+
+ // Get commits between latest tag and current HEAD
+ const currentCommit = git.getLatestCommitHash()
+ const commits = git.getCommitsBetween(latestTag.hash, currentCommit)
+
+ console.info(`๐ Found ${commits.length} commits since last release`)
+
+ if (commits.length === 0) {
+ console.warn("โ ๏ธ No new commits found since last release")
+ return
+ }
+
+ // Initialize AI agent
+ const aiAgent = new AIAgent(config.aiModel, config.commitAnalysis.categories as any)
+
+ // Analyze commits with AI
+ const changelogEntries = await aiAgent.analyzeCommits(commits)
+ console.info(`โจ Generated ${changelogEntries.length} changelog entries`)
+
+ // Get contributors
+ const contributors = git.getUniqueAuthors(commits, config.internalTeamMembers)
+ console.info(`๐ฅ Found ${contributors.length} external contributors`)
+
+ // Generate changelog content
+ const changelogContent = generateChangelogContent(
+ version,
+ changelogEntries,
+ contributors,
+ config,
+ )
+
+ // Write to next.md
+ const nextFilePath = join(changelogDir, "next.md")
+ writeFileSync(nextFilePath, changelogContent, "utf-8")
+
+ console.info("โ
Changelog generated successfully!")
+ console.info(`๐ Updated: ${nextFilePath}`)
+
+ // Show preview
+ console.info("\n๐ Preview:")
+ console.info("โ".repeat(50))
+ console.info(changelogContent)
+ console.info("โ".repeat(50))
+ } catch (error) {
+ console.error("โ Failed to generate changelog:", error)
+ process.exit(1)
+ }
+}
+
+// Run the script if called directly
+if (import.meta.url === `file://${process.argv[1]}`) {
+ main()
+}
+
+export default main
diff --git a/packages/changelog-cli/openai-client.ts b/packages/changelog-cli/openai-client.ts
new file mode 100644
index 000000000..5e26b43e5
--- /dev/null
+++ b/packages/changelog-cli/openai-client.ts
@@ -0,0 +1,84 @@
+export interface OpenAIConfig {
+ apiKey?: string
+ model: string
+ temperature: number
+ maxTokens: number
+ baseURL?: string
+ customEndpoint?: string
+}
+
+export class OpenAIClient {
+ private config: OpenAIConfig
+ private apiKey: string
+ private baseURL: string
+
+ constructor(config: OpenAIConfig) {
+ this.config = config
+ this.apiKey = config.apiKey || process.env.OPENAI_API_KEY || ""
+
+ // Support custom endpoints
+ if (config.customEndpoint) {
+ this.baseURL = config.customEndpoint
+ } else if (config.baseURL) {
+ this.baseURL = config.baseURL
+ } else {
+ this.baseURL = process.env.OPENAI_BASE_URL || "https://api.openai.com/v1"
+ }
+
+ if (!this.apiKey) {
+ console.warn("โ ๏ธ No OpenAI API key provided. Using fallback analysis.")
+ }
+
+ if (config.customEndpoint) {
+ console.info(`๐ Using custom OpenAI endpoint: ${this.baseURL}`)
+ }
+ }
+
+ async chat(prompt: string): Promise {
+ if (!this.apiKey) {
+ throw new Error("OpenAI API key not provided")
+ }
+
+ try {
+ const response = await fetch(`${this.baseURL}/chat/completions`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${this.apiKey}`,
+ },
+ body: JSON.stringify({
+ model: this.config.model,
+ messages: [
+ {
+ role: "user",
+ content: prompt,
+ },
+ ],
+ temperature: this.config.temperature,
+ max_tokens: this.config.maxTokens,
+ }),
+ })
+
+ if (!response.ok) {
+ throw new Error(`OpenAI API error: ${response.status} ${response.statusText}`)
+ }
+
+ const data = await response.json()
+
+ if (!data.choices || data.choices.length === 0) {
+ throw new Error("No response from OpenAI API")
+ }
+
+ return data.choices[0].message.content
+ } catch (error) {
+ console.error("OpenAI API call failed:", error)
+ throw error
+ }
+ }
+
+ isAvailable(): boolean {
+ return Boolean(this.apiKey)
+ }
+}
+
+export default OpenAIClient
diff --git a/packages/changelog-cli/package.json b/packages/changelog-cli/package.json
new file mode 100644
index 000000000..3354c071c
--- /dev/null
+++ b/packages/changelog-cli/package.json
@@ -0,0 +1,35 @@
+{
+ "name": "@follow/changelog-cli",
+ "type": "module",
+ "version": "1.0.0",
+ "private": true,
+ "description": "AI-driven changelog generator for Follow project",
+ "keywords": [
+ "changelog",
+ "git",
+ "ai",
+ "cli",
+ "automation"
+ ],
+ "main": "./index.ts",
+ "bin": {
+ "changelog-cli": "./bin/cli.js"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "scripts": {
+ "build": "tsc",
+ "dev": "tsx index.ts",
+ "generate": "tsx index.ts",
+ "typecheck": "tsc --noEmit"
+ },
+ "dependencies": {
+ "dotenv": "17.2.0",
+ "pathe": "2.0.3"
+ },
+ "devDependencies": {
+ "tsx": "4.20.3",
+ "typescript": "catalog:"
+ }
+}
diff --git a/packages/changelog-cli/tsconfig.json b/packages/changelog-cli/tsconfig.json
new file mode 100644
index 000000000..5fd15f48a
--- /dev/null
+++ b/packages/changelog-cli/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../configs/tsconfig.extend.json",
+ "compilerOptions": {
+ "outDir": "./dist",
+ "rootDir": "./",
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "allowSyntheticDefaultImports": true,
+ "esModuleInterop": true,
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true
+ },
+ "include": ["**/*.ts"],
+ "exclude": ["node_modules", "dist", "**/*.test.ts"]
+}
diff --git a/packages/internal/components/package.json b/packages/internal/components/package.json
index a229a5802..70f4ff732 100644
--- a/packages/internal/components/package.json
+++ b/packages/internal/components/package.json
@@ -23,11 +23,21 @@
},
"dependencies": {
"@essentials/request-timeout": "1.3.0",
+ "@floating-ui/core": "*",
+ "@floating-ui/react": "*",
+ "@floating-ui/react-dom": "*",
"@follow/hooks": "workspace:*",
"@follow/models": "workspace:*",
"@follow/types": "workspace:*",
"@follow/utils": "workspace:*",
"@headlessui/react": "2.2.4",
+ "@lexical/code": "0.33.1",
+ "@lexical/link": "0.33.1",
+ "@lexical/list": "0.33.1",
+ "@lexical/mark": "0.33.1",
+ "@lexical/markdown": "0.33.1",
+ "@lexical/react": "0.33.1",
+ "@lexical/rich-text": "0.33.1",
"@microflash/remark-callout-directives": "4.4.0",
"@radix-ui/react-accordion": "1.2.11",
"@radix-ui/react-avatar": "1.1.10",
@@ -60,6 +70,7 @@
"input-otp": "1.4.2",
"jotai": "2.12.5",
"katex": "0.16.22",
+ "lexical": "0.33.1",
"masonic": "4.1.0",
"motion": "12.23.0",
"react-blurhash": "0.3.0",
diff --git a/packages/internal/components/src/ui/input/InputV2.tsx b/packages/internal/components/src/ui/input/InputV2.tsx
new file mode 100644
index 000000000..3898b54f1
--- /dev/null
+++ b/packages/internal/components/src/ui/input/InputV2.tsx
@@ -0,0 +1,83 @@
+import { useInputComposition } from "@follow/hooks"
+import { cn, stopPropagation } from "@follow/utils"
+import type { DetailedHTMLProps, InputHTMLAttributes, ReactNode } from "react"
+import { useState } from "react"
+
+export const InputV2 = ({
+ ref,
+ className,
+ icon,
+ canClear,
+ ...props
+}: Omit, HTMLInputElement>, "ref"> & {
+ icon?: ReactNode
+ canClear?: boolean
+} & { ref?: React.RefObject }) => {
+ const [internalValue, setInternalValue] = useState(props.value || props.defaultValue || "")
+
+ const inputProps = useInputComposition(props)
+
+ const handleClear = () => {
+ setInternalValue("")
+
+ if (props.onChange) {
+ const event = {
+ target: { value: "" },
+ currentTarget: { value: "" },
+ } as React.ChangeEvent
+ props.onChange(event)
+ }
+ }
+
+ const handleChange = (e: React.ChangeEvent) => {
+ setInternalValue(e.target.value)
+ if (props.onChange) {
+ props.onChange(e)
+ }
+ }
+
+ const showClearButton = canClear && internalValue
+
+ return (
+
+ {icon && (
+
+ {icon}
+
+ )}
+
+ {showClearButton && (
+
+
+
+ )}
+
+ )
+}
diff --git a/packages/internal/components/src/ui/input/TextArea.tsx b/packages/internal/components/src/ui/input/TextArea.tsx
index dca5943cd..0bd7cceea 100644
--- a/packages/internal/components/src/ui/input/TextArea.tsx
+++ b/packages/internal/components/src/ui/input/TextArea.tsx
@@ -30,7 +30,7 @@ export const TextArea = ({
className,
wrapperClassName,
children,
- rounded = "xl",
+ rounded = "lg",
bordered = true,
onCmdEnter,
autoHeight,
diff --git a/packages/internal/components/src/ui/input/index.ts b/packages/internal/components/src/ui/input/index.ts
index dc78a9b80..59f250887 100644
--- a/packages/internal/components/src/ui/input/index.ts
+++ b/packages/internal/components/src/ui/input/index.ts
@@ -1,3 +1,4 @@
export * from "./Input"
+export * from "./InputV2"
export * from "./OTP"
export * from "./TextArea"
diff --git a/packages/internal/components/src/ui/json-highlighter/index.tsx b/packages/internal/components/src/ui/json-highlighter/index.tsx
new file mode 100644
index 000000000..e6e45e7c5
--- /dev/null
+++ b/packages/internal/components/src/ui/json-highlighter/index.tsx
@@ -0,0 +1,410 @@
+import { cn } from "@follow/utils/utils"
+import * as React from "react"
+
+export interface JsonHighlighterProps {
+ /** JSON string to highlight */
+ json: string
+ /** Additional CSS class name */
+ className?: string
+ /** Whether to show indentation */
+ showIndentation?: boolean
+ /** Whether to show line numbers */
+ showLineNumbers?: boolean
+ /** Maximum height before scrolling */
+ maxHeight?: string
+}
+
+/**
+ * A lightweight JSON syntax highlighter component that uses regex matching
+ * and TailwindCSS for styling without external highlighting libraries.
+ */
+export const JsonHighlighter = ({
+ ref,
+ json,
+ className,
+ showIndentation = true,
+ showLineNumbers = false,
+ maxHeight,
+ ...props
+}: JsonHighlighterProps & { ref?: React.RefObject }) => {
+ const highlightedJson = React.useMemo(() => {
+ try {
+ // Try to parse and format the JSON first
+ const parsed = JSON.parse(json)
+ const formatted = JSON.stringify(parsed, null, showIndentation ? 2 : 0)
+ return highlightJson(formatted)
+ } catch {
+ // If parsing fails, highlight the raw string
+ return highlightJson(json)
+ }
+ }, [json, showIndentation])
+
+ const lines = React.useMemo(() => {
+ return highlightedJson.split("\n")
+ }, [highlightedJson])
+
+ return (
+
+
+ {showLineNumbers ? (
+
+
+ {lines.map((_, index) => (
+
+ {index + 1}
+
+ ))}
+
+
+ {lines.map((line, index) => (
+
+ ))}
+
+
+ ) : (
+ lines.map((line, index) =>
)
+ )}
+
+
+ )
+}
+
+JsonHighlighter.displayName = "JsonHighlighter"
+
+/**
+ * Token types for JSON highlighting
+ */
+interface Token {
+ type: "key" | "string" | "number" | "boolean" | "null" | "punctuation" | "whitespace"
+ value: string
+ start: number
+ end: number
+}
+
+/**
+ * Highlights JSON syntax using precise tokenization and UIKit colors
+ */
+function highlightJson(jsonString: string): string {
+ // Escape HTML entities first
+ const escaped = jsonString
+ .replaceAll("&", "&")
+ .replaceAll("<", "<")
+ .replaceAll(">", ">")
+
+ const tokens = tokenizeJson(escaped)
+ return renderTokens(tokens, escaped)
+}
+
+/**
+ * Tokenizes JSON string into semantic tokens
+ */
+function tokenizeJson(json: string): Token[] {
+ const tokens: Token[] = []
+ let i = 0
+
+ // Track context to distinguish keys from string values
+ const contextStack: ("object" | "array")[] = []
+ let expectingKey = false
+
+ while (i < json.length) {
+ const char = json[i]!
+
+ // Skip whitespace but track it for proper rendering
+ if (/\s/.test(char)) {
+ const start = i
+ while (i < json.length && /\s/.test(json[i]!)) {
+ i++
+ }
+ tokens.push({
+ type: "whitespace",
+ value: json.slice(start, i),
+ start,
+ end: i,
+ })
+ continue
+ }
+
+ // Handle strings (keys and values)
+ if (char === '"') {
+ const start = i
+ i++ // Skip opening quote
+ let value = '"'
+
+ // Parse string content, handling escapes
+ while (i < json.length) {
+ const current = json[i]
+ value += current
+
+ if (current === '"') {
+ i++
+ break
+ }
+
+ // Handle escape sequences
+ if (current === "\\" && i + 1 < json.length) {
+ i++
+ value += json[i]
+ }
+ i++
+ }
+
+ // Determine if this is a key or string value
+ const isKey = expectingKey || (contextStack.at(-1) === "object" && isFollowedByColon(json, i))
+
+ tokens.push({
+ type: isKey ? "key" : "string",
+ value,
+ start,
+ end: i,
+ })
+
+ if (isKey) {
+ expectingKey = false
+ }
+ continue
+ }
+
+ // Handle numbers
+ if (/[-\d]/.test(char)) {
+ const start = i
+ let value = ""
+
+ // Handle negative sign
+ if (char === "-") {
+ value += char
+ i++
+ }
+
+ // Parse integer part
+ if (i < json.length && /\d/.test(json[i]!)) {
+ while (i < json.length && /\d/.test(json[i]!)) {
+ value += json[i]!
+ i++
+ }
+
+ // Parse decimal part
+ if (i < json.length && json[i] === ".") {
+ value += json[i]!
+ i++
+ while (i < json.length && /\d/.test(json[i]!)) {
+ value += json[i]!
+ i++
+ }
+ }
+
+ // Parse exponent part
+ if (i < json.length && /e/i.test(json[i]!)) {
+ value += json[i]!
+ i++
+ if (i < json.length && /[+-]/.test(json[i]!)) {
+ value += json[i]!
+ i++
+ }
+ while (i < json.length && /\d/.test(json[i]!)) {
+ value += json[i]!
+ i++
+ }
+ }
+
+ tokens.push({
+ type: "number",
+ value,
+ start,
+ end: i,
+ })
+ continue
+ } else {
+ // Not a valid number, treat as punctuation
+ tokens.push({
+ type: "punctuation",
+ value: char,
+ start,
+ end: i + 1,
+ })
+ i++
+ continue
+ }
+ }
+
+ // Handle boolean and null literals
+ if (/[tfn]/.test(char)) {
+ const start = i
+
+ // Check for 'true'
+ if (json.slice(i, i + 4) === "true") {
+ tokens.push({
+ type: "boolean",
+ value: "true",
+ start,
+ end: i + 4,
+ })
+ i += 4
+ continue
+ }
+
+ // Check for 'false'
+ if (json.slice(i, i + 5) === "false") {
+ tokens.push({
+ type: "boolean",
+ value: "false",
+ start,
+ end: i + 5,
+ })
+ i += 5
+ continue
+ }
+
+ // Check for 'null'
+ if (json.slice(i, i + 4) === "null") {
+ tokens.push({
+ type: "null",
+ value: "null",
+ start,
+ end: i + 4,
+ })
+ i += 4
+ continue
+ }
+ }
+
+ // Handle punctuation
+ if (/[{}[\],:]/.test(char)) {
+ // Update context stack
+ switch (char) {
+ case "{": {
+ contextStack.push("object")
+ expectingKey = true
+
+ break
+ }
+ case "[": {
+ contextStack.push("array")
+
+ break
+ }
+ case "}":
+ case "]": {
+ contextStack.pop()
+ expectingKey = contextStack.at(-1) === "object"
+
+ break
+ }
+ case ",": {
+ expectingKey = contextStack.at(-1) === "object"
+
+ break
+ }
+ case ":": {
+ expectingKey = false
+
+ break
+ }
+ // No default
+ }
+
+ tokens.push({
+ type: "punctuation",
+ value: char,
+ start: i,
+ end: i + 1,
+ })
+ i++
+ continue
+ }
+
+ // Unknown character, skip
+ i++
+ }
+
+ return tokens
+}
+
+/**
+ * Checks if a string token is followed by a colon (indicating it's a key)
+ */
+function isFollowedByColon(json: string, startIndex: number): boolean {
+ let i = startIndex
+
+ // Skip whitespace
+ while (i < json.length && /\s/.test(json[i]!)) {
+ i++
+ }
+
+ return i < json.length && json[i] === ":"
+}
+
+/**
+ * Renders tokens with appropriate UIKit colors
+ */
+function renderTokens(tokens: Token[], originalJson: string): string {
+ let result = ""
+ let lastEnd = 0
+
+ for (const token of tokens) {
+ // Add any characters between tokens (shouldn't happen with proper tokenization)
+ if (token.start > lastEnd) {
+ result += originalJson.slice(lastEnd, token.start)
+ }
+
+ // Apply semantic coloring with enhanced Tailwind colors
+ switch (token.type) {
+ case "key": {
+ result += `${token.value} `
+ break
+ }
+ case "string": {
+ result += `${token.value} `
+ break
+ }
+ case "number": {
+ result += `${token.value} `
+ break
+ }
+ case "boolean": {
+ result += `${token.value} `
+ break
+ }
+ case "null": {
+ result += `${token.value} `
+ break
+ }
+ case "punctuation": {
+ // Use different colors for different punctuation types
+ if (token.value === ":") {
+ result += `${token.value} `
+ } else if (/[{}[\]]/.test(token.value)) {
+ result += `${token.value} `
+ } else {
+ result += `${token.value} `
+ }
+ break
+ }
+ case "whitespace": {
+ result += token.value
+ break
+ }
+ default: {
+ result += token.value
+ break
+ }
+ }
+
+ lastEnd = token.end
+ }
+
+ // Add any remaining characters
+ if (lastEnd < originalJson.length) {
+ result += originalJson.slice(lastEnd)
+ }
+
+ return result
+}
diff --git a/packages/internal/components/src/ui/key-value-editor/index.tsx b/packages/internal/components/src/ui/key-value-editor/index.tsx
new file mode 100644
index 000000000..615d65457
--- /dev/null
+++ b/packages/internal/components/src/ui/key-value-editor/index.tsx
@@ -0,0 +1,163 @@
+import { Button } from "@follow/components/ui/button/index.js"
+import { Input } from "@follow/components/ui/input/index.js"
+import { cn } from "@follow/utils/utils"
+import { useCallback, useEffect, useRef, useState } from "react"
+
+export interface KeyValuePair {
+ key: string
+ value: string
+}
+
+export interface KeyValueEditorProps {
+ value?: Record
+ onChange?: (data: Record) => void
+ className?: string
+ keyPlaceholder?: string
+ valuePlaceholder?: string
+ addButtonText?: string
+ minRows?: number
+ disabled?: boolean
+}
+
+const emptyObject = {} as Record
+
+export const KeyValueEditor = ({
+ value = emptyObject,
+ onChange,
+ className,
+ keyPlaceholder = "Key",
+ valuePlaceholder = "Value",
+ addButtonText = "Add Row",
+ minRows = 1,
+ disabled = false,
+}: KeyValueEditorProps) => {
+ // Internal state for key-value pairs array
+ const [pairs, setPairs] = useState(() => {
+ const entries = Object.entries(value)
+ return entries.length > 0
+ ? entries.map(([key, val]) => ({ key, value: val }))
+ : Array.from({ length: minRows }, () => ({ key: "", value: "" }))
+ })
+
+ // Track if we're in the middle of an internal update to avoid sync conflicts
+ const isInternalUpdateRef = useRef(false)
+ const lastExternalValueRef = useRef(value)
+
+ // Sync external value changes to internal state
+ useEffect(() => {
+ // Skip sync if this change originated from internal update
+ if (isInternalUpdateRef.current) {
+ isInternalUpdateRef.current = false
+ return
+ }
+
+ // Skip if external value hasn't actually changed
+ if (JSON.stringify(value) === JSON.stringify(lastExternalValueRef.current)) {
+ return
+ }
+
+ lastExternalValueRef.current = value
+
+ const entries = Object.entries(value)
+ const newPairs =
+ entries.length > 0
+ ? entries.map(([key, val]) => ({ key, value: val }))
+ : Array.from({ length: minRows }, () => ({ key: "", value: "" }))
+
+ setPairs(newPairs)
+ }, [value, minRows])
+
+ // Convert pairs array to object and notify parent
+ const notifyChange = useCallback(
+ (newPairs: KeyValuePair[]) => {
+ if (!onChange) return
+
+ const dataObject = newPairs.reduce(
+ (acc, { key, value }) => {
+ if (key.trim() && value.trim()) {
+ acc[key.trim()] = value.trim()
+ }
+ return acc
+ },
+ {} as Record,
+ )
+
+ // Mark this as an internal update to prevent sync conflicts
+ isInternalUpdateRef.current = true
+ lastExternalValueRef.current = dataObject
+ onChange(dataObject)
+ },
+ [onChange],
+ )
+
+ const addPair = useCallback(() => {
+ const newPairs = [...pairs, { key: "", value: "" }]
+ setPairs(newPairs)
+ notifyChange(newPairs)
+ }, [pairs, notifyChange])
+
+ const removePair = useCallback(
+ (index: number) => {
+ if (pairs.length <= minRows) return
+
+ const newPairs = pairs.filter((_, i) => i !== index)
+ setPairs(newPairs)
+ notifyChange(newPairs)
+ },
+ [pairs, minRows, notifyChange],
+ )
+
+ const updatePair = useCallback(
+ (index: number, field: "key" | "value", newValue: string) => {
+ const newPairs = pairs.map((pair, i) => (i === index ? { ...pair, [field]: newValue } : pair))
+ setPairs(newPairs)
+ notifyChange(newPairs)
+ },
+ [pairs, notifyChange],
+ )
+
+ return (
+
+ )
+}
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx b/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx
new file mode 100644
index 000000000..986688a8f
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx
@@ -0,0 +1,136 @@
+import { cn } from "@follow/utils"
+import { TRANSFORMERS } from "@lexical/markdown"
+import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin"
+import type { InitialConfigType } from "@lexical/react/LexicalComposer"
+import { LexicalComposer } from "@lexical/react/LexicalComposer"
+import { ContentEditable } from "@lexical/react/LexicalContentEditable"
+import { EditorRefPlugin } from "@lexical/react/LexicalEditorRefPlugin"
+import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary"
+import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin"
+import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin"
+import { ListPlugin } from "@lexical/react/LexicalListPlugin"
+import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin"
+import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin"
+import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin"
+import type { EditorState, LexicalEditor } from "lexical"
+import { $getRoot } from "lexical"
+import { useCallback, useImperativeHandle, useState } from "react"
+
+import { LexicalRichEditorNodes } from "./nodes"
+import { KeyboardPlugin } from "./plugins"
+import { defaultLexicalTheme } from "./theme"
+import type { BuiltInPlugins, LexicalRichEditorProps, LexicalRichEditorRef } from "./types"
+
+function onError(error: Error) {
+ console.error("Lexical Editor Error:", error)
+}
+const defaultEnabledPlugins: BuiltInPlugins = {
+ history: true,
+ markdown: true,
+ list: true,
+ link: true,
+ autoFocus: true,
+}
+
+export const LexicalRichEditor = ({
+ ref,
+ placeholder = "Enter your message...",
+ className,
+ onChange,
+ onKeyDown,
+ autoFocus = false,
+ namespace = "LexicalRichEditor",
+ theme = defaultLexicalTheme,
+ enabledPlugins = defaultEnabledPlugins,
+ initalEditorState,
+ plugins,
+}: LexicalRichEditorProps & { ref?: React.RefObject }) => {
+ const [editorRef, setEditorRef] = useState(null)
+ const [isEmpty, setIsEmpty] = useState(true)
+
+ // Collect nodes from plugins
+ const pluginNodes = plugins?.flatMap((plugin) => plugin.nodes || []) || []
+
+ // Merge base nodes with custom nodes and plugin nodes
+ const allNodes = [...LexicalRichEditorNodes, ...pluginNodes]
+
+ const initialConfig: InitialConfigType = {
+ namespace,
+ theme,
+ onError,
+ nodes: allNodes,
+ editorState: initalEditorState,
+ }
+
+ useImperativeHandle(
+ ref,
+ useCallback(
+ () => ({
+ getEditor: () => editorRef!,
+ focus: () => {
+ editorRef?.focus()
+ },
+ clear: () => {
+ editorRef?.update(() => {
+ const root = $getRoot()
+ root.clear()
+ })
+ },
+ isEmpty: () => isEmpty,
+ }),
+ [isEmpty, editorRef],
+ ),
+ )
+
+ const handleChange = (editorState: EditorState, editor: LexicalEditor) => {
+ // Check if editor is empty
+ editorState.read(() => {
+ const root = $getRoot()
+ const textContent = root.getTextContent().trim()
+ setIsEmpty(textContent === "")
+ })
+
+ onChange?.(editorState, editor)
+ }
+
+ return (
+
+
+
+ {placeholder}
+
+ }
+ />
+ }
+ ErrorBoundary={LexicalErrorBoundary}
+ />
+
+
+
+ {enabledPlugins.history && }
+ {enabledPlugins.markdown && }
+ {enabledPlugins.list && }
+ {enabledPlugins.link && }
+
+ {plugins?.map((Plugin) => (
+
+ ))}
+
+
+ {autoFocus && enabledPlugins.autoFocus && }
+
+
+ )
+}
+
+LexicalRichEditor.displayName = "LexicalRichEditor"
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/editor.tsx b/packages/internal/components/src/ui/lexical-rich-editor/editor.tsx
new file mode 100644
index 000000000..4116e32b8
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/editor.tsx
@@ -0,0 +1,22 @@
+import type { CreateEditorArgs } from "lexical"
+import { createEditor } from "lexical"
+
+import { LexicalRichEditorNodes } from "./nodes"
+import { defaultLexicalTheme } from "./theme"
+
+export const createLexicalEditor = (options: CreateEditorArgs) => {
+ const editor = createEditor({
+ theme: defaultLexicalTheme,
+ nodes: LexicalRichEditorNodes,
+ ...options,
+ })
+ return editor
+}
+
+export const createDefaultLexicalEditor = () => {
+ return createLexicalEditor({
+ namespace: "LexicalRichEditor",
+ theme: defaultLexicalTheme,
+ nodes: LexicalRichEditorNodes,
+ })
+}
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/index.ts b/packages/internal/components/src/ui/lexical-rich-editor/index.ts
new file mode 100644
index 000000000..8eec0d013
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/index.ts
@@ -0,0 +1,6 @@
+export { createDefaultLexicalEditor, createLexicalEditor } from "./editor"
+export { LexicalRichEditor } from "./LexicalRichEditor"
+export { LexicalRichEditorNodes } from "./nodes"
+export { KeyboardPlugin } from "./plugins"
+export { defaultLexicalTheme } from "./theme"
+export type * from "./types"
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/nodes.ts b/packages/internal/components/src/ui/lexical-rich-editor/nodes.ts
new file mode 100644
index 000000000..7bf89baa3
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/nodes.ts
@@ -0,0 +1,33 @@
+import { CodeHighlightNode, CodeNode } from "@lexical/code"
+import { LinkNode } from "@lexical/link"
+import { ListItemNode, ListNode } from "@lexical/list"
+import { MarkNode } from "@lexical/mark"
+import { HeadingNode, QuoteNode } from "@lexical/rich-text"
+import { ParagraphNode, TextNode } from "lexical"
+
+// Mention functionality moved to desktop app, import should be handled there
+// import { MentionNode } from "./plugins/mention"
+
+export const LexicalRichEditorNodes = [
+ // Core nodes
+ ParagraphNode,
+ TextNode,
+
+ // Rich text nodes
+ HeadingNode, // For HEADING transformer
+ QuoteNode, // For QUOTE transformer
+
+ // List nodes
+ ListNode, // For UNORDERED_LIST, ORDERED_LIST transformers
+ ListItemNode,
+
+ // Code nodes
+ CodeNode, // For CODE transformer (multiline)
+ CodeHighlightNode, // For code syntax highlighting
+
+ // Link nodes
+ LinkNode, // For LINK transformer
+
+ // Text format nodes
+ MarkNode, // For HIGHLIGHT transformer
+]
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/plugins/index.ts b/packages/internal/components/src/ui/lexical-rich-editor/plugins/index.ts
new file mode 100644
index 000000000..ba383f8bd
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/plugins/index.ts
@@ -0,0 +1 @@
+export { KeyboardPlugin } from "./keyboard"
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/plugins/keyboard/index.tsx b/packages/internal/components/src/ui/lexical-rich-editor/plugins/keyboard/index.tsx
new file mode 100644
index 000000000..d2ea1b64d
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/plugins/keyboard/index.tsx
@@ -0,0 +1,55 @@
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext"
+import { COMMAND_PRIORITY_LOW, KEY_ENTER_COMMAND } from "lexical"
+import { useEffect } from "react"
+
+interface KeyboardPluginProps {
+ onKeyDown?: (event: KeyboardEvent) => boolean
+}
+
+export function KeyboardPlugin({ onKeyDown }: KeyboardPluginProps) {
+ const [editor] = useLexicalComposerContext()
+
+ useEffect(() => {
+ if (!onKeyDown) return
+
+ // Register a low-priority command that will only execute if no higher-priority commands handle the event
+ const removeEnterCommand = editor.registerCommand(
+ KEY_ENTER_COMMAND,
+ (event) => {
+ // This will only be called if no higher-priority commands handled the Enter key
+ if (!event) return false
+ const handled = onKeyDown(event)
+ return handled
+ },
+ COMMAND_PRIORITY_LOW,
+ )
+
+ // For other keys, use DOM event listener
+ const handleKeyDown = (event: KeyboardEvent) => {
+ // Skip Enter key as it's handled by the command system
+ if (event.key === "Enter") return
+
+ const handled = onKeyDown(event)
+ if (handled) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+
+ const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
+ if (prevRootElement !== null) {
+ prevRootElement.removeEventListener("keydown", handleKeyDown)
+ }
+ if (rootElement !== null) {
+ rootElement.addEventListener("keydown", handleKeyDown)
+ }
+ })
+
+ return () => {
+ removeEnterCommand()
+ removeRootListener()
+ }
+ }, [editor, onKeyDown])
+
+ return null
+}
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/theme.ts b/packages/internal/components/src/ui/lexical-rich-editor/theme.ts
new file mode 100644
index 000000000..bfdbcb678
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/theme.ts
@@ -0,0 +1,69 @@
+/**
+ * Default Lexical theme configuration for consistent styling
+ * across editable and read-only rich text components.
+ *
+ * Uses Follow's UIKit color system with Tailwind classes for
+ * automatic light/dark mode adaptation.
+ */
+export const defaultLexicalTheme = {
+ paragraph: "mb-1 last:mb-0",
+ text: {
+ bold: "font-semibold",
+ italic: "italic",
+ strikethrough: "line-through",
+ underline: "underline",
+ code: "bg-fill px-1 py-0.5 rounded text-sm font-mono",
+ },
+ heading: {
+ h1: "text-2xl font-bold mb-2",
+ h2: "text-xl font-bold mb-2",
+ h3: "text-lg font-bold mb-1",
+ h4: "text-base font-bold mb-1",
+ h5: "text-sm font-bold mb-1",
+ h6: "text-xs font-bold mb-1",
+ },
+ list: {
+ nested: {
+ listitem: "list-none",
+ },
+ ol: "list-decimal list-inside mb-2",
+ ul: "list-disc list-inside mb-2",
+ listitem: "mb-1",
+ },
+ quote: "border-l-4 border-accent pl-4 italic mb-2",
+ code: "bg-fill px-3 py-2 rounded font-mono text-sm mb-2 block overflow-x-auto",
+ codeHighlight: {
+ atrule: "text-purple-400",
+ attr: "text-blue-400",
+ boolean: "text-orange-400",
+ builtin: "text-purple-400",
+ cdata: "text-gray-400",
+ char: "text-green-400",
+ class: "text-blue-400",
+ "class-name": "text-blue-400",
+ comment: "text-gray-400",
+ constant: "text-orange-400",
+ deleted: "text-red-400",
+ doctype: "text-gray-400",
+ entity: "text-orange-400",
+ function: "text-yellow-400",
+ important: "text-red-400",
+ inserted: "text-green-400",
+ keyword: "text-purple-400",
+ namespace: "text-blue-400",
+ number: "text-orange-400",
+ operator: "text-pink-400",
+ prolog: "text-gray-400",
+ property: "text-blue-400",
+ punctuation: "text-gray-300",
+ regex: "text-green-400",
+ selector: "text-green-400",
+ string: "text-green-400",
+ symbol: "text-orange-400",
+ tag: "text-red-400",
+ url: "text-blue-400",
+ variable: "text-orange-400",
+ },
+ link: "text-accent underline hover:text-accent/80",
+ mark: "bg-yellow-200 px-1 py-0.5 rounded",
+}
diff --git a/packages/internal/components/src/ui/lexical-rich-editor/types.ts b/packages/internal/components/src/ui/lexical-rich-editor/types.ts
new file mode 100644
index 000000000..3021c9bb9
--- /dev/null
+++ b/packages/internal/components/src/ui/lexical-rich-editor/types.ts
@@ -0,0 +1,32 @@
+import type { EditorState, Klass, LexicalEditor, LexicalNode } from "lexical"
+
+export interface LexicalRichEditorRef {
+ getEditor: () => LexicalEditor
+ focus: () => void
+ clear: () => void
+ isEmpty: () => boolean
+}
+
+export interface BuiltInPlugins {
+ history?: boolean
+ markdown?: boolean
+ list?: boolean
+ link?: boolean
+ autoFocus?: boolean
+}
+export interface LexicalRichEditorProps {
+ placeholder?: string
+ className?: string
+ onChange?: (editorState: EditorState, editor: LexicalEditor) => void
+ onKeyDown?: (event: KeyboardEvent) => boolean
+ autoFocus?: boolean
+ namespace?: string
+ theme?: any
+ enabledPlugins?: BuiltInPlugins
+ initalEditorState?: EditorState
+ plugins?: LexicalPluginFC[]
+}
+export type LexicalPluginFC = React.FC & {
+ id: string
+ nodes?: ReadonlyArray>
+}
diff --git a/packages/internal/components/src/utils/parse-markdown.tsx b/packages/internal/components/src/utils/parse-markdown.tsx
index 2c0fdff93..03553de68 100644
--- a/packages/internal/components/src/utils/parse-markdown.tsx
+++ b/packages/internal/components/src/utils/parse-markdown.tsx
@@ -14,16 +14,17 @@ import remarkGfm from "remark-gfm"
import remarkGithubAlerts from "remark-gh-alerts"
import remarkParse from "remark-parse"
import remarkRehype from "remark-rehype"
-import type { Processor } from "unified"
+import type { PluggableList, Processor } from "unified"
import { unified } from "unified"
export interface RemarkOptions {
components: Partial
applyMiddleware?: >(pipeline: T) => T
+ rehypePlugins?: PluggableList
}
export const parseMarkdown = (content: string, options?: Partial) => {
- const { components, applyMiddleware } = options || {}
+ const { components, applyMiddleware, rehypePlugins } = options || {}
let pipeline: Processor = unified()
.use(remarkDirective)
@@ -67,9 +68,13 @@ export const parseMarkdown = (content: string, options?: Partial)
pipeline = applyMiddleware(pipeline)
}
- pipeline = pipeline
- .use(remarkRehype, { allowDangerousHtml: true })
- .use(rehypeStringify, { allowDangerousHtml: true })
+ pipeline = pipeline.use(remarkRehype, { allowDangerousHtml: true })
+
+ if (rehypePlugins) {
+ pipeline = pipeline.use(rehypePlugins)
+ }
+
+ pipeline = pipeline.use(rehypeStringify, { allowDangerousHtml: true })
const tree = pipeline.parse(content)
diff --git a/packages/internal/database/package.json b/packages/internal/database/package.json
index 7616ab968..32c90b636 100644
--- a/packages/internal/database/package.json
+++ b/packages/internal/database/package.json
@@ -36,7 +36,7 @@
"@follow/constants": "workspace:*",
"@follow/models": "workspace:*",
"@follow/shared": "workspace:*",
- "ai": "5.0.0-beta.7",
+ "ai": "5.0.4",
"drizzle-orm": "0.44.3",
"expo-sqlite": "15.2.12",
"sqlocal": "npm:@hyoban/sqlocal@0.14.1-fork.4",
diff --git a/packages/internal/database/src/db.desktop.ts b/packages/internal/database/src/db.desktop.ts
index 629c1c36f..b9bd0fbb5 100644
--- a/packages/internal/database/src/db.desktop.ts
+++ b/packages/internal/database/src/db.desktop.ts
@@ -78,8 +78,7 @@ export async function migrateDB() {
await migrate(db, migrations)
}
}
-
-export async function exportDB() {
+export async function getDBFile() {
const module = await SQLiteESMFactory()
const vfs = await MyVFS.create(IDB_NAME, module)
const source = new DatabaseSource(vfs, SQLITE_DB_NAME)
@@ -93,7 +92,11 @@ export async function exportDB() {
},
})
const databaseFile = await response.blob()
+ return databaseFile
+}
+export async function exportDB() {
+ const databaseFile = await getDBFile()
const fileUrl = URL.createObjectURL(databaseFile)
const a = document.createElement("a")
diff --git a/packages/internal/database/src/db.rn.ts b/packages/internal/database/src/db.rn.ts
index 021384335..ff3e1df3d 100644
--- a/packages/internal/database/src/db.rn.ts
+++ b/packages/internal/database/src/db.rn.ts
@@ -33,6 +33,7 @@ export async function migrateDB(): Promise {
}
}
+export async function getDBFile() {}
export async function exportDB() {}
export async function deleteDB() {
try {
diff --git a/packages/internal/database/src/db.ts b/packages/internal/database/src/db.ts
index d86b87f88..9a5c4338f 100644
--- a/packages/internal/database/src/db.ts
+++ b/packages/internal/database/src/db.ts
@@ -1,11 +1,17 @@
+import type { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core"
+
+import type * as schema from "./schemas"
import type { DB } from "./types"
export declare const sqlite: unknown
export declare const db: DB
export declare function initializeDB(): Promise
export declare function migrateDB(): Promise
-export declare function exportDB(): Promise
+export declare function getDBFile(): Promise
+export declare function exportDB(): Promise
/**
* Deletes the database file, normally you should reload the app after calling this function.
*/
export declare function deleteDB(): Promise
+
+export type AsyncDb = BaseSQLiteDatabase<"async", any, typeof schema>
diff --git a/packages/internal/database/src/drizzle/0033_shiny_sebastian_shaw.sql b/packages/internal/database/src/drizzle/0033_shiny_sebastian_shaw.sql
new file mode 100644
index 000000000..66618b80a
--- /dev/null
+++ b/packages/internal/database/src/drizzle/0033_shiny_sebastian_shaw.sql
@@ -0,0 +1,25 @@
+ALTER TABLE `ai_chat` RENAME TO `ai_chat_sessions`;--> statement-breakpoint
+ALTER TABLE `ai_chat_sessions` RENAME COLUMN "room_id" TO "id";--> statement-breakpoint
+ALTER TABLE `ai_chat_sessions` ADD `updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL;--> statement-breakpoint
+CREATE INDEX `idx_ai_chat_sessions_updated_at` ON `ai_chat_sessions` (`updated_at`);--> statement-breakpoint
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_ai_chat_messages` (
+ `id` text PRIMARY KEY NOT NULL,
+ `chat_id` text NOT NULL,
+ `role` text NOT NULL,
+ `rich_text_schema` text,
+ `created_at` integer,
+ `metadata` text,
+ `status` text DEFAULT 'completed',
+ `finished_at` integer,
+ `message_parts` text,
+ FOREIGN KEY (`chat_id`) REFERENCES `ai_chat_sessions`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_ai_chat_messages`("id", "chat_id", "role", "rich_text_schema", "created_at", "metadata", "status", "finished_at", "message_parts") SELECT "id", "chat_id", "role", "rich_text_schema", "created_at", "metadata", "status", "finished_at", "message_parts" FROM `ai_chat_messages`;--> statement-breakpoint
+DROP TABLE `ai_chat_messages`;--> statement-breakpoint
+ALTER TABLE `__new_ai_chat_messages` RENAME TO `ai_chat_messages`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE INDEX `idx_ai_chat_messages_chat_id_created_at` ON `ai_chat_messages` (`chat_id`,`created_at`);--> statement-breakpoint
+CREATE INDEX `idx_ai_chat_messages_status` ON `ai_chat_messages` (`status`);--> statement-breakpoint
+CREATE INDEX `idx_ai_chat_messages_chat_id_role` ON `ai_chat_messages` (`chat_id`,`role`);
\ No newline at end of file
diff --git a/packages/internal/database/src/drizzle/0034_curly_darkstar.sql b/packages/internal/database/src/drizzle/0034_curly_darkstar.sql
new file mode 100644
index 000000000..b6be5b012
--- /dev/null
+++ b/packages/internal/database/src/drizzle/0034_curly_darkstar.sql
@@ -0,0 +1 @@
+ALTER TABLE `ai_chat_messages` DROP COLUMN `rich_text_schema`;
\ No newline at end of file
diff --git a/packages/internal/database/src/drizzle/meta/0033_snapshot.json b/packages/internal/database/src/drizzle/meta/0033_snapshot.json
new file mode 100644
index 000000000..9f047fd58
--- /dev/null
+++ b/packages/internal/database/src/drizzle/meta/0033_snapshot.json
@@ -0,0 +1,950 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "339611d0-cf1e-4ec9-9bf6-275608b815f5",
+ "prevId": "611bbe39-b8f0-4c81-a067-315ac9b0f8a3",
+ "tables": {
+ "ai_chat_messages": {
+ "name": "ai_chat_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rich_text_schema": {
+ "name": "rich_text_schema",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'completed'"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_parts": {
+ "name": "message_parts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_ai_chat_messages_chat_id_created_at": {
+ "name": "idx_ai_chat_messages_chat_id_created_at",
+ "columns": ["chat_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_ai_chat_messages_status": {
+ "name": "idx_ai_chat_messages_status",
+ "columns": ["status"],
+ "isUnique": false
+ },
+ "idx_ai_chat_messages_chat_id_role": {
+ "name": "idx_ai_chat_messages_chat_id_role",
+ "columns": ["chat_id", "role"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "ai_chat_messages_chat_id_ai_chat_sessions_id_fk": {
+ "name": "ai_chat_messages_chat_id_ai_chat_sessions_id_fk",
+ "tableFrom": "ai_chat_messages",
+ "tableTo": "ai_chat_sessions",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ai_chat_sessions": {
+ "name": "ai_chat_sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch() * 1000)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch() * 1000)"
+ }
+ },
+ "indexes": {
+ "idx_ai_chat_sessions_updated_at": {
+ "name": "idx_ai_chat_sessions_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "collections": {
+ "name": "collections",
+ "columns": {
+ "feed_id": {
+ "name": "feed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "entry_id": {
+ "name": "entry_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "view": {
+ "name": "view",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "entries": {
+ "name": "entries",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_content": {
+ "name": "source_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readability_updated_at": {
+ "name": "readability_updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "guid": {
+ "name": "guid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author_url": {
+ "name": "author_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author_avatar": {
+ "name": "author_avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inserted_at": {
+ "name": "inserted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "media": {
+ "name": "media",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "categories": {
+ "name": "categories",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attachments": {
+ "name": "attachments",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "extra": {
+ "name": "extra",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "feed_id": {
+ "name": "feed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inbox_handle": {
+ "name": "inbox_handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "read": {
+ "name": "read",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sources": {
+ "name": "sources",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "settings": {
+ "name": "settings",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "feeds": {
+ "name": "feeds",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_at": {
+ "name": "error_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "site_url": {
+ "name": "site_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subscription_count": {
+ "name": "subscription_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updates_per_week": {
+ "name": "updates_per_week",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "latest_entry_published_at": {
+ "name": "latest_entry_published_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tip_users": {
+ "name": "tip_users",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "images": {
+ "name": "images",
+ "columns": {
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "colors": {
+ "name": "colors",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch() * 1000)"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "inboxes": {
+ "name": "inboxes",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "lists": {
+ "name": "lists",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "feed_ids": {
+ "name": "feed_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "view": {
+ "name": "view",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fee": {
+ "name": "fee",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subscription_count": {
+ "name": "subscription_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "purchase_amount": {
+ "name": "purchase_amount",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subscriptions": {
+ "name": "subscriptions",
+ "columns": {
+ "feed_id": {
+ "name": "feed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_id": {
+ "name": "list_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inbox_id": {
+ "name": "inbox_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "view": {
+ "name": "view",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hide_from_timeline": {
+ "name": "hide_from_timeline",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "summaries": {
+ "name": "summaries",
+ "columns": {
+ "entry_id": {
+ "name": "entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "readability_summary": {
+ "name": "readability_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "unq": {
+ "name": "unq",
+ "columns": ["entry_id", "language"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "translations": {
+ "name": "translations",
+ "columns": {
+ "entry_id": {
+ "name": "entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readability_content": {
+ "name": "readability_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "translation-unique-index": {
+ "name": "translation-unique-index",
+ "columns": ["entry_id", "language"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "unread": {
+ "name": "unread",
+ "columns": {
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "users": {
+ "name": "users",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "handle": {
+ "name": "handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_me": {
+ "name": "is_me",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bio": {
+ "name": "bio",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "website": {
+ "name": "website",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "social_links": {
+ "name": "social_links",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {
+ "\"ai_chat\"": "\"ai_chat_sessions\""
+ },
+ "columns": {
+ "\"ai_chat_messages\".\"room_id\"": "\"ai_chat_messages\".\"chat_id\"",
+ "\"ai_chat_sessions\".\"room_id\"": "\"ai_chat_sessions\".\"id\""
+ }
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/packages/internal/database/src/drizzle/meta/0034_snapshot.json b/packages/internal/database/src/drizzle/meta/0034_snapshot.json
new file mode 100644
index 000000000..c68afacc1
--- /dev/null
+++ b/packages/internal/database/src/drizzle/meta/0034_snapshot.json
@@ -0,0 +1,938 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "6cfe24ba-739c-4f3f-a894-dd70ecb47d02",
+ "prevId": "339611d0-cf1e-4ec9-9bf6-275608b815f5",
+ "tables": {
+ "ai_chat_messages": {
+ "name": "ai_chat_messages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'completed'"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "message_parts": {
+ "name": "message_parts",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "idx_ai_chat_messages_chat_id_created_at": {
+ "name": "idx_ai_chat_messages_chat_id_created_at",
+ "columns": ["chat_id", "created_at"],
+ "isUnique": false
+ },
+ "idx_ai_chat_messages_status": {
+ "name": "idx_ai_chat_messages_status",
+ "columns": ["status"],
+ "isUnique": false
+ },
+ "idx_ai_chat_messages_chat_id_role": {
+ "name": "idx_ai_chat_messages_chat_id_role",
+ "columns": ["chat_id", "role"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "ai_chat_messages_chat_id_ai_chat_sessions_id_fk": {
+ "name": "ai_chat_messages_chat_id_ai_chat_sessions_id_fk",
+ "tableFrom": "ai_chat_messages",
+ "tableTo": "ai_chat_sessions",
+ "columnsFrom": ["chat_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ai_chat_sessions": {
+ "name": "ai_chat_sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch() * 1000)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch() * 1000)"
+ }
+ },
+ "indexes": {
+ "idx_ai_chat_sessions_updated_at": {
+ "name": "idx_ai_chat_sessions_updated_at",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "collections": {
+ "name": "collections",
+ "columns": {
+ "feed_id": {
+ "name": "feed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "entry_id": {
+ "name": "entry_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "view": {
+ "name": "view",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "entries": {
+ "name": "entries",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "source_content": {
+ "name": "source_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readability_updated_at": {
+ "name": "readability_updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "guid": {
+ "name": "guid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "author": {
+ "name": "author",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author_url": {
+ "name": "author_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "author_avatar": {
+ "name": "author_avatar",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inserted_at": {
+ "name": "inserted_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "media": {
+ "name": "media",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "categories": {
+ "name": "categories",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "attachments": {
+ "name": "attachments",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "extra": {
+ "name": "extra",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "feed_id": {
+ "name": "feed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inbox_handle": {
+ "name": "inbox_handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "read": {
+ "name": "read",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "sources": {
+ "name": "sources",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "settings": {
+ "name": "settings",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "feeds": {
+ "name": "feeds",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_at": {
+ "name": "error_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "site_url": {
+ "name": "site_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subscription_count": {
+ "name": "subscription_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updates_per_week": {
+ "name": "updates_per_week",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "latest_entry_published_at": {
+ "name": "latest_entry_published_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "tip_users": {
+ "name": "tip_users",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "images": {
+ "name": "images",
+ "columns": {
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "colors": {
+ "name": "colors",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch() * 1000)"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "inboxes": {
+ "name": "inboxes",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "lists": {
+ "name": "lists",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "feed_ids": {
+ "name": "feed_ids",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "view": {
+ "name": "view",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fee": {
+ "name": "fee",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "subscription_count": {
+ "name": "subscription_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "purchase_amount": {
+ "name": "purchase_amount",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "subscriptions": {
+ "name": "subscriptions",
+ "columns": {
+ "feed_id": {
+ "name": "feed_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "list_id": {
+ "name": "list_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inbox_id": {
+ "name": "inbox_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "view": {
+ "name": "view",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "hide_from_timeline": {
+ "name": "hide_from_timeline",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "summaries": {
+ "name": "summaries",
+ "columns": {
+ "entry_id": {
+ "name": "entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "readability_summary": {
+ "name": "readability_summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "unq": {
+ "name": "unq",
+ "columns": ["entry_id", "language"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "translations": {
+ "name": "translations",
+ "columns": {
+ "entry_id": {
+ "name": "entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "language": {
+ "name": "language",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "readability_content": {
+ "name": "readability_content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "translation-unique-index": {
+ "name": "translation-unique-index",
+ "columns": ["entry_id", "language"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "unread": {
+ "name": "unread",
+ "columns": {
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "users": {
+ "name": "users",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "handle": {
+ "name": "handle",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_me": {
+ "name": "is_me",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "bio": {
+ "name": "bio",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "website": {
+ "name": "website",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "social_links": {
+ "name": "social_links",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/packages/internal/database/src/drizzle/meta/_journal.json b/packages/internal/database/src/drizzle/meta/_journal.json
index ff7902552..9d90c0f87 100644
--- a/packages/internal/database/src/drizzle/meta/_journal.json
+++ b/packages/internal/database/src/drizzle/meta/_journal.json
@@ -232,6 +232,20 @@
"when": 1753240775348,
"tag": "0032_orange_prima",
"breakpoints": true
+ },
+ {
+ "idx": 33,
+ "version": "6",
+ "when": 1753890574250,
+ "tag": "0033_shiny_sebastian_shaw",
+ "breakpoints": true
+ },
+ {
+ "idx": 34,
+ "version": "6",
+ "when": 1753937164043,
+ "tag": "0034_curly_darkstar",
+ "breakpoints": true
}
]
}
diff --git a/packages/internal/database/src/drizzle/migrations.js b/packages/internal/database/src/drizzle/migrations.js
index 110dc1b24..0ec674a8d 100644
--- a/packages/internal/database/src/drizzle/migrations.js
+++ b/packages/internal/database/src/drizzle/migrations.js
@@ -33,6 +33,8 @@ import m0029 from "./0029_flaky_gorgon.sql"
import m0030 from "./0030_common_gabe_jones.sql"
import m0031 from "./0031_kind_ikaris.sql"
import m0032 from "./0032_orange_prima.sql"
+import m0033 from "./0033_shiny_sebastian_shaw.sql"
+import m0034 from "./0034_curly_darkstar.sql"
import journal from "./meta/_journal.json"
export default {
@@ -71,5 +73,7 @@ export default {
m0030,
m0031,
m0032,
+ m0033,
+ m0034,
},
}
diff --git a/packages/internal/database/src/schemas/index.ts b/packages/internal/database/src/schemas/index.ts
index c3b431bc4..43411949a 100644
--- a/packages/internal/database/src/schemas/index.ts
+++ b/packages/internal/database/src/schemas/index.ts
@@ -1,9 +1,8 @@
import type { FeedViewType } from "@follow/constants"
import type { SupportedActionLanguage } from "@follow/shared/language"
import type { EntrySettings } from "@follow-app/client-sdk"
-import type { UIMessage } from "ai"
import { sql } from "drizzle-orm"
-import { integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core"
+import { index, integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core"
import type { AttachmentsModel, ExtraModel, ImageColorsResult, MediaModel } from "./types"
@@ -156,28 +155,99 @@ export const imagesTable = sqliteTable("images", (t) => ({
.default(sql`(unixepoch() * 1000)`),
}))
-export const aiChatTable = sqliteTable("ai_chat", (t) => ({
- roomId: t.text("room_id").notNull().primaryKey(),
- title: t.text("title"),
- createdAt: t
- .integer("created_at", { mode: "timestamp_ms" })
- .notNull()
- .default(sql`(unixepoch() * 1000)`),
-}))
-
-export const aiChatMessagesTable = sqliteTable(
- "ai_chat_messages",
+// AI Chat Sessions Table
+export const aiChatTable = sqliteTable(
+ "ai_chat_sessions",
(t) => ({
- roomId: t
- .text("room_id")
- .notNull()
- .references(() => aiChatTable.roomId),
- id: t.text("id").notNull().primaryKey(),
+ chatId: t.text("id").notNull().primaryKey(),
+ title: t.text("title"),
createdAt: t
.integer("created_at", { mode: "timestamp_ms" })
.notNull()
.default(sql`(unixepoch() * 1000)`),
- message: t.text("message", { mode: "json" }).$type>().notNull(),
+ updatedAt: t
+ .integer("updated_at", { mode: "timestamp_ms" })
+ .notNull()
+ .default(sql`(unixepoch() * 1000)`),
+ }),
+ (table) => ({
+ updatedAtIdx: index("idx_ai_chat_sessions_updated_at").on(table.updatedAt),
+ }),
+)
+
+// Message Part types based on Vercel AI SDK UIMessage parts
+interface TextUIPart {
+ type: "text"
+ text: string
+}
+
+interface ReasoningUIPart {
+ type: "reasoning"
+ reasoning: string
+}
+
+interface ToolInvocationUIPart {
+ type: "tool-invocation"
+ toolInvocation: {
+ state: "partial-call" | "call" | "result"
+ toolCallId: string
+ toolName: string
+ args: any
+ result?: any
+ }
+}
+
+interface SourceUIPart {
+ type: "source"
+ source: {
+ sourceType: "url"
+ id: string
+ url: string
+ title?: string
+ }
+}
+
+interface StepStartUIPart {
+ type: "step-start"
+}
+
+type UIMessagePart =
+ | TextUIPart
+ | ReasoningUIPart
+ | ToolInvocationUIPart
+ | SourceUIPart
+ | StepStartUIPart
+
+// AI Chat Messages Table - Rich text support
+export const aiChatMessagesTable = sqliteTable(
+ "ai_chat_messages",
+ (t) => ({
+ id: t.text("id").notNull().primaryKey(),
+ chatId: t
+ .text("chat_id")
+ .notNull()
+ .references(() => aiChatTable.chatId, { onDelete: "cascade" }),
+
+ role: t.text("role").notNull().$type<"user" | "assistant" | "system">(),
+
+ createdAt: t.integer("created_at", { mode: "timestamp_ms" }),
+ metadata: t.text("metadata", { mode: "json" }).$type(),
+
+ status: t
+ .text("status")
+ .$type<"pending" | "streaming" | "completed" | "error">()
+ .default("completed"),
+ finishedAt: t.integer("finished_at", { mode: "timestamp_ms" }),
+
+ // Store UIMessage parts for complex assistant responses (tools, reasoning, etc)
+ messageParts: t.text("message_parts", { mode: "json" }).$type(),
+ }),
+ (table) => ({
+ chatIdCreatedAtIdx: index("idx_ai_chat_messages_chat_id_created_at").on(
+ table.chatId,
+ table.createdAt,
+ ),
+ statusIdx: index("idx_ai_chat_messages_status").on(table.status),
+ chatIdRoleIdx: index("idx_ai_chat_messages_chat_id_role").on(table.chatId, table.role),
}),
- (t) => [uniqueIndex("ai_chat_messages_unq").on(t.roomId, t.id)],
)
diff --git a/packages/internal/shared/package.json b/packages/internal/shared/package.json
index d97ca7267..e4cd503e5 100644
--- a/packages/internal/shared/package.json
+++ b/packages/internal/shared/package.json
@@ -36,7 +36,7 @@
"@electron-toolkit/tsconfig": "1.0.1",
"@hono/node-server": "1.15.0",
"@t3-oss/env-core": "0.13.8",
- "ai": "5.0.0-beta.6",
+ "ai": "5.0.4",
"better-auth": "1.2.9",
"drizzle-orm": "0.44.3",
"hono": "4.8.1",
diff --git a/packages/internal/shared/src/settings/constants.ts b/packages/internal/shared/src/settings/constants.ts
index a81fe7a7b..6b2834559 100644
--- a/packages/internal/shared/src/settings/constants.ts
+++ b/packages/internal/shared/src/settings/constants.ts
@@ -6,32 +6,32 @@ const ACCENT_COLOR_MAP: Record = {
dark: "#FF5C00",
},
blue: {
- light: "#007AFF",
- dark: "#409CFF",
+ light: "#0066FF", // Brighter blue while maintaining contrast with white text
+ dark: "#3B82F6", // Darker blue for dark theme
},
green: {
- light: "#34C759",
- dark: "#30E85B",
+ light: "#2DB84D", // Brighter green while maintaining contrast with white text
+ dark: "#22C55E", // Darker green for dark theme
},
purple: {
- light: "#AF52DE",
- dark: "#BF5AF2",
+ light: "#9F52C7", // Brighter purple while maintaining contrast with white text
+ dark: "#A855F7", // Darker purple for dark theme
},
pink: {
- light: "#FF2D92",
- dark: "#FF69B4",
+ light: "#E62E85", // Brighter pink while maintaining contrast with white text
+ dark: "#EC4899", // Darker pink for dark theme
},
red: {
- light: "#FF3B30",
- dark: "#FF6B6B",
+ light: "#DC3526", // Brighter red while maintaining contrast with white text
+ dark: "#EF4444", // Darker red for dark theme
},
yellow: {
- light: "#FFD54F",
- dark: "#FFD60A",
+ light: "#E6A700", // Brighter yellow while maintaining contrast with white text
+ dark: "#EAB308", // Darker yellow for dark theme
},
gray: {
- light: "#8E8E93",
- dark: "#98989D",
+ light: "#757580", // Brighter gray while maintaining contrast with white text
+ dark: "#94A3B8", // Darker gray for dark theme
},
}
diff --git a/packages/internal/shared/src/settings/defaults.ts b/packages/internal/shared/src/settings/defaults.ts
index 9cc885b92..54033c9fb 100644
--- a/packages/internal/shared/src/settings/defaults.ts
+++ b/packages/internal/shared/src/settings/defaults.ts
@@ -11,8 +11,7 @@ export const defaultGeneralSettings: GeneralSettings = {
// mobile app
startupScreen: "timeline",
- // Data control
- dataPersist: true,
+
sendAnonymousData: true,
showQuickTimeline: true,
@@ -144,6 +143,13 @@ export const defaultIntegrationSettings: IntegrationSettings = {
qbittorrentPassword: "",
saveSummaryAsDescription: false,
+
+ // custom actions
+ enableCustomIntegration: false,
+ customIntegration: [],
+
+ // fetch preferences (Electron only)
+ useBrowserFetch: true,
}
export const defaultAISettings: AISettings = {
diff --git a/packages/internal/shared/src/settings/interface.ts b/packages/internal/shared/src/settings/interface.ts
index fa61d4111..75025cd1b 100644
--- a/packages/internal/shared/src/settings/interface.ts
+++ b/packages/internal/shared/src/settings/interface.ts
@@ -6,7 +6,6 @@ export interface GeneralSettings {
summary: boolean
actionLanguage: string
startupScreen: "subscription" | "timeline"
- dataPersist: boolean
sendAnonymousData: boolean
unreadOnly: boolean
scrollMarkUnread: boolean
@@ -139,6 +138,35 @@ export interface IntegrationSettings {
qbittorrentPassword: string
saveSummaryAsDescription: boolean
+
+ // custom actions
+ enableCustomIntegration: boolean
+ customIntegration: CustomIntegration[]
+
+ // fetch preferences (Electron only)
+ useBrowserFetch: boolean
+}
+
+export interface FetchTemplate {
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"
+ url: string
+ headers: Record
+ body?: string
+}
+
+export interface URLSchemeTemplate {
+ scheme: string // e.g., "obsidian://", "bear://", "drafts://action"
+ // URL schemes use query parameters or path segments for data
+}
+
+export interface CustomIntegration {
+ id: string
+ name: string
+ icon: string
+ type?: "http" | "url-scheme" // Optional for backward compatibility
+ fetchTemplate?: FetchTemplate // Keep optional for url-scheme integrations
+ urlSchemeTemplate?: URLSchemeTemplate
+ enabled: boolean
}
export interface AIShortcut {
diff --git a/packages/internal/store/src/entry/hooks.ts b/packages/internal/store/src/entry/hooks.ts
index 79935d395..9f3e6e3ca 100644
--- a/packages/internal/store/src/entry/hooks.ts
+++ b/packages/internal/store/src/entry/hooks.ts
@@ -120,10 +120,10 @@ export const useEntriesQuery = (
}, [entriesIds, query])
}
-export const usePrefetchEntryDetail = (entryId: string) => {
+export const usePrefetchEntryDetail = (entryId: string, isInbox?: boolean) => {
return useQuery({
queryKey: ["entry", entryId],
- queryFn: () => entrySyncServices.fetchEntryDetail(entryId),
+ queryFn: () => entrySyncServices.fetchEntryDetail(entryId, isInbox),
})
}
@@ -172,7 +172,7 @@ export const useEntryIdsByView = (view: FeedViewType, excludePrivate: boolean |
return Array.from(ids)
.filter((id) => {
const subscription = getSubscriptionByEntryId(id)
- if (excludePrivate && subscription?.isPrivate) {
+ if ((excludePrivate && subscription?.isPrivate) || subscription?.hideFromTimeline) {
return false
}
return true
diff --git a/packages/internal/store/src/entry/store.ts b/packages/internal/store/src/entry/store.ts
index be96f2e19..bc768e483 100644
--- a/packages/internal/store/src/entry/store.ts
+++ b/packages/internal/store/src/entry/store.ts
@@ -543,11 +543,12 @@ class EntrySyncServices {
return res
}
- async fetchEntryDetail(entryId: EntryId) {
+ async fetchEntryDetail(entryId: EntryId, isInbox?: boolean) {
const currentEntry = getEntry(entryId)
- const res = currentEntry?.inboxHandle
- ? await apiClient().entries.inbox.$get({ query: { id: entryId } })
- : await apiClient().entries.$get({ query: { id: entryId } })
+ const res =
+ currentEntry?.inboxHandle || isInbox
+ ? await apiClient().entries.inbox.$get({ query: { id: entryId } })
+ : await apiClient().entries.$get({ query: { id: entryId } })
const entry = honoMorph.toEntry(res.data)
if (!currentEntry && entry) {
await entryActions.upsertMany([entry])
diff --git a/packages/internal/store/src/subscription/getter.ts b/packages/internal/store/src/subscription/getter.ts
index b6950143a..1e7b54bdf 100644
--- a/packages/internal/store/src/subscription/getter.ts
+++ b/packages/internal/store/src/subscription/getter.ts
@@ -23,18 +23,25 @@ export const getSubscriptionByEntryId = (entryId: string | undefined) => {
return possibleSource.map((id) => getSubscriptionByFeedId(id)).find((s) => !!s)
}
-export const getSubscribedFeedIdAndInboxHandlesByView = (
- view: FeedViewType | undefined,
- excludePrivate: boolean,
-): string[] => {
+export const getSubscribedFeedIdAndInboxHandlesByView = ({
+ view,
+ excludePrivate,
+ excludeHidden,
+}: {
+ view: FeedViewType | undefined
+ excludePrivate: boolean
+ excludeHidden: boolean
+}): string[] => {
if (typeof view !== "number") return []
const state = useSubscriptionStore.getState()
return Array.from(state.feedIdByView[view])
.filter((i) => !excludePrivate || !state.data[i]?.isPrivate)
+ .filter((i) => !excludeHidden || !state.data[i]?.hideFromTimeline)
.concat(view === FeedViewType.Articles ? getInboxList().map((i) => i.id) : [])
.concat(
Array.from(state.listIdByView[view])
.filter((i) => !excludePrivate || !state.data[i]?.isPrivate)
+ .filter((i) => !excludeHidden || !state.data[i]?.hideFromTimeline)
.flatMap((id) => getListFeedIds(id) ?? []),
)
}
diff --git a/packages/internal/store/src/subscription/store.ts b/packages/internal/store/src/subscription/store.ts
index ebbc1f4c3..09c34760d 100644
--- a/packages/internal/store/src/subscription/store.ts
+++ b/packages/internal/store/src/subscription/store.ts
@@ -243,12 +243,9 @@ class SubscriptionSyncService {
})
tx.request(async () => {
await api().subscriptions.update({
- view: subscription.view,
+ ...subscription,
feedId: subscription.feedId ?? undefined,
- isPrivate: subscription.isPrivate ?? undefined,
listId: subscription.listId ?? undefined,
- category: subscription.category ?? undefined,
- title: subscription.title ?? undefined,
})
})
@@ -257,6 +254,8 @@ class SubscriptionSyncService {
})
await tx.run()
+
+ invalidateEntriesQuery({ views: [subscription.view] })
}
async subscribe(subscription: SubscriptionForm) {
@@ -283,8 +282,9 @@ class SubscriptionSyncService {
if (data.unread) {
unreadActions.upsertMany(data.unread)
}
+
// Insert to subscription
- subscriptionActions.upsertMany([
+ await subscriptionActions.upsertMany([
{
...subscription,
title: subscription.title ?? null,
@@ -298,6 +298,8 @@ class SubscriptionSyncService {
userId: whoami()?.id ?? "",
},
])
+
+ invalidateEntriesQuery({ views: [subscription.view] })
}
async unsubscribe(id: string | undefined | null | (string | undefined | null)[]) {
diff --git a/packages/internal/store/src/unread/hooks.ts b/packages/internal/store/src/unread/hooks.ts
index d9054f867..1a4bbe867 100644
--- a/packages/internal/store/src/unread/hooks.ts
+++ b/packages/internal/store/src/unread/hooks.ts
@@ -42,13 +42,15 @@ export const useSyncUnreadWhenUnMatch = (entryIds: string[]) => {
}, [entryIds.toString()])
}
-export const useAutoMarkAsRead = (entryId: string) => {
+export const useAutoMarkAsRead = (entryId: string, enabled: boolean) => {
const { mutate } = useMutation({
mutationFn: (entryId: string) => unreadSyncService.markEntryAsRead(entryId),
})
useEffect(() => {
- mutate(entryId)
- }, [entryId, mutate])
+ if (enabled) {
+ mutate(entryId)
+ }
+ }, [enabled, entryId, mutate])
}
export const useUnreadById = (id: string) => {
diff --git a/packages/internal/store/src/unread/store.ts b/packages/internal/store/src/unread/store.ts
index 46300587f..18f0b2334 100644
--- a/packages/internal/store/src/unread/store.ts
+++ b/packages/internal/store/src/unread/store.ts
@@ -150,7 +150,11 @@ class UnreadSyncService {
} else if (filter?.inboxId) {
await this.updateUnreadStatus({ ids: [filter.inboxId], time, request })
} else {
- const feedIdAndInboxHandles = getSubscribedFeedIdAndInboxHandlesByView(view, excludePrivate)
+ const feedIdAndInboxHandles = getSubscribedFeedIdAndInboxHandlesByView({
+ view,
+ excludePrivate,
+ excludeHidden: true,
+ })
await this.updateUnreadStatus({ ids: feedIdAndInboxHandles, time, request })
}
}
diff --git a/packages/internal/tracker/src/enums.ts b/packages/internal/tracker/src/enums.ts
index badbd8e6c..69a52208d 100644
--- a/packages/internal/tracker/src/enums.ts
+++ b/packages/internal/tracker/src/enums.ts
@@ -25,7 +25,7 @@ export enum TrackerMapper {
Register = 3000,
OnBoarding = 3001,
Subscribe = 3002,
- EntryRead = 3003,
- EntryAction = 3004,
- ViewAction = 3005,
+
+ // AI
+ AIChatMessageSent = 4000,
}
diff --git a/packages/internal/tracker/src/op/index.ts b/packages/internal/tracker/src/op/index.ts
index adf263cdb..4bab6980d 100644
--- a/packages/internal/tracker/src/op/index.ts
+++ b/packages/internal/tracker/src/op/index.ts
@@ -107,7 +107,6 @@ export class OpenPanel {
return
}
- // eslint-disable-next-line unicorn/no-array-callback-reference
if (this.options.filter && !this.options.filter(payload)) {
return
}
diff --git a/packages/internal/tracker/src/tracker-points.ts b/packages/internal/tracker/src/tracker-points.ts
index b5c7c65c3..1c76c36ae 100644
--- a/packages/internal/tracker/src/tracker-points.ts
+++ b/packages/internal/tracker/src/tracker-points.ts
@@ -114,16 +114,8 @@ export class TrackerPoints {
this.track(TrackerMapper.Subscribe, props)
}
- entryRead(props: { entryId: string }) {
- this.track(TrackerMapper.EntryRead, props)
- }
-
- entryAction(props: { entryId: string; action: string }) {
- this.track(TrackerMapper.EntryAction, props)
- }
-
- viewAction(props: { view: string; action: string }) {
- this.track(TrackerMapper.ViewAction, props)
+ aiChatMessageSent() {
+ this.track(TrackerMapper.AIChatMessageSent)
}
private track(code: TrackerMapper, properties?: Record) {
diff --git a/packages/internal/utils/src/bind-this.ts b/packages/internal/utils/src/bind-this.ts
new file mode 100644
index 000000000..12e513372
--- /dev/null
+++ b/packages/internal/utils/src/bind-this.ts
@@ -0,0 +1,76 @@
+/**
+ * ่ชๅจ็ปๅฎ็ฑปๅฎไพ็ๆๆๆนๆณๅฐๆญฃ็กฎ็ this ไธไธๆ
+ * ้ฒๆญขๅจ่งฃๆ่ตๅผๆถไธขๅคฑ this ๆๅ
+ *
+ * @param instance ็ฑปๅฎไพ
+ * @param excludeMethods ่ฆๆ้ค็ๆนๆณๅๆฐ็ป๏ผ้ป่ฎคๆ้ค constructor
+ * @returns ็ปๅฎไบ this ็ๅฎไพ
+ *
+ * @example
+ * ```ts
+ * class MyClass {
+ * constructor() {
+ * return autoBindThis(this)
+ * }
+ *
+ * myMethod() {
+ * console.log(this)
+ * }
+ * }
+ *
+ * const instance = new MyClass()
+ * const { myMethod } = instance // ่งฃๆไธไผไธขๅคฑ this
+ * myMethod() // this ไป็ถๆๅ instance
+ * ```
+ */
+export function autoBindThis>(
+ instance: T,
+ excludeMethods: string[] = ["constructor"],
+): T {
+ const prototype = Object.getPrototypeOf(instance)
+ const propertyNames = Object.getOwnPropertyNames(prototype)
+
+ for (const name of propertyNames) {
+ if (excludeMethods.includes(name)) {
+ continue
+ }
+
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, name)
+ if (descriptor && typeof descriptor.value === "function") {
+ ;(instance as any)[name] = instance[name].bind(instance)
+ }
+ }
+
+ return instance
+}
+
+/**
+ * ๅๅปบไธไธช่ชๅจ็ปๅฎ this ็็ฑป่ฃ
้ฅฐๅจ
+ *
+ * @param excludeMethods ่ฆๆ้ค็ๆนๆณๅๆฐ็ป
+ * @returns ็ฑป่ฃ
้ฅฐๅจ
+ *
+ * @example
+ * ```ts
+ * @AutoBindThis()
+ * class MyClass {
+ * myMethod() {
+ * console.log(this)
+ * }
+ * }
+ *
+ * const instance = new MyClass()
+ * const { myMethod } = instance
+ * myMethod() // this ไป็ถๆๅ instance
+ * ```
+ */
+export function AutoBindThis(excludeMethods: string[] = ["constructor"]) {
+ return function any>(constructor: T) {
+ return class extends constructor {
+ constructor(...args: any[]) {
+ super(...args)
+ autoBindThis(this, excludeMethods)
+ }
+ }
+ }
+}
diff --git a/packages/internal/utils/src/dom.ts b/packages/internal/utils/src/dom.ts
index 26d2cce05..1f6b39564 100644
--- a/packages/internal/utils/src/dom.ts
+++ b/packages/internal/utils/src/dom.ts
@@ -4,11 +4,16 @@ export const stopPropagation = any }>(e: T)
export const preventDefault = any }>(e: T) => e.preventDefault()
export const nextFrame = (fn: (...args: any[]) => any) => {
- requestAnimationFrame(() => {
- requestAnimationFrame(() => {
+ let timer2: number | null = null
+ const timer1 = requestAnimationFrame(() => {
+ timer2 = requestAnimationFrame(() => {
fn()
})
})
+ return () => {
+ if (timer1) cancelAnimationFrame(timer1)
+ if (timer2) cancelAnimationFrame(timer2)
+ }
}
export const getElementTop = (element: HTMLElement) => {
diff --git a/packages/internal/utils/src/index.ts b/packages/internal/utils/src/index.ts
index 88078a3ae..fd0df3473 100644
--- a/packages/internal/utils/src/index.ts
+++ b/packages/internal/utils/src/index.ts
@@ -1,9 +1,12 @@
+export * from "./bind-this"
export * from "./cjk"
export * from "./color"
export * from "./data-structure/set"
export * from "./dom"
export * from "./duration"
export * from "./jotai"
+export * from "./noop"
export * from "./path-parser"
+export * from "./react"
export * from "./url-for-video"
export * from "./utils"
diff --git a/packages/internal/utils/src/noop.ts b/packages/internal/utils/src/noop.ts
new file mode 100644
index 000000000..2b49e954f
--- /dev/null
+++ b/packages/internal/utils/src/noop.ts
@@ -0,0 +1,4 @@
+export const noop = () => {}
+// eslint-disable-next-line unicorn/no-thenable
+export const thenable: any = { then: noop }
+export const emptyObject = {}
diff --git a/packages/internal/utils/src/react.ts b/packages/internal/utils/src/react.ts
new file mode 100644
index 000000000..8ea5b9d89
--- /dev/null
+++ b/packages/internal/utils/src/react.ts
@@ -0,0 +1,31 @@
+import type { ComponentType, ReactElement } from "react"
+import { createElement, Suspense } from "react"
+
+type FallbackOptions = ReactElement | ComponentType
+
+interface WithSuspenseOptions {
+ fallback?: FallbackOptions
+}
+
+/**
+ * Higher-order component that wraps a component with React Suspense
+ * @param Component - The component to wrap with Suspense
+ * @param options - Configuration options for the Suspense wrapper
+ * @returns A new component wrapped with Suspense
+ */
+export function withSuspense(
+ Component: ComponentType
,
+ options: WithSuspenseOptions = {},
+): ComponentType
{
+ const { fallback } = options
+
+ const WrappedComponent = (props: P) => {
+ const fallbackElement = typeof fallback === "function" ? createElement(fallback) : fallback
+
+ return createElement(Suspense, { fallback: fallbackElement }, createElement(Component, props))
+ }
+
+ WrappedComponent.displayName = `withSuspense(${Component.displayName || Component.name || "Component"})`
+
+ return WrappedComponent
+}
diff --git a/packages/internal/utils/src/utils.ts b/packages/internal/utils/src/utils.ts
index 6a396f2df..ba79722ad 100644
--- a/packages/internal/utils/src/utils.ts
+++ b/packages/internal/utils/src/utils.ts
@@ -395,6 +395,27 @@ export const formatTimeToSeconds = (time?: string | number) => {
}
}
+/**
+ * @example
+ * ```ts
+ * timeStringToSeconds("1:30") // 90
+ * timeStringToSeconds("1:30:00") // 5400
+ * ```
+ */
+export function timeStringToSeconds(time: string): number | null {
+ const timeParts = time.split(":").map(Number)
+
+ if (timeParts.length === 2) {
+ const [minutes, seconds] = timeParts
+ return minutes! * 60 + seconds!
+ } else if (timeParts.length === 3) {
+ const [hours, minutes, seconds] = timeParts
+ return hours! * 3600 + minutes! * 60 + seconds!
+ } else {
+ return null
+ }
+}
+
export const formatEstimatedMins = (estimatedMins: number) => {
const minutesInHour = 60
const minutesInDay = minutesInHour * 24
diff --git a/packages/readability/package.json b/packages/readability/package.json
index 03d1b1c28..a4433a8f5 100644
--- a/packages/readability/package.json
+++ b/packages/readability/package.json
@@ -18,7 +18,7 @@
},
"devDependencies": {
"@follow/configs": "workspace:*",
- "nbump": "2.1.3",
+ "nbump": "2.1.5",
"tsdown": "0.12.9"
},
"publishConfig": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 32e374204..5a6f780cb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -7,8 +7,8 @@ settings:
catalogs:
default:
'@follow-app/client-sdk':
- specifier: 0.3.24
- version: 0.3.24
+ specifier: 0.3.27
+ version: 0.3.27
typescript:
specifier: 5.8.3
version: 5.8.3
@@ -22,6 +22,10 @@ overrides:
react-dom: 19.0.0
react-native-ios-context-menu: 3.1.1
react-native-ios-utilities: 5.1.5
+ '@floating-ui/core': 1.7.2
+ '@floating-ui/dom': 1.7.2
+ '@floating-ui/react-dom': 2.1.4
+ '@floating-ui/react': 0.27.14
patchedDependencies:
'@microflash/remark-callout-directives':
@@ -294,8 +298,8 @@ importers:
specifier: 4.1.0
version: 4.1.0
nbump:
- specifier: 2.1.3
- version: 2.1.3(conventional-commits-filter@5.0.0)
+ specifier: 2.1.5
+ version: 2.1.5(conventional-commits-filter@5.0.0)
pathe:
specifier: 2.0.3
version: 2.0.3
@@ -389,6 +393,9 @@ importers:
js-yaml:
specifier: 4.1.0
version: 4.1.0
+ ky:
+ specifier: 1.8.2
+ version: 1.8.2
linkedom:
specifier: 0.18.11
version: 0.18.11
@@ -444,12 +451,6 @@ importers:
apps/desktop/layer/renderer:
dependencies:
- '@ai-sdk/openai':
- specifier: 2.0.0-beta.11
- version: 2.0.0-beta.11(zod@3.25.75)
- '@ai-sdk/react':
- specifier: 2.0.0-beta.25
- version: 2.0.0-beta.25(react@19.0.0)(zod@3.25.75)
'@dnd-kit/core':
specifier: 6.3.1
version: 6.3.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
@@ -461,7 +462,7 @@ importers:
version: 3.0.2(electron@37.2.0)
'@follow-app/client-sdk':
specifier: 'catalog:'
- version: 0.3.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ version: 0.3.27(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
'@follow/database':
specifier: workspace:*
version: link:../../../../packages/internal/database
@@ -477,9 +478,6 @@ importers:
'@follow/tracker':
specifier: workspace:*
version: link:../../../../packages/internal/tracker
- '@folo-services/constants':
- specifier: 0.1.6
- version: 0.1.6
'@fontsource/sn-pro':
specifier: 5.2.5
version: 5.2.5
@@ -492,6 +490,12 @@ importers:
'@hookform/resolvers':
specifier: 5.1.1
version: 5.1.1(react-hook-form@7.60.0(react@19.0.0))
+ '@lexical/markdown':
+ specifier: 0.33.1
+ version: 0.33.1
+ '@lexical/react':
+ specifier: 0.33.1
+ version: 0.33.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(yjs@13.6.27)
'@lottiefiles/dotlottie-react':
specifier: 0.14.2
version: 0.14.2(react@19.0.0)
@@ -555,12 +559,15 @@ importers:
'@welldone-software/why-did-you-render':
specifier: 10.0.1
version: 10.0.1(react@19.0.0)
+ '@xyflow/react':
+ specifier: 12.8.2
+ version: 12.8.2(@types/react@19.1.8)(immer@10.1.1(patch_hash=594c60b929bc0a3b56576f1a1787da1aec2a1fba51e3c21ec09c0ed38280af6c))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@yornaath/batshit':
specifier: 0.10.1
version: 0.10.1
ai:
- specifier: 5.0.0-beta.25
- version: 5.0.0-beta.25(zod@3.25.75)
+ specifier: 5.0.4
+ version: 5.0.4(zod@3.25.75)
camelcase-keys:
specifier: 9.1.3
version: 9.1.3
@@ -627,6 +634,9 @@ importers:
lethargy:
specifier: 1.0.9
version: 1.0.9
+ lexical:
+ specifier: 0.33.1
+ version: 0.33.1
masonic:
specifier: 4.1.0
version: 4.1.0(react@19.0.0)
@@ -636,9 +646,6 @@ importers:
mdast-util-to-markdown:
specifier: 2.1.2
version: 2.1.2
- mermaid:
- specifier: 11.7.0
- version: 11.7.0
motion:
specifier: 12.23.0
version: 12.23.0(@emotion/is-prop-valid@1.3.1)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
@@ -657,6 +664,9 @@ importers:
react-blurhash:
specifier: 0.3.0
version: 0.3.0(blurhash@2.0.5)(react@19.0.0)
+ react-fast-compare:
+ specifier: 3.2.2
+ version: 3.2.2
react-fast-marquee:
specifier: 1.6.5
version: 1.6.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
@@ -752,8 +762,8 @@ importers:
specifier: workspace:*
version: link:../../../../packages/internal/utils
'@folo-services/ai-tools':
- specifier: 0.2.14
- version: 0.2.14(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ specifier: 0.2.19
+ version: 0.2.19(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
'@types/node':
specifier: 24.0.10
version: 24.0.10
@@ -854,8 +864,8 @@ importers:
specifier: 2.11.1
version: 2.11.1(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)
'@shopify/flash-list':
- specifier: 1.8.3
- version: 1.8.3(@babel/runtime@7.27.6)(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)
+ specifier: 2.0.0
+ version: 2.0.0(@babel/runtime@7.27.6)(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)
'@tanstack/query-sync-storage-persister':
specifier: 5.81.5
version: 5.81.5
@@ -1143,8 +1153,8 @@ importers:
specifier: 0.2.0
version: 0.2.0(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)
nbump:
- specifier: 2.1.3
- version: 2.1.3(conventional-commits-filter@5.0.0)
+ specifier: 2.1.5
+ version: 2.1.5(conventional-commits-filter@5.0.0)
postcss:
specifier: 8.5.6
version: 8.5.6
@@ -1338,6 +1348,22 @@ importers:
specifier: 0.3.0
version: 0.3.0
+ packages/changelog-cli:
+ dependencies:
+ dotenv:
+ specifier: 17.2.0
+ version: 17.2.0
+ pathe:
+ specifier: 2.0.3
+ version: 2.0.3
+ devDependencies:
+ tsx:
+ specifier: 4.20.3
+ version: 4.20.3
+ typescript:
+ specifier: 'catalog:'
+ version: 5.8.3
+
packages/configs:
dependencies:
'@egoist/tailwindcss-icons':
@@ -1419,6 +1445,15 @@ importers:
'@essentials/request-timeout':
specifier: 1.3.0
version: 1.3.0
+ '@floating-ui/core':
+ specifier: 1.7.2
+ version: 1.7.2
+ '@floating-ui/react':
+ specifier: 0.27.14
+ version: 0.27.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@floating-ui/react-dom':
+ specifier: 2.1.4
+ version: 2.1.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@follow/hooks':
specifier: workspace:*
version: link:../hooks
@@ -1434,6 +1469,27 @@ importers:
'@headlessui/react':
specifier: 2.2.4
version: 2.2.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@lexical/code':
+ specifier: 0.33.1
+ version: 0.33.1
+ '@lexical/link':
+ specifier: 0.33.1
+ version: 0.33.1
+ '@lexical/list':
+ specifier: 0.33.1
+ version: 0.33.1
+ '@lexical/mark':
+ specifier: 0.33.1
+ version: 0.33.1
+ '@lexical/markdown':
+ specifier: 0.33.1
+ version: 0.33.1
+ '@lexical/react':
+ specifier: 0.33.1
+ version: 0.33.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(yjs@13.6.27)
+ '@lexical/rich-text':
+ specifier: 0.33.1
+ version: 0.33.1
'@microflash/remark-callout-directives':
specifier: 4.4.0
version: 4.4.0(patch_hash=6160b1cf0eab6deca36415693dda703746edcd42e0e64b9174294e2210481396)
@@ -1530,6 +1586,9 @@ importers:
katex:
specifier: 0.16.22
version: 0.16.22
+ lexical:
+ specifier: 0.33.1
+ version: 0.33.1
masonic:
specifier: 4.1.0
version: 4.1.0(react@19.0.0)
@@ -1611,7 +1670,7 @@ importers:
dependencies:
'@follow-app/client-sdk':
specifier: 'catalog:'
- version: 0.3.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ version: 0.3.27(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
'@follow/configs':
specifier: workspace:*
version: link:../../configs
@@ -1623,7 +1682,7 @@ importers:
dependencies:
'@follow-app/client-sdk':
specifier: 'catalog:'
- version: 0.3.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ version: 0.3.27(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
'@follow/constants':
specifier: workspace:*
version: link:../constants
@@ -1634,8 +1693,8 @@ importers:
specifier: workspace:*
version: link:../shared
ai:
- specifier: 5.0.0-beta.7
- version: 5.0.0-beta.7(zod@3.25.76)
+ specifier: 5.0.4
+ version: 5.0.4(zod@3.25.76)
drizzle-orm:
specifier: 0.44.3
version: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
@@ -1701,7 +1760,7 @@ importers:
dependencies:
'@follow-app/client-sdk':
specifier: 'catalog:'
- version: 0.3.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ version: 0.3.27(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
'@follow/constants':
specifier: workspace:*
version: link:../constants
@@ -1740,8 +1799,8 @@ importers:
specifier: 0.13.8
version: 0.13.8(arktype@2.1.20)(typescript@5.8.3)(zod@3.25.75)
ai:
- specifier: 5.0.0-beta.6
- version: 5.0.0-beta.6(zod@3.25.75)
+ specifier: 5.0.4
+ version: 5.0.4(zod@3.25.75)
better-auth:
specifier: 1.2.9
version: 1.2.9
@@ -1765,7 +1824,7 @@ importers:
dependencies:
'@follow-app/client-sdk':
specifier: 'catalog:'
- version: 0.3.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ version: 0.3.27(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
'@follow/configs':
specifier: workspace:*
version: link:../../configs
@@ -1892,8 +1951,8 @@ importers:
specifier: workspace:*
version: link:../configs
nbump:
- specifier: 2.1.3
- version: 2.1.3(conventional-commits-filter@5.0.0)
+ specifier: 2.1.5
+ version: 2.1.5(conventional-commits-filter@5.0.0)
tsdown:
specifier: 0.12.9
version: 0.12.9(typescript@5.8.3)
@@ -1911,49 +1970,33 @@ packages:
graphql:
optional: true
- '@ai-sdk/gateway@1.0.0-beta.11':
- resolution: {integrity: sha512-dnRUPzSLvp3xvIx6M4FIz4ht8dfL8JkPKwH+akj10im4zbxUii3c3TQ3BJLRdx2Gq/SeljE9H0dX7PDtVyIrbQ==}
+ '@ai-sdk/gateway@1.0.2':
+ resolution: {integrity: sha512-RCE6v6/7JMzSHmjB0R7oWT54y/VYeEv+6NYLtkQKdxN871UawFFHpL7TW7IRnn+/SHdRlr7XoWxxGdHEaGRKiA==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4
- '@ai-sdk/gateway@1.0.0-beta.3':
- resolution: {integrity: sha512-g49gMSkXy94lYvl5LRh438OR/0JCG6ol0jV+iLot7cy5HLltZlGocEuauETBu4b10mDXOd7XIjTEZoQpYFMYLQ==}
- engines: {node: '>=18'}
- peerDependencies:
- zod: ^3.25.49
-
- '@ai-sdk/openai@2.0.0-beta.11':
- resolution: {integrity: sha512-HQXUMb1V6Xr8EBYvEDwNb8ISyRqyxg2zUst7lzPb6s1nGDKJRBTfSyytNWRL9dZ9vxjM2wK34cltCfZbjaHpAA==}
+ '@ai-sdk/openai@2.0.2':
+ resolution: {integrity: sha512-D4zYz2uR90aooKQvX1XnS00Z7PkbrcY+snUvPfm5bCabTG7bzLrVtD56nJ5bSaZG8lmuOMfXpyiEEArYLyWPpw==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4
- '@ai-sdk/provider-utils@3.0.0-beta.2':
- resolution: {integrity: sha512-H4K+4weOVgWqrDDeAbQWoA4U5mN4WrQPHQFdH7ynQYcnhj/pzctU9Q6mGlR5ESMWxaXxazxlOblSITlXo9bahA==}
- engines: {node: '>=18'}
- peerDependencies:
- zod: ^3.25.49
-
- '@ai-sdk/provider-utils@3.0.0-beta.5':
- resolution: {integrity: sha512-4Dv/wiGZrvO6fI7P0yMLa4XZru0XW8LPibTObbkHBdweLUVGIze7aCfxxQeY44Uqcbl/h6/yBTkx2XmPtwf/Ow==}
+ '@ai-sdk/provider-utils@3.0.0':
+ resolution: {integrity: sha512-BoQZtGcBxkeSH1zK+SRYNDtJPIPpacTeiMZqnG4Rv6xXjEwM0FH4MGs9c+PlhyEWmQCzjRM2HAotEydFhD4dYw==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.25.76 || ^4
- '@ai-sdk/provider@2.0.0-beta.1':
- resolution: {integrity: sha512-Z8SPncMtS3RsoXITmT7NVwrAq6M44dmw0DoUOYJqNNtCu8iMWuxB8Nxsoqpa0uEEy9R1V1ZThJAXTYgjTUxl3w==}
- engines: {node: '>=18'}
-
- '@ai-sdk/react@2.0.0-beta.25':
- resolution: {integrity: sha512-3f3f/z3idsH+sctQJ7t0enFywzIbHXDM6a3tvdPMX1dI53mAsVfyhaHzz8WT9swW3Mmphj0i5fZCH4t78m0L4A==}
+ '@ai-sdk/provider-utils@3.0.1':
+ resolution: {integrity: sha512-/iP1sKc6UdJgGH98OCly7sWJKv+J9G47PnTjIj40IJMUQKwDrUMyf7zOOfRtPwSuNifYhSoJQ4s1WltI65gJ/g==}
engines: {node: '>=18'}
peerDependencies:
- react: 19.0.0
zod: ^3.25.76 || ^4
- peerDependenciesMeta:
- zod:
- optional: true
+
+ '@ai-sdk/provider@2.0.0':
+ resolution: {integrity: sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA==}
+ engines: {node: '>=18'}
'@alloc/quick-lru@5.2.0':
resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==}
@@ -2710,30 +2753,12 @@ packages:
'@better-fetch/fetch@1.1.18':
resolution: {integrity: sha512-rEFOE1MYIsBmoMJtQbl32PGHHXuG2hDxvEd7rUHE0vCBoFQVSDqaVs9hkZEtHCxRoY+CljXKFCOuJ8uxqw1LcA==}
- '@braintree/sanitize-url@7.1.1':
- resolution: {integrity: sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==}
-
'@canvas/image-data@1.0.0':
resolution: {integrity: sha512-BxOqI5LgsIQP1odU5KMwV9yoijleOPzHL18/YvNqF9KFSGF2K/DLlYAbDQsWqd/1nbaFuSkYD/191dpMtNh4vw==}
'@cfcs/core@0.0.6':
resolution: {integrity: sha512-FxfJMwoLB8MEMConeXUCqtMGqxdtePQxRBOiGip9ULcYYam3WfCgoY6xdnMaSkYvRvmosp5iuG+TiPofm65+Pw==}
- '@chevrotain/cst-dts-gen@11.0.3':
- resolution: {integrity: sha512-BvIKpRLeS/8UbfxXxgC33xOumsacaeCKAjAeLyOn7Pcp95HiRbrpl14S+9vaZLolnbssPIUuiUd8IvgkRyt6NQ==}
-
- '@chevrotain/gast@11.0.3':
- resolution: {integrity: sha512-+qNfcoNk70PyS/uxmj3li5NiECO+2YKZZQMbmjTqRI3Qchu8Hig/Q9vgkHpI3alNjr7M+a2St5pw5w5F6NL5/Q==}
-
- '@chevrotain/regexp-to-ast@11.0.3':
- resolution: {integrity: sha512-1fMHaBZxLFvWI067AVbGJav1eRY7N8DDvYCTwGBiE/ytKBgP8azTdgyrKyWZ9Mfh09eHWb5PgTSO8wi7U824RA==}
-
- '@chevrotain/types@11.0.3':
- resolution: {integrity: sha512-gsiM3G8b58kZC2HaWR50gu6Y1440cHiJ+i3JUvcp/35JchYejb2+5MVeJK0iKThYpAa/P2PYFV4hoi44HD+aHQ==}
-
- '@chevrotain/utils@11.0.3':
- resolution: {integrity: sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==}
-
'@clack/core@0.3.5':
resolution: {integrity: sha512-5cfhQNH+1VQ2xLQlmzXMqUoiaH0lRBq9/CLW9lTyMbuKLC3+xEK01tHVvyut++mLOn5urSHmkm6I0Lg9MaJSTQ==}
@@ -4002,53 +4027,44 @@ packages:
'@firebase/webchannel-wrapper@1.0.3':
resolution: {integrity: sha512-2xCRM9q9FlzGZCdgDMJwc0gyUkWFtkosy7Xxr6sFgQwn+wMNIWd7xIvYNauU1r64B5L5rsGKy/n9TKJ0aAFeqQ==}
- '@floating-ui/core@1.7.0':
- resolution: {integrity: sha512-FRdBLykrPPA6P76GGGqlex/e7fbe0F1ykgxHYNXQsH/iTEtjMj/f9bpY5oQqbjt5VgZvgz/uKXbGuROijh3VLA==}
+ '@floating-ui/core@1.7.2':
+ resolution: {integrity: sha512-wNB5ooIKHQc+Kui96jE/n69rHFWAVoxn5CAzL1Xdd8FG03cgY3MLO+GF9U3W737fYDSgPWA6MReKhBQBop6Pcw==}
- '@floating-ui/dom@1.7.0':
- resolution: {integrity: sha512-lGTor4VlXcesUMh1cupTUTDoCxMb0V6bm3CnxHzQcw8Eaf1jQbgQX4i02fYgT0vJ82tb5MZ4CZk1LRGkktJCzg==}
+ '@floating-ui/dom@1.7.2':
+ resolution: {integrity: sha512-7cfaOQuCS27HD7DX+6ib2OrnW+b4ZBwDNnCcT0uTyidcmyWb03FnQqJybDBoCnpdxwBSfA94UAYlRCt7mV+TbA==}
- '@floating-ui/react-dom@2.1.2':
- resolution: {integrity: sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==}
+ '@floating-ui/react-dom@2.1.4':
+ resolution: {integrity: sha512-JbbpPhp38UmXDDAu60RJmbeme37Jbgsm7NrHGgzYYFKmblzRUh6Pa641dII6LsjwF4XlScDrde2UAzDo/b9KPw==}
peerDependencies:
react: 19.0.0
react-dom: 19.0.0
- '@floating-ui/react@0.26.28':
- resolution: {integrity: sha512-yORQuuAtVpiRjpMhdc0wJj06b9JFjrYF4qp96j++v2NBpbi6SEGF7donUJ3TMieerQ6qVkAv1tgr7L4r5roTqw==}
+ '@floating-ui/react@0.27.14':
+ resolution: {integrity: sha512-aSf9JXfyXpRQWMbtuW+CJQrnhzHu4Hg1Th9AkvR1o+wSW/vCUVMrtgXaRY5ToV5Fh5w3I7lXJdvlKVvYrQrppw==}
peerDependencies:
react: 19.0.0
react-dom: 19.0.0
- '@floating-ui/utils@0.2.9':
- resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==}
+ '@floating-ui/utils@0.2.10':
+ resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
- '@follow-app/client-sdk@0.3.24':
- resolution: {integrity: sha512-lR22RZrhXrHoHRz+C8/9ccU8vl9kaMq83NaeSNQq6TfJU645TiA/GQu2pHE0H8N9KRUPzE/P82bAnye59dyBUA==}
+ '@follow-app/client-sdk@0.3.27':
+ resolution: {integrity: sha512-Zr4XtFpZ+Gx+CFxcqJwNTSqv0UaKfb5WKMxbHrJ/a9dzdL1MvkAnvO50sx5ViOCLur+bimgz9Epx8+4qGq5VTg==}
- '@folo-services/ai-tools@0.2.14':
- resolution: {integrity: sha512-3DG/FqGqNvpCUtq1WMwzMYW6XuhQQfRfIGyZbokJ+XgbyR4YO3Jtz9T5fluINy+Q9iQSRyZSLyhMxe4Evsj5Hg==}
+ '@folo-services/ai-tools@0.2.19':
+ resolution: {integrity: sha512-izmFV5zz7HvlyvMGQQS2xNZS/H6QjH+Uvw0n7AywTwkBsvAR1qHsuOGfNTEhb0mRr3EZumk0g9NlA73nmG6v2g==}
- '@folo-services/constants@0.1.15':
- resolution: {integrity: sha512-XoHXH/rNV1kDRiaozNDMWW7/VHHduW6GARZUDSmCFCMwkhMdevHHqP/bpfMkJkcFKl0+I01a4SSN76OQgkYA0g==}
+ '@folo-services/constants@0.1.17':
+ resolution: {integrity: sha512-IR+X76A/ScNj9jvgKdHv9Q1ozGlRo6ayEOpEAG3mwy1adlJdyG2eDlwHsUSMj9kiQUTwDF2JryG0GF32KkmUMw==}
- '@folo-services/constants@0.1.6':
- resolution: {integrity: sha512-+Wdd0BfCmjddduteksJnbHl1GVrTJlFHnjXeyVJxr7l6nkHdW9lacpqLbyFBmlXm39Mtvvz6vDdR0DjaCsJG3w==}
+ '@folo-services/drizzle@0.1.12':
+ resolution: {integrity: sha512-CZmid9EyOi2DDGW3s/lQWNTNt1wPHUqTSDDPZqpC3mlou/m/N4e+kZxpDJ+LY1cmXyP7cPQO9H1tDlXesmItiw==}
- '@folo-services/drizzle@0.1.10':
- resolution: {integrity: sha512-gLElV37jxfg0+f6kbkWyTswBHqfc6cdhfFJu0scQIw+PxIKYepH3Sj8larIQDcOeTvAgD6cz0/n3lXKBPrDB5w==}
+ '@folo-services/exceptions@0.1.10':
+ resolution: {integrity: sha512-54ShG+RYYnXarjdxPyC1SSqIeAIbQimB/iBBRgt+LzHp9jMTenjU2CfP7RiYpgwCrS5tNz6eH+cNjZdWa6jTag==}
- '@folo-services/drizzle@0.1.9':
- resolution: {integrity: sha512-X+YIuukSKaC5F7ZK7/zYDvtU75RVcJDC4lNvUdx/xCwaJgpRj0gjw8PMoTz7nc77Va99g6yw4a31cKxgfrPSSA==}
-
- '@folo-services/exceptions@0.1.7':
- resolution: {integrity: sha512-e3BnGAfCEt19kAvdijGvgdFI0IJ8pBANeEj+CXUtoa95UdHCw88x6ePWpJp1m8SL34ImmstywNhnWHHQgT8ZKg==}
-
- '@folo-services/exceptions@0.1.8':
- resolution: {integrity: sha512-7SeOZt98DIXSjLjO8ZyTpWuk3OAnsFMvLUMuPR6LMabikqkMxkwSDeR8Dv8KKl93/XZyk/F/k0CZ8IfH09oBKg==}
-
- '@folo-services/shared@0.0.5':
- resolution: {integrity: sha512-GNoMAxmNAvdR9qSr6DgdIpBqnzmKrjaTkxC+q0dnAbxRKjREUFmKaQSaN5amChQBUhGs8d5LZdCsoI34DOXQLw==}
+ '@folo-services/shared@0.0.7':
+ resolution: {integrity: sha512-Tb94/bSFU2vXwg/JUSjeGFoDhPyv9NANa19P0L/ohNsEvymSXyjdmkpKowkw4+CQEhNiSkROTDjPJylO6nIm8g==}
'@fontsource/sn-pro@5.2.5':
resolution: {integrity: sha512-rBdBv/0ygj6bkO7xDMMFpwobLdSrcQ2Jncb6DIwdeYGoAgeWkQRwVYhGDKasfLjEYCNYxrqr6wsXsM9+aU39RA==}
@@ -4401,6 +4417,77 @@ packages:
'@levischuck/tiny-cbor@0.2.11':
resolution: {integrity: sha512-llBRm4dT4Z89aRsm6u2oEZ8tfwL/2l6BwpZ7JcyieouniDECM5AqNgr/y08zalEIvW3RSK4upYyybDcmjXqAow==}
+ '@lexical/clipboard@0.33.1':
+ resolution: {integrity: sha512-Qd3/Cm3TW2DFQv58kMtLi86u5YOgpBdf+o7ySbXz55C613SLACsYQBB3X5Vu5hTx/t/ugYOpII4HkiatW6d9zA==}
+
+ '@lexical/code@0.33.1':
+ resolution: {integrity: sha512-E0Y/+1znkqVpP52Y6blXGAduoZek9SSehJN+vbH+4iQKyFwTA7JB+jd5C5/K0ik55du9X7SN/oTynByg7lbcAA==}
+
+ '@lexical/devtools-core@0.33.1':
+ resolution: {integrity: sha512-3yHu5diNtjwhoe2q/x9as6n6rIfA+QO2CfaVjFRkam8rkAW6zUzQT1D0fQdE8nOfWvXBgY1mH/ZLP4dDXBdG5Q==}
+ peerDependencies:
+ react: 19.0.0
+ react-dom: 19.0.0
+
+ '@lexical/dragon@0.33.1':
+ resolution: {integrity: sha512-UQ6DLkcDAr83wA1vz3sUgtcpYcMifC4sF0MieZAoMzFrna6Ekqj7OJ7g8Lo7m7AeuT4NETRVDsjIEDdrQMKLLA==}
+
+ '@lexical/hashtag@0.33.1':
+ resolution: {integrity: sha512-M3IsDe4cifggMBZgYAVT7hCLWcwQ3dIcUPdr9Xc6wDQQQdEqOQYB0PO//9bSYUVq+BNiiTgysc+TtlM7PiJfiw==}
+
+ '@lexical/history@0.33.1':
+ resolution: {integrity: sha512-Bk0h3D6cFkJ7w3HKvqQua7n6Xfz7nR7L3gLDBH9L0nsS4MM9+LteSEZPUe0kj4VuEjnxufYstTc9HA2aNLKxnQ==}
+
+ '@lexical/html@0.33.1':
+ resolution: {integrity: sha512-t14vu4eKa6BWz1N7/rwXgXif1k4dj73dRvllWJgfXum+a36vn1aySNYOlOfqWXF7k1b3uJmoqsWK7n/1ASnimw==}
+
+ '@lexical/link@0.33.1':
+ resolution: {integrity: sha512-JCTu7Fft2J2kgfqJiWnGei+UMIXVKiZKaXzuHCuGQTFu92DeCyd02azBaFazZHEkSqCIFZ0DqVV2SpIJmd0Ygw==}
+
+ '@lexical/list@0.33.1':
+ resolution: {integrity: sha512-PXp56dWADSThc9WhwWV4vXhUc3sdtCqsfPD3UQNGUZ9rsAY1479rqYLtfYgEmYPc8JWXikQCAKEejahCJIm8OQ==}
+
+ '@lexical/mark@0.33.1':
+ resolution: {integrity: sha512-tGdOf1e694lnm/HyWUKEkEWjDyfhCBFG7u8iRKNpsYTpB3M1FsJUXbphE2bb8MyWfhHbaNxnklupSSaSPzO88A==}
+
+ '@lexical/markdown@0.33.1':
+ resolution: {integrity: sha512-p5zwWNF70pELRx60wxE8YOFVNiNDkw7gjKoYqkED23q5hj4mcqco9fQf6qeeZChjxLKjfyT6F1PpWgxmlBlxBw==}
+
+ '@lexical/offset@0.33.1':
+ resolution: {integrity: sha512-3YIlUs43QdKSBLEfOkuciE2tn9loxVmkSs/HgaIiLYl0Edf1W00FP4ItSmYU4De5GopXsHq6+Y3ry4pU/ciUiQ==}
+
+ '@lexical/overflow@0.33.1':
+ resolution: {integrity: sha512-3BDq1lOw567FeCk4rN2ellKwoXTM9zGkGuKnSGlXS1JmtGGGSvT+uTANX3KOOfqTNSrOkrwoM+3hlFv7p6VpiQ==}
+
+ '@lexical/plain-text@0.33.1':
+ resolution: {integrity: sha512-2HxdhAx6bwF8y5A9P0q3YHsYbhUo4XXm+GyKJO87an8JClL2W+GYLTSDbfNWTh4TtH95eG+UYLOjNEgyU6tsWA==}
+
+ '@lexical/react@0.33.1':
+ resolution: {integrity: sha512-ylnUmom5h8PY+Z14uDmKLQEoikTPN77GRM0NRCIdtbWmOQqOq/5BhuCzMZE1WvpL5C6n3GtK6IFnsMcsKmVOcw==}
+ peerDependencies:
+ react: 19.0.0
+ react-dom: 19.0.0
+
+ '@lexical/rich-text@0.33.1':
+ resolution: {integrity: sha512-ZBIsj4LwmamRBCGjJiPSLj7N/XkUDv/pnYn5Rp0BL42WpOiQLvOoGLrZxgUJZEmRPQnx42ZgLKVgrWHsyjuoAA==}
+
+ '@lexical/selection@0.33.1':
+ resolution: {integrity: sha512-KXPkdCDdVfIUXmkwePu9DAd3kLjL0aAqL5G9CMCFsj7RG9lLvvKk7kpivrAIbRbcsDzO44QwsFPisZHbX4ioXA==}
+
+ '@lexical/table@0.33.1':
+ resolution: {integrity: sha512-pzB11i1Y6fzmy0IPUKJyCdhVBgXaNOxJUxrQJWdKNYCh1eMwwMEQvj+8inItd/11aUkjcdHjwDTht8gL2UHKiQ==}
+
+ '@lexical/text@0.33.1':
+ resolution: {integrity: sha512-CnyU3q3RytXXWVSvC5StOKISzFAPGK9MuesNDDGyZk7yDK+J98gV6df4RBKfqwcokFMThpkUlvMeKe1+S2y25A==}
+
+ '@lexical/utils@0.33.1':
+ resolution: {integrity: sha512-eKysPjzEE9zD+2af3WRX5U3XbeNk0z4uv1nXGH3RG15uJ4Huzjht82hzsQpCFUobKmzYlQaQs5y2IYKE2puipQ==}
+
+ '@lexical/yjs@0.33.1':
+ resolution: {integrity: sha512-Zx1rabMm/Zjk7n7YQMIQLUN+tqzcg1xqcgNpEHSfK1GA8QMPXCPvXWFT3ZDC4tfZOSy/YIqpVUyWZAomFqRa+g==}
+ peerDependencies:
+ yjs: '>=13.5.22'
+
'@lottiefiles/dotlottie-react@0.14.2':
resolution: {integrity: sha512-RR4r0HrKQbOAw6iS6C3mRARS2iu+yI+G1vICoUsRMHzlUUk1/26l3WyAjhcG+KoaGoKmORx8FgHjTNr4Sr/2Ug==}
peerDependencies:
@@ -4426,9 +4513,6 @@ packages:
engines: {node: '>=18'}
hasBin: true
- '@mermaid-js/parser@0.5.0':
- resolution: {integrity: sha512-AiaN7+VjXC+3BYE+GwNezkpjIcCI2qIMB/K4S2/vMWe0q/XJCBbx5+K7iteuz7VyltX9iAK4FmVTvGc9kjOV4w==}
-
'@microflash/remark-callout-directives@4.4.0':
resolution: {integrity: sha512-OhNjgpkK9/pWZ/nyU8m2eJl88v9+N9BTforFcGn9wp0OiYqcZVWZ3zLIPrYLw309rEivedbxUytxGxc0Y5YY+w==}
@@ -6088,8 +6172,8 @@ packages:
'@shikijs/vscode-textmate@10.0.2':
resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==}
- '@shopify/flash-list@1.8.3':
- resolution: {integrity: sha512-vXuj6JyuMjONVOXjEhWFeaONPuWN/53Cl2LeyeM8TZ0JzUcNU+BE6iyga1/yyJeDf0K7YPgAE/PcUX2+DM1LiA==}
+ '@shopify/flash-list@2.0.0':
+ resolution: {integrity: sha512-N04dXZq4wgrXx3nGytchR4FUN/hBO9PmvpcqMXvy4841zTL8GKLPbdwsFe8UdLsaM5n++mBPWft0wqEddW5Q/w==}
peerDependencies:
'@babel/runtime': '*'
react: 19.0.0
@@ -6311,99 +6395,24 @@ packages:
'@types/connect@3.4.38':
resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==}
- '@types/d3-array@3.2.1':
- resolution: {integrity: sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==}
-
- '@types/d3-axis@3.0.6':
- resolution: {integrity: sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==}
-
- '@types/d3-brush@3.0.6':
- resolution: {integrity: sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==}
-
- '@types/d3-chord@3.0.6':
- resolution: {integrity: sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==}
-
'@types/d3-color@3.1.3':
resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}
- '@types/d3-contour@3.0.6':
- resolution: {integrity: sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==}
-
- '@types/d3-delaunay@6.0.4':
- resolution: {integrity: sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==}
-
- '@types/d3-dispatch@3.0.6':
- resolution: {integrity: sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==}
-
'@types/d3-drag@3.0.7':
resolution: {integrity: sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==}
- '@types/d3-dsv@3.0.7':
- resolution: {integrity: sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==}
-
- '@types/d3-ease@3.0.2':
- resolution: {integrity: sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==}
-
- '@types/d3-fetch@3.0.7':
- resolution: {integrity: sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==}
-
- '@types/d3-force@3.0.10':
- resolution: {integrity: sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==}
-
- '@types/d3-format@3.0.4':
- resolution: {integrity: sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==}
-
- '@types/d3-geo@3.1.0':
- resolution: {integrity: sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==}
-
- '@types/d3-hierarchy@3.1.7':
- resolution: {integrity: sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==}
-
'@types/d3-interpolate@3.0.4':
resolution: {integrity: sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==}
- '@types/d3-path@3.1.1':
- resolution: {integrity: sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==}
-
- '@types/d3-polygon@3.0.2':
- resolution: {integrity: sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==}
-
- '@types/d3-quadtree@3.0.6':
- resolution: {integrity: sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==}
-
- '@types/d3-random@3.0.3':
- resolution: {integrity: sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==}
-
- '@types/d3-scale-chromatic@3.1.0':
- resolution: {integrity: sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ==}
-
- '@types/d3-scale@4.0.9':
- resolution: {integrity: sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==}
-
'@types/d3-selection@3.0.11':
resolution: {integrity: sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w==}
- '@types/d3-shape@3.1.7':
- resolution: {integrity: sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==}
-
- '@types/d3-time-format@4.0.3':
- resolution: {integrity: sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==}
-
- '@types/d3-time@3.0.4':
- resolution: {integrity: sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==}
-
- '@types/d3-timer@3.0.2':
- resolution: {integrity: sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==}
-
'@types/d3-transition@3.0.9':
resolution: {integrity: sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg==}
'@types/d3-zoom@3.0.8':
resolution: {integrity: sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==}
- '@types/d3@7.4.3':
- resolution: {integrity: sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==}
-
'@types/debug@4.1.12':
resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
@@ -6425,9 +6434,6 @@ packages:
'@types/fs-extra@9.0.13':
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
- '@types/geojson@7946.0.16':
- resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==}
-
'@types/graceful-fs@4.1.9':
resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==}
@@ -6911,6 +6917,15 @@ packages:
resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==}
engines: {node: '>=10.0.0'}
+ '@xyflow/react@12.8.2':
+ resolution: {integrity: sha512-VifLpxOy74ck283NQOtBn1e8igmB7xo7ADDKxyBHkKd8IKpyr16TgaYOhzqVwNMdB4NT+m++zfkic530L+gEXw==}
+ peerDependencies:
+ react: 19.0.0
+ react-dom: 19.0.0
+
+ '@xyflow/system@0.0.66':
+ resolution: {integrity: sha512-TTxESDwPsATnuDMUeYYtKe4wt9v8bRO29dgYBhR8HyhSCzipnAdIL/1CDfFd+WqS1srVreo24u6zZeVIDk4r3Q==}
+
'@yornaath/batshit-devtools@1.7.1':
resolution: {integrity: sha512-AyttV1Njj5ug+XqEWY1smV45dTWMlWKtj1B8jcFYgBKUFyUlF/qEhD+iP1E5UaRYW6hQRYD9T2WNDwFTrOMWzQ==}
@@ -6978,25 +6993,12 @@ packages:
resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==}
engines: {node: '>=8'}
- ai@5.0.0-beta.25:
- resolution: {integrity: sha512-pbfFqtQvz7hiDw6TwUH75CK9FgrZFBsxqbW4yW0aqluHw3nRbhf0w1u2AMiYgvWMy8Xf8TkBbMtY4vyMc4neeA==}
+ ai@5.0.4:
+ resolution: {integrity: sha512-nizyqRxFlJShCAh/xPqor9EYpuaiGqCcYqau9A2GaSL+di+Qf6pA+Hos5x1orlodmT+EciZfoC2Sq+I12OmIUg==}
engines: {node: '>=18'}
- hasBin: true
peerDependencies:
zod: ^3.25.76 || ^4
- ai@5.0.0-beta.6:
- resolution: {integrity: sha512-0VqcqbWiF2XwWBgNfrEr05QrB0bJqctwLyuk7xfy7g8OBSqyJ4OV95HGTzrBvN8/iU/4u+eNTlF5nAG5Qx3utw==}
- engines: {node: '>=18'}
- peerDependencies:
- zod: ^3.25.49
-
- ai@5.0.0-beta.7:
- resolution: {integrity: sha512-oC4KzUJCQPMB7v9rCqL/rVk2ogZvI6lYiXfKjzPYHwa1zIgy329qqRLmAd3mKEDTTG6By1r0zasQu7FKmG+4gw==}
- engines: {node: '>=18'}
- peerDependencies:
- zod: ^3.25.49
-
ajv-formats@2.1.1:
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependencies:
@@ -7703,14 +7705,6 @@ packages:
resolution: {integrity: sha512-quS9HgjQpdaXOvsZz82Oz7uxtXiy6UIsIQcpBj7HRw2M63Skasm9qlDocAM7jNuaxdhpPU7c4kJN+gA5MCu4ww==}
engines: {node: '>=18.17'}
- chevrotain-allstar@0.3.1:
- resolution: {integrity: sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw==}
- peerDependencies:
- chevrotain: ^11.0.0
-
- chevrotain@11.0.3:
- resolution: {integrity: sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==}
-
chokidar@3.6.0:
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'}
@@ -7772,6 +7766,9 @@ packages:
class-variance-authority@0.7.1:
resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==}
+ classcat@5.0.5:
+ resolution: {integrity: sha512-JhZUT7JFcQy/EzW605k/ktHtncoo9vnyW/2GspNYwFlN1C/WmjuV/xtS04e9SOkL2sTdw0VAZ2UGCcQ9lR6p6w==}
+
clean-css@5.3.3:
resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==}
engines: {node: '>= 10.0'}
@@ -8100,12 +8097,6 @@ packages:
core-util-is@1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
- cose-base@1.0.3:
- resolution: {integrity: sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==}
-
- cose-base@2.2.0:
- resolution: {integrity: sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g==}
-
cosmiconfig@5.2.1:
resolution: {integrity: sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==}
engines: {node: '>=4'}
@@ -8265,51 +8256,10 @@ packages:
resolution: {integrity: sha512-pHJg+jbuFsCjz9iclQBqyL3B2HLCBF71BwVNujUYEvCeQMvV97R59MNK3R2+jgJ3a1fcZgI9B3vYgz8lzr/BFQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
- cytoscape-cose-bilkent@4.1.0:
- resolution: {integrity: sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==}
- peerDependencies:
- cytoscape: ^3.2.0
-
- cytoscape-fcose@2.2.0:
- resolution: {integrity: sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ==}
- peerDependencies:
- cytoscape: ^3.2.0
-
- cytoscape@3.32.0:
- resolution: {integrity: sha512-5JHBC9n75kz5851jeklCPmZWcg3hUe6sjqJvyk3+hVqFaKcHwHgxsjeN1yLmggoUc6STbtm9/NQyabQehfjvWQ==}
- engines: {node: '>=0.10'}
-
- d3-array@2.12.1:
- resolution: {integrity: sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==}
-
- d3-array@3.2.4:
- resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==}
- engines: {node: '>=12'}
-
- d3-axis@3.0.0:
- resolution: {integrity: sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==}
- engines: {node: '>=12'}
-
- d3-brush@3.0.0:
- resolution: {integrity: sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==}
- engines: {node: '>=12'}
-
- d3-chord@3.0.1:
- resolution: {integrity: sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==}
- engines: {node: '>=12'}
-
d3-color@3.1.0:
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
engines: {node: '>=12'}
- d3-contour@4.0.2:
- resolution: {integrity: sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==}
- engines: {node: '>=12'}
-
- d3-delaunay@6.0.4:
- resolution: {integrity: sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==}
- engines: {node: '>=12'}
-
d3-dispatch@3.0.1:
resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==}
engines: {node: '>=12'}
@@ -8318,88 +8268,18 @@ packages:
resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==}
engines: {node: '>=12'}
- d3-dsv@3.0.1:
- resolution: {integrity: sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==}
- engines: {node: '>=12'}
- hasBin: true
-
d3-ease@3.0.1:
resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==}
engines: {node: '>=12'}
- d3-fetch@3.0.1:
- resolution: {integrity: sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==}
- engines: {node: '>=12'}
-
- d3-force@3.0.0:
- resolution: {integrity: sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==}
- engines: {node: '>=12'}
-
- d3-format@3.1.0:
- resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==}
- engines: {node: '>=12'}
-
- d3-geo@3.1.1:
- resolution: {integrity: sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==}
- engines: {node: '>=12'}
-
- d3-hierarchy@3.1.2:
- resolution: {integrity: sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==}
- engines: {node: '>=12'}
-
d3-interpolate@3.0.1:
resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
engines: {node: '>=12'}
- d3-path@1.0.9:
- resolution: {integrity: sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==}
-
- d3-path@3.1.0:
- resolution: {integrity: sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==}
- engines: {node: '>=12'}
-
- d3-polygon@3.0.1:
- resolution: {integrity: sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==}
- engines: {node: '>=12'}
-
- d3-quadtree@3.0.1:
- resolution: {integrity: sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==}
- engines: {node: '>=12'}
-
- d3-random@3.0.1:
- resolution: {integrity: sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==}
- engines: {node: '>=12'}
-
- d3-sankey@0.12.3:
- resolution: {integrity: sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==}
-
- d3-scale-chromatic@3.1.0:
- resolution: {integrity: sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==}
- engines: {node: '>=12'}
-
- d3-scale@4.0.2:
- resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}
- engines: {node: '>=12'}
-
d3-selection@3.0.0:
resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==}
engines: {node: '>=12'}
- d3-shape@1.3.7:
- resolution: {integrity: sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==}
-
- d3-shape@3.2.0:
- resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==}
- engines: {node: '>=12'}
-
- d3-time-format@4.1.0:
- resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==}
- engines: {node: '>=12'}
-
- d3-time@3.1.0:
- resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==}
- engines: {node: '>=12'}
-
d3-timer@3.0.1:
resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==}
engines: {node: '>=12'}
@@ -8414,13 +8294,6 @@ packages:
resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==}
engines: {node: '>=12'}
- d3@7.9.0:
- resolution: {integrity: sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==}
- engines: {node: '>=12'}
-
- dagre-d3-es@7.0.11:
- resolution: {integrity: sha512-tvlJLyQf834SylNKax8Wkzco/1ias1OPw8DcUMDE7oUIoSEW25riQVuiu/0OWEFqT0cxHT3Pa9/D82Jr47IONw==}
-
daisyui@4.12.24:
resolution: {integrity: sha512-JYg9fhQHOfXyLadrBrEqCDM6D5dWCSSiM6eTNCRrBRzx/VlOCrLS8eDfIw9RVvs64v2mJdLooKXY8EwQzoszAA==}
engines: {node: '>=16.9.0'}
@@ -8528,9 +8401,6 @@ packages:
defu@6.1.4:
resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
- delaunator@5.0.1:
- resolution: {integrity: sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==}
-
delayed-stream@1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
@@ -8696,6 +8566,10 @@ packages:
resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==}
engines: {node: '>=12'}
+ dotenv@17.2.0:
+ resolution: {integrity: sha512-Q4sgBT60gzd0BB0lSyYD3xM4YxrXA9y4uBDof1JNYGzOXrQdQ6yX+7XIAqoFOGQFOTK1D3Hts5OllpxMDZFONQ==}
+ engines: {node: '>=12'}
+
dotenv@9.0.2:
resolution: {integrity: sha512-I9OvvrHp4pIARv4+x9iuewrWycX6CcZtoAu1XrzPxc5UygMJXJZYmBsynku8IkrJwgypE5DGNjDPmPRhDCptUg==}
engines: {node: '>=10'}
@@ -10372,9 +10246,6 @@ packages:
resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==}
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
- hachure-fill@0.5.2:
- resolution: {integrity: sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==}
-
handlebars@4.7.8:
resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==}
engines: {node: '>=0.4.7'}
@@ -10728,13 +10599,6 @@ packages:
resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==}
engines: {node: '>= 0.4'}
- internmap@1.0.1:
- resolution: {integrity: sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==}
-
- internmap@2.0.3:
- resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}
- engines: {node: '>=12'}
-
interpret@3.1.1:
resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==}
engines: {node: '>=10.13.0'}
@@ -11004,6 +10868,9 @@ packages:
peerDependencies:
ws: '*'
+ isomorphic.js@0.2.5:
+ resolution: {integrity: sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==}
+
istanbul-lib-coverage@3.2.2:
resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}
engines: {node: '>=8'}
@@ -11225,9 +11092,6 @@ packages:
keyv@4.5.4:
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
- khroma@2.1.0:
- resolution: {integrity: sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==}
-
kleur@3.0.3:
resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==}
engines: {node: '>=6'}
@@ -11242,6 +11106,10 @@ packages:
kose-font@1.0.0:
resolution: {integrity: sha512-8R1M6ajjPvG0E4UxiNgZe0Hoy4qGTX1RuNZHN96dvqzuUwNM08gkpx1O+Q8/PzT8lp3lqH7w2DCUCGr8Wt7wPA==}
+ ky@1.8.2:
+ resolution: {integrity: sha512-XybQJ3d4Ea1kI27DoelE5ZCT3bSJlibYTtQuMsyzKox3TMyayw1asgQdl54WroAm+fIA3ZCr8zXW2RpR7qWVpA==}
+ engines: {node: '>=18'}
+
kysely@0.28.2:
resolution: {integrity: sha512-4YAVLoF0Sf0UTqlhgQMFU9iQECdah7n+13ANkiuVfRvlK+uI0Etbgd7bVP36dKlG+NXWbhGua8vnGt+sdhvT7A==}
engines: {node: '>=18.0.0'}
@@ -11250,19 +11118,9 @@ packages:
resolution: {integrity: sha512-mnIlAEMu4OyEvUNdzco9xpuB9YVcPkQec+QsgycBCtPZvEqWPCDPfbAE4OJMdBBWpZWtpCn1xw9jJYlwjWI5zQ==}
hasBin: true
- langium@3.3.1:
- resolution: {integrity: sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==}
- engines: {node: '>=16.0.0'}
-
launch-ide@1.0.7:
resolution: {integrity: sha512-wJMTq6U2sVYqxrlp544KQxtl8cHoXFfQa2ivDtKJ6ock2ARneiEHqUFce/NQsnNP1aZNg4OXB6g00oFRvni1/Q==}
- layout-base@1.0.2:
- resolution: {integrity: sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==}
-
- layout-base@2.0.1:
- resolution: {integrity: sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==}
-
lazy-val@1.0.5:
resolution: {integrity: sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==}
@@ -11281,6 +11139,14 @@ packages:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
+ lexical@0.33.1:
+ resolution: {integrity: sha512-+kiCS/GshQmCs/meMb8MQT4AMvw3S3Ef0lSCv2Xi6Itvs59OD+NjQWNfYkDteIbKtVE/w0Yiqh56VyGwIb8UcA==}
+
+ lib0@0.2.114:
+ resolution: {integrity: sha512-gcxmNFzA4hv8UYi8j43uPlQ7CGcyMJ2KQb5kZASw6SnAKAf10hK12i2fjrS3Cl/ugZa5Ui6WwIu1/6MIXiHttQ==}
+ engines: {node: '>=16'}
+ hasBin: true
+
lie@3.3.0:
resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==}
@@ -11471,9 +11337,6 @@ packages:
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'}
- lodash-es@4.17.21:
- resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
-
lodash.camelcase@4.3.0:
resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
@@ -11645,11 +11508,6 @@ packages:
markdown-table@3.0.4:
resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==}
- marked@15.0.12:
- resolution: {integrity: sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==}
- engines: {node: '>= 18'}
- hasBin: true
-
marked@16.0.0:
resolution: {integrity: sha512-MUKMXDjsD/eptB7GPzxo4xcnLS6oo7/RHimUMHEDRhUooPwmN9BEpMl7AEOJv3bmso169wHI2wUF9VQgL7zfmA==}
engines: {node: '>= 20'}
@@ -11755,9 +11613,6 @@ packages:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'}
- mermaid@11.7.0:
- resolution: {integrity: sha512-/1/5R0rt0Z1Ak0CuznAnCF3HtQgayRXUz6SguzOwN4L+DuCobz0UxnQ+ZdTSZ3AugKVVh78tiVmsHpHWV25TCw==}
-
metro-babel-transformer@0.82.4:
resolution: {integrity: sha512-4juJahGRb1gmNbQq48lNinB6WFNfb6m0BQqi/RQibEltNiqTCxew/dBspI2EWA4xVCd3mQWGfw0TML4KurQZnQ==}
engines: {node: '>=18.18'}
@@ -12172,8 +12027,8 @@ packages:
natural-orderby@2.0.3:
resolution: {integrity: sha512-p7KTHxU0CUrcOXe62Zfrb5Z13nLvPhSWR/so3kFulUQU0sgUll2Z0LwpsLN351eOOD+hRGu/F1g+6xDfPeD++Q==}
- nbump@2.1.3:
- resolution: {integrity: sha512-QrUShF6Deurj0mYmbO6v4qLjI9HmYQtVzybd7gNPQJNkfhAhnKygs0whZQuvsEM3jnaNYqFg+SkRkEQY7ARc/Q==}
+ nbump@2.1.5:
+ resolution: {integrity: sha512-zp1rgf0Xt3h6VbxwTP3dMZpaf7oenbxDmTGq3RXqaLaVhES/3jVtkx7gScHTYSyutRblRqOW30E1YTGUyLQNlw==}
hasBin: true
ncp@2.0.0:
@@ -12579,9 +12434,6 @@ packages:
path-browserify@1.0.1:
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
- path-data-parser@0.1.0:
- resolution: {integrity: sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w==}
-
path-exists@3.0.0:
resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==}
engines: {node: '>=4'}
@@ -12804,12 +12656,6 @@ packages:
resolution: {integrity: sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==}
engines: {node: '>=14.19.0'}
- points-on-curve@0.2.0:
- resolution: {integrity: sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A==}
-
- points-on-path@0.2.1:
- resolution: {integrity: sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g==}
-
portfinder@1.0.37:
resolution: {integrity: sha512-yuGIEjDAYnnOex9ddMnKZEMFE0CcGo6zbfzDklkmT1m5z734ss6JMzN9rNB3+RR7iS+F10D4/BVIaXOyh8PQKw==}
engines: {node: '>= 10.12'}
@@ -13187,6 +13033,10 @@ packages:
resolution: {integrity: sha512-973driJZvxiGOQ5ONsFhOF/DtzPMOMtgC11kCpUrPGMTgqp2q/1gwzCquocrN33is0VZ5GFHXZYMM9l6h67v2Q==}
engines: {node: '>=10'}
+ prismjs@1.30.0:
+ resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==}
+ engines: {node: '>=6'}
+
proc-log@2.0.1:
resolution: {integrity: sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw==}
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
@@ -13377,11 +13227,20 @@ packages:
peerDependencies:
react: 19.0.0
+ react-error-boundary@3.1.4:
+ resolution: {integrity: sha512-uM9uPzZJTF6wRQORmSrvOIgt4lJ9MC1sNgEOj2XGsDTRE4kmpWxg7ENK9EWNKJRMAOY9z0MuF4yIfl6gp4sotA==}
+ engines: {node: '>=10', npm: '>=6'}
+ peerDependencies:
+ react: 19.0.0
+
react-error-boundary@6.0.0:
resolution: {integrity: sha512-gdlJjD7NWr0IfkPlaREN2d9uUZUlksrfOx7SX62VRerwXbMY6ftGCIZua1VG1aXFNOimhISsTq+Owp725b9SiA==}
peerDependencies:
react: 19.0.0
+ react-fast-compare@3.2.2:
+ resolution: {integrity: sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==}
+
react-fast-marquee@1.6.5:
resolution: {integrity: sha512-swDnPqrT2XISAih0o74zQVE2wQJFMvkx+9VZXYYNSLb/CUcAzU9pNj637Ar2+hyRw6b4tP6xh4GQZip2ZCpQpg==}
peerDependencies:
@@ -13789,12 +13648,6 @@ packages:
resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==}
engines: {node: '>= 10.13.0'}
- recyclerlistview@4.2.3:
- resolution: {integrity: sha512-STR/wj/FyT8EMsBzzhZ1l2goYirMkIgfV3gYEPxI3Kf3lOnu6f7Dryhyw7/IkQrgX5xtTcDrZMqytvteH9rL3g==}
- peerDependencies:
- react: 19.0.0
- react-native: '>= 0.30.0'
-
redeyed@2.1.1:
resolution: {integrity: sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==}
@@ -14036,9 +13889,6 @@ packages:
resolution: {integrity: sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==}
engines: {node: '>=8.0'}
- robust-predicates@3.0.2:
- resolution: {integrity: sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==}
-
rolldown-plugin-dts@0.13.13:
resolution: {integrity: sha512-Nchx9nQoa4IpfQ/BJzodKMvtJ3H3dT322siAJSp3uvQJ+Pi1qgEjOp7hSQwGSQRhaC5gC+9hparbWEH5oiAL9Q==}
engines: {node: '>=20.18.0'}
@@ -14072,9 +13922,6 @@ packages:
rou3@0.5.1:
resolution: {integrity: sha512-OXMmJ3zRk2xeXFGfA3K+EOPHC5u7RDFG7lIOx0X1pdnhUkI8MdVrbV+sNsD80ElpUZ+MRHdyxPnFthq9VHs8uQ==}
- roughjs@4.6.6:
- resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==}
-
rtl-detect@1.1.2:
resolution: {integrity: sha512-PGMBq03+TTG/p/cRB7HCLKJ1MgDIi07+QU1faSjiYRfmY5UsAttV9Hs08jDAHVwcOwmVLcSJkpwyfXszVjWfIQ==}
@@ -14085,9 +13932,6 @@ packages:
run-parallel@1.2.0:
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
- rw@1.3.3:
- resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==}
-
rxjs@6.6.7:
resolution: {integrity: sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==}
engines: {npm: '>=2.0.0'}
@@ -14395,6 +14239,7 @@ packages:
source-map@0.8.0-beta.0:
resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
engines: {node: '>= 8'}
+ deprecated: The work that was done in this beta branch won't be included in future versions
sourcemap-codec@1.4.8:
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==}
@@ -14632,9 +14477,6 @@ packages:
styleq@0.1.3:
resolution: {integrity: sha512-3ZUifmCDCQanjeej1f6kyl/BeP/Vae5EYkQ9iJfUm/QwZvlgnZzyflqAsAWYURdtea8Vkvswu2GrC57h3qffcA==}
- stylis@4.3.6:
- resolution: {integrity: sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==}
-
sucrase@3.35.0:
resolution: {integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==}
engines: {node: '>=16 || 14 >=14.17'}
@@ -14684,11 +14526,6 @@ packages:
engines: {node: '>=14.0.0'}
hasBin: true
- swr@2.3.3:
- resolution: {integrity: sha512-dshNvs3ExOqtZ6kJBaAsabhPdHyeY4P2cKwRCniDVifBMoG/SVI7tfLWqPXriVspf2Rg4tPzXJTnwaihIeFw2A==}
- peerDependencies:
- react: 19.0.0
-
synckit@0.11.8:
resolution: {integrity: sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A==}
engines: {node: ^14.18.0 || >=16.0.0}
@@ -14809,10 +14646,6 @@ packages:
throat@5.0.0:
resolution: {integrity: sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==}
- throttleit@2.1.0:
- resolution: {integrity: sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==}
- engines: {node: '>=18'}
-
through@2.3.8:
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
@@ -14949,10 +14782,6 @@ packages:
peerDependencies:
typescript: '>=4.0.0'
- ts-dedent@2.2.0:
- resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==}
- engines: {node: '>=6.10'}
-
ts-interface-checker@0.1.13:
resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==}
@@ -14987,9 +14816,6 @@ packages:
'@swc/wasm':
optional: true
- ts-object-utils@0.0.5:
- resolution: {integrity: sha512-iV0GvHqOmilbIKJsfyfJY9/dNHCs969z3so90dQWsO1eMMozvTpnB1MEaUbb3FYtZTGjv5sIy/xmslEz0Rg2TA==}
-
ts-pattern@5.7.1:
resolution: {integrity: sha512-EGs8PguQqAAUIcQfK4E9xdXxB6s2GK4sJfT/vcc9V1ELIvC4LH/zXu2t/5fajtv6oiRCxdv7BgtVK3vWgROxag==}
@@ -15404,10 +15230,6 @@ packages:
resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==}
engines: {node: '>= 0.4.0'}
- uuid@11.1.0:
- resolution: {integrity: sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==}
- hasBin: true
-
uuid@7.0.3:
resolution: {integrity: sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==}
hasBin: true
@@ -15579,26 +15401,6 @@ packages:
resolution: {integrity: sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==}
engines: {node: '>=0.10.0'}
- vscode-jsonrpc@8.2.0:
- resolution: {integrity: sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==}
- engines: {node: '>=14.0.0'}
-
- vscode-languageserver-protocol@3.17.5:
- resolution: {integrity: sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==}
-
- vscode-languageserver-textdocument@1.0.12:
- resolution: {integrity: sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==}
-
- vscode-languageserver-types@3.17.5:
- resolution: {integrity: sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==}
-
- vscode-languageserver@9.0.1:
- resolution: {integrity: sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==}
- hasBin: true
-
- vscode-uri@3.0.8:
- resolution: {integrity: sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==}
-
vscode-uri@3.1.0:
resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==}
@@ -15936,6 +15738,10 @@ packages:
yauzl@2.10.0:
resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==}
+ yjs@13.6.27:
+ resolution: {integrity: sha512-OIDwaflOaq4wC6YlPBy2L6ceKeKuF7DeTxx+jPzv1FHn9tCZ0ZwSRnUBxD05E3yed46fv/FWJbvR+Ud7x0L7zw==}
+ engines: {node: '>=16.0.0', npm: '>=8.0.0'}
+
yn@3.1.1:
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
engines: {node: '>=6'}
@@ -15977,6 +15783,21 @@ packages:
zod@3.25.76:
resolution: {integrity: sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==}
+ zustand@4.5.7:
+ resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==}
+ engines: {node: '>=12.7.0'}
+ peerDependencies:
+ '@types/react': '>=16.8'
+ immer: '>=9.0.6'
+ react: 19.0.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ immer:
+ optional: true
+ react:
+ optional: true
+
zustand@5.0.6:
resolution: {integrity: sha512-ihAqNeUVhe0MAD+X8M5UzqyZ9k3FFZLBTtqo6JLPwV53cbRB/mJwBI0PxcIgqhBBHlEs8G45OTDTMq3gNcLq3A==}
engines: {node: '>=12.20.0'}
@@ -15998,8 +15819,8 @@ packages:
zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
- zx@8.6.1:
- resolution: {integrity: sha512-ig4Gn2e3L9QaQq3OsyDyGKvXFiq7wYvLCPmFJgcneHsr5vTeJefe0SXtDE7qaur9ysv7giAc0CmEtQcS71UA5Q==}
+ zx@8.7.2:
+ resolution: {integrity: sha512-4Wtl46msLFx6QW6GjLu1aRnFhavukT4VSp4tdXvfRIBRNW3RP7Si3RlRFD7YeQeecQBacVFRQQgm5LTvE/YEGQ==}
engines: {node: '>= 12.17.0'}
hasBin: true
@@ -16011,88 +15832,52 @@ snapshots:
optionalDependencies:
graphql: 16.8.1
- '@ai-sdk/gateway@1.0.0-beta.11(zod@3.25.75)':
+ '@ai-sdk/gateway@1.0.2(zod@3.25.75)':
dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.75)
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.1(zod@3.25.75)
zod: 3.25.75
- '@ai-sdk/gateway@1.0.0-beta.11(zod@3.25.76)':
+ '@ai-sdk/gateway@1.0.2(zod@3.25.76)':
dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.76)
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.1(zod@3.25.76)
zod: 3.25.76
- '@ai-sdk/gateway@1.0.0-beta.3(zod@3.25.75)':
+ '@ai-sdk/openai@2.0.2(zod@3.25.76)':
dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.2(zod@3.25.75)
- zod: 3.25.75
-
- '@ai-sdk/gateway@1.0.0-beta.3(zod@3.25.76)':
- dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.2(zod@3.25.76)
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.0(zod@3.25.76)
zod: 3.25.76
- '@ai-sdk/openai@2.0.0-beta.11(zod@3.25.75)':
+ '@ai-sdk/provider-utils@3.0.0(zod@3.25.76)':
dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.75)
- zod: 3.25.75
-
- '@ai-sdk/openai@2.0.0-beta.11(zod@3.25.76)':
- dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.76)
- zod: 3.25.76
-
- '@ai-sdk/provider-utils@3.0.0-beta.2(zod@3.25.75)':
- dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
- '@standard-schema/spec': 1.0.0
- eventsource-parser: 3.0.3
- zod: 3.25.75
- zod-to-json-schema: 3.24.5(zod@3.25.75)
-
- '@ai-sdk/provider-utils@3.0.0-beta.2(zod@3.25.76)':
- dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
+ '@ai-sdk/provider': 2.0.0
'@standard-schema/spec': 1.0.0
eventsource-parser: 3.0.3
zod: 3.25.76
zod-to-json-schema: 3.24.5(zod@3.25.76)
- '@ai-sdk/provider-utils@3.0.0-beta.5(zod@3.25.75)':
+ '@ai-sdk/provider-utils@3.0.1(zod@3.25.75)':
dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
+ '@ai-sdk/provider': 2.0.0
'@standard-schema/spec': 1.0.0
eventsource-parser: 3.0.3
zod: 3.25.75
zod-to-json-schema: 3.24.5(zod@3.25.75)
- '@ai-sdk/provider-utils@3.0.0-beta.5(zod@3.25.76)':
+ '@ai-sdk/provider-utils@3.0.1(zod@3.25.76)':
dependencies:
- '@ai-sdk/provider': 2.0.0-beta.1
+ '@ai-sdk/provider': 2.0.0
'@standard-schema/spec': 1.0.0
eventsource-parser: 3.0.3
zod: 3.25.76
zod-to-json-schema: 3.24.5(zod@3.25.76)
- '@ai-sdk/provider@2.0.0-beta.1':
+ '@ai-sdk/provider@2.0.0':
dependencies:
json-schema: 0.4.0
- '@ai-sdk/react@2.0.0-beta.25(react@19.0.0)(zod@3.25.75)':
- dependencies:
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.75)
- ai: 5.0.0-beta.25(zod@3.25.75)
- react: 19.0.0
- swr: 2.3.3(react@19.0.0)
- throttleit: 2.1.0
- optionalDependencies:
- zod: 3.25.75
-
'@alloc/quick-lru@5.2.0': {}
'@altano/repository-tools@0.1.1': {}
@@ -17040,31 +16825,12 @@ snapshots:
'@better-fetch/fetch@1.1.18': {}
- '@braintree/sanitize-url@7.1.1': {}
-
'@canvas/image-data@1.0.0': {}
'@cfcs/core@0.0.6':
dependencies:
'@egjs/component': 3.0.5
- '@chevrotain/cst-dts-gen@11.0.3':
- dependencies:
- '@chevrotain/gast': 11.0.3
- '@chevrotain/types': 11.0.3
- lodash-es: 4.17.21
-
- '@chevrotain/gast@11.0.3':
- dependencies:
- '@chevrotain/types': 11.0.3
- lodash-es: 4.17.21
-
- '@chevrotain/regexp-to-ast@11.0.3': {}
-
- '@chevrotain/types@11.0.3': {}
-
- '@chevrotain/utils@11.0.3': {}
-
'@clack/core@0.3.5':
dependencies:
picocolors: 1.1.1
@@ -19130,37 +18896,37 @@ snapshots:
'@firebase/webchannel-wrapper@1.0.3': {}
- '@floating-ui/core@1.7.0':
+ '@floating-ui/core@1.7.2':
dependencies:
- '@floating-ui/utils': 0.2.9
+ '@floating-ui/utils': 0.2.10
- '@floating-ui/dom@1.7.0':
+ '@floating-ui/dom@1.7.2':
dependencies:
- '@floating-ui/core': 1.7.0
- '@floating-ui/utils': 0.2.9
+ '@floating-ui/core': 1.7.2
+ '@floating-ui/utils': 0.2.10
- '@floating-ui/react-dom@2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
+ '@floating-ui/react-dom@2.1.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
dependencies:
- '@floating-ui/dom': 1.7.0
+ '@floating-ui/dom': 1.7.2
react: 19.0.0
react-dom: 19.0.0(react@19.0.0)
- '@floating-ui/react@0.26.28(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
+ '@floating-ui/react@0.27.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
dependencies:
- '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
- '@floating-ui/utils': 0.2.9
+ '@floating-ui/react-dom': 2.1.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@floating-ui/utils': 0.2.10
react: 19.0.0
react-dom: 19.0.0(react@19.0.0)
tabbable: 6.2.0
- '@floating-ui/utils@0.2.9': {}
+ '@floating-ui/utils@0.2.10': {}
- '@follow-app/client-sdk@0.3.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
+ '@follow-app/client-sdk@0.3.27(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
dependencies:
- '@folo-services/constants': 0.1.15
- '@folo-services/drizzle': 0.1.10(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
- '@folo-services/exceptions': 0.1.8
- '@folo-services/shared': 0.0.5(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
+ '@folo-services/constants': 0.1.17
+ '@folo-services/drizzle': 0.1.12(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
+ '@folo-services/exceptions': 0.1.10
+ '@folo-services/shared': 0.0.7(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
zod: 3.25.76
transitivePeerDependencies:
- '@aws-sdk/client-rds-data'
@@ -19194,11 +18960,11 @@ snapshots:
- sql.js
- sqlite3
- '@folo-services/ai-tools@0.2.14(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
+ '@folo-services/ai-tools@0.2.19(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
dependencies:
- '@ai-sdk/openai': 2.0.0-beta.11(zod@3.25.76)
- '@folo-services/drizzle': 0.1.9(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
- ai: 5.0.0-beta.25(zod@3.25.76)
+ '@ai-sdk/openai': 2.0.2(zod@3.25.76)
+ '@folo-services/drizzle': 0.1.12(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
+ ai: 5.0.4(zod@3.25.76)
drizzle-orm: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
zod: 3.25.76
transitivePeerDependencies:
@@ -19233,17 +18999,13 @@ snapshots:
- sql.js
- sqlite3
- '@folo-services/constants@0.1.15':
+ '@folo-services/constants@0.1.17':
dependencies:
zod: 3.25.76
- '@folo-services/constants@0.1.6':
+ '@folo-services/drizzle@0.1.12(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)':
dependencies:
- zod: 3.25.76
-
- '@folo-services/drizzle@0.1.10(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)':
- dependencies:
- '@folo-services/exceptions': 0.1.8
+ '@folo-services/exceptions': 0.1.10
drizzle-orm: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
drizzle-zod: 0.7.1(drizzle-orm@0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3))(zod@3.25.76)
nanoid: 5.1.5
@@ -19280,52 +19042,11 @@ snapshots:
- sql.js
- sqlite3
- '@folo-services/drizzle@0.1.9(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)':
+ '@folo-services/exceptions@0.1.10': {}
+
+ '@folo-services/shared@0.0.7(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
dependencies:
- '@folo-services/exceptions': 0.1.7
- drizzle-orm: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
- drizzle-zod: 0.7.1(drizzle-orm@0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3))(zod@3.25.76)
- nanoid: 5.1.5
- pg: 8.16.3
- zod: 3.25.76
- transitivePeerDependencies:
- - '@aws-sdk/client-rds-data'
- - '@cloudflare/workers-types'
- - '@electric-sql/pglite'
- - '@libsql/client'
- - '@libsql/client-wasm'
- - '@neondatabase/serverless'
- - '@op-engineering/op-sqlite'
- - '@opentelemetry/api'
- - '@planetscale/database'
- - '@prisma/client'
- - '@tidbcloud/serverless'
- - '@types/better-sqlite3'
- - '@types/pg'
- - '@types/sql.js'
- - '@upstash/redis'
- - '@vercel/postgres'
- - '@xata.io/client'
- - better-sqlite3
- - bun-types
- - expo-sqlite
- - gel
- - knex
- - kysely
- - mysql2
- - pg-native
- - postgres
- - prisma
- - sql.js
- - sqlite3
-
- '@folo-services/exceptions@0.1.7': {}
-
- '@folo-services/exceptions@0.1.8': {}
-
- '@folo-services/shared@0.0.5(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
- dependencies:
- '@folo-services/drizzle': 0.1.10(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
+ '@folo-services/drizzle': 0.1.12(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
drizzle-orm: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
drizzle-zod: 0.7.1(drizzle-orm@0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3))(zod@3.25.76)
zod: 3.25.76
@@ -19402,7 +19123,7 @@ snapshots:
'@headlessui/react@2.2.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
dependencies:
- '@floating-ui/react': 0.26.28(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@floating-ui/react': 0.27.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@react-aria/focus': 3.20.3(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@react-aria/interactions': 3.25.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@tanstack/react-virtual': 3.13.12(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
@@ -19771,6 +19492,152 @@ snapshots:
'@levischuck/tiny-cbor@0.2.11': {}
+ '@lexical/clipboard@0.33.1':
+ dependencies:
+ '@lexical/html': 0.33.1
+ '@lexical/list': 0.33.1
+ '@lexical/selection': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/code@0.33.1':
+ dependencies:
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+ prismjs: 1.30.0
+
+ '@lexical/devtools-core@0.33.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
+ dependencies:
+ '@lexical/html': 0.33.1
+ '@lexical/link': 0.33.1
+ '@lexical/mark': 0.33.1
+ '@lexical/table': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+ react: 19.0.0
+ react-dom: 19.0.0(react@19.0.0)
+
+ '@lexical/dragon@0.33.1':
+ dependencies:
+ lexical: 0.33.1
+
+ '@lexical/hashtag@0.33.1':
+ dependencies:
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/history@0.33.1':
+ dependencies:
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/html@0.33.1':
+ dependencies:
+ '@lexical/selection': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/link@0.33.1':
+ dependencies:
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/list@0.33.1':
+ dependencies:
+ '@lexical/selection': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/mark@0.33.1':
+ dependencies:
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/markdown@0.33.1':
+ dependencies:
+ '@lexical/code': 0.33.1
+ '@lexical/link': 0.33.1
+ '@lexical/list': 0.33.1
+ '@lexical/rich-text': 0.33.1
+ '@lexical/text': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/offset@0.33.1':
+ dependencies:
+ lexical: 0.33.1
+
+ '@lexical/overflow@0.33.1':
+ dependencies:
+ lexical: 0.33.1
+
+ '@lexical/plain-text@0.33.1':
+ dependencies:
+ '@lexical/clipboard': 0.33.1
+ '@lexical/selection': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/react@0.33.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(yjs@13.6.27)':
+ dependencies:
+ '@floating-ui/react': 0.27.14(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@lexical/devtools-core': 0.33.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@lexical/dragon': 0.33.1
+ '@lexical/hashtag': 0.33.1
+ '@lexical/history': 0.33.1
+ '@lexical/link': 0.33.1
+ '@lexical/list': 0.33.1
+ '@lexical/mark': 0.33.1
+ '@lexical/markdown': 0.33.1
+ '@lexical/overflow': 0.33.1
+ '@lexical/plain-text': 0.33.1
+ '@lexical/rich-text': 0.33.1
+ '@lexical/table': 0.33.1
+ '@lexical/text': 0.33.1
+ '@lexical/utils': 0.33.1
+ '@lexical/yjs': 0.33.1(yjs@13.6.27)
+ lexical: 0.33.1
+ react: 19.0.0
+ react-dom: 19.0.0(react@19.0.0)
+ react-error-boundary: 3.1.4(react@19.0.0)
+ transitivePeerDependencies:
+ - yjs
+
+ '@lexical/rich-text@0.33.1':
+ dependencies:
+ '@lexical/clipboard': 0.33.1
+ '@lexical/selection': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/selection@0.33.1':
+ dependencies:
+ lexical: 0.33.1
+
+ '@lexical/table@0.33.1':
+ dependencies:
+ '@lexical/clipboard': 0.33.1
+ '@lexical/utils': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/text@0.33.1':
+ dependencies:
+ lexical: 0.33.1
+
+ '@lexical/utils@0.33.1':
+ dependencies:
+ '@lexical/list': 0.33.1
+ '@lexical/selection': 0.33.1
+ '@lexical/table': 0.33.1
+ lexical: 0.33.1
+
+ '@lexical/yjs@0.33.1(yjs@13.6.27)':
+ dependencies:
+ '@lexical/offset': 0.33.1
+ '@lexical/selection': 0.33.1
+ lexical: 0.33.1
+ yjs: 13.6.27
+
'@lottiefiles/dotlottie-react@0.14.2(react@19.0.0)':
dependencies:
'@lottiefiles/dotlottie-web': 0.47.0
@@ -19808,10 +19675,6 @@ snapshots:
- encoding
- supports-color
- '@mermaid-js/parser@0.5.0':
- dependencies:
- langium: 3.3.1
-
'@microflash/remark-callout-directives@4.4.0(patch_hash=6160b1cf0eab6deca36415693dda703746edcd42e0e64b9174294e2210481396)':
dependencies:
defu: 6.1.4
@@ -20701,7 +20564,7 @@ snapshots:
'@radix-ui/react-popper@1.2.7(@types/react-dom@19.1.6(@types/react@19.1.8))(@types/react@19.1.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
dependencies:
- '@floating-ui/react-dom': 2.1.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
+ '@floating-ui/react-dom': 2.1.4(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@radix-ui/react-arrow': 1.1.7(@types/react-dom@19.1.6(@types/react@19.1.8))(@types/react@19.1.8)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)
'@radix-ui/react-compose-refs': 1.1.2(@types/react@19.1.8)(react@19.0.0)
'@radix-ui/react-context': 1.1.2(@types/react@19.1.8)(react@19.0.0)
@@ -21755,13 +21618,11 @@ snapshots:
'@shikijs/vscode-textmate@10.0.2': {}
- '@shopify/flash-list@1.8.3(@babel/runtime@7.27.6)(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)':
+ '@shopify/flash-list@2.0.0(@babel/runtime@7.27.6)(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)':
dependencies:
'@babel/runtime': 7.27.6
react: 19.0.0
react-native: 0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)
- recyclerlistview: 4.2.3(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0)
- tslib: 2.8.1
'@shuding/opentype.js@1.4.0-beta.0':
dependencies:
@@ -22017,81 +21878,18 @@ snapshots:
dependencies:
'@types/node': 24.0.10
- '@types/d3-array@3.2.1': {}
-
- '@types/d3-axis@3.0.6':
- dependencies:
- '@types/d3-selection': 3.0.11
-
- '@types/d3-brush@3.0.6':
- dependencies:
- '@types/d3-selection': 3.0.11
-
- '@types/d3-chord@3.0.6': {}
-
'@types/d3-color@3.1.3': {}
- '@types/d3-contour@3.0.6':
- dependencies:
- '@types/d3-array': 3.2.1
- '@types/geojson': 7946.0.16
-
- '@types/d3-delaunay@6.0.4': {}
-
- '@types/d3-dispatch@3.0.6': {}
-
'@types/d3-drag@3.0.7':
dependencies:
'@types/d3-selection': 3.0.11
- '@types/d3-dsv@3.0.7': {}
-
- '@types/d3-ease@3.0.2': {}
-
- '@types/d3-fetch@3.0.7':
- dependencies:
- '@types/d3-dsv': 3.0.7
-
- '@types/d3-force@3.0.10': {}
-
- '@types/d3-format@3.0.4': {}
-
- '@types/d3-geo@3.1.0':
- dependencies:
- '@types/geojson': 7946.0.16
-
- '@types/d3-hierarchy@3.1.7': {}
-
'@types/d3-interpolate@3.0.4':
dependencies:
'@types/d3-color': 3.1.3
- '@types/d3-path@3.1.1': {}
-
- '@types/d3-polygon@3.0.2': {}
-
- '@types/d3-quadtree@3.0.6': {}
-
- '@types/d3-random@3.0.3': {}
-
- '@types/d3-scale-chromatic@3.1.0': {}
-
- '@types/d3-scale@4.0.9':
- dependencies:
- '@types/d3-time': 3.0.4
-
'@types/d3-selection@3.0.11': {}
- '@types/d3-shape@3.1.7':
- dependencies:
- '@types/d3-path': 3.1.1
-
- '@types/d3-time-format@4.0.3': {}
-
- '@types/d3-time@3.0.4': {}
-
- '@types/d3-timer@3.0.2': {}
-
'@types/d3-transition@3.0.9':
dependencies:
'@types/d3-selection': 3.0.11
@@ -22101,39 +21899,6 @@ snapshots:
'@types/d3-interpolate': 3.0.4
'@types/d3-selection': 3.0.11
- '@types/d3@7.4.3':
- dependencies:
- '@types/d3-array': 3.2.1
- '@types/d3-axis': 3.0.6
- '@types/d3-brush': 3.0.6
- '@types/d3-chord': 3.0.6
- '@types/d3-color': 3.1.3
- '@types/d3-contour': 3.0.6
- '@types/d3-delaunay': 6.0.4
- '@types/d3-dispatch': 3.0.6
- '@types/d3-drag': 3.0.7
- '@types/d3-dsv': 3.0.7
- '@types/d3-ease': 3.0.2
- '@types/d3-fetch': 3.0.7
- '@types/d3-force': 3.0.10
- '@types/d3-format': 3.0.4
- '@types/d3-geo': 3.1.0
- '@types/d3-hierarchy': 3.1.7
- '@types/d3-interpolate': 3.0.4
- '@types/d3-path': 3.1.1
- '@types/d3-polygon': 3.0.2
- '@types/d3-quadtree': 3.0.6
- '@types/d3-random': 3.0.3
- '@types/d3-scale': 4.0.9
- '@types/d3-scale-chromatic': 3.1.0
- '@types/d3-selection': 3.0.11
- '@types/d3-shape': 3.1.7
- '@types/d3-time': 3.0.4
- '@types/d3-time-format': 4.0.3
- '@types/d3-timer': 3.0.2
- '@types/d3-transition': 3.0.9
- '@types/d3-zoom': 3.0.8
-
'@types/debug@4.1.12':
dependencies:
'@types/ms': 2.1.0
@@ -22154,8 +21919,6 @@ snapshots:
dependencies:
'@types/node': 24.0.10
- '@types/geojson@7946.0.16': {}
-
'@types/graceful-fs@4.1.9':
dependencies:
'@types/node': 24.0.10
@@ -22753,6 +22516,29 @@ snapshots:
'@xmldom/xmldom@0.8.10': {}
+ '@xyflow/react@12.8.2(@types/react@19.1.8)(immer@10.1.1(patch_hash=594c60b929bc0a3b56576f1a1787da1aec2a1fba51e3c21ec09c0ed38280af6c))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)':
+ dependencies:
+ '@xyflow/system': 0.0.66
+ classcat: 5.0.5
+ react: 19.0.0
+ react-dom: 19.0.0(react@19.0.0)
+ zustand: 4.5.7(@types/react@19.1.8)(immer@10.1.1(patch_hash=594c60b929bc0a3b56576f1a1787da1aec2a1fba51e3c21ec09c0ed38280af6c))(react@19.0.0)
+ transitivePeerDependencies:
+ - '@types/react'
+ - immer
+
+ '@xyflow/system@0.0.66':
+ dependencies:
+ '@types/d3-drag': 3.0.7
+ '@types/d3-interpolate': 3.0.4
+ '@types/d3-selection': 3.0.11
+ '@types/d3-transition': 3.0.9
+ '@types/d3-zoom': 3.0.8
+ d3-drag: 3.0.0
+ d3-interpolate: 3.0.1
+ d3-selection: 3.0.0
+ d3-zoom: 3.0.0
+
'@yornaath/batshit-devtools@1.7.1': {}
'@yornaath/batshit@0.10.1':
@@ -22809,35 +22595,19 @@ snapshots:
clean-stack: 2.2.0
indent-string: 4.0.0
- ai@5.0.0-beta.25(zod@3.25.75):
+ ai@5.0.4(zod@3.25.75):
dependencies:
- '@ai-sdk/gateway': 1.0.0-beta.11(zod@3.25.75)
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.75)
+ '@ai-sdk/gateway': 1.0.2(zod@3.25.75)
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.1(zod@3.25.75)
'@opentelemetry/api': 1.9.0
zod: 3.25.75
- ai@5.0.0-beta.25(zod@3.25.76):
+ ai@5.0.4(zod@3.25.76):
dependencies:
- '@ai-sdk/gateway': 1.0.0-beta.11(zod@3.25.76)
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.5(zod@3.25.76)
- '@opentelemetry/api': 1.9.0
- zod: 3.25.76
-
- ai@5.0.0-beta.6(zod@3.25.75):
- dependencies:
- '@ai-sdk/gateway': 1.0.0-beta.3(zod@3.25.75)
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.2(zod@3.25.75)
- '@opentelemetry/api': 1.9.0
- zod: 3.25.75
-
- ai@5.0.0-beta.7(zod@3.25.76):
- dependencies:
- '@ai-sdk/gateway': 1.0.0-beta.3(zod@3.25.76)
- '@ai-sdk/provider': 2.0.0-beta.1
- '@ai-sdk/provider-utils': 3.0.0-beta.2(zod@3.25.76)
+ '@ai-sdk/gateway': 1.0.2(zod@3.25.76)
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.1(zod@3.25.76)
'@opentelemetry/api': 1.9.0
zod: 3.25.76
@@ -23759,20 +23529,6 @@ snapshots:
undici: 6.21.3
whatwg-mimetype: 4.0.0
- chevrotain-allstar@0.3.1(chevrotain@11.0.3):
- dependencies:
- chevrotain: 11.0.3
- lodash-es: 4.17.21
-
- chevrotain@11.0.3:
- dependencies:
- '@chevrotain/cst-dts-gen': 11.0.3
- '@chevrotain/gast': 11.0.3
- '@chevrotain/regexp-to-ast': 11.0.3
- '@chevrotain/types': 11.0.3
- '@chevrotain/utils': 11.0.3
- lodash-es: 4.17.21
-
chokidar@3.6.0:
dependencies:
anymatch: 3.1.3
@@ -23842,6 +23598,8 @@ snapshots:
dependencies:
clsx: 2.1.1
+ classcat@5.0.5: {}
+
clean-css@5.3.3:
dependencies:
source-map: 0.6.1
@@ -24198,14 +23956,6 @@ snapshots:
core-util-is@1.0.3: {}
- cose-base@1.0.3:
- dependencies:
- layout-base: 1.0.2
-
- cose-base@2.2.0:
- dependencies:
- layout-base: 2.0.1
-
cosmiconfig@5.2.1:
dependencies:
import-fresh: 2.0.0
@@ -24417,50 +24167,8 @@ snapshots:
culori@3.3.0: {}
- cytoscape-cose-bilkent@4.1.0(cytoscape@3.32.0):
- dependencies:
- cose-base: 1.0.3
- cytoscape: 3.32.0
-
- cytoscape-fcose@2.2.0(cytoscape@3.32.0):
- dependencies:
- cose-base: 2.2.0
- cytoscape: 3.32.0
-
- cytoscape@3.32.0: {}
-
- d3-array@2.12.1:
- dependencies:
- internmap: 1.0.1
-
- d3-array@3.2.4:
- dependencies:
- internmap: 2.0.3
-
- d3-axis@3.0.0: {}
-
- d3-brush@3.0.0:
- dependencies:
- d3-dispatch: 3.0.1
- d3-drag: 3.0.0
- d3-interpolate: 3.0.1
- d3-selection: 3.0.0
- d3-transition: 3.0.1(d3-selection@3.0.0)
-
- d3-chord@3.0.1:
- dependencies:
- d3-path: 3.1.0
-
d3-color@3.1.0: {}
- d3-contour@4.0.2:
- dependencies:
- d3-array: 3.2.4
-
- d3-delaunay@6.0.4:
- dependencies:
- delaunator: 5.0.1
-
d3-dispatch@3.0.1: {}
d3-drag@3.0.0:
@@ -24468,82 +24176,14 @@ snapshots:
d3-dispatch: 3.0.1
d3-selection: 3.0.0
- d3-dsv@3.0.1:
- dependencies:
- commander: 7.2.0
- iconv-lite: 0.6.3
- rw: 1.3.3
-
d3-ease@3.0.1: {}
- d3-fetch@3.0.1:
- dependencies:
- d3-dsv: 3.0.1
-
- d3-force@3.0.0:
- dependencies:
- d3-dispatch: 3.0.1
- d3-quadtree: 3.0.1
- d3-timer: 3.0.1
-
- d3-format@3.1.0: {}
-
- d3-geo@3.1.1:
- dependencies:
- d3-array: 3.2.4
-
- d3-hierarchy@3.1.2: {}
-
d3-interpolate@3.0.1:
dependencies:
d3-color: 3.1.0
- d3-path@1.0.9: {}
-
- d3-path@3.1.0: {}
-
- d3-polygon@3.0.1: {}
-
- d3-quadtree@3.0.1: {}
-
- d3-random@3.0.1: {}
-
- d3-sankey@0.12.3:
- dependencies:
- d3-array: 2.12.1
- d3-shape: 1.3.7
-
- d3-scale-chromatic@3.1.0:
- dependencies:
- d3-color: 3.1.0
- d3-interpolate: 3.0.1
-
- d3-scale@4.0.2:
- dependencies:
- d3-array: 3.2.4
- d3-format: 3.1.0
- d3-interpolate: 3.0.1
- d3-time: 3.1.0
- d3-time-format: 4.1.0
-
d3-selection@3.0.0: {}
- d3-shape@1.3.7:
- dependencies:
- d3-path: 1.0.9
-
- d3-shape@3.2.0:
- dependencies:
- d3-path: 3.1.0
-
- d3-time-format@4.1.0:
- dependencies:
- d3-time: 3.1.0
-
- d3-time@3.1.0:
- dependencies:
- d3-array: 3.2.4
-
d3-timer@3.0.1: {}
d3-transition@3.0.1(d3-selection@3.0.0):
@@ -24563,44 +24203,6 @@ snapshots:
d3-selection: 3.0.0
d3-transition: 3.0.1(d3-selection@3.0.0)
- d3@7.9.0:
- dependencies:
- d3-array: 3.2.4
- d3-axis: 3.0.0
- d3-brush: 3.0.0
- d3-chord: 3.0.1
- d3-color: 3.1.0
- d3-contour: 4.0.2
- d3-delaunay: 6.0.4
- d3-dispatch: 3.0.1
- d3-drag: 3.0.0
- d3-dsv: 3.0.1
- d3-ease: 3.0.1
- d3-fetch: 3.0.1
- d3-force: 3.0.0
- d3-format: 3.1.0
- d3-geo: 3.1.1
- d3-hierarchy: 3.1.2
- d3-interpolate: 3.0.1
- d3-path: 3.1.0
- d3-polygon: 3.0.1
- d3-quadtree: 3.0.1
- d3-random: 3.0.1
- d3-scale: 4.0.2
- d3-scale-chromatic: 3.1.0
- d3-selection: 3.0.0
- d3-shape: 3.2.0
- d3-time: 3.1.0
- d3-time-format: 4.1.0
- d3-timer: 3.0.1
- d3-transition: 3.0.1(d3-selection@3.0.0)
- d3-zoom: 3.0.0
-
- dagre-d3-es@7.0.11:
- dependencies:
- d3: 7.9.0
- lodash-es: 4.17.21
-
daisyui@4.12.24(patch_hash=d393ab1cbfbfcff21dce0796a59c2d8a37e2c6dd634a8ab476cbc67e47b93d9c)(postcss@8.5.6):
dependencies:
css-selector-tokenizer: 0.8.0
@@ -24701,10 +24303,6 @@ snapshots:
defu@6.1.4: {}
- delaunator@5.0.1:
- dependencies:
- robust-predicates: 3.0.2
-
delayed-stream@1.0.0: {}
depd@2.0.0: {}
@@ -24862,6 +24460,8 @@ snapshots:
dotenv@16.5.0: {}
+ dotenv@17.2.0: {}
+
dotenv@9.0.2: {}
drizzle-kit@0.31.4:
@@ -27023,8 +26623,6 @@ snapshots:
graphql@16.8.1: {}
- hachure-fill@0.5.2: {}
-
handlebars@4.7.8:
dependencies:
minimist: 1.2.8
@@ -27503,10 +27101,6 @@ snapshots:
hasown: 2.0.2
side-channel: 1.1.0
- internmap@1.0.1: {}
-
- internmap@2.0.3: {}
-
interpret@3.1.1: {}
invariant@2.2.4:
@@ -27746,6 +27340,8 @@ snapshots:
dependencies:
ws: 8.18.2(bufferutil@4.0.9)(utf-8-validate@6.0.5)
+ isomorphic.js@0.2.5: {}
+
istanbul-lib-coverage@3.2.2: {}
istanbul-lib-instrument@5.2.1:
@@ -28017,8 +27613,6 @@ snapshots:
dependencies:
json-buffer: 3.0.1
- khroma@2.1.0: {}
-
kleur@3.0.3: {}
kleur@4.1.5: {}
@@ -28027,27 +27621,17 @@ snapshots:
kose-font@1.0.0: {}
+ ky@1.8.2: {}
+
kysely@0.28.2: {}
lan-network@0.1.7: {}
- langium@3.3.1:
- dependencies:
- chevrotain: 11.0.3
- chevrotain-allstar: 0.3.1(chevrotain@11.0.3)
- vscode-languageserver: 9.0.1
- vscode-languageserver-textdocument: 1.0.12
- vscode-uri: 3.0.8
-
launch-ide@1.0.7:
dependencies:
chalk: 4.1.2
dotenv: 16.5.0
- layout-base@1.0.2: {}
-
- layout-base@2.0.1: {}
-
lazy-val@1.0.5: {}
lazystream@1.0.1:
@@ -28063,6 +27647,12 @@ snapshots:
prelude-ls: 1.2.1
type-check: 0.4.0
+ lexical@0.33.1: {}
+
+ lib0@0.2.114:
+ dependencies:
+ isomorphic.js: 0.2.5
+
lie@3.3.0:
dependencies:
immediate: 3.0.6
@@ -28264,8 +27854,6 @@ snapshots:
dependencies:
p-locate: 5.0.0
- lodash-es@4.17.21: {}
-
lodash.camelcase@4.3.0: {}
lodash.castarray@4.4.0: {}
@@ -28430,8 +28018,6 @@ snapshots:
markdown-table@3.0.4: {}
- marked@15.0.12: {}
-
marked@16.0.0: {}
marky@1.3.0: {}
@@ -28659,31 +28245,6 @@ snapshots:
merge2@1.4.1: {}
- mermaid@11.7.0:
- dependencies:
- '@braintree/sanitize-url': 7.1.1
- '@iconify/utils': 2.3.0
- '@mermaid-js/parser': 0.5.0
- '@types/d3': 7.4.3
- cytoscape: 3.32.0
- cytoscape-cose-bilkent: 4.1.0(cytoscape@3.32.0)
- cytoscape-fcose: 2.2.0(cytoscape@3.32.0)
- d3: 7.9.0
- d3-sankey: 0.12.3
- dagre-d3-es: 7.0.11
- dayjs: 1.11.13
- dompurify: 3.2.6
- katex: 0.16.22
- khroma: 2.1.0
- lodash-es: 4.17.21
- marked: 15.0.12
- roughjs: 4.6.6
- stylis: 4.3.6
- ts-dedent: 2.2.0
- uuid: 11.1.0
- transitivePeerDependencies:
- - supports-color
-
metro-babel-transformer@0.82.4:
dependencies:
'@babel/core': 7.28.0
@@ -29301,11 +28862,11 @@ snapshots:
natural-orderby@2.0.3: {}
- nbump@2.1.3(conventional-commits-filter@5.0.0):
+ nbump@2.1.5(conventional-commits-filter@5.0.0):
dependencies:
c12: 3.0.4
conventional-changelog: 6.0.0(conventional-commits-filter@5.0.0)
- zx: 8.6.1
+ zx: 8.7.2
transitivePeerDependencies:
- conventional-commits-filter
- magicast
@@ -29733,8 +29294,6 @@ snapshots:
path-browserify@1.0.1: {}
- path-data-parser@0.1.0: {}
-
path-exists@3.0.0: {}
path-exists@4.0.0: {}
@@ -29928,13 +29487,6 @@ snapshots:
pngjs@7.0.0: {}
- points-on-curve@0.2.0: {}
-
- points-on-path@0.2.1:
- dependencies:
- path-data-parser: 0.1.0
- points-on-curve: 0.2.0
-
portfinder@1.0.37:
dependencies:
async: 3.2.6
@@ -30203,6 +29755,8 @@ snapshots:
dependencies:
parse-ms: 2.1.0
+ prismjs@1.30.0: {}
+
proc-log@2.0.1: {}
proc-log@4.2.0: {}
@@ -30408,11 +29962,18 @@ snapshots:
react: 19.0.0
scheduler: 0.25.0
+ react-error-boundary@3.1.4(react@19.0.0):
+ dependencies:
+ '@babel/runtime': 7.27.6
+ react: 19.0.0
+
react-error-boundary@6.0.0(react@19.0.0):
dependencies:
'@babel/runtime': 7.27.6
react: 19.0.0
+ react-fast-compare@3.2.2: {}
+
react-fast-marquee@1.6.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0):
dependencies:
react: 19.0.0
@@ -30880,14 +30441,6 @@ snapshots:
dependencies:
resolve: 1.22.10
- recyclerlistview@4.2.3(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0):
- dependencies:
- lodash.debounce: 4.0.8
- prop-types: 15.8.1
- react: 19.0.0
- react-native: 0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)
- ts-object-utils: 0.0.5
-
redeyed@2.1.1:
dependencies:
esprima: 4.0.1
@@ -31179,8 +30732,6 @@ snapshots:
sprintf-js: 1.1.3
optional: true
- robust-predicates@3.0.2: {}
-
rolldown-plugin-dts@0.13.13(rolldown@1.0.0-beta.24)(typescript@5.8.3):
dependencies:
'@babel/generator': 7.28.0
@@ -31250,13 +30801,6 @@ snapshots:
rou3@0.5.1: {}
- roughjs@4.6.6:
- dependencies:
- hachure-fill: 0.5.2
- path-data-parser: 0.1.0
- points-on-curve: 0.2.0
- points-on-path: 0.2.1
-
rtl-detect@1.1.2: {}
run-async@2.4.1:
@@ -31266,8 +30810,6 @@ snapshots:
dependencies:
queue-microtask: 1.2.3
- rw@1.3.3: {}
-
rxjs@6.6.7:
dependencies:
tslib: 1.14.1
@@ -31913,8 +31455,6 @@ snapshots:
styleq@0.1.3: {}
- stylis@4.3.6: {}
-
sucrase@3.35.0:
dependencies:
'@jridgewell/gen-mapping': 0.3.12
@@ -31968,12 +31508,6 @@ snapshots:
csso: 5.0.5
picocolors: 1.1.1
- swr@2.3.3(react@19.0.0):
- dependencies:
- dequal: 2.0.3
- react: 19.0.0
- use-sync-external-store: 1.5.0(react@19.0.0)
-
synckit@0.11.8:
dependencies:
'@pkgr/core': 0.2.7
@@ -32138,8 +31672,6 @@ snapshots:
throat@5.0.0: {}
- throttleit@2.1.0: {}
-
through@2.3.8: {}
thumbhash@0.1.1: {}
@@ -32252,8 +31784,6 @@ snapshots:
picomatch: 4.0.2
typescript: 5.8.3
- ts-dedent@2.2.0: {}
-
ts-interface-checker@0.1.13: {}
ts-morph@12.0.0:
@@ -32297,8 +31827,6 @@ snapshots:
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
- ts-object-utils@0.0.5: {}
-
ts-pattern@5.7.1: {}
ts-tiny-invariant@2.0.5: {}
@@ -32734,8 +32262,6 @@ snapshots:
utils-merge@1.0.1: {}
- uuid@11.1.0: {}
-
uuid@7.0.3: {}
uuid@8.3.2: {}
@@ -32927,23 +32453,6 @@ snapshots:
void-elements@3.1.0: {}
- vscode-jsonrpc@8.2.0: {}
-
- vscode-languageserver-protocol@3.17.5:
- dependencies:
- vscode-jsonrpc: 8.2.0
- vscode-languageserver-types: 3.17.5
-
- vscode-languageserver-textdocument@1.0.12: {}
-
- vscode-languageserver-types@3.17.5: {}
-
- vscode-languageserver@9.0.1:
- dependencies:
- vscode-languageserver-protocol: 3.17.5
-
- vscode-uri@3.0.8: {}
-
vscode-uri@3.1.0: {}
wa-sqlite@https://codeload.github.com/rhashimoto/wa-sqlite/tar.gz/03c00ed67cd934bd664ae310234bba317928f851: {}
@@ -33349,6 +32858,10 @@ snapshots:
buffer-crc32: 0.2.13
fd-slicer: 1.1.0
+ yjs@13.6.27:
+ dependencies:
+ lib0: 0.2.114
+
yn@3.1.1: {}
yocto-queue@0.1.0: {}
@@ -33392,6 +32905,14 @@ snapshots:
zod@3.25.76: {}
+ zustand@4.5.7(@types/react@19.1.8)(immer@10.1.1(patch_hash=594c60b929bc0a3b56576f1a1787da1aec2a1fba51e3c21ec09c0ed38280af6c))(react@19.0.0):
+ dependencies:
+ use-sync-external-store: 1.5.0(react@19.0.0)
+ optionalDependencies:
+ '@types/react': 19.1.8
+ immer: 10.1.1(patch_hash=594c60b929bc0a3b56576f1a1787da1aec2a1fba51e3c21ec09c0ed38280af6c)
+ react: 19.0.0
+
zustand@5.0.6(@types/react@19.1.8)(immer@10.1.1(patch_hash=594c60b929bc0a3b56576f1a1787da1aec2a1fba51e3c21ec09c0ed38280af6c))(react@19.0.0)(use-sync-external-store@1.5.0(react@19.0.0)):
optionalDependencies:
'@types/react': 19.1.8
@@ -33401,4 +32922,4 @@ snapshots:
zwitch@2.0.4: {}
- zx@8.6.1: {}
+ zx@8.7.2: {}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 87cc5f3a4..1abc59877 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -51,6 +51,11 @@ overrides:
react-native-ios-context-menu: "3.1.1"
react-native-ios-utilities: "5.1.5"
+ "@floating-ui/core": "1.7.2"
+ "@floating-ui/dom": "1.7.2"
+ "@floating-ui/react-dom": "2.1.4"
+ "@floating-ui/react": "0.27.14"
+
catalog:
typescript: "5.8.3"
- "@follow-app/client-sdk": "0.3.24"
+ "@follow-app/client-sdk": "0.3.27"