From ea10ac667c8b2602f442e311bbf737d854d32b58 Mon Sep 17 00:00:00 2001 From: Krzysztof Wende Date: Fri, 20 Mar 2026 21:03:32 +0100 Subject: [PATCH] Migrate path alias from @/ to @mc/ MobileClaw is embedded inside 8claw which also uses @/ as its path alias. Turbopack can't do context-aware resolution, requiring a fragile per-file alias scanner in the parent config. Using a distinct @mc/ prefix eliminates the collision and lets both apps coexist with a single wildcard alias. --- app/page.tsx | 78 ++++++++++++------------- components/ChatHeader.tsx | 4 +- components/ChatInput.tsx | 12 ++-- components/CommandSheet.tsx | 2 +- components/FloatingSubagentPanel.tsx | 8 +-- components/ImageThumbnails.tsx | 4 +- components/LinkPreviewCard.tsx | 2 +- components/MessageRow.tsx | 42 ++++++------- components/SessionSheet.tsx | 4 +- components/SetupDialog.tsx | 4 +- components/StreamingText.tsx | 2 +- components/SubagentActivityFeed.tsx | 2 +- components/ToolCallPill.tsx | 12 ++-- components/chat/ChatChrome.tsx | 10 ++-- components/chat/ChatComposerBar.tsx | 12 ++-- components/chat/ChatViewport.tsx | 20 +++---- components/plugins/PluginRenderer.tsx | 10 ++-- hooks/chat/useDemoRuntime.ts | 8 +-- hooks/chat/useInputAttachments.ts | 4 +- hooks/chat/useLmStudioRuntime.ts | 4 +- hooks/chat/useMessageSender.ts | 8 +-- hooks/chat/useModeBootstrap.ts | 12 ++-- hooks/chat/useNativeBridgeMessage.ts | 6 +- hooks/chat/useOpenClawRuntime.ts | 28 ++++----- hooks/chat/useQueuedMessage.ts | 2 +- hooks/chat/useUnreadTabIndicator.ts | 4 +- hooks/useAppMode.ts | 2 +- hooks/usePullToRefresh.ts | 2 +- hooks/useScrollManager.ts | 2 +- hooks/useSessionSwitcher.ts | 2 +- hooks/useSubagentStore.ts | 4 +- hooks/useThinkingState.ts | 4 +- hooks/useUnfurl.ts | 4 +- lib/chat/chatEventUpsert.ts | 8 +-- lib/chat/historyResponse.ts | 8 +-- lib/chat/messageTransforms.ts | 6 +- lib/chat/streamMutations.ts | 8 +-- lib/constants.ts | 2 +- lib/demoMode.ts | 4 +- lib/deviceIdentity.ts | 2 +- lib/lmStudio.ts | 6 +- lib/messageUtils.ts | 4 +- lib/parseBackendModels.ts | 2 +- lib/plugins/actionPayload.ts | 2 +- lib/plugins/builtins.tsx | 4 +- lib/plugins/compat.ts | 2 +- lib/plugins/inputAttachmentBuiltins.tsx | 2 +- lib/plugins/inputAttachmentRegistry.ts | 6 +- lib/plugins/inputAttachmentTypes.ts | 2 +- lib/plugins/registry.ts | 6 +- lib/plugins/types.ts | 2 +- lib/toolDisplay.ts | 2 +- plugins/app/contextChip.tsx | 4 +- plugins/app/index.ts | 6 +- tests/ChatInput.test.tsx | 2 +- tests/ChatViewport.zen.test.tsx | 8 +-- tests/MessageRow.test.tsx | 4 +- tests/SetupDialog.test.tsx | 2 +- tests/chatMessageTransforms.test.ts | 4 +- tests/chatStreamMutations.test.ts | 4 +- tests/constants.test.ts | 2 +- tests/contextChipPlugin.test.tsx | 6 +- tests/demoMode.test.ts | 6 +- tests/historyResponse.test.ts | 4 +- tests/inputAttachmentPlugins.test.tsx | 4 +- tests/inputAttachmentRegistry.test.ts | 2 +- tests/layout.test.ts | 2 +- tests/messageUtils.test.ts | 4 +- tests/newCommandFlow.test.tsx | 10 ++-- tests/pluginActionPayload.test.ts | 4 +- tests/toolDisplay.test.ts | 2 +- tests/unfurl.test.ts | 2 +- tests/useInputAttachments.test.tsx | 2 +- tests/useMessageSender.test.tsx | 4 +- tests/useModeBootstrap.test.tsx | 10 ++-- tests/useNativeBridgeMessage.test.tsx | 12 ++-- tests/useQueuedMessage.test.tsx | 2 +- tests/useUnreadTabIndicator.test.tsx | 4 +- tests/useWebSocket.test.tsx | 2 +- tests/useZenMode.test.tsx | 2 +- tests/zenBridge.test.ts | 2 +- tsconfig.json | 2 +- vitest.config.ts | 2 +- 83 files changed, 264 insertions(+), 264 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 4d8c591..801488b 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,16 +2,16 @@ import { useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle } from "react"; -import { createLmStudioHandler, type LmStudioConfig } from "@/lib/lmStudio"; -import { notifyMessageComplete } from "@/lib/notifications"; -import { getTextFromContent, updateAt } from "@/lib/messageUtils"; +import { createLmStudioHandler, type LmStudioConfig } from "@mc/lib/lmStudio"; +import { notifyMessageComplete } from "@mc/lib/notifications"; +import { getTextFromContent, updateAt } from "@mc/lib/messageUtils"; import { NO_REPLY_MARKER, STOP_REASON_INJECTED, hasHeartbeatOnOwnLine, hasUnquotedMarker, -} from "@/lib/constants"; -import { postScrollPosition, postRunState, postModelState, type BridgeMessage } from "@/lib/nativeBridge"; +} from "@mc/lib/constants"; +import { postScrollPosition, postRunState, postModelState, type BridgeMessage } from "@mc/lib/nativeBridge"; import { appendContentDelta as appendContentDeltaToMessages, appendThinkingDelta as appendThinkingDeltaToMessages, @@ -22,10 +22,10 @@ import { resolveToolCall as resolveToolCallInMessages, startThinkingBlock as startThinkingBlockInMessages, upsertCanvasPluginByMessageId as upsertCanvasPluginByMessageIdInMessages, -} from "@/lib/chat/streamMutations"; -import { buildDisplayMessages } from "@/lib/chat/messageTransforms"; -import { applyNativeZenMode } from "@/lib/chat/zenBridge"; -import { DEFAULT_INPUT_ZONE_HEIGHT, getChatBottomPad } from "@/lib/chat/layout"; +} from "@mc/lib/chat/streamMutations"; +import { buildDisplayMessages } from "@mc/lib/chat/messageTransforms"; +import { applyNativeZenMode } from "@mc/lib/chat/zenBridge"; +import { DEFAULT_INPUT_ZONE_HEIGHT, getChatBottomPad } from "@mc/lib/chat/layout"; import type { BackendMode, @@ -34,36 +34,36 @@ import type { Message, ModelChoice, PluginContentPart, -} from "@/types/chat"; - -import type { Command } from "@/components/CommandSheet"; -import { type ChatInputHandle } from "@/components/ChatInput"; -import { TurnstileGate } from "@/components/TurnstileGate"; -import { ChatChrome } from "@/components/chat/ChatChrome"; -import { ChatViewport } from "@/components/chat/ChatViewport"; -import { ChatComposerBar } from "@/components/chat/ChatComposerBar"; - -import { useThinkingState } from "@/hooks/useThinkingState"; -import { PIN_LOCK_MS, useScrollManager } from "@/hooks/useScrollManager"; -import { useKeyboardLayout } from "@/hooks/useKeyboardLayout"; -import { useTheme } from "@/hooks/useTheme"; -import { useZenMode } from "@/hooks/useZenMode"; -import { useSubagentStore } from "@/hooks/useSubagentStore"; -import { formatSessionName } from "@/hooks/useSessionSwitcher"; -import { useAppMode } from "@/hooks/useAppMode"; - -import { useModeBootstrap } from "@/hooks/chat/useModeBootstrap"; -import { useOpenClawRuntime } from "@/hooks/chat/useOpenClawRuntime"; -import { useQuoteSelection } from "@/hooks/chat/useQuoteSelection"; -import { useQueuedMessage } from "@/hooks/chat/useQueuedMessage"; -import { useInputAttachments } from "@/hooks/chat/useInputAttachments"; -import { useUnreadTabIndicator } from "@/hooks/chat/useUnreadTabIndicator"; -import { useNativeBridgeMessage } from "@/hooks/chat/useNativeBridgeMessage"; -import { useDemoRuntime } from "@/hooks/chat/useDemoRuntime"; -import { useLmStudioRuntime } from "@/hooks/chat/useLmStudioRuntime"; -import { useMessageSender } from "@/hooks/chat/useMessageSender"; -import { appendPluginActionPayloadToUrl, mergePluginActionPayload } from "@/lib/plugins/actionPayload"; -import type { PluginActionInvocation } from "@/lib/plugins/types"; +} from "@mc/types/chat"; + +import type { Command } from "@mc/components/CommandSheet"; +import { type ChatInputHandle } from "@mc/components/ChatInput"; +import { TurnstileGate } from "@mc/components/TurnstileGate"; +import { ChatChrome } from "@mc/components/chat/ChatChrome"; +import { ChatViewport } from "@mc/components/chat/ChatViewport"; +import { ChatComposerBar } from "@mc/components/chat/ChatComposerBar"; + +import { useThinkingState } from "@mc/hooks/useThinkingState"; +import { PIN_LOCK_MS, useScrollManager } from "@mc/hooks/useScrollManager"; +import { useKeyboardLayout } from "@mc/hooks/useKeyboardLayout"; +import { useTheme } from "@mc/hooks/useTheme"; +import { useZenMode } from "@mc/hooks/useZenMode"; +import { useSubagentStore } from "@mc/hooks/useSubagentStore"; +import { formatSessionName } from "@mc/hooks/useSessionSwitcher"; +import { useAppMode } from "@mc/hooks/useAppMode"; + +import { useModeBootstrap } from "@mc/hooks/chat/useModeBootstrap"; +import { useOpenClawRuntime } from "@mc/hooks/chat/useOpenClawRuntime"; +import { useQuoteSelection } from "@mc/hooks/chat/useQuoteSelection"; +import { useQueuedMessage } from "@mc/hooks/chat/useQueuedMessage"; +import { useInputAttachments } from "@mc/hooks/chat/useInputAttachments"; +import { useUnreadTabIndicator } from "@mc/hooks/chat/useUnreadTabIndicator"; +import { useNativeBridgeMessage } from "@mc/hooks/chat/useNativeBridgeMessage"; +import { useDemoRuntime } from "@mc/hooks/chat/useDemoRuntime"; +import { useLmStudioRuntime } from "@mc/hooks/chat/useLmStudioRuntime"; +import { useMessageSender } from "@mc/hooks/chat/useMessageSender"; +import { appendPluginActionPayloadToUrl, mergePluginActionPayload } from "@mc/lib/plugins/actionPayload"; +import type { PluginActionInvocation } from "@mc/lib/plugins/types"; const TURNSTILE_SITE_KEY = process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY ?? null; const ZEN_TOGGLE_PIN_MS = 700; diff --git a/components/ChatHeader.tsx b/components/ChatHeader.tsx index b81e1c6..0d4d7bb 100644 --- a/components/ChatHeader.tsx +++ b/components/ChatHeader.tsx @@ -1,5 +1,5 @@ -import type { BackendMode } from "@/types/chat"; -import type { ConnectionState } from "@/lib/useWebSocket"; +import type { BackendMode } from "@mc/types/chat"; +import type { ConnectionState } from "@mc/lib/useWebSocket"; interface ChatHeaderProps { currentModel: string | null; diff --git a/components/ChatInput.tsx b/components/ChatInput.tsx index 455abd4..1e2d543 100644 --- a/components/ChatInput.tsx +++ b/components/ChatInput.tsx @@ -1,12 +1,12 @@ "use client"; import React, { useState, useRef, useEffect, useImperativeHandle, forwardRef, useMemo } from "react"; -import { ALL_COMMANDS, type Command } from "@/components/CommandSheet"; -import maps from "@/maps.json"; -import { ImageLightbox } from "@/components/ImageLightbox"; -import type { ModelChoice, ImageAttachment, InputAttachment } from "@/types/chat"; -import { inputAttachmentRegistry } from "@/lib/plugins/inputAttachmentRegistry"; -import { SQUIRCLE_RADIUS, PILL_BASE_HEIGHT, RADIUS_TRANSITION } from "@/lib/constants"; +import { ALL_COMMANDS, type Command } from "@mc/components/CommandSheet"; +import maps from "@mc/maps.json"; +import { ImageLightbox } from "@mc/components/ImageLightbox"; +import type { ModelChoice, ImageAttachment, InputAttachment } from "@mc/types/chat"; +import { inputAttachmentRegistry } from "@mc/lib/plugins/inputAttachmentRegistry"; +import { SQUIRCLE_RADIUS, PILL_BASE_HEIGHT, RADIUS_TRANSITION } from "@mc/lib/constants"; export interface ModelSuggestion { id: string; diff --git a/components/CommandSheet.tsx b/components/CommandSheet.tsx index 347ba4e..e876843 100644 --- a/components/CommandSheet.tsx +++ b/components/CommandSheet.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useRef, useEffect } from "react"; -import type { ModelChoice } from "@/types/chat"; +import type { ModelChoice } from "@mc/types/chat"; export interface Command { name: string; diff --git a/components/FloatingSubagentPanel.tsx b/components/FloatingSubagentPanel.tsx index 9d05a44..469d6eb 100644 --- a/components/FloatingSubagentPanel.tsx +++ b/components/FloatingSubagentPanel.tsx @@ -1,10 +1,10 @@ "use client"; import { useCallback, useState, useEffect } from "react"; -import { SubagentActivityFeed } from "@/components/SubagentActivityFeed"; -import { SlideContent } from "@/components/SlideContent"; -import type { SubagentStore } from "@/hooks/useSubagentStore"; -import { useSwipeAction } from "@/hooks/useSwipeAction"; +import { SubagentActivityFeed } from "@mc/components/SubagentActivityFeed"; +import { SlideContent } from "@mc/components/SlideContent"; +import type { SubagentStore } from "@mc/hooks/useSubagentStore"; +import { useSwipeAction } from "@mc/hooks/useSwipeAction"; interface FloatingSubagentPanelProps { toolCallId: string | null; diff --git a/components/ImageThumbnails.tsx b/components/ImageThumbnails.tsx index 6fe713f..5976b4d 100644 --- a/components/ImageThumbnails.tsx +++ b/components/ImageThumbnails.tsx @@ -1,8 +1,8 @@ "use client"; import { useState } from "react"; -import type { ContentPart } from "@/types/chat"; -import { ImageLightbox } from "@/components/ImageLightbox"; +import type { ContentPart } from "@mc/types/chat"; +import { ImageLightbox } from "@mc/components/ImageLightbox"; export function ImageThumbnails({ images }: { images: ContentPart[] }) { const [lightboxSrc, setLightboxSrc] = useState(null); diff --git a/components/LinkPreviewCard.tsx b/components/LinkPreviewCard.tsx index 044f64d..0d96780 100644 --- a/components/LinkPreviewCard.tsx +++ b/components/LinkPreviewCard.tsx @@ -1,7 +1,7 @@ "use client"; import { useState } from "react"; -import type { UnfurlData } from "@/lib/unfurl"; +import type { UnfurlData } from "@mc/lib/unfurl"; export function LinkPreviewCard({ data }: { data: UnfurlData }) { const [imgError, setImgError] = useState(false); diff --git a/components/MessageRow.tsx b/components/MessageRow.tsx index 76ae9af..78d0da9 100644 --- a/components/MessageRow.tsx +++ b/components/MessageRow.tsx @@ -1,27 +1,27 @@ "use client"; import React, { useState, useEffect, useRef } from "react"; -import type { ContentPart, Message } from "@/types/chat"; -import { getTextFromContent, getImages, getFiles } from "@/lib/messageUtils"; -import { HEARTBEAT_MARKER, NO_REPLY_MARKER, SYSTEM_PREFIX, SYSTEM_MESSAGE_PREFIX, STOP_REASON_INJECTED, isToolCallPart, SPAWN_TOOL_NAME, hasUnquotedMarker, hasHeartbeatOnOwnLine, SQUIRCLE_RADIUS, MESSAGE_SEND_ANIMATION } from "@/lib/constants"; -import { useExpandablePanel } from "@/hooks/useExpandablePanel"; -import { SlideContent } from "@/components/SlideContent"; -import { MarkdownContent } from "@/components/markdown/MarkdownContent"; -import { StreamingText } from "@/components/StreamingText"; -import { ToolCallPill } from "@/components/ToolCallPill"; -import { ImageThumbnails } from "@/components/ImageThumbnails"; -import { SmoothGrow } from "@/components/SmoothGrow"; -import { ZenToggle } from "@/components/ZenToggle"; -import { PluginRenderer } from "@/components/plugins/PluginRenderer"; -import type { SubagentStore } from "@/hooks/useSubagentStore"; -import { isNativeMode, postLinkTap, postImageTap } from "@/lib/nativeBridge"; -import { ZEN_SLIDE_MS, ZEN_FADE_MS } from "@/lib/chat/zenUi"; -import { useUnfurl } from "@/hooks/useUnfurl"; -import { LinkPreviewCard } from "@/components/LinkPreviewCard"; -import { isPluginPart } from "@/lib/constants"; -import { pluginRegistry } from "@/lib/plugins/registry"; -import type { PluginActionHandler } from "@/lib/plugins/types"; -import type { PluginContentPart } from "@/types/chat"; +import type { ContentPart, Message } from "@mc/types/chat"; +import { getTextFromContent, getImages, getFiles } from "@mc/lib/messageUtils"; +import { HEARTBEAT_MARKER, NO_REPLY_MARKER, SYSTEM_PREFIX, SYSTEM_MESSAGE_PREFIX, STOP_REASON_INJECTED, isToolCallPart, SPAWN_TOOL_NAME, hasUnquotedMarker, hasHeartbeatOnOwnLine, SQUIRCLE_RADIUS, MESSAGE_SEND_ANIMATION } from "@mc/lib/constants"; +import { useExpandablePanel } from "@mc/hooks/useExpandablePanel"; +import { SlideContent } from "@mc/components/SlideContent"; +import { MarkdownContent } from "@mc/components/markdown/MarkdownContent"; +import { StreamingText } from "@mc/components/StreamingText"; +import { ToolCallPill } from "@mc/components/ToolCallPill"; +import { ImageThumbnails } from "@mc/components/ImageThumbnails"; +import { SmoothGrow } from "@mc/components/SmoothGrow"; +import { ZenToggle } from "@mc/components/ZenToggle"; +import { PluginRenderer } from "@mc/components/plugins/PluginRenderer"; +import type { SubagentStore } from "@mc/hooks/useSubagentStore"; +import { isNativeMode, postLinkTap, postImageTap } from "@mc/lib/nativeBridge"; +import { ZEN_SLIDE_MS, ZEN_FADE_MS } from "@mc/lib/chat/zenUi"; +import { useUnfurl } from "@mc/hooks/useUnfurl"; +import { LinkPreviewCard } from "@mc/components/LinkPreviewCard"; +import { isPluginPart } from "@mc/lib/constants"; +import { pluginRegistry } from "@mc/lib/plugins/registry"; +import type { PluginActionHandler } from "@mc/lib/plugins/types"; +import type { PluginContentPart } from "@mc/types/chat"; // ── File Thumbnails ────────────────────────────────────────────────────────── diff --git a/components/SessionSheet.tsx b/components/SessionSheet.tsx index 731a729..4ad1f7f 100644 --- a/components/SessionSheet.tsx +++ b/components/SessionSheet.tsx @@ -1,8 +1,8 @@ "use client"; import { useState, useRef, useEffect } from "react"; -import type { SessionInfo } from "@/types/chat"; -import { formatSessionName, formatRelativeTime } from "@/hooks/useSessionSwitcher"; +import type { SessionInfo } from "@mc/types/chat"; +import { formatSessionName, formatRelativeTime } from "@mc/hooks/useSessionSwitcher"; const KIND_LABELS: Record = { main: "main", diff --git a/components/SetupDialog.tsx b/components/SetupDialog.tsx index c90e251..1c42a4b 100644 --- a/components/SetupDialog.tsx +++ b/components/SetupDialog.tsx @@ -1,8 +1,8 @@ "use client"; import { useState, useRef, useEffect, useCallback } from "react"; -import type { ConnectionConfig } from "@/types/chat"; -import { fetchLmStudioModels, type LmStudioModel } from "@/lib/lmStudio"; +import type { ConnectionConfig } from "@mc/types/chat"; +import { fetchLmStudioModels, type LmStudioModel } from "@mc/lib/lmStudio"; const OPENCLAW_SAVED_CONFIGS_KEY = "openclaw-saved-configs"; const OPENCLAW_SAVED_CONFIGS_LIMIT = 10; diff --git a/components/StreamingText.tsx b/components/StreamingText.tsx index efa9c2a..bc73e48 100644 --- a/components/StreamingText.tsx +++ b/components/StreamingText.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useRef, useEffect } from "react"; -import { MarkdownContent, StreamingCursor } from "@/components/markdown/MarkdownContent"; +import { MarkdownContent, StreamingCursor } from "@mc/components/markdown/MarkdownContent"; // Module-level: remembered rate from previous responses (persists across component instances) let learnedCharsPerMs = 0.15; // Default: ~150 chars/sec, learned from history diff --git a/components/SubagentActivityFeed.tsx b/components/SubagentActivityFeed.tsx index de1bdcb..80b5d5f 100644 --- a/components/SubagentActivityFeed.tsx +++ b/components/SubagentActivityFeed.tsx @@ -1,7 +1,7 @@ "use client"; import { useState, useEffect, useRef } from "react"; -import type { SubagentEntry, SubagentSession } from "@/types/chat"; +import type { SubagentEntry, SubagentSession } from "@mc/types/chat"; interface SubagentActivityFeedProps { getEntries: () => { entries: SubagentEntry[]; status: SubagentSession["status"] } | null; diff --git a/components/ToolCallPill.tsx b/components/ToolCallPill.tsx index fbf63f8..7273451 100644 --- a/components/ToolCallPill.tsx +++ b/components/ToolCallPill.tsx @@ -2,10 +2,10 @@ import { useCallback, useEffect, useState } from "react"; import type { CSSProperties } from "react"; -import { getToolDisplay, parseArgs } from "@/lib/toolDisplay"; -import { SubagentActivityFeed } from "@/components/SubagentActivityFeed"; -import { SlideContent } from "@/components/SlideContent"; -import type { SubagentStore } from "@/hooks/useSubagentStore"; +import { getToolDisplay, parseArgs } from "@mc/lib/toolDisplay"; +import { SubagentActivityFeed } from "@mc/components/SubagentActivityFeed"; +import { SlideContent } from "@mc/components/SlideContent"; +import type { SubagentStore } from "@mc/hooks/useSubagentStore"; import { isEditTool, isReadTool, @@ -18,8 +18,8 @@ import { TOOL_CALL_BUBBLE_BORDER, TOOL_CALL_BUBBLE_BORDER_ERROR, TOOL_CALL_BUBBLE_SHADOW, -} from "@/lib/constants"; -import { useSwipeAction } from "@/hooks/useSwipeAction"; +} from "@mc/lib/constants"; +import { useSwipeAction } from "@mc/hooks/useSwipeAction"; interface PinInfo { toolCallId: string | null; diff --git a/components/chat/ChatChrome.tsx b/components/chat/ChatChrome.tsx index d1f7230..9d382e3 100644 --- a/components/chat/ChatChrome.tsx +++ b/components/chat/ChatChrome.tsx @@ -1,10 +1,10 @@ "use client"; -import { ChatHeader } from "@/components/ChatHeader"; -import { SessionSheet } from "@/components/SessionSheet"; -import { SetupDialog } from "@/components/SetupDialog"; -import type { ConnectionState } from "@/lib/useWebSocket"; -import type { BackendMode, ConnectionConfig, SessionInfo } from "@/types/chat"; +import { ChatHeader } from "@mc/components/ChatHeader"; +import { SessionSheet } from "@mc/components/SessionSheet"; +import { SetupDialog } from "@mc/components/SetupDialog"; +import type { ConnectionState } from "@mc/lib/useWebSocket"; +import type { BackendMode, ConnectionConfig, SessionInfo } from "@mc/types/chat"; interface ChatChromeProps { hideChrome: boolean; diff --git a/components/chat/ChatComposerBar.tsx b/components/chat/ChatComposerBar.tsx index 554506b..a72c9d8 100644 --- a/components/chat/ChatComposerBar.tsx +++ b/components/chat/ChatComposerBar.tsx @@ -2,12 +2,12 @@ import React from "react"; -import { ChatInput, type ChatInputHandle } from "@/components/ChatInput"; -import { FloatingSubagentPanel } from "@/components/FloatingSubagentPanel"; -import { QueuePill } from "@/components/chat/QueuePill"; -import type { Command } from "@/components/CommandSheet"; -import type { useSubagentStore } from "@/hooks/useSubagentStore"; -import type { BackendMode, ImageAttachment, InputAttachment, ModelChoice } from "@/types/chat"; +import { ChatInput, type ChatInputHandle } from "@mc/components/ChatInput"; +import { FloatingSubagentPanel } from "@mc/components/FloatingSubagentPanel"; +import { QueuePill } from "@mc/components/chat/QueuePill"; +import type { Command } from "@mc/components/CommandSheet"; +import type { useSubagentStore } from "@mc/hooks/useSubagentStore"; +import type { BackendMode, ImageAttachment, InputAttachment, ModelChoice } from "@mc/types/chat"; interface ChatComposerBarProps { isNative: boolean; diff --git a/components/chat/ChatViewport.tsx b/components/chat/ChatViewport.tsx index f3c5fb3..bef7f74 100644 --- a/components/chat/ChatViewport.tsx +++ b/components/chat/ChatViewport.tsx @@ -2,16 +2,16 @@ import React, { useMemo, useState, useEffect, useLayoutEffect, useCallback, useRef } from "react"; -import { MessageRow } from "@/components/MessageRow"; -import { ThinkingIndicator } from "@/components/ThinkingIndicator"; -import { ZenToggle } from "@/components/ZenToggle"; -import { formatMessageTime, getMessageSide } from "@/lib/messageUtils"; -import { STOP_REASON_INJECTED, isToolCallPart, MESSAGE_SEND_ANIMATION } from "@/lib/constants"; -import { ZEN_SLIDE_MS, ZEN_FADE_MS, ZEN_TOGGLE_FRAME_MS } from "@/lib/chat/zenUi"; -import { getThinkingIndicatorBottom } from "@/lib/chat/layout"; -import type { Message } from "@/types/chat"; -import type { useSubagentStore } from "@/hooks/useSubagentStore"; -import type { PluginActionHandler } from "@/lib/plugins/types"; +import { MessageRow } from "@mc/components/MessageRow"; +import { ThinkingIndicator } from "@mc/components/ThinkingIndicator"; +import { ZenToggle } from "@mc/components/ZenToggle"; +import { formatMessageTime, getMessageSide } from "@mc/lib/messageUtils"; +import { STOP_REASON_INJECTED, isToolCallPart, MESSAGE_SEND_ANIMATION } from "@mc/lib/constants"; +import { ZEN_SLIDE_MS, ZEN_FADE_MS, ZEN_TOGGLE_FRAME_MS } from "@mc/lib/chat/zenUi"; +import { getThinkingIndicatorBottom } from "@mc/lib/chat/layout"; +import type { Message } from "@mc/types/chat"; +import type { useSubagentStore } from "@mc/hooks/useSubagentStore"; +import type { PluginActionHandler } from "@mc/lib/plugins/types"; const TIME_GAP_THRESHOLD_MS = 10 * 60 * 1000; const ZEN_COLLAPSE_TOTAL_MS = ZEN_TOGGLE_FRAME_MS + ZEN_FADE_MS + ZEN_SLIDE_MS; diff --git a/components/plugins/PluginRenderer.tsx b/components/plugins/PluginRenderer.tsx index 58e5b2d..fac74f3 100644 --- a/components/plugins/PluginRenderer.tsx +++ b/components/plugins/PluginRenderer.tsx @@ -1,10 +1,10 @@ "use client"; -import { InvalidPluginCard } from "@/components/plugins/InvalidPluginCard"; -import { UnknownPluginCard } from "@/components/plugins/UnknownPluginCard"; -import { pluginRegistry } from "@/lib/plugins/registry"; -import type { PluginActionHandler, PluginParseResult } from "@/lib/plugins/types"; -import type { PluginContentPart } from "@/types/chat"; +import { InvalidPluginCard } from "@mc/components/plugins/InvalidPluginCard"; +import { UnknownPluginCard } from "@mc/components/plugins/UnknownPluginCard"; +import { pluginRegistry } from "@mc/lib/plugins/registry"; +import type { PluginActionHandler, PluginParseResult } from "@mc/lib/plugins/types"; +import type { PluginContentPart } from "@mc/types/chat"; export function PluginRenderer({ part, diff --git a/hooks/chat/useDemoRuntime.ts b/hooks/chat/useDemoRuntime.ts index 4167930..95cf6c2 100644 --- a/hooks/chat/useDemoRuntime.ts +++ b/hooks/chat/useDemoRuntime.ts @@ -1,9 +1,9 @@ import { useEffect, useRef } from "react"; -import { createDemoHandler } from "@/lib/demoMode"; -import type { AgentEventPayload, PluginContentPart } from "@/types/chat"; -import type { useSubagentStore } from "@/hooks/useSubagentStore"; -import { SPAWN_TOOL_NAME } from "@/lib/constants"; +import { createDemoHandler } from "@mc/lib/demoMode"; +import type { AgentEventPayload, PluginContentPart } from "@mc/types/chat"; +import type { useSubagentStore } from "@mc/hooks/useSubagentStore"; +import { SPAWN_TOOL_NAME } from "@mc/lib/constants"; interface UseDemoRuntimeOptions { isDemoMode: boolean; diff --git a/hooks/chat/useInputAttachments.ts b/hooks/chat/useInputAttachments.ts index df50ede..6845b57 100644 --- a/hooks/chat/useInputAttachments.ts +++ b/hooks/chat/useInputAttachments.ts @@ -1,6 +1,6 @@ import { useState, useCallback, useEffect, useRef } from "react"; -import type { InputAttachment } from "@/types/chat"; -import { inputAttachmentRegistry } from "@/lib/plugins/inputAttachmentRegistry"; +import type { InputAttachment } from "@mc/types/chat"; +import { inputAttachmentRegistry } from "@mc/lib/plugins/inputAttachmentRegistry"; const MAX_FILE_SIZE = 50 * 1024 * 1024; // 50MB diff --git a/hooks/chat/useLmStudioRuntime.ts b/hooks/chat/useLmStudioRuntime.ts index 77dbd4a..d8128ec 100644 --- a/hooks/chat/useLmStudioRuntime.ts +++ b/hooks/chat/useLmStudioRuntime.ts @@ -1,7 +1,7 @@ import { useEffect } from "react"; -import { createLmStudioHandler, type LmStudioCallbacks, type LmStudioConfig } from "@/lib/lmStudio"; -import type { ContentPart, Message } from "@/types/chat"; +import { createLmStudioHandler, type LmStudioCallbacks, type LmStudioConfig } from "@mc/lib/lmStudio"; +import type { ContentPart, Message } from "@mc/types/chat"; interface UseLmStudioRuntimeOptions { backendMode: "openclaw" | "lmstudio" | "demo"; diff --git a/hooks/chat/useMessageSender.ts b/hooks/chat/useMessageSender.ts index c1b58f2..a4bcfac 100644 --- a/hooks/chat/useMessageSender.ts +++ b/hooks/chat/useMessageSender.ts @@ -1,9 +1,9 @@ import { useState, useCallback } from "react"; -import { LITTERBOX_UPLOAD_URL } from "@/lib/constants"; -import { requestNotificationPermission } from "@/lib/notifications"; -import { PIN_LOCK_MS } from "@/hooks/useScrollManager"; -import type { ContentPart, ImageAttachment, Message } from "@/types/chat"; +import { LITTERBOX_UPLOAD_URL } from "@mc/lib/constants"; +import { requestNotificationPermission } from "@mc/lib/notifications"; +import { PIN_LOCK_MS } from "@mc/hooks/useScrollManager"; +import type { ContentPart, ImageAttachment, Message } from "@mc/types/chat"; interface UseMessageSenderOptions { backendMode: "openclaw" | "lmstudio" | "demo"; diff --git a/hooks/chat/useModeBootstrap.ts b/hooks/chat/useModeBootstrap.ts index 44ffdbd..1e59cef 100644 --- a/hooks/chat/useModeBootstrap.ts +++ b/hooks/chat/useModeBootstrap.ts @@ -1,11 +1,11 @@ import { useEffect, useCallback, useRef } from "react"; -import { useWidgetContext } from "@/lib/widgetContext"; -import { DEMO_HISTORY } from "@/lib/demoMode"; -import type { LmStudioConfig } from "@/lib/lmStudio"; -import { notifyWebViewReady, registerBridgeHandler, updateBridgeHandler, type BridgeMessage } from "@/lib/nativeBridge"; -import type { Command } from "@/components/CommandSheet"; -import type { BackendMode, ConnectionConfig, Message } from "@/types/chat"; +import { useWidgetContext } from "@mc/lib/widgetContext"; +import { DEMO_HISTORY } from "@mc/lib/demoMode"; +import type { LmStudioConfig } from "@mc/lib/lmStudio"; +import { notifyWebViewReady, registerBridgeHandler, updateBridgeHandler, type BridgeMessage } from "@mc/lib/nativeBridge"; +import type { Command } from "@mc/components/CommandSheet"; +import type { BackendMode, ConnectionConfig, Message } from "@mc/types/chat"; /** Read a URL search param. Returns null when absent or during SSR. */ function getSearchParam(name: string): string | null { diff --git a/hooks/chat/useNativeBridgeMessage.ts b/hooks/chat/useNativeBridgeMessage.ts index 29ba80e..858bf36 100644 --- a/hooks/chat/useNativeBridgeMessage.ts +++ b/hooks/chat/useNativeBridgeMessage.ts @@ -1,8 +1,8 @@ import { useCallback } from "react"; -import { PIN_LOCK_MS } from "@/hooks/useScrollManager"; -import { resolveIdentitySign, type BridgeMessage } from "@/lib/nativeBridge"; -import type { BackendMode, ConnectionConfig, Message } from "@/types/chat"; +import { PIN_LOCK_MS } from "@mc/hooks/useScrollManager"; +import { resolveIdentitySign, type BridgeMessage } from "@mc/lib/nativeBridge"; +import type { BackendMode, ConnectionConfig, Message } from "@mc/types/chat"; interface UseNativeBridgeMessageOptions { setMessages: React.Dispatch>; diff --git a/hooks/chat/useOpenClawRuntime.ts b/hooks/chat/useOpenClawRuntime.ts index 52c93ad..b67a8f1 100644 --- a/hooks/chat/useOpenClawRuntime.ts +++ b/hooks/chat/useOpenClawRuntime.ts @@ -1,20 +1,20 @@ import { useRef, useEffect, useCallback } from "react"; -import { parseServerCommands, ALL_COMMANDS, type Command } from "@/components/CommandSheet"; -import { usePullToRefresh } from "@/hooks/usePullToRefresh"; -import { useSessionSwitcher } from "@/hooks/useSessionSwitcher"; +import { parseServerCommands, ALL_COMMANDS, type Command } from "@mc/components/CommandSheet"; +import { usePullToRefresh } from "@mc/hooks/usePullToRefresh"; +import { useSessionSwitcher } from "@mc/hooks/useSessionSwitcher"; import { isInternalCommandFetchRunId, SPAWN_TOOL_NAME, WS_HELLO_OK, -} from "@/lib/constants"; -import { signConnectChallenge } from "@/lib/deviceIdentity"; -import { getTextFromContent, updateAt } from "@/lib/messageUtils"; -import { upsertChatEventMessage } from "@/lib/chat/chatEventUpsert"; -import { mergeModels, parseConfigProviders, type ConfigParseResult } from "@/lib/parseBackendModels"; -import { useWebSocket, type WebSocketMessage } from "@/lib/useWebSocket"; -import { postConnectionState, postRunState, postSessionsState } from "@/lib/nativeBridge"; -import { mergeAndNormalizeToolResults } from "@/lib/chat/messageTransforms"; +} from "@mc/lib/constants"; +import { signConnectChallenge } from "@mc/lib/deviceIdentity"; +import { getTextFromContent, updateAt } from "@mc/lib/messageUtils"; +import { upsertChatEventMessage } from "@mc/lib/chat/chatEventUpsert"; +import { mergeModels, parseConfigProviders, type ConfigParseResult } from "@mc/lib/parseBackendModels"; +import { useWebSocket, type WebSocketMessage } from "@mc/lib/useWebSocket"; +import { postConnectionState, postRunState, postSessionsState } from "@mc/lib/nativeBridge"; +import { mergeAndNormalizeToolResults } from "@mc/lib/chat/messageTransforms"; import { buildHistoryMessages, extractSpawnChildSessionKeys, @@ -22,7 +22,7 @@ import { isRunInProgressFromHistory, mergeHistoryWithOptimistic, prepareHistoryMessages, -} from "@/lib/chat/historyResponse"; +} from "@mc/lib/chat/historyResponse"; import type { AgentEventPayload, BackendMode, @@ -34,8 +34,8 @@ import type { ModelChoice, PluginContentPart, WSIncomingMessage, -} from "@/types/chat"; -import type { useSubagentStore } from "@/hooks/useSubagentStore"; +} from "@mc/types/chat"; +import type { useSubagentStore } from "@mc/hooks/useSubagentStore"; interface StreamActions { appendContentDelta: (runId: string, delta: string, ts: number) => void; diff --git a/hooks/chat/useQueuedMessage.ts b/hooks/chat/useQueuedMessage.ts index 9bad7f0..b0d8531 100644 --- a/hooks/chat/useQueuedMessage.ts +++ b/hooks/chat/useQueuedMessage.ts @@ -1,5 +1,5 @@ import { useState, useRef, useEffect, useCallback } from "react"; -import type { ImageAttachment } from "@/types/chat"; +import type { ImageAttachment } from "@mc/types/chat"; type QueuedMessage = { text: string; attachments?: ImageAttachment[] }; diff --git a/hooks/chat/useUnreadTabIndicator.ts b/hooks/chat/useUnreadTabIndicator.ts index 7d67ec7..95e58ef 100644 --- a/hooks/chat/useUnreadTabIndicator.ts +++ b/hooks/chat/useUnreadTabIndicator.ts @@ -1,6 +1,6 @@ import { useState, useRef, useEffect } from "react"; -import type { Message } from "@/types/chat"; -import { isUnreadCandidateMessage } from "@/lib/chat/messageTransforms"; +import type { Message } from "@mc/types/chat"; +import { isUnreadCandidateMessage } from "@mc/lib/chat/messageTransforms"; interface UseUnreadTabIndicatorOptions { messages: Message[]; diff --git a/hooks/useAppMode.ts b/hooks/useAppMode.ts index 3dd525b..6c18f55 100644 --- a/hooks/useAppMode.ts +++ b/hooks/useAppMode.ts @@ -1,5 +1,5 @@ import { useState, useRef, useEffect } from "react"; -import { useWidgetContext } from "@/lib/widgetContext"; +import { useWidgetContext } from "@mc/lib/widgetContext"; /** Read a URL search param. Only call on the client. */ function getSearchParam(name: string): string | null { diff --git a/hooks/usePullToRefresh.ts b/hooks/usePullToRefresh.ts index fdc603d..1025a8b 100644 --- a/hooks/usePullToRefresh.ts +++ b/hooks/usePullToRefresh.ts @@ -1,5 +1,5 @@ import { useState, useRef, useEffect, useCallback } from "react"; -import type { BackendMode } from "@/types/chat"; +import type { BackendMode } from "@mc/types/chat"; interface PullToRefreshOptions { scrollRef: React.RefObject; diff --git a/hooks/useScrollManager.ts b/hooks/useScrollManager.ts index 5aae6cf..730010e 100644 --- a/hooks/useScrollManager.ts +++ b/hooks/useScrollManager.ts @@ -1,5 +1,5 @@ import { useState, useRef, useEffect, useLayoutEffect, useCallback } from "react"; -import type { Message } from "@/types/chat"; +import type { Message } from "@mc/types/chat"; /** After pinning, ignore scroll-based unpin checks for this long (ms). * Prevents layout reflows from immediately unpinning after send. */ diff --git a/hooks/useSessionSwitcher.ts b/hooks/useSessionSwitcher.ts index 453fc71..0cf1572 100644 --- a/hooks/useSessionSwitcher.ts +++ b/hooks/useSessionSwitcher.ts @@ -1,5 +1,5 @@ import { useState, useRef, useCallback } from "react"; -import type { SessionInfo, BackendMode } from "@/types/chat"; +import type { SessionInfo, BackendMode } from "@mc/types/chat"; // ── Pure helpers ────────────────────────────────────────────────────────────── diff --git a/hooks/useSubagentStore.ts b/hooks/useSubagentStore.ts index cc6ce5a..83fa164 100644 --- a/hooks/useSubagentStore.ts +++ b/hooks/useSubagentStore.ts @@ -1,6 +1,6 @@ import { useRef, useCallback } from "react"; -import type { SubagentEntry, SubagentSession, AgentEventPayload } from "@/types/chat"; -import { isToolCallPart } from "@/lib/constants"; +import type { SubagentEntry, SubagentSession, AgentEventPayload } from "@mc/types/chat"; +import { isToolCallPart } from "@mc/lib/constants"; const TEXT_COALESCE_GAP_MS = 2000; /** Grace period after lifecycle:end before marking "done" — if lifecycle:start fires within this window, cancel. */ diff --git a/hooks/useThinkingState.ts b/hooks/useThinkingState.ts index 9c38cff..aa9afee 100644 --- a/hooks/useThinkingState.ts +++ b/hooks/useThinkingState.ts @@ -1,6 +1,6 @@ import { useState, useRef, useEffect, useLayoutEffect, useCallback } from "react"; -import { updateAt } from "@/lib/messageUtils"; -import type { Message } from "@/types/chat"; +import { updateAt } from "@mc/lib/messageUtils"; +import type { Message } from "@mc/types/chat"; /** * Manages the "thinking" indicator state: awaiting response, exit animation, diff --git a/hooks/useUnfurl.ts b/hooks/useUnfurl.ts index c225265..080bacb 100644 --- a/hooks/useUnfurl.ts +++ b/hooks/useUnfurl.ts @@ -1,8 +1,8 @@ "use client"; import { useState, useEffect, useRef } from "react"; -import type { UnfurlData } from "@/lib/unfurl"; -import { extractUrls, shouldUnfurl, fetchUnfurl, isUnfurlDisabled } from "@/lib/unfurl"; +import type { UnfurlData } from "@mc/lib/unfurl"; +import { extractUrls, shouldUnfurl, fetchUnfurl, isUnfurlDisabled } from "@mc/lib/unfurl"; const MAX_UNFURLS = 3; const DEBOUNCE_MS = 300; diff --git a/lib/chat/chatEventUpsert.ts b/lib/chat/chatEventUpsert.ts index ad9509c..5d2e2cd 100644 --- a/lib/chat/chatEventUpsert.ts +++ b/lib/chat/chatEventUpsert.ts @@ -1,9 +1,9 @@ import { isContextText, -} from "@/lib/constants"; -import { appendCanvasPart } from "@/lib/plugins/compat"; -import { getTextFromContent, updateAt } from "@/lib/messageUtils"; -import type { CanvasPayload, ChatEventPayload, ContentPart, Message, PluginContentPart } from "@/types/chat"; +} from "@mc/lib/constants"; +import { appendCanvasPart } from "@mc/lib/plugins/compat"; +import { getTextFromContent, updateAt } from "@mc/lib/messageUtils"; +import type { CanvasPayload, ChatEventPayload, ContentPart, Message, PluginContentPart } from "@mc/types/chat"; function normalizeChatText(text: string): string { return text.replace(/\s+/g, " ").trim(); diff --git a/lib/chat/historyResponse.ts b/lib/chat/historyResponse.ts index 3b06da2..b4347fb 100644 --- a/lib/chat/historyResponse.ts +++ b/lib/chat/historyResponse.ts @@ -5,10 +5,10 @@ import { STOP_REASON_INJECTED, isContextText, isToolCallPart, -} from "@/lib/constants"; -import { appendCanvasPart } from "@/lib/plugins/compat"; -import { getTextFromContent } from "@/lib/messageUtils"; -import type { CanvasPayload, ContentPart, Message } from "@/types/chat"; +} from "@mc/lib/constants"; +import { appendCanvasPart } from "@mc/lib/plugins/compat"; +import { getTextFromContent } from "@mc/lib/messageUtils"; +import type { CanvasPayload, ContentPart, Message } from "@mc/types/chat"; type RawHistoryMessage = Record; diff --git a/lib/chat/messageTransforms.ts b/lib/chat/messageTransforms.ts index 1d7b8bd..df7c00e 100644 --- a/lib/chat/messageTransforms.ts +++ b/lib/chat/messageTransforms.ts @@ -1,12 +1,12 @@ -import { getTextFromContent } from "@/lib/messageUtils"; +import { getTextFromContent } from "@mc/lib/messageUtils"; import { NO_REPLY_MARKER, STOP_REASON_INJECTED, hasHeartbeatOnOwnLine, hasUnquotedMarker, isToolCallPart, -} from "@/lib/constants"; -import type { ContentPart, Message } from "@/types/chat"; +} from "@mc/lib/constants"; +import type { ContentPart, Message } from "@mc/types/chat"; export function hasVisibleMessageContent(msg: Message): boolean { if (typeof msg.content === "string") return msg.content.trim().length > 0; diff --git a/lib/chat/streamMutations.ts b/lib/chat/streamMutations.ts index 14f78c1..ddfac34 100644 --- a/lib/chat/streamMutations.ts +++ b/lib/chat/streamMutations.ts @@ -1,7 +1,7 @@ -import { isToolCallPart } from "@/lib/constants"; -import { appendCanvasPart, canvasToPluginPart, ensureContentArray } from "@/lib/plugins/compat"; -import { updateAt } from "@/lib/messageUtils"; -import type { CanvasPayload, ContentPart, Message, PluginContentPart } from "@/types/chat"; +import { isToolCallPart } from "@mc/lib/constants"; +import { appendCanvasPart, canvasToPluginPart, ensureContentArray } from "@mc/lib/plugins/compat"; +import { updateAt } from "@mc/lib/messageUtils"; +import type { CanvasPayload, ContentPart, Message, PluginContentPart } from "@mc/types/chat"; interface EnsureResult { messages: Message[]; diff --git a/lib/constants.ts b/lib/constants.ts index abd02d9..89b429a 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -1,4 +1,4 @@ -import contextPrefixes from "@/shared/contextPrefixes.json"; +import contextPrefixes from "@mc/shared/contextPrefixes.json"; // Context detection — single source of truth is shared/contextPrefixes.json export const CONTEXT_STARTS_WITH: string[] = contextPrefixes.startsWith; diff --git a/lib/demoMode.ts b/lib/demoMode.ts index 06e110f..812fed1 100644 --- a/lib/demoMode.ts +++ b/lib/demoMode.ts @@ -1,7 +1,7 @@ // Demo mode — simulates an OpenClaw backend with curated history and keyword-matched responses -import type { PluginActionInvocation } from "@/lib/plugins/types"; -import type { AgentEventPayload, Message, PluginAction, PluginActionStyle, PluginContentPart, PluginState } from "@/types/chat"; +import type { PluginActionInvocation } from "@mc/lib/plugins/types"; +import type { AgentEventPayload, Message, PluginAction, PluginActionStyle, PluginContentPart, PluginState } from "@mc/types/chat"; // ── Demo conversation history ──────────────────────────────────────────────── // Single message exchange that showcases ALL display features diff --git a/lib/deviceIdentity.ts b/lib/deviceIdentity.ts index 8acd5e2..71b78b3 100644 --- a/lib/deviceIdentity.ts +++ b/lib/deviceIdentity.ts @@ -127,7 +127,7 @@ export async function signConnectChallenge( ): Promise<{ id: string; publicKey: string; signature: string; signedAt: number; nonce?: string }> { if (opts.isNative) { // Delegate to Swift Keychain via bridge — private key never enters JS - const { requestNativeIdentitySign } = await import("@/lib/nativeBridge"); + const { requestNativeIdentitySign } = await import("@mc/lib/nativeBridge"); const result = await requestNativeIdentitySign(opts.nonce ?? "", opts.token); return { id: result.deviceId, diff --git a/lib/lmStudio.ts b/lib/lmStudio.ts index 75c488a..87654b1 100644 --- a/lib/lmStudio.ts +++ b/lib/lmStudio.ts @@ -3,9 +3,9 @@ // ── Types ──────────────────────────────────────────────────────────────────── -import type { ContentPart, Message } from "@/types/chat"; -import { STOP_REASON_INJECTED } from "@/lib/constants"; -import { getTextFromContent } from "@/lib/messageUtils"; +import type { ContentPart, Message } from "@mc/types/chat"; +import { STOP_REASON_INJECTED } from "@mc/lib/constants"; +import { getTextFromContent } from "@mc/lib/messageUtils"; export interface LmStudioConfig { baseUrl: string; diff --git a/lib/messageUtils.ts b/lib/messageUtils.ts index 11afb82..e128373 100644 --- a/lib/messageUtils.ts +++ b/lib/messageUtils.ts @@ -1,5 +1,5 @@ -import type { ContentPart, Message, MessageRole } from "@/types/chat"; -import { isToolCallPart, isImagePart } from "@/lib/constants"; +import type { ContentPart, Message, MessageRole } from "@mc/types/chat"; +import { isToolCallPart, isImagePart } from "@mc/lib/constants"; /** Immutable update of a single array element by index. */ export function updateAt(arr: T[], index: number, updater: (item: T) => T): T[] { diff --git a/lib/parseBackendModels.ts b/lib/parseBackendModels.ts index a965efc..c996bb8 100644 --- a/lib/parseBackendModels.ts +++ b/lib/parseBackendModels.ts @@ -1,4 +1,4 @@ -import type { ModelChoice } from "@/types/chat"; +import type { ModelChoice } from "@mc/types/chat"; export interface ConfigParseResult { /** Provider keys that have explicit model lists in models.providers */ diff --git a/lib/plugins/actionPayload.ts b/lib/plugins/actionPayload.ts index 87c23b1..5ef4da6 100644 --- a/lib/plugins/actionPayload.ts +++ b/lib/plugins/actionPayload.ts @@ -1,4 +1,4 @@ -import type { PluginActionInvocation } from "@/lib/plugins/types"; +import type { PluginActionInvocation } from "@mc/lib/plugins/types"; export interface PluginActionHostPayload { messageId: string; diff --git a/lib/plugins/builtins.tsx b/lib/plugins/builtins.tsx index 1e30c4b..b12d181 100644 --- a/lib/plugins/builtins.tsx +++ b/lib/plugins/builtins.tsx @@ -4,8 +4,8 @@ import { useEffect, useMemo, useState } from "react"; import { z } from "zod"; -import type { PluginAction, PluginActionStyle } from "@/types/chat"; -import type { AnyMobileClawPlugin, MobileClawPlugin, PluginParseResult, PluginViewProps } from "@/lib/plugins/types"; +import type { PluginAction, PluginActionStyle } from "@mc/types/chat"; +import type { AnyMobileClawPlugin, MobileClawPlugin, PluginParseResult, PluginViewProps } from "@mc/lib/plugins/types"; const pluginStyleSchema = z.enum(["primary", "secondary", "destructive"]); diff --git a/lib/plugins/compat.ts b/lib/plugins/compat.ts index e0a7fcd..98896dd 100644 --- a/lib/plugins/compat.ts +++ b/lib/plugins/compat.ts @@ -1,4 +1,4 @@ -import type { CanvasPayload, ContentPart, PluginContentPart } from "@/types/chat"; +import type { CanvasPayload, ContentPart, PluginContentPart } from "@mc/types/chat"; function getLegacyCanvasPartId(canvas: CanvasPayload): string { return canvas.partId || `legacy-canvas:${canvas.type}`; diff --git a/lib/plugins/inputAttachmentBuiltins.tsx b/lib/plugins/inputAttachmentBuiltins.tsx index 0c4fed6..1b8129f 100644 --- a/lib/plugins/inputAttachmentBuiltins.tsx +++ b/lib/plugins/inputAttachmentBuiltins.tsx @@ -1,6 +1,6 @@ "use client"; -import type { AnyInputAttachmentPlugin, InputAttachmentPlugin } from "@/lib/plugins/inputAttachmentTypes"; +import type { AnyInputAttachmentPlugin, InputAttachmentPlugin } from "@mc/lib/plugins/inputAttachmentTypes"; interface ImageData { mimeType: string; diff --git a/lib/plugins/inputAttachmentRegistry.ts b/lib/plugins/inputAttachmentRegistry.ts index ba99618..a2c85d8 100644 --- a/lib/plugins/inputAttachmentRegistry.ts +++ b/lib/plugins/inputAttachmentRegistry.ts @@ -1,6 +1,6 @@ -import { builtinInputAttachmentPlugins } from "@/lib/plugins/inputAttachmentBuiltins"; -import { appInputAttachmentPlugins } from "@/plugins/app"; -import type { AnyInputAttachmentPlugin } from "@/lib/plugins/inputAttachmentTypes"; +import { builtinInputAttachmentPlugins } from "@mc/lib/plugins/inputAttachmentBuiltins"; +import { appInputAttachmentPlugins } from "@mc/plugins/app"; +import type { AnyInputAttachmentPlugin } from "@mc/lib/plugins/inputAttachmentTypes"; const registry = new Map(); diff --git a/lib/plugins/inputAttachmentTypes.ts b/lib/plugins/inputAttachmentTypes.ts index 6f31d16..eefafed 100644 --- a/lib/plugins/inputAttachmentTypes.ts +++ b/lib/plugins/inputAttachmentTypes.ts @@ -1,6 +1,6 @@ import type { ReactNode } from "react"; -import type { ImageAttachment } from "@/types/chat"; +import type { ImageAttachment } from "@mc/types/chat"; export interface InputAttachmentPreviewProps { data: TData; diff --git a/lib/plugins/registry.ts b/lib/plugins/registry.ts index 0643cdd..2563678 100644 --- a/lib/plugins/registry.ts +++ b/lib/plugins/registry.ts @@ -1,6 +1,6 @@ -import { builtinPlugins } from "@/lib/plugins/builtins"; -import { appPlugins } from "@/plugins/app"; -import type { AnyMobileClawPlugin, PluginWidth } from "@/lib/plugins/types"; +import { builtinPlugins } from "@mc/lib/plugins/builtins"; +import { appPlugins } from "@mc/plugins/app"; +import type { AnyMobileClawPlugin, PluginWidth } from "@mc/lib/plugins/types"; const registry = new Map(); diff --git a/lib/plugins/types.ts b/lib/plugins/types.ts index 6a7d21f..ac80fb9 100644 --- a/lib/plugins/types.ts +++ b/lib/plugins/types.ts @@ -1,6 +1,6 @@ import type { ReactNode } from "react"; -import type { PluginAction, PluginContentPart, PluginState } from "@/types/chat"; +import type { PluginAction, PluginContentPart, PluginState } from "@mc/types/chat"; export type PluginWidth = "bubble" | "chat"; diff --git a/lib/toolDisplay.ts b/lib/toolDisplay.ts index d2d4543..7cfb409 100644 --- a/lib/toolDisplay.ts +++ b/lib/toolDisplay.ts @@ -1,6 +1,6 @@ // Tool display logic — maps tool names/args to human-friendly labels and icons -import { isReadTool, isEditTool, isWriteTool, isGatewayTool, SPAWN_TOOL_NAME } from "@/lib/constants"; +import { isReadTool, isEditTool, isWriteTool, isGatewayTool, SPAWN_TOOL_NAME } from "@mc/lib/constants"; export type ToolIcon = "terminal" | "file" | "tool" | "robot" | "globe" | "gear"; diff --git a/plugins/app/contextChip.tsx b/plugins/app/contextChip.tsx index e3c35d5..643801b 100644 --- a/plugins/app/contextChip.tsx +++ b/plugins/app/contextChip.tsx @@ -1,8 +1,8 @@ "use client"; import { useState } from "react"; -import type { MobileClawPlugin, PluginViewProps } from "@/lib/plugins/types"; -import type { InputAttachmentPlugin } from "@/lib/plugins/inputAttachmentTypes"; +import type { MobileClawPlugin, PluginViewProps } from "@mc/lib/plugins/types"; +import type { InputAttachmentPlugin } from "@mc/lib/plugins/inputAttachmentTypes"; // ── Message plugin: renders a button in the chat thread ────────────────────── diff --git a/plugins/app/index.ts b/plugins/app/index.ts index 33a9968..2d41569 100644 --- a/plugins/app/index.ts +++ b/plugins/app/index.ts @@ -1,6 +1,6 @@ -import type { AnyMobileClawPlugin } from "@/lib/plugins/types"; -import type { AnyInputAttachmentPlugin } from "@/lib/plugins/inputAttachmentTypes"; -import { contextChipPlugin, promptContextAttachmentPlugin } from "@/plugins/app/contextChip"; +import type { AnyMobileClawPlugin } from "@mc/lib/plugins/types"; +import type { AnyInputAttachmentPlugin } from "@mc/lib/plugins/inputAttachmentTypes"; +import { contextChipPlugin, promptContextAttachmentPlugin } from "@mc/plugins/app/contextChip"; export const appPlugins: AnyMobileClawPlugin[] = [ contextChipPlugin, diff --git a/tests/ChatInput.test.tsx b/tests/ChatInput.test.tsx index 06ab008..6134635 100644 --- a/tests/ChatInput.test.tsx +++ b/tests/ChatInput.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; -import { ChatInput } from "@/components/ChatInput"; +import { ChatInput } from "@mc/components/ChatInput"; const defaultProps = { onSend: vi.fn(), diff --git a/tests/ChatViewport.zen.test.tsx b/tests/ChatViewport.zen.test.tsx index c4b2687..4fed6b0 100644 --- a/tests/ChatViewport.zen.test.tsx +++ b/tests/ChatViewport.zen.test.tsx @@ -2,10 +2,10 @@ import React from "react"; import { describe, it, expect, vi } from "vitest"; import { render, screen, fireEvent, waitFor, act } from "@testing-library/react"; -import { ChatViewport } from "@/components/chat/ChatViewport"; -import { STOP_REASON_INJECTED } from "@/lib/constants"; -import type { Message } from "@/types/chat"; -import type { useSubagentStore } from "@/hooks/useSubagentStore"; +import { ChatViewport } from "@mc/components/chat/ChatViewport"; +import { STOP_REASON_INJECTED } from "@mc/lib/constants"; +import type { Message } from "@mc/types/chat"; +import type { useSubagentStore } from "@mc/hooks/useSubagentStore"; import { findSlideGrid } from "./utils/zenDom"; function renderViewport( diff --git a/tests/MessageRow.test.tsx b/tests/MessageRow.test.tsx index 305f6f2..1c64cb8 100644 --- a/tests/MessageRow.test.tsx +++ b/tests/MessageRow.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, vi } from "vitest"; import { act, render, screen, fireEvent, waitFor } from "@testing-library/react"; -import { MessageRow } from "@/components/MessageRow"; -import type { Message } from "@/types/chat"; +import { MessageRow } from "@mc/components/MessageRow"; +import type { Message } from "@mc/types/chat"; import { findSlideGrid } from "./utils/zenDom"; describe("MessageRow", () => { diff --git a/tests/SetupDialog.test.tsx b/tests/SetupDialog.test.tsx index b65f6fb..30d544a 100644 --- a/tests/SetupDialog.test.tsx +++ b/tests/SetupDialog.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; import { render, screen, act, fireEvent } from "@testing-library/react"; -import { SetupDialog } from "@/components/SetupDialog"; +import { SetupDialog } from "@mc/components/SetupDialog"; function mockLocalStorage() { const store = new Map(); diff --git a/tests/chatMessageTransforms.test.ts b/tests/chatMessageTransforms.test.ts index ef3b235..5c7d33c 100644 --- a/tests/chatMessageTransforms.test.ts +++ b/tests/chatMessageTransforms.test.ts @@ -4,8 +4,8 @@ import { buildDisplayMessages, isUnreadCandidateMessage, mergeAndNormalizeToolResults, -} from "@/lib/chat/messageTransforms"; -import type { ContentPart, Message } from "@/types/chat"; +} from "@mc/lib/chat/messageTransforms"; +import type { ContentPart, Message } from "@mc/types/chat"; function assistant(content: Message["content"], extra: Partial = {}): Message { return { role: "assistant", content, id: `a-${Math.random()}`, ...extra }; diff --git a/tests/chatStreamMutations.test.ts b/tests/chatStreamMutations.test.ts index 70cdbb5..1144670 100644 --- a/tests/chatStreamMutations.test.ts +++ b/tests/chatStreamMutations.test.ts @@ -10,8 +10,8 @@ import { resolveToolCall, upsertFinalRunMessage, startThinkingBlock, -} from "@/lib/chat/streamMutations"; -import type { Message, PluginContentPart } from "@/types/chat"; +} from "@mc/lib/chat/streamMutations"; +import type { Message, PluginContentPart } from "@mc/types/chat"; describe("chat stream mutations", () => { it("appends text after tool call boundary without destroying earlier text", () => { diff --git a/tests/constants.test.ts b/tests/constants.test.ts index e7f3241..86cb61c 100644 --- a/tests/constants.test.ts +++ b/tests/constants.test.ts @@ -7,7 +7,7 @@ import { TOOL_CALL_BUBBLE_MUTED, TOOL_CALL_BUBBLE_BORDER, TOOL_CALL_BUBBLE_BORDER_ERROR, -} from "@/lib/constants"; +} from "@mc/lib/constants"; describe("hasHeartbeatOnOwnLine", () => { it("matches HEARTBEAT_OK as the entire text", () => { diff --git a/tests/contextChipPlugin.test.tsx b/tests/contextChipPlugin.test.tsx index 84f75e4..e38f7d4 100644 --- a/tests/contextChipPlugin.test.tsx +++ b/tests/contextChipPlugin.test.tsx @@ -1,8 +1,8 @@ import { describe, it, expect, vi } from "vitest"; import { render, screen, fireEvent } from "@testing-library/react"; -import { MessageRow } from "@/components/MessageRow"; -import type { Message } from "@/types/chat"; -import { contextChipPlugin } from "@/plugins/app/contextChip"; +import { MessageRow } from "@mc/components/MessageRow"; +import type { Message } from "@mc/types/chat"; +import { contextChipPlugin } from "@mc/plugins/app/contextChip"; describe("contextChipPlugin parse", () => { it("parses valid data", () => { diff --git a/tests/demoMode.test.ts b/tests/demoMode.test.ts index d8fea92..7318534 100644 --- a/tests/demoMode.test.ts +++ b/tests/demoMode.test.ts @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; -import { DEMO_HISTORY, createDemoHandler } from "@/lib/demoMode"; -import type { PluginActionInvocation } from "@/lib/plugins/types"; -import type { AgentEventPayload, PluginContentPart } from "@/types/chat"; +import { DEMO_HISTORY, createDemoHandler } from "@mc/lib/demoMode"; +import type { PluginActionInvocation } from "@mc/lib/plugins/types"; +import type { AgentEventPayload, PluginContentPart } from "@mc/types/chat"; describe("DEMO_HISTORY", () => { it("contains system + user + assistant messages", () => { diff --git a/tests/historyResponse.test.ts b/tests/historyResponse.test.ts index 6894152..59eb8e0 100644 --- a/tests/historyResponse.test.ts +++ b/tests/historyResponse.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from "vitest"; -import { buildHistoryMessages, mergeHistoryWithOptimistic, prepareHistoryMessages } from "@/lib/chat/historyResponse"; -import type { Message } from "@/types/chat"; +import { buildHistoryMessages, mergeHistoryWithOptimistic, prepareHistoryMessages } from "@mc/lib/chat/historyResponse"; +import type { Message } from "@mc/types/chat"; describe("mergeHistoryWithOptimistic", () => { it("keeps already-rendered realtime messages when history snapshot lags", () => { diff --git a/tests/inputAttachmentPlugins.test.tsx b/tests/inputAttachmentPlugins.test.tsx index cae1324..80303c7 100644 --- a/tests/inputAttachmentPlugins.test.tsx +++ b/tests/inputAttachmentPlugins.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect } from "vitest"; import { render, screen } from "@testing-library/react"; -import { imageAttachmentPlugin, fileAttachmentPlugin, quoteAttachmentPlugin } from "@/lib/plugins/inputAttachmentBuiltins"; -import { promptContextAttachmentPlugin } from "@/plugins/app/contextChip"; +import { imageAttachmentPlugin, fileAttachmentPlugin, quoteAttachmentPlugin } from "@mc/lib/plugins/inputAttachmentBuiltins"; +import { promptContextAttachmentPlugin } from "@mc/plugins/app/contextChip"; describe("imageAttachmentPlugin", () => { it("renders a thumbnail preview", () => { diff --git a/tests/inputAttachmentRegistry.test.ts b/tests/inputAttachmentRegistry.test.ts index 4491dd2..ccddbd9 100644 --- a/tests/inputAttachmentRegistry.test.ts +++ b/tests/inputAttachmentRegistry.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from "vitest"; -import { inputAttachmentRegistry } from "@/lib/plugins/inputAttachmentRegistry"; +import { inputAttachmentRegistry } from "@mc/lib/plugins/inputAttachmentRegistry"; describe("inputAttachmentRegistry", () => { it("registers built-in image attachment plugin", () => { diff --git a/tests/layout.test.ts b/tests/layout.test.ts index aad5a1a..824d5f7 100644 --- a/tests/layout.test.ts +++ b/tests/layout.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import { getChatBottomPad, getThinkingIndicatorBottom } from "@/lib/chat/layout"; +import { getChatBottomPad, getThinkingIndicatorBottom } from "@mc/lib/chat/layout"; describe("chat layout spacing", () => { it("adds composer clearance to detached bottom padding", () => { diff --git a/tests/messageUtils.test.ts b/tests/messageUtils.test.ts index e57e5b2..85c0609 100644 --- a/tests/messageUtils.test.ts +++ b/tests/messageUtils.test.ts @@ -5,8 +5,8 @@ import { getImages, getMessageSide, thinkingPreview, -} from "@/lib/messageUtils"; -import type { MessageRole } from "@/types/chat"; +} from "@mc/lib/messageUtils"; +import type { MessageRole } from "@mc/types/chat"; describe("getTextFromContent", () => { it("returns empty string for null", () => { diff --git a/tests/newCommandFlow.test.tsx b/tests/newCommandFlow.test.tsx index 6e16824..bd1d2b3 100644 --- a/tests/newCommandFlow.test.tsx +++ b/tests/newCommandFlow.test.tsx @@ -2,11 +2,11 @@ import React from "react"; import { describe, it, expect, vi } from "vitest"; import { act, render, renderHook, screen } from "@testing-library/react"; -import { MessageRow } from "@/components/MessageRow"; -import { useMessageSender } from "@/hooks/chat/useMessageSender"; -import { upsertChatEventMessage } from "@/lib/chat/chatEventUpsert"; -import { mergeHistoryWithOptimistic } from "@/lib/chat/historyResponse"; -import type { ChatEventPayload, Message } from "@/types/chat"; +import { MessageRow } from "@mc/components/MessageRow"; +import { useMessageSender } from "@mc/hooks/chat/useMessageSender"; +import { upsertChatEventMessage } from "@mc/lib/chat/chatEventUpsert"; +import { mergeHistoryWithOptimistic } from "@mc/lib/chat/historyResponse"; +import type { ChatEventPayload, Message } from "@mc/types/chat"; describe("/new flow integration", () => { it("keeps /new response as command pill after realtime update and history refresh", async () => { diff --git a/tests/pluginActionPayload.test.ts b/tests/pluginActionPayload.test.ts index d339c0d..63ebf72 100644 --- a/tests/pluginActionPayload.test.ts +++ b/tests/pluginActionPayload.test.ts @@ -4,8 +4,8 @@ import { appendPluginActionPayloadToUrl, getPluginActionHostPayload, mergePluginActionPayload, -} from "@/lib/plugins/actionPayload"; -import type { PluginActionInvocation } from "@/lib/plugins/types"; +} from "@mc/lib/plugins/actionPayload"; +import type { PluginActionInvocation } from "@mc/lib/plugins/types"; const invocation: PluginActionInvocation = { messageId: "message-123", diff --git a/tests/toolDisplay.test.ts b/tests/toolDisplay.test.ts index 25acc32..6a0e726 100644 --- a/tests/toolDisplay.test.ts +++ b/tests/toolDisplay.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from "vitest"; -import { getToolDisplay } from "@/lib/toolDisplay"; +import { getToolDisplay } from "@mc/lib/toolDisplay"; describe("getToolDisplay", () => { describe("exec tool", () => { diff --git a/tests/unfurl.test.ts b/tests/unfurl.test.ts index 9e99e36..2cf6c4c 100644 --- a/tests/unfurl.test.ts +++ b/tests/unfurl.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, beforeEach } from "vitest"; -import { extractUrls, shouldUnfurl, _resetForTests, _getCache, BARE_URL_REGEX } from "@/lib/unfurl"; +import { extractUrls, shouldUnfurl, _resetForTests, _getCache, BARE_URL_REGEX } from "@mc/lib/unfurl"; beforeEach(() => { _resetForTests(); diff --git a/tests/useInputAttachments.test.tsx b/tests/useInputAttachments.test.tsx index 2c202cc..4ce84c8 100644 --- a/tests/useInputAttachments.test.tsx +++ b/tests/useInputAttachments.test.tsx @@ -1,6 +1,6 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; import { renderHook, act } from "@testing-library/react"; -import { useInputAttachments } from "@/hooks/chat/useInputAttachments"; +import { useInputAttachments } from "@mc/hooks/chat/useInputAttachments"; describe("useInputAttachments", () => { const revokeObjectURL = vi.fn(); diff --git a/tests/useMessageSender.test.tsx b/tests/useMessageSender.test.tsx index 034d4b2..f31eccd 100644 --- a/tests/useMessageSender.test.tsx +++ b/tests/useMessageSender.test.tsx @@ -2,8 +2,8 @@ import React from "react"; import { describe, it, expect, vi, afterEach } from "vitest"; import { renderHook, act } from "@testing-library/react"; -import { useMessageSender } from "@/hooks/chat/useMessageSender"; -import type { Message } from "@/types/chat"; +import { useMessageSender } from "@mc/hooks/chat/useMessageSender"; +import type { Message } from "@mc/types/chat"; describe("useMessageSender", () => { afterEach(() => { diff --git a/tests/useModeBootstrap.test.tsx b/tests/useModeBootstrap.test.tsx index 8a3e346..40638d4 100644 --- a/tests/useModeBootstrap.test.tsx +++ b/tests/useModeBootstrap.test.tsx @@ -2,11 +2,11 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; import { renderHook, act } from "@testing-library/react"; import type { Dispatch, MutableRefObject, SetStateAction } from "react"; -import { useModeBootstrap } from "@/hooks/chat/useModeBootstrap"; -import type { BackendMode, Message } from "@/types/chat"; -import type { LmStudioConfig } from "@/lib/lmStudio"; -import type { Command } from "@/components/CommandSheet"; -import type { BridgeMessage } from "@/lib/nativeBridge"; +import { useModeBootstrap } from "@mc/hooks/chat/useModeBootstrap"; +import type { BackendMode, Message } from "@mc/types/chat"; +import type { LmStudioConfig } from "@mc/lib/lmStudio"; +import type { Command } from "@mc/components/CommandSheet"; +import type { BridgeMessage } from "@mc/lib/nativeBridge"; function mockLocalStorage() { const store = new Map(); diff --git a/tests/useNativeBridgeMessage.test.tsx b/tests/useNativeBridgeMessage.test.tsx index cfccb89..733ab6d 100644 --- a/tests/useNativeBridgeMessage.test.tsx +++ b/tests/useNativeBridgeMessage.test.tsx @@ -2,18 +2,18 @@ import { describe, it, expect, vi } from "vitest"; import { renderHook, act } from "@testing-library/react"; import type { Dispatch, MutableRefObject, SetStateAction } from "react"; -vi.mock("@/lib/nativeBridge", async (importOriginal) => { - const actual = await importOriginal(); +vi.mock("@mc/lib/nativeBridge", async (importOriginal) => { + const actual = await importOriginal(); return { ...actual, resolveIdentitySign: vi.fn(), }; }); -import { PIN_LOCK_MS } from "@/hooks/useScrollManager"; -import { useNativeBridgeMessage } from "@/hooks/chat/useNativeBridgeMessage"; -import { resolveIdentitySign } from "@/lib/nativeBridge"; -import type { ConnectionConfig, Message } from "@/types/chat"; +import { PIN_LOCK_MS } from "@mc/hooks/useScrollManager"; +import { useNativeBridgeMessage } from "@mc/hooks/chat/useNativeBridgeMessage"; +import { resolveIdentitySign } from "@mc/lib/nativeBridge"; +import type { ConnectionConfig, Message } from "@mc/types/chat"; function createOptions(overrides: Partial[0]> = {}) { return { diff --git a/tests/useQueuedMessage.test.tsx b/tests/useQueuedMessage.test.tsx index b0b3da6..fe31242 100644 --- a/tests/useQueuedMessage.test.tsx +++ b/tests/useQueuedMessage.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; import { renderHook, act } from "@testing-library/react"; -import { useQueuedMessage } from "@/hooks/chat/useQueuedMessage"; +import { useQueuedMessage } from "@mc/hooks/chat/useQueuedMessage"; describe("useQueuedMessage", () => { beforeEach(() => { diff --git a/tests/useUnreadTabIndicator.test.tsx b/tests/useUnreadTabIndicator.test.tsx index 0d1bd1e..0016c18 100644 --- a/tests/useUnreadTabIndicator.test.tsx +++ b/tests/useUnreadTabIndicator.test.tsx @@ -1,8 +1,8 @@ import { describe, it, expect } from "vitest"; import { renderHook, act } from "@testing-library/react"; -import { useUnreadTabIndicator } from "@/hooks/chat/useUnreadTabIndicator"; -import type { Message } from "@/types/chat"; +import { useUnreadTabIndicator } from "@mc/hooks/chat/useUnreadTabIndicator"; +import type { Message } from "@mc/types/chat"; function assistantMessage(id: string, text: string): Message { return { diff --git a/tests/useWebSocket.test.tsx b/tests/useWebSocket.test.tsx index 2747cd0..18aa6d6 100644 --- a/tests/useWebSocket.test.tsx +++ b/tests/useWebSocket.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; import { renderHook, act } from "@testing-library/react"; -import { useWebSocket } from "@/lib/useWebSocket"; +import { useWebSocket } from "@mc/lib/useWebSocket"; // ── Mock WebSocket ────────────────────────────────────────────────────────── diff --git a/tests/useZenMode.test.tsx b/tests/useZenMode.test.tsx index 3b519f0..e458497 100644 --- a/tests/useZenMode.test.tsx +++ b/tests/useZenMode.test.tsx @@ -1,7 +1,7 @@ import { describe, it, expect, beforeEach, vi } from "vitest"; import { renderHook, act, waitFor } from "@testing-library/react"; -import { useZenMode, ZEN_STORAGE_KEY } from "@/hooks/useZenMode"; +import { useZenMode, ZEN_STORAGE_KEY } from "@mc/hooks/useZenMode"; function mockStorage(initial: Record = {}) { const store = new Map(Object.entries(initial)); diff --git a/tests/zenBridge.test.ts b/tests/zenBridge.test.ts index 4e937bf..95e023a 100644 --- a/tests/zenBridge.test.ts +++ b/tests/zenBridge.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect, vi } from "vitest"; -import { applyNativeZenMode } from "@/lib/chat/zenBridge"; +import { applyNativeZenMode } from "@mc/lib/chat/zenBridge"; describe("applyNativeZenMode", () => { it("toggles zen mode when requested state differs from current state", () => { diff --git a/tsconfig.json b/tsconfig.json index 1f40fbd..6105952 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,7 +25,7 @@ } ], "paths": { - "@/*": [ + "@mc/*": [ "./*" ] } diff --git a/vitest.config.ts b/vitest.config.ts index 96092db..71b697c 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,7 +6,7 @@ export default defineConfig({ plugins: [react()], resolve: { alias: { - "@": path.resolve(__dirname, "."), + "@mc": path.resolve(__dirname, "."), }, }, test: {