@vetta-org/theme-ui 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +735 -7
- package/src/action-approval/AppearanceActionPickerView.tsx +2 -78
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +2 -9
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +4 -1
- package/src/action-approval/GenericActionApprovalView.tsx +2 -9
- package/src/action-approval/ManageActionApprovalFrameView.tsx +4 -1
- package/src/action-approval/NavigationOpenApprovalView.tsx +2 -9
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +3 -1
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +3 -10
- package/src/action-approval/index.ts +0 -1
- package/src/activity/ActivityPanel.tsx +13 -10
- package/src/activity/ActivityPanelFrame.test.tsx +32 -0
- package/src/activity/ActivityPanelFrame.tsx +3 -2
- package/src/activity/BackgroundTasksTabPanelView.tsx +1 -1
- package/src/activity/BrowserPanelView.tsx +48 -49
- package/src/activity/DebugTabPanelView.tsx +1 -1
- package/src/activity/MarkdownPreviewView.tsx +56 -59
- package/src/activity/PluginTabPickerView.tsx +5 -3
- package/src/activity/PortsTabPanelView.tsx +911 -0
- package/src/activity/ToolCallsSubTabView.tsx +1 -1
- package/src/activity/WorkflowTabPanelView.tsx +1 -1
- package/src/activity/index.ts +9 -0
- package/src/app/AppBackground.tsx +1 -1
- package/src/app/AppBootLoadingView.tsx +4 -2
- package/src/app-shell/DefaultWindowControls.tsx +1 -1
- package/src/app-shell/PageHeaderActionGroup.tsx +1 -1
- package/src/app-shell/PageHeaderContent.tsx +36 -7
- package/src/app-shell/PageHeaderFrame.tsx +15 -3
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +1 -1
- package/src/app-shell/PageHeaderTitle.tsx +1 -1
- package/src/app-shell/WindowControlButton.tsx +1 -1
- package/src/app-shell/header-crowding.test.ts +62 -0
- package/src/app-shell/header-crowding.tsx +137 -0
- package/src/appearance/BackgroundImageFrame.tsx +1 -1
- package/src/appearance/CenterSliceImageFrame.tsx +1 -1
- package/src/appearance/CornerImageFrame.tsx +1 -1
- package/src/appearance/HorizontalSliceImageFrame.tsx +1 -1
- package/src/appearance/NineSliceImageFrame.tsx +1 -1
- package/src/appearance/ThemeSurface.tsx +1 -1
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +2 -1
- package/src/batch-tasks/BatchTaskProjectActionsView.test.tsx +97 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +45 -35
- package/src/batch-tasks/batchTaskUi.tsx +0 -29
- package/src/bottom-panel/BottomPanelView.test.tsx +43 -0
- package/src/bottom-panel/BottomPanelView.tsx +222 -0
- package/src/bottom-panel/index.ts +26 -0
- package/src/chat/AgentAvatarView.tsx +1 -1
- package/src/chat/AnnotationViews.tsx +107 -0
- package/src/chat/AskUserQuestionView.tsx +18 -11
- package/src/chat/AssistantMessageView.tsx +48 -13
- package/src/chat/AtPanelView.test.tsx +61 -0
- package/src/chat/AtPanelView.tsx +63 -38
- package/src/chat/BashTerminalCard.tsx +1 -2
- package/src/chat/ChatHeaderActionsView.tsx +74 -18
- package/src/chat/CompactionStepView.test.tsx +34 -0
- package/src/chat/CompactionStepView.tsx +85 -0
- package/src/chat/ExecutionModeSelectorView.tsx +20 -5
- package/src/chat/HeaderActionBarView.tsx +731 -0
- package/src/chat/HeaderActionOverflowMenu.tsx +137 -0
- package/src/chat/InlineModelPicker.test.tsx +81 -0
- package/src/chat/InlineModelPicker.tsx +201 -0
- package/src/chat/InlineTokenChip.tsx +2 -68
- package/src/chat/InputBarBackground.tsx +1 -1
- package/src/chat/InputBarPlaceholder.tsx +26 -3
- package/src/chat/LiveThinkingView.tsx +51 -37
- package/src/chat/MessageBoundaryViews.tsx +21 -0
- package/src/chat/MessageFeedContext.tsx +13 -5
- package/src/chat/MessageFeedLayoutView.tsx +28 -3
- package/src/chat/MessageFeedView.test.tsx +81 -0
- package/src/chat/MessageFeedView.tsx +72 -152
- package/src/chat/MessageInputView.tsx +1 -1
- package/src/chat/MessageLayoutView.tsx +1 -1
- package/src/chat/MessageSelectionContextMenuView.tsx +4 -1
- package/src/chat/MessageTimelineView.tsx +1 -1
- package/src/chat/MessageView.tsx +1 -1
- package/src/chat/MessageVisualView.tsx +1 -1
- package/src/chat/ModelConfiguration.tsx +283 -0
- package/src/chat/ModelSelectorTrigger.tsx +63 -0
- package/src/chat/ModelSelectorView.tsx +1037 -223
- package/src/chat/NewSession.ts +1 -37
- package/src/chat/NewSessionPicker.tsx +3 -2
- package/src/chat/ProjectSelectorView.tsx +3 -2
- package/src/chat/ReasoningStepSlider.tsx +61 -0
- package/src/chat/RemoteSessionBadgeView.tsx +24 -0
- package/src/chat/SkillPromptAreaView.tsx +5 -19
- package/src/chat/TeamMemberReplyCardView.test.tsx +33 -0
- package/src/chat/TeamMemberReplyCardView.tsx +133 -0
- package/src/chat/TextBlockView.tsx +7 -770
- package/src/chat/TodoProgress.tsx +25 -53
- package/src/chat/TodoStatusBarView.tsx +14 -5
- package/src/chat/UserMessageView.tsx +113 -33
- package/src/chat/header-action-narrow.test.ts +21 -0
- package/src/chat/header-action-narrow.ts +38 -0
- package/src/chat/index.ts +32 -27
- package/src/chat/markdown-link.ts +7 -279
- package/src/chat/send-button.css +4 -22
- package/src/chat/streaming-reveal.test.ts +218 -0
- package/src/chat/streaming-reveal.ts +13 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +2 -1
- package/src/file-explorer/FileContextMenuView.tsx +44 -11
- package/src/file-explorer/FileExplorerSettingsView.tsx +97 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +1 -1
- package/src/file-explorer/FileTreeNodeView.tsx +59 -18
- package/src/file-explorer/FileTreeView.tsx +236 -129
- package/src/file-explorer/file-tree-dom.ts +23 -0
- package/src/file-explorer/file-tree-rows.test.ts +74 -0
- package/src/file-explorer/file-tree-rows.ts +168 -0
- package/src/file-explorer/index.ts +17 -0
- package/src/file-explorer/types.ts +3 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +24 -16
- package/src/file-preview/FilePreviewDialogView.tsx +2 -2
- package/src/file-preview/FilePreviewView.tsx +12 -2
- package/src/file-preview/TextFileEditorView.tsx +2 -1
- package/src/index.ts +1 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +1 -1
- package/src/layout/AppFrame.tsx +3 -2
- package/src/layout/MainContentFrame.tsx +7 -2
- package/src/layout/ResizeHandle.tsx +68 -17
- package/src/layout/SidebarDock.tsx +75 -19
- package/src/layout/SidebarOverlay.tsx +1 -1
- package/src/layout/index.ts +1 -1
- package/src/layout/resize-handle-axis.test.ts +51 -0
- package/src/live-indicators.test.ts +43 -0
- package/src/markdown/CodeBlock.tsx +123 -0
- package/src/markdown/InlineTokenChip.tsx +68 -0
- package/src/markdown/MarkdownContent.tsx +411 -0
- package/src/markdown/MarkdownImage.tsx +51 -0
- package/src/markdown/MathFormula.tsx +46 -0
- package/src/markdown/MermaidBlock.tsx +43 -0
- package/src/markdown/RichCodeBlock.tsx +127 -0
- package/src/markdown/SvgPreview.tsx +45 -0
- package/src/markdown/WebsiteIcon.tsx +94 -0
- package/src/markdown/builtin-renderers.tsx +43 -0
- package/src/markdown/definition.tsx +49 -0
- package/src/markdown/host.tsx +18 -0
- package/src/markdown/index.ts +11 -0
- package/src/markdown/inline-tokens.ts +187 -0
- package/src/markdown/markdown-link.ts +279 -0
- package/src/markdown/math-client.ts +116 -0
- package/src/markdown/math-render.ts +23 -0
- package/src/markdown/math-syntax.ts +80 -0
- package/src/markdown/math.worker.ts +16 -0
- package/src/markdown/nodes.ts +15 -0
- package/src/markdown/preview-policy.ts +43 -0
- package/src/markdown/rich-labels.ts +49 -0
- package/src/markdown/rich-syntax.ts +93 -0
- package/src/markdown/stable-blocks.test.ts +90 -0
- package/src/markdown/stable-blocks.ts +124 -0
- package/src/markdown/streaming-reveal.ts +297 -0
- package/src/markdown/streaming.test.ts +57 -0
- package/src/markdown/streaming.ts +211 -0
- package/src/markdown/use-render-snapshot.ts +24 -0
- package/src/markdown/use-rich-visibility.ts +24 -0
- package/src/overlays/CommandMenuRow.tsx +38 -9
- package/src/overlays/CommandMenuView.tsx +77 -117
- package/src/overlays/ConfirmDialogView.tsx +25 -20
- package/src/overlays/ReleaseNoteMarkdown.tsx +29 -0
- package/src/overlays/SplashOptionRow.tsx +46 -0
- package/src/overlays/SplashPanel.tsx +85 -0
- package/src/overlays/SplashParts.tsx +213 -0
- package/src/overlays/UpdateCheckerView.tsx +34 -18
- package/src/overlays/UpdateRestartDialogView.tsx +139 -54
- package/src/overlays/command-menu-types.ts +2 -0
- package/src/overlays/command-menu.css +1 -20
- package/src/overlays/index.ts +14 -1
- package/src/plugin-ui/index.ts +8 -0
- package/src/project/ConversationTagDotsView.tsx +1 -1
- package/src/project/ConversationTagEditorDialogView.tsx +4 -1
- package/src/project/DefaultConversationSectionView.tsx +4 -4
- package/src/project/DefaultSessionListView.tsx +5 -31
- package/src/project/DefaultSessionRowView.tsx +106 -55
- package/src/project/ManageSessionsSplashView.tsx +439 -0
- package/src/project/NewProjectDialogView.tsx +3 -10
- package/src/project/ProjectContextMenuView.tsx +30 -139
- package/src/project/ProjectDetailPageView.test.tsx +140 -0
- package/src/project/ProjectDetailPageView.tsx +372 -165
- package/src/project/ProjectGroupView.tsx +1 -1
- package/src/project/ProjectRowView.tsx +29 -12
- package/src/project/ProjectSessionsView.tsx +25 -47
- package/src/project/QuickScrollOverlay.tsx +1 -1
- package/src/project/SessionContextMenuView.tsx +15 -7
- package/src/project/SessionRowMoreButton.tsx +50 -0
- package/src/project/SessionRowView.tsx +106 -63
- package/src/project/SessionTitleMarquee.tsx +54 -0
- package/src/project/SidebarProjectDisclosure.tsx +60 -0
- package/src/project/SidebarProjectsSectionView.tsx +6 -1
- package/src/project/index.ts +12 -0
- package/src/project/session-row-transition.ts +9 -0
- package/src/project/types.ts +4 -2
- package/src/project/useActiveSessionAutoScroll.ts +10 -4
- package/src/registry.ts +0 -2
- package/src/scheduler/AutomationDetailPaneView.tsx +68 -0
- package/src/scheduler/AutomationPageView.tsx +118 -121
- package/src/scheduler/ExecutionHistoryView.tsx +7 -5
- package/src/scheduler/TaskListView.tsx +52 -201
- package/src/scheduler/index.ts +7 -12
- package/src/settings/AchievementSettingsView.tsx +0 -1
- package/src/settings/AppshotSettingsView.tsx +0 -1
- package/src/settings/BuiltinMcpSectionView.tsx +1 -1
- package/src/settings/EnvironmentGitRowView.tsx +156 -0
- package/src/settings/EnvironmentSettingsView.tsx +25 -3
- package/src/settings/GeneralSettingsView.tsx +17 -20
- package/src/settings/ImChannelGuideDialogView.tsx +2 -2
- package/src/settings/ImFeishuDialogView.tsx +1 -1
- package/src/settings/ImLegacyImportBannerView.tsx +1 -1
- package/src/settings/ImLogDrawerView.tsx +2 -1
- package/src/settings/JsonConfigInputView.tsx +171 -0
- package/src/settings/ModelsFetchedModelsDrawerView.tsx +292 -0
- package/src/settings/ModelsProvidersSectionView.tsx +26 -23
- package/src/settings/MotionSelect.tsx +9 -7
- package/src/settings/NotificationSettingsView.tsx +79 -0
- package/src/settings/PermissionsSettingsView.tsx +3 -7
- package/src/settings/PresetProviderModelsListView.tsx +141 -24
- package/src/settings/PresetProviderRowView.tsx +205 -182
- package/src/settings/ProxySettingsSectionView.tsx +182 -0
- package/src/settings/QrBindDialogView.tsx +1 -1
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -2
- package/src/settings/RemoteMcpSectionView.tsx +1 -1
- package/src/settings/SettingChrome.tsx +2 -2
- package/src/settings/SettingsAiAssistButtonView.tsx +9 -119
- package/src/settings/SettingsFormFields.tsx +4 -7
- package/src/settings/SettingsSidebarView.tsx +64 -3
- package/src/settings/ShortcutRecorderView.test.tsx +108 -0
- package/src/settings/ShortcutRecorderView.tsx +15 -9
- package/src/settings/ShortcutsSettingsView.tsx +1 -1
- package/src/settings/SpaceEditorDialogView.tsx +120 -0
- package/src/settings/SpacesSettingsView.tsx +105 -0
- package/src/settings/WebhookEndpointListView.tsx +4 -5
- package/src/settings/index.ts +41 -29
- package/src/shared/ActivityStatusDot.tsx +69 -0
- package/src/shared/AvatarStackView.tsx +13 -13
- package/src/shared/BotAvatar.tsx +11 -9
- package/src/shared/CodeBlockCopyButton.tsx +1 -1
- package/src/shared/ContextMenuView.tsx +4 -11
- package/src/shared/MarkdownTable.tsx +2 -2
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.outline.test.tsx +59 -0
- package/src/shared/TabBar.tsx +22 -17
- package/src/shared/VettaKbd.test.tsx +52 -0
- package/src/shared/VettaKbd.tsx +81 -0
- package/src/shared/connected-tab-outline.test.ts +2 -2
- package/src/shared/connected-tab-outline.ts +2 -1
- package/src/shared/index.ts +6 -0
- package/src/shared/kbd-keys.test.ts +61 -0
- package/src/shared/kbd-keys.ts +253 -0
- package/src/shared/provider-icon/icons.ts +4 -2
- package/src/shared/provider-icon/index.tsx +1 -1
- package/src/shared/provider-icon/magpie.svg +1 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +25 -15
- package/src/sidebar/DefaultSidebar.tsx +3 -1
- package/src/sidebar/MessageCenterDialogView.tsx +3 -2
- package/src/sidebar/MessageCenterEmptyState.tsx +1 -1
- package/src/sidebar/MessageCenterTabs.tsx +1 -1
- package/src/sidebar/MessageCenterToolbarButton.tsx +1 -1
- package/src/sidebar/MessageCenterTriggerView.tsx +2 -2
- package/src/sidebar/ProjectsPanelEmptyState.tsx +26 -7
- package/src/sidebar/SessionStatusIcon.tsx +16 -1
- package/src/sidebar/SettingsMenuThemeSection.tsx +1 -1
- package/src/sidebar/SettingsMenuTriggerView.test.tsx +42 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +28 -50
- package/src/sidebar/ShowMoreSessionsButton.tsx +1 -1
- package/src/sidebar/SidebarFilterSelectView.tsx +8 -16
- package/src/sidebar/SidebarNavBadgeView.tsx +1 -1
- package/src/sidebar/SidebarNavIcon.tsx +1 -1
- package/src/sidebar/SidebarNavItemButton.tsx +1 -1
- package/src/sidebar/SidebarNavMorePanel.tsx +19 -7
- package/src/sidebar/SidebarNavigation.tsx +24 -15
- package/src/sidebar/SidebarPanel.tsx +11 -2
- package/src/sidebar/SidebarSectionTriggerLabel.tsx +20 -0
- package/src/sidebar/SidebarTopBar.tsx +10 -7
- package/src/sidebar/WaitingPulseBadge.tsx +19 -0
- package/src/sidebar/index.ts +1 -16
- package/src/skills/index.ts +0 -19
- package/src/skills/skill-icon.tsx +4 -8
- package/src/styles.css +24 -6
- package/src/chat/DefaultSceneCarousel.tsx +0 -113
- package/src/chat/SceneCard.tsx +0 -138
- package/src/scheduler/HistoryDrawerView.tsx +0 -149
- package/src/scheduler/TaskFormDialogView.tsx +0 -60
- package/src/settings/SubscriptionActionsView.tsx +0 -63
- package/src/settings/SubscriptionCardsView.tsx +0 -212
- package/src/settings/TeamDetailView.tsx +0 -148
- package/src/settings/TeamDialogsView.tsx +0 -151
- package/src/settings/TeamListView.tsx +0 -57
- package/src/settings/TeamSettingsView.tsx +0 -51
- package/src/settings/TokenActivityChartView.tsx +0 -286
- package/src/settings/UsageStatsView.tsx +0 -101
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +0 -135
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +0 -40
- package/src/settings/token-activity.test.ts +0 -195
- package/src/settings/token-activity.ts +0 -320
- package/src/sidebar/AddProjectMenuItem.tsx +0 -21
- package/src/sidebar/AddProjectMenuPopoverView.tsx +0 -52
- package/src/sidebar/NotificationMessageListView.tsx +0 -136
- package/src/sidebar/SettingsMenuAccountSection.tsx +0 -32
- package/src/sidebar/SettingsMenuQuotaSection.tsx +0 -45
- package/src/skills/SceneCardView.tsx +0 -194
- package/src/skills/SkillCardView.tsx +0 -186
- package/src/skills/SkillDetailDialogView.tsx +0 -138
- package/src/skills/SkillTagGroupView.tsx +0 -56
- package/src/skills/SkillToggleSwitch.tsx +0 -31
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import type { JSX } from "react";
|
|
1
|
+
import type { JSX, ReactNode } from "react";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 逐字符入场改为纯 CSS:原来每个字符一个 motion.span,流式全程 JS 每帧写内联
|
|
6
6
|
* style + 触发样式重算;CSS animation-delay 错峰能给出一模一样的画面,主线程零参与。
|
|
7
|
+
*
|
|
8
|
+
* 只动 opacity 和 transform:早先每个字符还带一段 blur(6px)→0,流式全程有几十个滤镜
|
|
9
|
+
* 动画同时在跑,每一帧都要重新栅格化;毛玻璃窗口上这类每帧重绘代价很高。
|
|
7
10
|
*/
|
|
8
11
|
const STREAM_CHAR_CSS = `
|
|
9
12
|
@keyframes stream-char-in {
|
|
10
|
-
from { opacity: 0;
|
|
11
|
-
to { opacity: 1;
|
|
13
|
+
from { opacity: 0; transform: translateY(3px); }
|
|
14
|
+
to { opacity: 1; transform: translateY(0); }
|
|
12
15
|
}
|
|
13
16
|
.stream-char {
|
|
14
17
|
display: inline-block;
|
|
@@ -22,6 +25,7 @@ export interface AssistantMessageFoldLabels {
|
|
|
22
25
|
waitingFold: (elapsed: number) => string;
|
|
23
26
|
expandFold: (count: number) => string;
|
|
24
27
|
collapseFold: (count: number) => string;
|
|
28
|
+
doneFold?: string;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
function useElapsedSeconds(startedAt: number | undefined, active: boolean): number {
|
|
@@ -70,7 +74,7 @@ export function AssistantMessageFold({
|
|
|
70
74
|
);
|
|
71
75
|
}
|
|
72
76
|
return (
|
|
73
|
-
<div className="mb-3">
|
|
77
|
+
<div className={expanded ? "mb-0" : "mb-3"}>
|
|
74
78
|
<button
|
|
75
79
|
type="button"
|
|
76
80
|
onClick={onToggle}
|
|
@@ -78,16 +82,22 @@ export function AssistantMessageFold({
|
|
|
78
82
|
data-export-label-collapsed={labels.expandFold(count)}
|
|
79
83
|
data-export-label-expanded={labels.collapseFold(count)}
|
|
80
84
|
aria-expanded={expanded}
|
|
81
|
-
className="
|
|
85
|
+
className="group inline-flex w-fit items-center gap-1.5 text-[14px] font-bold text-foreground transition-colors hover:opacity-85"
|
|
82
86
|
>
|
|
83
87
|
<span
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
data-export-toggle-label=""
|
|
89
|
+
className={
|
|
90
|
+
expanded
|
|
91
|
+
? ""
|
|
92
|
+
: "pb-0.5 [background-image:linear-gradient(to_right,color-mix(in_srgb,currentColor_40%,transparent)_6px,transparent_6px)] [background-position:bottom] [background-repeat:repeat-x] [background-size:9px_1px]"
|
|
93
|
+
}
|
|
94
|
+
>
|
|
87
95
|
{expanded ? labels.collapseFold(count) : labels.expandFold(count)}
|
|
88
96
|
</span>
|
|
97
|
+
<span
|
|
98
|
+
className={`icon-[mdi--chevron-right] h-4 w-4 shrink-0 transition-transform duration-200 ${expanded ? "rotate-90" : ""}`}
|
|
99
|
+
/>
|
|
89
100
|
</button>
|
|
90
|
-
<div className="h-px w-full rounded-full bg-border/80" />
|
|
91
101
|
</div>
|
|
92
102
|
);
|
|
93
103
|
}
|
|
@@ -126,10 +136,7 @@ export function StreamingIndicator({ phrases }: { phrases: string[] }): JSX.Elem
|
|
|
126
136
|
export function AssistantMessageStreamingStatus({ label }: { readonly label: string }): JSX.Element {
|
|
127
137
|
return (
|
|
128
138
|
<>
|
|
129
|
-
<span
|
|
130
|
-
className="h-1.5 w-1.5 rounded-full bg-primary/60"
|
|
131
|
-
style={{ animation: "pulse 1.5s infinite" }}
|
|
132
|
-
/>
|
|
139
|
+
<span className="vetta-live-dot h-1.5 w-1.5 rounded-full bg-primary/60" />
|
|
133
140
|
<span className="text-[11px] text-muted-foreground/35">{label}</span>
|
|
134
141
|
</>
|
|
135
142
|
);
|
|
@@ -139,8 +146,36 @@ export function AssistantMessagePredictingStatus({ label }: { readonly label: st
|
|
|
139
146
|
return <span className="processing-shimmer text-[11px] font-medium">{label}</span>;
|
|
140
147
|
}
|
|
141
148
|
|
|
149
|
+
export function AssistantMessageProcessContainer({
|
|
150
|
+
children,
|
|
151
|
+
completedLabel = "完成",
|
|
152
|
+
}: {
|
|
153
|
+
readonly children: ReactNode;
|
|
154
|
+
readonly completedLabel?: string;
|
|
155
|
+
}): JSX.Element {
|
|
156
|
+
return (
|
|
157
|
+
<div className="relative mt-0.5 mb-2.5 flex flex-col gap-2">
|
|
158
|
+
<div
|
|
159
|
+
aria-hidden="true"
|
|
160
|
+
className="absolute left-2 -translate-x-1/2 -top-2 bottom-4 w-px bg-border/70"
|
|
161
|
+
/>
|
|
162
|
+
<div className="flex flex-col gap-2 pl-6">
|
|
163
|
+
{children}
|
|
164
|
+
</div>
|
|
165
|
+
<div className="relative flex items-center gap-2 text-[14px] font-bold text-foreground">
|
|
166
|
+
<span
|
|
167
|
+
aria-hidden="true"
|
|
168
|
+
className="icon-[solar--check-circle-linear] h-4 w-4 shrink-0 text-foreground"
|
|
169
|
+
/>
|
|
170
|
+
<span className="text-[14px] font-bold text-foreground">{completedLabel}</span>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
142
176
|
export const AssistantMessage = {
|
|
143
177
|
Fold: AssistantMessageFold,
|
|
178
|
+
ProcessContainer: AssistantMessageProcessContainer,
|
|
144
179
|
StreamingStatus: AssistantMessageStreamingStatus,
|
|
145
180
|
PredictingStatus: AssistantMessagePredictingStatus,
|
|
146
181
|
StreamingIndicator,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { createRef } from "react";
|
|
4
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { AtPanelView, type AtPanelEntryModel, type AtPanelViewProps } from "./AtPanelView";
|
|
7
|
+
|
|
8
|
+
const labels: AtPanelViewProps["labels"] = {
|
|
9
|
+
header: "Reference",
|
|
10
|
+
headingMeta: "/",
|
|
11
|
+
loading: "Loading",
|
|
12
|
+
noResults: "None",
|
|
13
|
+
emptyDirectory: "Empty",
|
|
14
|
+
goUp: "..",
|
|
15
|
+
enterDirectory: "Tab to enter",
|
|
16
|
+
citeDirectory: "Attach folder",
|
|
17
|
+
citeDirectoryHint: "Attach this folder (⌘↩)",
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
function entry(overrides: Partial<AtPanelEntryModel> = {}): AtPanelEntryModel {
|
|
21
|
+
return {
|
|
22
|
+
path: "/workspace/src",
|
|
23
|
+
name: "src",
|
|
24
|
+
isDirectory: true,
|
|
25
|
+
index: 0,
|
|
26
|
+
active: false,
|
|
27
|
+
icon: "icon-folder",
|
|
28
|
+
...overrides,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function markup(entries: AtPanelEntryModel[]): string {
|
|
33
|
+
return renderToStaticMarkup(
|
|
34
|
+
<AtPanelView
|
|
35
|
+
open
|
|
36
|
+
loading={false}
|
|
37
|
+
normalizedFilter=""
|
|
38
|
+
canGoUp={false}
|
|
39
|
+
goUpActive={false}
|
|
40
|
+
entries={entries}
|
|
41
|
+
labels={labels}
|
|
42
|
+
panelRef={createRef()}
|
|
43
|
+
onGoUp={() => undefined}
|
|
44
|
+
onHoverIndex={() => undefined}
|
|
45
|
+
onEntryClick={() => undefined}
|
|
46
|
+
onCiteDirectory={() => undefined}
|
|
47
|
+
/>,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
describe("AtPanelView directory citation", () => {
|
|
52
|
+
it("浏览目录时给出单独的引用按钮,搜索结果里的目录没有", () => {
|
|
53
|
+
const browsing = markup([entry()]);
|
|
54
|
+
expect(browsing).toContain("Attach folder");
|
|
55
|
+
expect(browsing).toContain("Tab to enter");
|
|
56
|
+
|
|
57
|
+
const searching = markup([entry({ relPath: "src" })]);
|
|
58
|
+
expect(searching).not.toContain("Attach folder");
|
|
59
|
+
expect(searching).not.toContain("Tab to enter");
|
|
60
|
+
});
|
|
61
|
+
});
|
package/src/chat/AtPanelView.tsx
CHANGED
|
@@ -32,6 +32,9 @@ export interface AtPanelLabels {
|
|
|
32
32
|
emptyDirectory: string;
|
|
33
33
|
goUp: string;
|
|
34
34
|
enterDirectory: string;
|
|
35
|
+
/** 浏览目录时的「引用此目录」。旧主题可以不提供,那时不显示按钮。 */
|
|
36
|
+
citeDirectory?: string;
|
|
37
|
+
citeDirectoryHint?: string;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
export interface AtPanelViewProps {
|
|
@@ -48,6 +51,7 @@ export interface AtPanelViewProps {
|
|
|
48
51
|
onGoUp: () => void;
|
|
49
52
|
onHoverIndex: (index: number) => void;
|
|
50
53
|
onEntryClick: (entry: AtPanelEntryModel) => void;
|
|
54
|
+
onCiteDirectory?: (entry: AtPanelEntryModel) => void;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
export function AtPanelView({
|
|
@@ -64,6 +68,7 @@ export function AtPanelView({
|
|
|
64
68
|
onGoUp,
|
|
65
69
|
onHoverIndex,
|
|
66
70
|
onEntryClick,
|
|
71
|
+
onCiteDirectory,
|
|
67
72
|
}: AtPanelViewProps): JSX.Element {
|
|
68
73
|
return (
|
|
69
74
|
<AnimatePresence>
|
|
@@ -141,8 +146,11 @@ export function AtPanelView({
|
|
|
141
146
|
entry={entry}
|
|
142
147
|
className={classNames?.item}
|
|
143
148
|
enterDirectoryLabel={labels.enterDirectory}
|
|
149
|
+
citeDirectoryLabel={labels.citeDirectory}
|
|
150
|
+
citeDirectoryHint={labels.citeDirectoryHint}
|
|
144
151
|
onHover={() => onHoverIndex(entry.index)}
|
|
145
152
|
onClick={() => onEntryClick(entry)}
|
|
153
|
+
onCite={onCiteDirectory ? () => onCiteDirectory(entry) : undefined}
|
|
146
154
|
/>
|
|
147
155
|
))}
|
|
148
156
|
</div>
|
|
@@ -159,62 +167,79 @@ function AtPanelEntry({
|
|
|
159
167
|
entry,
|
|
160
168
|
className,
|
|
161
169
|
enterDirectoryLabel,
|
|
170
|
+
citeDirectoryLabel,
|
|
171
|
+
citeDirectoryHint,
|
|
162
172
|
onHover,
|
|
163
173
|
onClick,
|
|
174
|
+
onCite,
|
|
164
175
|
}: {
|
|
165
176
|
entry: AtPanelEntryModel;
|
|
166
177
|
className?: string;
|
|
167
178
|
enterDirectoryLabel: string;
|
|
179
|
+
citeDirectoryLabel?: string;
|
|
180
|
+
citeDirectoryHint?: string;
|
|
168
181
|
onHover: () => void;
|
|
169
182
|
onClick: () => void;
|
|
183
|
+
onCite?: () => void;
|
|
170
184
|
}): JSX.Element {
|
|
185
|
+
// 搜索结果带 relPath,整行点击就是引用;只有浏览中的目录才需要单独的引用按钮。
|
|
186
|
+
const browsingDirectory = entry.isDirectory && entry.relPath === undefined;
|
|
187
|
+
const citeLabel = browsingDirectory && onCite && citeDirectoryLabel ? citeDirectoryLabel : undefined;
|
|
171
188
|
return (
|
|
172
|
-
<
|
|
173
|
-
type="button"
|
|
189
|
+
<div
|
|
174
190
|
data-index={entry.index}
|
|
175
191
|
onMouseEnter={onHover}
|
|
176
|
-
|
|
177
|
-
className={["relative flex w-full items-center gap-3 px-4 py-1.5 text-left transition-colors", className]
|
|
178
|
-
.filter(Boolean)
|
|
179
|
-
.join(" ")}
|
|
192
|
+
className={["relative flex w-full items-center transition-colors", className].filter(Boolean).join(" ")}
|
|
180
193
|
style={{
|
|
181
194
|
background: entry.active ? "color-mix(in srgb, var(--primary) 9%, transparent)" : "transparent",
|
|
182
195
|
}}
|
|
183
196
|
>
|
|
184
|
-
{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
<button type="button" onClick={onClick} className="flex min-w-0 flex-1 items-center gap-3 px-4 py-1.5 text-left">
|
|
198
|
+
{entry.active && (
|
|
199
|
+
<motion.span
|
|
200
|
+
layoutId="at-active-marker"
|
|
201
|
+
className="absolute inset-y-1 left-0 w-0.5 rounded-full bg-primary"
|
|
202
|
+
transition={{ type: "spring", stiffness: 500, damping: 32 }}
|
|
203
|
+
/>
|
|
204
|
+
)}
|
|
205
|
+
{entry.avatar ? (
|
|
206
|
+
<img src={entry.avatar} alt="" className="h-5 w-5 shrink-0 rounded-full object-cover" />
|
|
207
|
+
) : (
|
|
208
|
+
<span
|
|
209
|
+
className={`${entry.icon} h-4 w-4 shrink-0 ${entry.isDirectory ? "text-muted-foreground" : "text-muted-foreground/50"}`}
|
|
210
|
+
/>
|
|
211
|
+
)}
|
|
194
212
|
<span
|
|
195
|
-
className={
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
<span
|
|
199
|
-
className={`shrink-0 truncate text-[12.5px] ${entry.isDirectory ? "font-medium text-foreground" : "text-foreground"}`}
|
|
200
|
-
>
|
|
201
|
-
{entry.name}
|
|
202
|
-
</span>
|
|
203
|
-
{entry.meta ? (
|
|
204
|
-
<span className="ml-auto truncate text-right text-[11px] text-muted-foreground/50" title={entry.meta}>
|
|
205
|
-
{entry.meta}
|
|
206
|
-
</span>
|
|
207
|
-
) : null}
|
|
208
|
-
{entry.relPath && entry.relPath !== entry.name && (
|
|
209
|
-
<span className="ml-auto truncate text-right font-mono text-[10px] text-muted-foreground/40">
|
|
210
|
-
{entry.relPath}
|
|
211
|
-
</span>
|
|
212
|
-
)}
|
|
213
|
-
{entry.isDirectory && (
|
|
214
|
-
<span className="ml-auto text-[10px] text-muted-foreground/50" title={enterDirectoryLabel}>
|
|
215
|
-
{enterDirectoryLabel}
|
|
213
|
+
className={`shrink-0 truncate text-[12.5px] ${entry.isDirectory ? "font-medium text-foreground" : "text-foreground"}`}
|
|
214
|
+
>
|
|
215
|
+
{entry.name}
|
|
216
216
|
</span>
|
|
217
|
+
{entry.meta ? (
|
|
218
|
+
<span className="ml-auto truncate text-right text-[11px] text-muted-foreground/50" title={entry.meta}>
|
|
219
|
+
{entry.meta}
|
|
220
|
+
</span>
|
|
221
|
+
) : null}
|
|
222
|
+
{entry.relPath && entry.relPath !== entry.name && (
|
|
223
|
+
<span className="ml-auto truncate text-right font-mono text-[10px] text-muted-foreground/40">
|
|
224
|
+
{entry.relPath}
|
|
225
|
+
</span>
|
|
226
|
+
)}
|
|
227
|
+
{browsingDirectory && (
|
|
228
|
+
<span className="ml-auto text-[10px] text-muted-foreground/50" title={enterDirectoryLabel}>
|
|
229
|
+
{enterDirectoryLabel}
|
|
230
|
+
</span>
|
|
231
|
+
)}
|
|
232
|
+
</button>
|
|
233
|
+
{citeLabel && (
|
|
234
|
+
<button
|
|
235
|
+
type="button"
|
|
236
|
+
onClick={onCite}
|
|
237
|
+
title={citeDirectoryHint ?? citeLabel}
|
|
238
|
+
className="mr-3 shrink-0 rounded-md px-1.5 py-0.5 text-[10px] text-muted-foreground/70 hover:bg-primary/10 hover:text-foreground"
|
|
239
|
+
>
|
|
240
|
+
{citeLabel}
|
|
241
|
+
</button>
|
|
217
242
|
)}
|
|
218
|
-
</
|
|
243
|
+
</div>
|
|
219
244
|
);
|
|
220
245
|
}
|
|
@@ -89,9 +89,8 @@ export function BashTerminalStatusDot(): JSX.Element {
|
|
|
89
89
|
return (
|
|
90
90
|
<span
|
|
91
91
|
className={`h-1.5 w-1.5 shrink-0 rounded-full ${
|
|
92
|
-
failed ? "bg-destructive/70" : pending ? "bg-primary/60" : "bg-muted-foreground/40"
|
|
92
|
+
failed ? "bg-destructive/70" : pending ? "vetta-live-dot bg-primary/60" : "bg-muted-foreground/40"
|
|
93
93
|
}`}
|
|
94
|
-
style={pending ? { animation: "pulse 1.5s infinite" } : undefined}
|
|
95
94
|
/>
|
|
96
95
|
);
|
|
97
96
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { ButtonGroup, ButtonGroupItem } from "@vetta-org/ui/button-group";
|
|
2
3
|
|
|
3
4
|
export function ChatHeaderExportAction({
|
|
4
5
|
disabled,
|
|
@@ -12,15 +13,15 @@ export function ChatHeaderExportAction({
|
|
|
12
13
|
readonly title?: string;
|
|
13
14
|
}): JSX.Element {
|
|
14
15
|
return (
|
|
15
|
-
<
|
|
16
|
+
<ButtonGroupItem title={title} aria-label={title} disabled={disabled} onClick={onClick} icon={
|
|
16
17
|
<span
|
|
17
18
|
className={
|
|
18
19
|
exporting
|
|
19
20
|
? "icon-[mdi--loading] animate-spin text-[14px]"
|
|
20
21
|
: "icon-[solar--square-share-line-linear] text-[14px]"
|
|
21
22
|
}
|
|
22
|
-
/>
|
|
23
|
-
|
|
23
|
+
/>}
|
|
24
|
+
/>
|
|
24
25
|
);
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -34,15 +35,14 @@ export function ChatHeaderPinAction({
|
|
|
34
35
|
readonly title: string;
|
|
35
36
|
}): JSX.Element {
|
|
36
37
|
return (
|
|
37
|
-
<
|
|
38
|
-
size="icon-xs"
|
|
39
|
-
variant="ghost"
|
|
38
|
+
<ButtonGroupItem
|
|
40
39
|
title={title}
|
|
40
|
+
aria-label={title}
|
|
41
|
+
active={pinned}
|
|
41
42
|
onClick={onClick}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</Button>
|
|
43
|
+
icon={
|
|
44
|
+
<span className={`${pinned ? "icon-[solar--pin-bold]" : "icon-[solar--pin-linear]"} text-[14px]`} />}
|
|
45
|
+
/>
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -56,20 +56,76 @@ export function ChatHeaderPanelAction({
|
|
|
56
56
|
readonly title: string;
|
|
57
57
|
}): JSX.Element {
|
|
58
58
|
return (
|
|
59
|
-
<
|
|
60
|
-
size="icon-xs"
|
|
61
|
-
variant="ghost"
|
|
59
|
+
<ButtonGroupItem
|
|
62
60
|
title={title}
|
|
61
|
+
aria-label={title}
|
|
62
|
+
active={open}
|
|
63
63
|
onClick={onClick}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</Button>
|
|
64
|
+
icon={
|
|
65
|
+
<span className="icon-[solar--sidebar-minimalistic-linear] -scale-x-100 text-[14px]" />}
|
|
66
|
+
/>
|
|
68
67
|
);
|
|
69
68
|
}
|
|
70
69
|
|
|
70
|
+
export function ChatHeaderBottomPanelAction({
|
|
71
|
+
onClick,
|
|
72
|
+
open,
|
|
73
|
+
title,
|
|
74
|
+
}: {
|
|
75
|
+
readonly onClick: () => void;
|
|
76
|
+
readonly open: boolean;
|
|
77
|
+
readonly title: string;
|
|
78
|
+
}): JSX.Element {
|
|
79
|
+
return (
|
|
80
|
+
<ButtonGroupItem
|
|
81
|
+
title={title}
|
|
82
|
+
aria-label={title}
|
|
83
|
+
active={open}
|
|
84
|
+
onClick={onClick}
|
|
85
|
+
icon={
|
|
86
|
+
<span className="icon-[solar--window-frame-linear] text-[14px]" />}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 一步到位打开终端。`focused` 表示此刻已经在终端里(再点不会有任何动作),
|
|
93
|
+
* 高亮与底部面板按钮的「展开」态同一套视觉。
|
|
94
|
+
*/
|
|
95
|
+
export function ChatHeaderTerminalAction({
|
|
96
|
+
disabled,
|
|
97
|
+
focused,
|
|
98
|
+
onClick,
|
|
99
|
+
title,
|
|
100
|
+
}: {
|
|
101
|
+
readonly disabled?: boolean;
|
|
102
|
+
readonly focused: boolean;
|
|
103
|
+
readonly onClick: () => void;
|
|
104
|
+
readonly title: string;
|
|
105
|
+
}): JSX.Element {
|
|
106
|
+
return (
|
|
107
|
+
<ButtonGroupItem
|
|
108
|
+
title={title}
|
|
109
|
+
aria-label={title}
|
|
110
|
+
active={focused}
|
|
111
|
+
disabled={disabled}
|
|
112
|
+
onClick={onClick}
|
|
113
|
+
icon={
|
|
114
|
+
<span className="icon-[solar--programming-linear] text-[14px]" />}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** 标题栏右侧的玻璃按钮组容器,把上面的各个动作按钮包在一起。 */
|
|
120
|
+
export function ChatHeaderActionGroup({ children }: { readonly children: ReactNode }): JSX.Element {
|
|
121
|
+
return <ButtonGroup>{children}</ButtonGroup>;
|
|
122
|
+
}
|
|
123
|
+
|
|
71
124
|
export const ChatHeaderActions = {
|
|
125
|
+
Group: ChatHeaderActionGroup,
|
|
72
126
|
Export: ChatHeaderExportAction,
|
|
73
127
|
Pin: ChatHeaderPinAction,
|
|
74
128
|
Panel: ChatHeaderPanelAction,
|
|
129
|
+
BottomPanel: ChatHeaderBottomPanelAction,
|
|
130
|
+
Terminal: ChatHeaderTerminalAction,
|
|
75
131
|
} as const;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { renderToStaticMarkup } from "react-dom/server";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { CompactionStepView } from "./CompactionStepView";
|
|
4
|
+
|
|
5
|
+
describe("CompactionStepView", () => {
|
|
6
|
+
it("shows the summary that replaced earlier context once opened", () => {
|
|
7
|
+
const closed = renderToStaticMarkup(
|
|
8
|
+
<CompactionStepView status="success" label="Context compacted" detail="120k tokens before" summary="earlier work" />,
|
|
9
|
+
);
|
|
10
|
+
expect(closed).toContain("Context compacted");
|
|
11
|
+
expect(closed).toContain("120k tokens before");
|
|
12
|
+
expect(closed).toContain('aria-expanded="false"');
|
|
13
|
+
expect(closed).not.toContain("earlier work");
|
|
14
|
+
|
|
15
|
+
const open = renderToStaticMarkup(
|
|
16
|
+
<CompactionStepView status="success" label="Context compacted" summary="earlier work" expanded />,
|
|
17
|
+
);
|
|
18
|
+
expect(open).toContain('aria-expanded="true"');
|
|
19
|
+
expect(open).toContain("earlier work");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("cannot open while running because there is no summary yet", () => {
|
|
23
|
+
const markup = renderToStaticMarkup(<CompactionStepView status="running" label="Compacting context…" />);
|
|
24
|
+
expect(markup).toContain('data-compaction-step="running"');
|
|
25
|
+
expect(markup).toContain("disabled");
|
|
26
|
+
expect(markup).toContain("tool-call-shimmer-text");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("keeps a failed compaction visibly distinct", () => {
|
|
30
|
+
const markup = renderToStaticMarkup(<CompactionStepView status="error" label="Context compaction failed" />);
|
|
31
|
+
expect(markup).toContain("icon-[solar--danger-circle-linear]");
|
|
32
|
+
expect(markup).toContain("text-destructive/80");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useId, useState, type JSX } from "react";
|
|
2
|
+
import { CollapsePanel } from "../shared/CollapsePanel";
|
|
3
|
+
|
|
4
|
+
export interface CompactionStepViewProps {
|
|
5
|
+
readonly status: "running" | "success" | "error";
|
|
6
|
+
/** Row title, e.g. "Compacting context…" / "Context compacted". */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** Secondary text after the title, e.g. the context size before compaction. */
|
|
9
|
+
readonly detail?: string;
|
|
10
|
+
/** The summary that replaced the earlier conversation; the row opens to show it. */
|
|
11
|
+
readonly summary?: string;
|
|
12
|
+
readonly expanded?: boolean;
|
|
13
|
+
readonly onToggle?: () => void;
|
|
14
|
+
readonly exportMode?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const STATUS_ICON: Record<CompactionStepViewProps["status"], string> = {
|
|
18
|
+
running: "icon-[mdi--compress] animate-pulse text-sky-500/80 dark:text-sky-400/80",
|
|
19
|
+
success: "icon-[mdi--compress] text-sky-500 dark:text-sky-400",
|
|
20
|
+
error: "icon-[solar--danger-circle-linear] text-destructive/70",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Automatic context compaction as a step of the reply: same row rhythm as a
|
|
25
|
+
* tool step, set apart by its icon and accent so it never reads as agent work.
|
|
26
|
+
*/
|
|
27
|
+
export function CompactionStepView({
|
|
28
|
+
status,
|
|
29
|
+
label,
|
|
30
|
+
detail,
|
|
31
|
+
summary,
|
|
32
|
+
expanded: expandedProp,
|
|
33
|
+
onToggle,
|
|
34
|
+
exportMode = false,
|
|
35
|
+
}: CompactionStepViewProps): JSX.Element {
|
|
36
|
+
const [uncontrolled, setUncontrolled] = useState(false);
|
|
37
|
+
const expanded = expandedProp ?? uncontrolled;
|
|
38
|
+
const generatedId = useId();
|
|
39
|
+
const panelId = exportMode ? `export-compaction-step-${generatedId}` : undefined;
|
|
40
|
+
const hasSummary = Boolean(summary?.trim());
|
|
41
|
+
const open = hasSummary && (expanded || exportMode);
|
|
42
|
+
return (
|
|
43
|
+
<div className="min-w-0 w-full" data-compaction-step={status}>
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
disabled={!hasSummary}
|
|
47
|
+
aria-expanded={open}
|
|
48
|
+
data-export-toggle={hasSummary ? panelId : undefined}
|
|
49
|
+
onClick={() => (onToggle ? onToggle() : setUncontrolled((value) => !value))}
|
|
50
|
+
className="inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-lg px-1.5 py-1 text-left transition-colors enabled:hover:bg-sky-500/10"
|
|
51
|
+
>
|
|
52
|
+
<span className={`h-3.5 w-3.5 shrink-0 ${STATUS_ICON[status]}`} aria-hidden="true" />
|
|
53
|
+
<span
|
|
54
|
+
className={`min-w-0 truncate text-[13px] ${
|
|
55
|
+
status === "running"
|
|
56
|
+
? "tool-call-shimmer-text"
|
|
57
|
+
: status === "error"
|
|
58
|
+
? "text-destructive/80"
|
|
59
|
+
: "text-sky-600/90 dark:text-sky-300/85"
|
|
60
|
+
}`}
|
|
61
|
+
>
|
|
62
|
+
{label}
|
|
63
|
+
</span>
|
|
64
|
+
{detail ? (
|
|
65
|
+
<span className="shrink-0 text-[12px] text-muted-foreground/50 tabular-nums">{detail}</span>
|
|
66
|
+
) : null}
|
|
67
|
+
{hasSummary ? (
|
|
68
|
+
<span
|
|
69
|
+
className={`icon-[solar--alt-arrow-right-linear] h-3.5 w-3.5 shrink-0 text-muted-foreground/40 transition-transform duration-200 ${open ? "rotate-90" : ""}`}
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
/>
|
|
72
|
+
) : null}
|
|
73
|
+
</button>
|
|
74
|
+
{hasSummary ? (
|
|
75
|
+
<CollapsePanel open={open} id={panelId} exportPanel={exportMode} hidden={exportMode && !expanded}>
|
|
76
|
+
<div className="ml-4 border-sky-500/25 border-l pb-1 pl-3">
|
|
77
|
+
<div className="max-h-72 overflow-y-auto whitespace-pre-wrap break-words py-1 text-[12px] leading-relaxed text-muted-foreground/80">
|
|
78
|
+
{summary}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</CollapsePanel>
|
|
82
|
+
) : null}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnimatePresence, motion } from "motion/react";
|
|
2
2
|
import type { JSX } from "react";
|
|
3
|
-
import { Popover, PopoverContent, PopoverTrigger
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@vetta-org/ui/popover";
|
|
4
|
+
import { cn } from "@vetta-org/ui/utils";
|
|
4
5
|
import { ThemeSurface } from "../appearance/ThemeSurface";
|
|
5
6
|
|
|
6
7
|
export interface ExecutionModeOptionView {
|
|
@@ -18,6 +19,10 @@ export interface ExecutionModeSelectorViewProps {
|
|
|
18
19
|
readonly selectedOption: ExecutionModeOptionView;
|
|
19
20
|
readonly options: readonly ExecutionModeOptionView[];
|
|
20
21
|
readonly className?: string;
|
|
22
|
+
/** 始终显示模式名。默认只在宽容器里显示、窄了只留图标;放在弹窗底栏这类没有容器查询的位置时要打开。 */
|
|
23
|
+
readonly showLabel?: boolean;
|
|
24
|
+
/** 弹出菜单与触发器的对齐边。 */
|
|
25
|
+
readonly contentAlign?: "start" | "end";
|
|
21
26
|
readonly classNames?: {
|
|
22
27
|
readonly root?: string;
|
|
23
28
|
readonly trigger?: string;
|
|
@@ -35,6 +40,8 @@ export function ExecutionModeSelectorView({
|
|
|
35
40
|
selectedOption,
|
|
36
41
|
options,
|
|
37
42
|
className,
|
|
43
|
+
showLabel = false,
|
|
44
|
+
contentAlign = "start",
|
|
38
45
|
classNames,
|
|
39
46
|
onOpenChange,
|
|
40
47
|
onSelect,
|
|
@@ -49,7 +56,8 @@ export function ExecutionModeSelectorView({
|
|
|
49
56
|
title={selectedOption.title}
|
|
50
57
|
className={cn(
|
|
51
58
|
// 窄容器只保留图标(title 仍可悬停查看模式名),宽了再显示文案
|
|
52
|
-
"no-drag flex h-7 max-w-full min-w-0 items-center
|
|
59
|
+
"no-drag flex h-7 max-w-full min-w-0 items-center rounded-lg text-[12px] font-medium transition-colors disabled:pointer-events-none disabled:opacity-40",
|
|
60
|
+
showLabel ? "gap-1.5 px-2" : "gap-1 px-1.5 @[22rem]:gap-1.5 @[22rem]:px-2",
|
|
53
61
|
open
|
|
54
62
|
? "bg-accent text-foreground"
|
|
55
63
|
: "text-foreground hover:bg-accent/60",
|
|
@@ -57,7 +65,14 @@ export function ExecutionModeSelectorView({
|
|
|
57
65
|
)}
|
|
58
66
|
>
|
|
59
67
|
<span className={cn(selectedOption.icon, "h-3.5 w-3.5 shrink-0")} />
|
|
60
|
-
<span
|
|
68
|
+
<span
|
|
69
|
+
className={cn(
|
|
70
|
+
"min-w-0 max-w-[5.5rem] truncate",
|
|
71
|
+
showLabel ? "inline" : "hidden @[22rem]:inline",
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
{selectedOption.label}
|
|
75
|
+
</span>
|
|
61
76
|
</button>
|
|
62
77
|
</PopoverTrigger>
|
|
63
78
|
<AnimatePresence>
|
|
@@ -66,10 +81,10 @@ export function ExecutionModeSelectorView({
|
|
|
66
81
|
forceMount
|
|
67
82
|
asChild
|
|
68
83
|
side="top"
|
|
69
|
-
align=
|
|
84
|
+
align={contentAlign}
|
|
70
85
|
sideOffset={6}
|
|
71
86
|
className={cn(
|
|
72
|
-
"w-[148px] gap-0 overflow-visible
|
|
87
|
+
"w-[148px] gap-0 overflow-visible p-0",
|
|
73
88
|
classNames?.content,
|
|
74
89
|
)}
|
|
75
90
|
style={{ animation: "none" }}
|