refactor: isolate runtime contracts and enforce import boundaries (#6166)
* test: enforce Python import ownership boundaries * test: protect client import boundaries and rehome shared UI contracts * refactor: remove gateway and client dependency inversions * fix: detect dynamic imports in conditional expressions * refactor(tools): keep configuration contracts with their owners * docs: keep design guidance focused on ownership and checks * fix: preserve default threaded turn delivery
This commit is contained in:
1 parent
cd2a863710
commit
328e933d36
162 files changed
+3449
-1888
No files matched your search
@@ -51,7 +51,8 @@ import {
|
||||
SIDEBAR_SELECTION_ITEM_CLASS,
|
||||
SidebarSelectionHighlight,
|
||||
} from "@/components/SidebarSelectionHighlight";
|
||||
import { relativeTime, visibleSessionPreview } from "@/lib/format";
|
||||
import { visibleSessionPreview } from "@/lib/format";
|
||||
import { relativeTime } from "@/lib/format-time";
|
||||
import {
|
||||
COLLAPSED_CHATS_VISIBLE_COUNT,
|
||||
displayTitle,
|
||||
|
||||
@@ -10,16 +10,7 @@ import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import { sessionHandleColor } from "@/lib/session-handle";
|
||||
import type { CliAppInfo, McpPresetInfo, SessionMention } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { composerMentionLabel } from "@/lib/composer-mention-text";
|
||||
|
||||
type CliAppMentionSegment =
|
||||
| { kind: "text"; text: string }
|
||||
| { kind: "cli"; text: string; app: CliAppInfo };
|
||||
|
||||
export type CapabilityMentionSegment =
|
||||
| CliAppMentionSegment
|
||||
| { kind: "mcp"; text: string; preset: McpPresetInfo }
|
||||
| { kind: "session"; text: string; mention: SessionMention };
|
||||
import { composerMentionLabel, type CapabilityMentionSegment } from "@/lib/composer-mention-text";
|
||||
|
||||
// Paint-only weight keeps the native textarea's regular-width caret and wrapping in sync.
|
||||
const COMPOSER_BRAND_NAME_CLASS = "[-webkit-text-stroke:0.4px_currentColor]";
|
||||
|
||||
@@ -12,7 +12,7 @@ import type { TFunction } from "i18next";
|
||||
import { Trash2 } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { currentLocale } from "@/i18n";
|
||||
import { fmtDateTime } from "@/lib/format";
|
||||
import { fmtDateTime } from "@/lib/format-time";
|
||||
import type { SessionAutomationJob } from "@/lib/types";
|
||||
|
||||
interface DeleteConfirmProps {
|
||||
|
||||
@@ -19,12 +19,13 @@ import { InlineImageProvider, useInlineImages } from "@/components/InlineImageCo
|
||||
import { MarkdownText } from "@/components/MarkdownText";
|
||||
import { SlashCommandText } from "@/components/SlashCommandText";
|
||||
import { ReasoningRow } from "@/components/thread/activity/ReasoningRow";
|
||||
import { StreamingLabelSheen } from "@/components/ui/streaming-label-sheen";
|
||||
import { ContextCompactionNotice } from "@/components/thread/ContextCompactionNotice";
|
||||
import { UserMessageText } from "@/components/UserMessageText";
|
||||
import { HoverHint } from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import { formatMessageEndTime } from "@/lib/format";
|
||||
import { formatMessageEndTime } from "@/lib/format-time";
|
||||
import { toMediaAttachment } from "@/lib/media";
|
||||
import { matchingSlashCommand } from "@/lib/slash-command";
|
||||
import { sessionHandleColor } from "@/lib/session-handle";
|
||||
@@ -704,35 +705,6 @@ function ThinkingState() {
|
||||
);
|
||||
}
|
||||
|
||||
/** L→R sheen on the glyphs themselves; inactive labels stay solid muted text. */
|
||||
export function StreamingLabelSheen({
|
||||
children,
|
||||
active,
|
||||
className,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
active: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
const sheenText =
|
||||
typeof children === "string" || typeof children === "number"
|
||||
? String(children)
|
||||
: undefined;
|
||||
return (
|
||||
<span className={cn("block min-w-0 overflow-hidden py-px", className)}>
|
||||
<span
|
||||
data-sheen-text={active ? sheenText : undefined}
|
||||
className={cn(
|
||||
"block w-fit max-w-full truncate pr-0.5 font-medium leading-normal",
|
||||
active ? "streaming-text-sheen after:pr-0.5" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
interface ReasoningBubbleProps {
|
||||
text: string;
|
||||
streaming: boolean;
|
||||
|
||||
@@ -4,13 +4,13 @@ import { useTranslation } from "react-i18next";
|
||||
import {
|
||||
CapabilityMentionToken,
|
||||
splitCapabilityMentionSegments,
|
||||
type CapabilityMentionSegment,
|
||||
} from "@/components/CliAppMentionText";
|
||||
import {
|
||||
INLINE_TOKEN_HIGHLIGHT_COLOR,
|
||||
InlineTokenHighlight,
|
||||
} from "@/components/InlineTokenHighlight";
|
||||
import type { CliAppInfo, McpPresetInfo, SessionMention } from "@/lib/types";
|
||||
import type { CapabilityMentionSegment } from "@/lib/composer-mention-text";
|
||||
|
||||
type SkillReferenceSegment =
|
||||
| { kind: "text"; text: string }
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CircleAlert, Loader2 } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type HostConnectionState = "open" | "closed" | "connecting" | "error";
|
||||
import type { HostConnectionState } from "./remote-context";
|
||||
|
||||
/** Connectivity is independent of which host the user is currently viewing. */
|
||||
export function HostConnectionStatus({ state, compact = false }: {
|
||||
|
||||
@@ -9,7 +9,8 @@ import { useClient } from "@/providers/ClientProvider";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ConnectionStatus } from "@/lib/types";
|
||||
import type { HostAnchor, EmbeddedHost } from "./host-bridge";
|
||||
import { HostConnectionStatus, type HostConnectionState } from "./HostConnectionStatus";
|
||||
import { HostConnectionStatus } from "./HostConnectionStatus";
|
||||
import type { HostConnectionState } from "./remote-context";
|
||||
|
||||
export interface HostPicker {
|
||||
kind: "shell";
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { useClient } from "@/providers/ClientProvider";
|
||||
import { remoteAction } from "@/lib/remote-instances";
|
||||
import { useRemoteConnections } from "./RemoteInstances";
|
||||
import { useRemoteConnections } from "./remote-context";
|
||||
|
||||
/** An explicit escape hatch for a VPN/bound-interface route, not a new SSH form. */
|
||||
export function PairRouteSettings({ id, onSaved, showHint = true }: { id: string; onSaved?: () => void; showHint?: boolean }) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CodeBlock } from "@/components/CodeBlock";
|
||||
import { remoteAction } from "@/lib/remote-instances";
|
||||
import { pairingReturnOrigin, type PairReturn } from "@/lib/remote-pair-return";
|
||||
import type { ConnectionStatus } from "@/lib/types";
|
||||
import { useRemoteConnections } from "./RemoteInstances";
|
||||
import { useRemoteConnections } from "./remote-context";
|
||||
import { PairRouteSettings } from "./PairRouteSettings";
|
||||
import "./remote-layout.css";
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { groupRemoteProfiles, isCompatibilityError, remoteAction, type RemoteIns
|
||||
import { cn } from "@/lib/utils";
|
||||
import { parseSSHAddress } from "@/lib/ssh-address";
|
||||
import { clearPairReturn, readPairReturn, subscribePairReturn } from "@/lib/remote-pair-return";
|
||||
import { useRemoteConnections } from "./RemoteInstances";
|
||||
import { useRemoteConnections } from "./remote-context";
|
||||
import { SSHHostPicker } from "./SSHHostPicker";
|
||||
import { QuickPairSetup } from "./QuickPairSetup";
|
||||
import { PairRouteSettings } from "./PairRouteSettings";
|
||||
|
||||
@@ -1,39 +1,16 @@
|
||||
import { createContext, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
||||
import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
||||
import { Loader2, PlugZap } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { groupRemoteProfiles, isCompatibilityError, needsRemoteSetup, type RemoteDirectory } from "@/lib/remote-instances";
|
||||
import { groupRemoteProfiles, isCompatibilityError, needsRemoteSetup } from "@/lib/remote-instances";
|
||||
import { HostCompatibilityDialog } from "./HostCompatibilityDialog";
|
||||
import { RemoteConnectionsPage } from "./RemoteConnectionsPage";
|
||||
import type { HostAnchor } from "./host-bridge";
|
||||
import { ThemeProvider } from "@/hooks/useTheme";
|
||||
import { useHostSessions } from "./useHostSessions";
|
||||
import { HostNavigationContext, HostSwitcher, RemoteHostMenu, type HostPicker } from "./HostSwitcher";
|
||||
import { useSidebarHostBridge } from "./useSidebarHostBridge";
|
||||
import { readPairReturn, subscribePairReturn } from "@/lib/remote-pair-return";
|
||||
import type { HostConnectionState } from "./HostConnectionStatus";
|
||||
|
||||
const RemoteContext = createContext<{
|
||||
available: boolean;
|
||||
localActive: boolean;
|
||||
activeHostId: string | null;
|
||||
hostStates: Record<string, HostConnectionState>;
|
||||
managing: boolean;
|
||||
embeddedManagement?: boolean;
|
||||
reportManagementSurface?: (rect: HostAnchor, theme: "light" | "dark") => void;
|
||||
closeManagement: () => void;
|
||||
selectLocal: () => void;
|
||||
openHostIds: string[];
|
||||
directory: RemoteDirectory | null;
|
||||
directoryError: boolean;
|
||||
refresh: () => Promise<RemoteDirectory>;
|
||||
rename: (id: string, name: string) => Promise<void>;
|
||||
connect: (id: string, stillWanted?: () => boolean) => Promise<void>;
|
||||
disconnect: (id: string) => Promise<void>;
|
||||
remove: (id: string) => Promise<void>;
|
||||
cancel: () => void;
|
||||
} | null>(null);
|
||||
export function useRemoteConnections() { return useContext(RemoteContext); }
|
||||
import { RemoteContext, type HostConnectionState } from "./remote-context";
|
||||
|
||||
/** Keep host views alive; navigation belongs in each view's sidebar, not a second header. */
|
||||
export function RemoteInstances({ children }: { children: ReactNode }) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
import type { RemoteDirectory } from "@/lib/remote-instances";
|
||||
import type { HostAnchor } from "./host-bridge";
|
||||
|
||||
export type HostConnectionState = "open" | "closed" | "connecting" | "error";
|
||||
|
||||
export const RemoteContext = createContext<{
|
||||
available: boolean;
|
||||
localActive: boolean;
|
||||
activeHostId: string | null;
|
||||
hostStates: Record<string, HostConnectionState>;
|
||||
managing: boolean;
|
||||
embeddedManagement?: boolean;
|
||||
reportManagementSurface?: (rect: HostAnchor, theme: "light" | "dark") => void;
|
||||
closeManagement: () => void;
|
||||
selectLocal: () => void;
|
||||
openHostIds: string[];
|
||||
directory: RemoteDirectory | null;
|
||||
directoryError: boolean;
|
||||
refresh: () => Promise<RemoteDirectory>;
|
||||
rename: (id: string, name: string) => Promise<void>;
|
||||
connect: (id: string, stillWanted?: () => boolean) => Promise<void>;
|
||||
disconnect: (id: string) => Promise<void>;
|
||||
remove: (id: string) => Promise<void>;
|
||||
cancel: () => void;
|
||||
} | null>(null);
|
||||
export function useRemoteConnections() { return useContext(RemoteContext); }
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
ChannelConfigField,
|
||||
ChannelFieldSection,
|
||||
ChannelSetupRequirement,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import {
|
||||
CredentialForm,
|
||||
channelFieldInputId,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { channelUiContribution } from "@/channel-plugins/registry";
|
||||
import { CircleHelp, ExternalLink } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { channelSetup } from "@/components/settings/channels/ChannelIdentity";
|
||||
import { docsUrlWithBase } from "@/components/settings/channels/catalog";
|
||||
import { docsUrlWithBase } from "@/channel-plugins/catalog";
|
||||
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
import { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {
|
||||
ChannelConfigField,
|
||||
ChannelFieldPresentation,
|
||||
ChannelSetupPresentation,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import { channelValidationMessage } from "@/components/settings/channels/validationMessages";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { normalizeLocale } from "@/i18n/config";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { channelUiPresentation } from "@/channel-plugins/registry";
|
||||
import { ToggleButton } from "@/components/settings/ToggleButton";
|
||||
import type { ChannelConfigField } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelConfigField } from "@/channel-plugins/catalog";
|
||||
import {
|
||||
CredentialForm,
|
||||
channelValuesForSave,
|
||||
|
||||
@@ -29,7 +29,7 @@ import { useAutoSave } from "@/components/settings/shared/useAutoSave";
|
||||
import {
|
||||
type ChannelProviderPreset,
|
||||
type ChannelSetupPresentation,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import {
|
||||
ChannelFieldGroups,
|
||||
channelRequirementErrors,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
type ChannelProviderPreset,
|
||||
type ChannelSetupPresentation,
|
||||
} from "@/components/settings/channels/catalog";
|
||||
} from "@/channel-plugins/catalog";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import type { NanobotFeatureInfo } from "@/lib/types";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import type { ChannelConfigField } from "@/components/settings/channels/catalog";
|
||||
import type { ChannelConfigField } from "@/channel-plugins/catalog";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function channelFieldValue(field: ChannelConfigField, values: Record<string, string>): string {
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
import type { ComponentType } from "react";
|
||||
|
||||
export type ChannelPresentation = {
|
||||
displayName: string;
|
||||
initials: string;
|
||||
color: string;
|
||||
icon?: ComponentType<{ className?: string; strokeWidth?: string | number }>;
|
||||
logoUrl?: string;
|
||||
/** Official site favicon to use when the primary asset is hosted on a CDN. */
|
||||
logoFallbackUrl?: string;
|
||||
/** The primary asset already includes its own background and safe area. */
|
||||
logoLayout?: "tile";
|
||||
setup?: ChannelCatalogSetupPresentation;
|
||||
};
|
||||
|
||||
export type ChannelSetupPresentation = {
|
||||
mode?: "webui" | "credentials" | "connect";
|
||||
primaryActionLabel?: string;
|
||||
command?: string;
|
||||
docsUrl?: string;
|
||||
docsLabel?: string;
|
||||
officialUrl?: string;
|
||||
officialLabel?: string;
|
||||
presetLabel?: string;
|
||||
sectionLabels?: Record<string, string>;
|
||||
fields?: ChannelConfigField[];
|
||||
manualFields?: ChannelConfigField[];
|
||||
requirements?: ChannelSetupRequirement[];
|
||||
actions?: ChannelSetupAction[];
|
||||
presets?: ChannelProviderPreset[];
|
||||
};
|
||||
|
||||
type ChannelCatalogSetupPresentation = {
|
||||
mode?: "webui" | "credentials" | "connect";
|
||||
command?: string;
|
||||
docsUrl?: string;
|
||||
fields?: ChannelFieldPresentation[];
|
||||
manualFields?: ChannelFieldPresentation[];
|
||||
actions?: ChannelSetupActionDefinition[];
|
||||
presets?: ChannelProviderPresetDefinition[];
|
||||
};
|
||||
|
||||
export type ChannelFieldPresentation = {
|
||||
key: string;
|
||||
section?: string;
|
||||
};
|
||||
|
||||
export type ChannelFieldSection =
|
||||
| "account"
|
||||
| "credentials"
|
||||
| "connection"
|
||||
| "access"
|
||||
| "behavior"
|
||||
| "security"
|
||||
| "advanced";
|
||||
|
||||
export type ChannelSetupRequirement = {
|
||||
alternatives: string[][];
|
||||
};
|
||||
|
||||
type ChannelSetupActionDefinition = Omit<ChannelSetupAction, "label">;
|
||||
|
||||
export type ChannelProviderPresetDefinition = Omit<ChannelProviderPreset, "label">;
|
||||
|
||||
type ChannelSetupAction = {
|
||||
id: string;
|
||||
label: string;
|
||||
url?: string;
|
||||
copyText?: string;
|
||||
logoUrl?: string;
|
||||
};
|
||||
|
||||
export type ChannelProviderPreset = {
|
||||
id: string;
|
||||
label: string;
|
||||
values: Record<string, string>;
|
||||
};
|
||||
|
||||
export type ChannelConfigField = {
|
||||
key: string;
|
||||
label: string;
|
||||
placeholder?: string;
|
||||
secret?: boolean;
|
||||
optional?: boolean;
|
||||
inputType?: "text" | "number" | "url" | "email" | "tel";
|
||||
kind?: "string" | "secret" | "int" | "bool" | "list" | "enum" | string;
|
||||
section?: string;
|
||||
defaultValue?: string;
|
||||
options?: ChannelConfigOption[];
|
||||
};
|
||||
|
||||
type ChannelConfigOption = {
|
||||
value: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
const NANOBOT_DOCS_URL = "https://nanobot.wiki/docs/latest";
|
||||
const CHAT_APPS_DOCS_URL = `${NANOBOT_DOCS_URL}/getting-started/chat-apps`;
|
||||
|
||||
export function chatAppGuideUrl(sectionId: string): string {
|
||||
return `${CHAT_APPS_DOCS_URL}#${sectionId}`;
|
||||
}
|
||||
|
||||
export function docsUrlWithBase(
|
||||
url: string | undefined,
|
||||
chatAppsDocsUrl?: string,
|
||||
): string | undefined {
|
||||
if (!url || !chatAppsDocsUrl) return url;
|
||||
if (!url.startsWith(CHAT_APPS_DOCS_URL)) return url;
|
||||
const anchor = url.includes("#") ? `#${url.split("#").pop()}` : "";
|
||||
return `${chatAppsDocsUrl.replace(/\/$/, "")}${anchor}`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { displayTitle } from "@/lib/chat-groups";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import { fmtDateTime, relativeTime } from "@/lib/format";
|
||||
import { fmtDateTime, relativeTime } from "@/lib/format-time";
|
||||
import type { SendAttachment, SendOptions } from "@/hooks/useNanobotStream";
|
||||
import type {
|
||||
AutomationsPayload,
|
||||
|
||||
@@ -14,7 +14,8 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { formatCompactTokenCount, formatTurnLatency } from "@/lib/format";
|
||||
import { formatCompactTokenCount } from "@/lib/format";
|
||||
import { formatTurnLatency } from "@/lib/format-time";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface ComposerContextUsage {
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
type PromptAnchor,
|
||||
userPromptAnchors,
|
||||
} from "@/components/thread/promptNavigation";
|
||||
import { fmtDateTime } from "@/lib/format";
|
||||
import { fmtDateTime } from "@/lib/format-time";
|
||||
import type { UIMessage } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { useSessionAutomationJobs } from "@/hooks/useSessionAutomationJobs";
|
||||
import { currentLocale } from "@/i18n";
|
||||
import { runAutomationAction, updateAutomation } from "@/lib/api";
|
||||
import type { WebUIMutationTransport } from "@/lib/api";
|
||||
import { fmtDateTime } from "@/lib/format";
|
||||
import { fmtDateTime } from "@/lib/format-time";
|
||||
import type {
|
||||
AutomationUpdatePayload,
|
||||
SessionAutomationJob,
|
||||
|
||||
@@ -43,8 +43,8 @@ import {
|
||||
cliAppInitials,
|
||||
mcpPresetInitials,
|
||||
splitCapabilityMentionSegments,
|
||||
type CapabilityMentionSegment,
|
||||
} from "@/components/CliAppMentionText";
|
||||
import type { CapabilityMentionSegment } from "@/lib/composer-mention-text";
|
||||
import { INLINE_TOKEN_HIGHLIGHT_COLOR } from "@/components/InlineTokenHighlight";
|
||||
import {
|
||||
ArrowUp,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "@/components/
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { useMediaQuery } from "@/hooks/useMediaQuery";
|
||||
import { useLocalPreferences } from "@/hooks/useLocalPreferences";
|
||||
import { fmtDateTime, formatMessageHoverTime } from "@/lib/format";
|
||||
import { fmtDateTime, formatMessageHoverTime } from "@/lib/format-time";
|
||||
import { projectActivityTimeline, type TurnUnit } from "@/lib/activity-timeline";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { CliAppInfo, McpPresetInfo, RetryStatus, SlashCommand, UIMessage } from "@/lib/types";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useRef, useState, type CSSProperties, type ReactNode } from "react";
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
|
||||
import { StreamingLabelSheen } from "@/components/MessageBubble";
|
||||
import { StreamingLabelSheen } from "@/components/ui/streaming-label-sheen";
|
||||
import { formControlFocusClassName } from "@/components/ui/form-control";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** L→R sheen on the glyphs themselves; inactive labels stay solid muted text. */
|
||||
export function StreamingLabelSheen({
|
||||
children,
|
||||
active,
|
||||
className,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
active: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
const sheenText =
|
||||
typeof children === "string" || typeof children === "number"
|
||||
? String(children)
|
||||
: undefined;
|
||||
return (
|
||||
<span className={cn("block min-w-0 overflow-hidden py-px", className)}>
|
||||
<span
|
||||
data-sheen-text={active ? sheenText : undefined}
|
||||
className={cn(
|
||||
"block w-fit max-w-full truncate pr-0.5 font-medium leading-normal",
|
||||
active ? "streaming-text-sheen after:pr-0.5" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user