@vetta-org/theme-ui 0.1.2 → 0.2.0

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.
Files changed (78) hide show
  1. package/package.json +8 -16
  2. package/src/activity/ActivityPanelFrame.tsx +1 -1
  3. package/src/activity/CodePreview.tsx +15 -1
  4. package/src/activity/MarkdownPreviewView.test.tsx +53 -0
  5. package/src/activity/MarkdownPreviewView.tsx +86 -10
  6. package/src/chat/ContextRingView.test.tsx +81 -0
  7. package/src/chat/ContextRingView.tsx +78 -62
  8. package/src/chat/HeaderActionBarView.tsx +122 -47
  9. package/src/chat/HeaderActionOverflowMenu.tsx +11 -20
  10. package/src/chat/MessageFeedLayoutView.tsx +6 -5
  11. package/src/chat/MessageInputView.tsx +5 -1
  12. package/src/chat/index.ts +2 -1
  13. package/src/chat/message-feed-fade.css +80 -0
  14. package/src/chat/message-feed-fade.test.tsx +75 -0
  15. package/src/file-preview/ReadonlyCodeView.tsx +46 -0
  16. package/src/file-preview/syntax-tokens.css +1 -1
  17. package/src/image-assets.d.ts +4 -0
  18. package/src/markdown/FileLinkBadge.tsx +77 -0
  19. package/src/markdown/MarkdownContent.tsx +12 -5
  20. package/src/markdown/MarkdownImage.tsx +6 -16
  21. package/src/markdown/MermaidBlock.tsx +50 -11
  22. package/src/markdown/image-actions.ts +29 -0
  23. package/src/markdown/index.ts +1 -0
  24. package/src/markdown/preview-policy.test.ts +31 -0
  25. package/src/markdown/preview-policy.ts +33 -0
  26. package/src/markdown/progressive-chunks.test.ts +43 -0
  27. package/src/markdown/progressive-chunks.ts +58 -0
  28. package/src/markdown/rich-labels.ts +6 -0
  29. package/src/overlays/CommandMenuRow.tsx +43 -12
  30. package/src/overlays/CommandMenuView.tsx +96 -11
  31. package/src/overlays/DiagnosticsExportDialogView.tsx +236 -0
  32. package/src/overlays/MagpieHandoverDialogView.tsx +217 -0
  33. package/src/overlays/ReleaseNoteMarkdown.test.tsx +24 -0
  34. package/src/overlays/ReleaseNoteMarkdown.tsx +26 -0
  35. package/src/overlays/SplashPanel.tsx +4 -4
  36. package/src/overlays/SplashParts.tsx +6 -2
  37. package/src/overlays/UpdateRestartDialogView.tsx +65 -0
  38. package/src/overlays/assets/diagnostics-banner.webp +0 -0
  39. package/src/overlays/command-menu-types.ts +13 -1
  40. package/src/overlays/index.ts +12 -0
  41. package/src/plugin-ui/index.ts +2 -0
  42. package/src/project/DefaultConversationSectionView.tsx +13 -22
  43. package/src/project/DefaultSessionRowView.tsx +8 -0
  44. package/src/settings/ArchivedProjectsSettingsView.tsx +122 -1
  45. package/src/settings/GeneralSettingsView.tsx +2 -5
  46. package/src/settings/LauncherSettingsView.test.tsx +95 -0
  47. package/src/settings/LauncherSettingsView.tsx +273 -0
  48. package/src/settings/PetActionGalleryView.test.tsx +163 -0
  49. package/src/settings/PetActionGalleryView.tsx +216 -0
  50. package/src/settings/PetSettingsView.test.tsx +117 -0
  51. package/src/settings/PetSettingsView.tsx +86 -22
  52. package/src/settings/PresetProviderRowView.tsx +37 -98
  53. package/src/settings/ShortcutsSettingsView.tsx +0 -4
  54. package/src/settings/SpaceEditorDialogView.tsx +94 -56
  55. package/src/settings/SpacesSettingsView.tsx +53 -8
  56. package/src/settings/assets/space-editor-illustration.webp +0 -0
  57. package/src/settings/index.ts +18 -39
  58. package/src/shared/SegmentedControl.test.tsx +68 -0
  59. package/src/shared/SegmentedControl.tsx +10 -2
  60. package/src/shared/TabBar.tsx +2 -2
  61. package/src/shared/VettaKbd.tsx +20 -1
  62. package/src/shared/index.ts +2 -1
  63. package/src/shared/platform.ts +9 -0
  64. package/src/sidebar/AddProjectMenuTriggerView.tsx +11 -12
  65. package/src/sidebar/SettingsMenuTriggerView.tsx +2 -1
  66. package/src/sidebar/SidebarSectionActionButton.test.tsx +91 -0
  67. package/src/sidebar/SidebarSectionActionButton.tsx +52 -0
  68. package/src/styles.css +2 -0
  69. package/src/settings/AchievementNavigationButtonView.tsx +0 -90
  70. package/src/settings/AchievementPromotionDialogView.tsx +0 -91
  71. package/src/settings/AchievementSettingsView.tsx +0 -43
  72. package/src/settings/PetBubbleStylePreviewView.tsx +0 -44
  73. package/src/settings/QuickPanelSettingsSectionView.tsx +0 -64
  74. package/src/settings/achievements/AchievementCurtains.tsx +0 -50
  75. package/src/settings/achievements/AchievementPromotionBadge3D.tsx +0 -350
  76. package/src/settings/achievements/AchievementPromotionConfetti.tsx +0 -71
  77. package/src/settings/achievements/AchievementTitle.tsx +0 -52
  78. package/src/settings/achievements/index.ts +0 -13
@@ -0,0 +1,217 @@
1
+ import { AnimatePresence, motion } from "motion/react";
2
+ import { type JSX, type ReactNode, useRef } from "react";
3
+ import { cn, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
4
+
5
+ export interface MagpieHandoverDialogViewLabels {
6
+ /** 标题上方的小字,点明这是一次接入方式的变化。 */
7
+ readonly eyebrow: string;
8
+ readonly title: string;
9
+ readonly description: string;
10
+ readonly stepInstall: string;
11
+ readonly stepConnect: string;
12
+ readonly stepUse: string;
13
+ /** 要在 Magpie 插件页搜索的包名,做成可复制的小标签。 */
14
+ readonly pluginName: string;
15
+ /** 插件名旁的说明,让用户认准官方发布者(如「发布者 openvetta」)。 */
16
+ readonly pluginPublisher: string;
17
+ readonly copy: string;
18
+ readonly copied: string;
19
+ readonly defaultModelCleared: string;
20
+ /** 删掉的是用户唯一的服务商:讲明接入前发不了消息。 */
21
+ readonly noProvidersLeft: string;
22
+ readonly primary: string;
23
+ readonly guide: string;
24
+ readonly close: string;
25
+ }
26
+
27
+ export interface MagpieHandoverDialogViewProps {
28
+ readonly visible: boolean;
29
+ readonly labels: MagpieHandoverDialogViewLabels;
30
+ /** 默认模型原本是 Magpie 的,随旧配置一起被清掉了。 */
31
+ readonly defaultModelCleared: boolean;
32
+ /** 删完后没有别的可用服务商:比默认模型被清掉更要紧,两条都成立时只显示这一条。 */
33
+ readonly noProvidersLeft: boolean;
34
+ readonly copied: boolean;
35
+ /** 顶部两枚图标:Vetta 的应用图标与 Magpie 的服务商图标,由宿主提供。 */
36
+ readonly vettaIcon: ReactNode;
37
+ readonly magpieIcon: ReactNode;
38
+ readonly onCopyPluginName: () => void;
39
+ readonly onOpenGuide: () => void;
40
+ readonly onClose: () => void;
41
+ }
42
+
43
+ const pillClass =
44
+ "inline-flex h-11 w-full items-center justify-center rounded-full bg-primary px-5 text-[14px] font-medium whitespace-nowrap text-primary-foreground shadow-lg shadow-black/15 transition-all outline-none select-none hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/50 active:translate-y-px";
45
+
46
+ // 图标块在任何主题下都是白底,单色图标(跟随文字颜色)要固定成深色,否则深色模式下是浅灰、看不清。
47
+ const iconTileClass =
48
+ "flex size-16 items-center justify-center overflow-hidden rounded-[18px] bg-white text-neutral-900 shadow-[0_10px_28px_rgba(15,23,42,0.18),0_2px_6px_rgba(15,23,42,0.12)] ring-1 ring-black/5";
49
+
50
+ /**
51
+ * 升级后告诉老用户:Magpie 改由 Magpie 在其 Agents 页接入 Vetta。
52
+ * 与「版本介绍」同一套外观:大圆角面板、顶部横幅、通栏胶囊主按钮、右上角白色关闭钮。
53
+ * 横幅是静态的两枚图标加一条连线,表示模型从 Magpie 流向 Vetta。
54
+ */
55
+ export function MagpieHandoverDialogView({
56
+ visible,
57
+ labels,
58
+ defaultModelCleared,
59
+ noProvidersLeft,
60
+ copied,
61
+ vettaIcon,
62
+ magpieIcon,
63
+ onCopyPluginName,
64
+ onOpenGuide,
65
+ onClose,
66
+ }: MagpieHandoverDialogViewProps): JSX.Element {
67
+ const overlayRef = useRef<HTMLDivElement>(null);
68
+ const steps = [
69
+ { text: labels.stepInstall, extra: true },
70
+ { text: labels.stepConnect, extra: false },
71
+ { text: labels.stepUse, extra: false },
72
+ ];
73
+
74
+ return (
75
+ <AnimatePresence>
76
+ {visible && (
77
+ <motion.div
78
+ ref={overlayRef}
79
+ initial={{ opacity: 0 }}
80
+ animate={{ opacity: 1 }}
81
+ exit={{ opacity: 0 }}
82
+ transition={{ duration: 0.15 }}
83
+ className={cn("pointer-events-auto fixed inset-0 z-[100] flex items-center justify-center", OVERLAY_BACKDROP_CLASS)}
84
+ onClick={(event) => {
85
+ if (event.target === overlayRef.current) onClose();
86
+ }}
87
+ onKeyDown={(event) => {
88
+ if (event.key === "Escape") onClose();
89
+ }}
90
+ >
91
+ <motion.div
92
+ role="dialog"
93
+ aria-modal="true"
94
+ aria-label={labels.title}
95
+ initial={{ opacity: 0, scale: 0.95 }}
96
+ animate={{ opacity: 1, scale: 1 }}
97
+ exit={{ opacity: 0, scale: 0.95 }}
98
+ transition={{ duration: 0.15, ease: [0.25, 0.1, 0.25, 1] }}
99
+ className={cn(
100
+ "relative flex max-h-[min(780px,calc(100vh-48px))] w-[min(520px,calc(100vw-32px))] flex-col overflow-hidden rounded-3xl bg-popover",
101
+ PANEL_SHADOW_CLASS,
102
+ )}
103
+ >
104
+ <button
105
+ type="button"
106
+ onClick={onClose}
107
+ aria-label={labels.close}
108
+ className="absolute top-4 right-4 z-20 inline-flex size-8 items-center justify-center rounded-full bg-white text-neutral-900 shadow-[0_6px_18px_rgba(0,0,0,0.28),0_1px_3px_rgba(0,0,0,0.22)] transition-transform outline-none hover:scale-105 focus-visible:ring-2 focus-visible:ring-white/70 active:scale-95"
109
+ >
110
+ <span className="icon-[mdi--close] h-4 w-4" />
111
+ </button>
112
+
113
+ <div className="no-scrollbar min-h-0 flex-1 overflow-y-auto [mask-image:linear-gradient(to_bottom,black_calc(100%-20px),transparent)]">
114
+ <HandoverBanner vettaIcon={vettaIcon} magpieIcon={magpieIcon} />
115
+
116
+ <div className="px-7 pt-5 pb-5">
117
+ <p className="text-[11px] font-semibold tracking-[0.08em] text-primary uppercase">{labels.eyebrow}</p>
118
+ <h3 className="mt-1.5 text-[19px] leading-snug font-semibold tracking-tight text-foreground">
119
+ {labels.title}
120
+ </h3>
121
+ <p className="mt-2 text-[13px] leading-relaxed text-muted-foreground">{labels.description}</p>
122
+
123
+ <ol className="mt-5 flex flex-col gap-2">
124
+ {steps.map((step, index) => (
125
+ <li
126
+ key={step.text}
127
+ className="flex items-start gap-3 rounded-2xl border border-border/70 bg-muted/40 px-4 py-3"
128
+ >
129
+ <span className="mt-px inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-primary/12 text-[12px] font-semibold text-primary tabular-nums">
130
+ {index + 1}
131
+ </span>
132
+ <div className="min-w-0 flex-1">
133
+ <p className="text-[13px] leading-6 text-foreground">{step.text}</p>
134
+ {step.extra && (
135
+ <div className="mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1">
136
+ <button
137
+ type="button"
138
+ onClick={onCopyPluginName}
139
+ title={copied ? labels.copied : labels.copy}
140
+ className="group inline-flex h-7 items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 font-mono text-[12px] text-foreground transition-colors outline-none hover:border-primary/50 focus-visible:ring-2 focus-visible:ring-ring/50"
141
+ >
142
+ {labels.pluginName}
143
+ <span
144
+ className={cn(
145
+ "h-3.5 w-3.5 transition-colors",
146
+ copied
147
+ ? "icon-[mdi--check] text-emerald-500"
148
+ : "icon-[mdi--content-copy] text-muted-foreground group-hover:text-foreground",
149
+ )}
150
+ />
151
+ <span className="sr-only">{copied ? labels.copied : labels.copy}</span>
152
+ </button>
153
+ <span className="inline-flex items-center gap-1 text-[12px] text-muted-foreground">
154
+ <span className="icon-[mdi--check-decagram] h-3.5 w-3.5 text-primary" />
155
+ {labels.pluginPublisher}
156
+ </span>
157
+ </div>
158
+ )}
159
+ </div>
160
+ </li>
161
+ ))}
162
+ </ol>
163
+
164
+ {(noProvidersLeft || defaultModelCleared) && (
165
+ <div className="mt-3 flex items-start gap-2.5 rounded-2xl border border-amber-500/30 bg-amber-500/10 px-4 py-3">
166
+ <span className="mt-0.5 icon-[mdi--information-outline] h-4 w-4 shrink-0 text-amber-500" />
167
+ <p className="text-[12.5px] leading-relaxed text-foreground/90">
168
+ {noProvidersLeft ? labels.noProvidersLeft : labels.defaultModelCleared}
169
+ </p>
170
+ </div>
171
+ )}
172
+ </div>
173
+ </div>
174
+
175
+ <div className="flex flex-col items-center gap-2 px-7 pt-2 pb-6">
176
+ <button type="button" onClick={onClose} className={pillClass}>
177
+ {labels.primary}
178
+ </button>
179
+ <button
180
+ type="button"
181
+ onClick={onOpenGuide}
182
+ className="inline-flex h-8 items-center gap-1 rounded-full px-3 text-[12.5px] text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50"
183
+ >
184
+ {labels.guide}
185
+ <span className="icon-[mdi--open-in-new] h-3.5 w-3.5" />
186
+ </button>
187
+ </div>
188
+ </motion.div>
189
+ </motion.div>
190
+ )}
191
+ </AnimatePresence>
192
+ );
193
+ }
194
+
195
+ /** 静态横幅:Magpie 在左、Vetta 在右,中间虚线与箭头表示模型由 Magpie 接入 Vetta。 */
196
+ function HandoverBanner({ vettaIcon, magpieIcon }: { readonly vettaIcon: ReactNode; readonly magpieIcon: ReactNode }): JSX.Element {
197
+ return (
198
+ <div className="relative flex h-[148px] items-center justify-center overflow-hidden bg-[radial-gradient(120%_90%_at_50%_0%,color-mix(in_oklab,var(--primary)_22%,transparent),transparent_70%),linear-gradient(180deg,color-mix(in_oklab,var(--primary)_10%,var(--popover)),var(--popover))]">
199
+ {/* 淡淡的网格底纹,呼应 Vetta 图标的蓝格背景。 */}
200
+ <div
201
+ aria-hidden
202
+ className="absolute inset-0 opacity-[0.35] [background-image:linear-gradient(to_right,color-mix(in_oklab,var(--primary)_18%,transparent)_1px,transparent_1px),linear-gradient(to_bottom,color-mix(in_oklab,var(--primary)_18%,transparent)_1px,transparent_1px)] [background-size:28px_28px] [mask-image:radial-gradient(70%_80%_at_50%_45%,black,transparent)]"
203
+ />
204
+ <div className="relative flex items-center gap-4">
205
+ <div className={iconTileClass}>{magpieIcon}</div>
206
+ <div aria-hidden className="flex items-center gap-1.5 text-primary">
207
+ <span className="h-px w-6 border-t-2 border-dashed border-primary/45" />
208
+ <span className="inline-flex size-7 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-md shadow-primary/30">
209
+ <span className="icon-[mdi--arrow-right] h-4 w-4" />
210
+ </span>
211
+ <span className="h-px w-6 border-t-2 border-dashed border-primary/45" />
212
+ </div>
213
+ <div className={iconTileClass}>{vettaIcon}</div>
214
+ </div>
215
+ </div>
216
+ );
217
+ }
@@ -0,0 +1,24 @@
1
+ import { renderToStaticMarkup } from "react-dom/server";
2
+ import { describe, expect, it } from "vitest";
3
+ import { ReleaseNoteMarkdown } from "./ReleaseNoteMarkdown";
4
+
5
+ function renderNote(note: string): string {
6
+ return renderToStaticMarkup(<ReleaseNoteMarkdown>{note}</ReleaseNoteMarkdown>);
7
+ }
8
+
9
+ describe("ReleaseNoteMarkdown", () => {
10
+ it("opens web links in a new window so the host hands them to the system browser", () => {
11
+ const html = renderNote("See [the issue](https://github.com/openvetta/open-vetta/issues/8).");
12
+
13
+ expect(html).toContain('href="https://github.com/openvetta/open-vetta/issues/8"');
14
+ expect(html).toContain('target="_blank"');
15
+ expect(html).toContain('rel="noopener noreferrer"');
16
+ });
17
+
18
+ it("renders non-web links as plain text so clicking cannot navigate the app window", () => {
19
+ const html = renderNote("Read [the docs](./docs/guide.md).");
20
+
21
+ expect(html).not.toContain("<a");
22
+ expect(html).toContain("the docs");
23
+ });
24
+ });
@@ -2,6 +2,17 @@ import type { JSX } from "react";
2
2
  import ReactMarkdown, { type Components } from "react-markdown";
3
3
  import remarkGfm from "remark-gfm";
4
4
 
5
+ const EXTERNAL_LINK_PROTOCOLS = new Set(["http:", "https:", "mailto:"]);
6
+
7
+ function isExternalLink(href: string | undefined): href is string {
8
+ if (!href) return false;
9
+ try {
10
+ return EXTERNAL_LINK_PROTOCOLS.has(new URL(href).protocol);
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+
5
16
  /** 更新日志的排版:标题、列表、行内代码要有层次和间距,不依赖宿主的 markdown 样式。 */
6
17
  const releaseNoteComponents: Components = {
7
18
  h1: ({ children }) => <h1 className="mb-2 text-[14px] font-semibold text-foreground">{children}</h1>,
@@ -14,6 +25,21 @@ const releaseNoteComponents: Components = {
14
25
  ol: ({ children }) => <ol className="my-1.5 list-decimal space-y-1.5 pl-5">{children}</ol>,
15
26
  li: ({ children }) => <li className="pl-0.5">{children}</li>,
16
27
  strong: ({ children }) => <strong className="font-semibold text-foreground">{children}</strong>,
28
+ // 普通 <a href> 会把整个主窗口导航到该网页且无法返回。外链改走 target=_blank,
29
+ // 由主进程的 window-open handler 交给系统浏览器;其余(相对路径、锚点)只显示文字。
30
+ a: ({ href, children }) =>
31
+ isExternalLink(href) ? (
32
+ <a
33
+ href={href}
34
+ target="_blank"
35
+ rel="noopener noreferrer"
36
+ className="text-primary underline decoration-primary/30 hover:decoration-primary"
37
+ >
38
+ {children}
39
+ </a>
40
+ ) : (
41
+ <span>{children}</span>
42
+ ),
17
43
  code: ({ children }) => (
18
44
  <code className="rounded bg-muted px-1 py-0.5 font-mono text-[11.5px] text-foreground">{children}</code>
19
45
  ),
@@ -3,11 +3,11 @@ import { useRef, type JSX, type ReactNode } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import { ThemeSurface } from "../appearance/ThemeSurface";
5
5
  import "./command-menu.css";
6
- import { cn, OVERLAY_BACKDROP_CLASS, PANEL_SHADOW_CLASS } from "@vetta-org/ui/utils";
6
+ import { cn, GLASS_PANEL_CLASS, OVERLAY_BACKDROP_CLASS } from "@vetta-org/ui/utils";
7
7
 
8
8
  /**
9
9
  * 居中偏上的 Splash 面板外壳:遮罩 + 入场动效 + 高光边 + 主题 surface 槽位。
10
- * ⌘K 命令面板与「添加项目」这类选项面板共用这一份,样式只在这里改一次。
10
+ * ⌘T 命令面板与「添加项目」这类选项面板共用这一份,样式只在这里改一次。
11
11
  *
12
12
  * 自己 portal 到 body:宿主可能把它挂在侧栏之类带 transform / contain 的祖先里,
13
13
  * 那样 `fixed` 会相对祖先定位,面板就缩在侧栏里了。
@@ -67,8 +67,8 @@ export function SplashPanel({
67
67
  exit={{ opacity: 0, scale: 0.96, y: -8 }}
68
68
  transition={{ duration: 0.16, ease: [0.25, 0.1, 0.25, 1] }}
69
69
  style={{ width: `min(${width}, calc(100vw - 32px))` }}
70
- // 不用边框线,靠柔和的大半径投影把面板托起来(与 Dialog 共用 PANEL_SHADOW_CLASS)。
71
- className={cn("command-menu-sheen relative flex flex-col rounded-2xl bg-popover", PANEL_SHADOW_CLASS)}
70
+ // 玻璃面板:与 ButtonGroup 同一套半透明叠层 + 内阴影高光边(见 GLASS_PANEL_CLASS)。
71
+ className={cn("command-menu-sheen relative flex flex-col rounded-2xl", GLASS_PANEL_CLASS)}
72
72
  >
73
73
  <ThemeSurface slot="root.commandMenu.panel" />
74
74
  <div className="relative z-10 flex min-h-0 flex-col">
@@ -53,6 +53,8 @@ export interface SplashInputHeaderProps {
53
53
  >;
54
54
  /** 挂载后自动聚焦,默认开启:进入这一步后的第一个动作就是打字。 */
55
55
  readonly autoFocus?: boolean;
56
+ /** 输入框右侧的附加内容,例如唤起面板的快捷键提示。 */
57
+ readonly trailing?: ReactNode;
56
58
  }
57
59
 
58
60
  export function SplashInputHeader({
@@ -69,6 +71,7 @@ export function SplashInputHeader({
69
71
  inputRef,
70
72
  inputProps,
71
73
  autoFocus = true,
74
+ trailing,
72
75
  }: SplashInputHeaderProps): JSX.Element {
73
76
  const ownRef = useRef<HTMLInputElement | null>(null);
74
77
  const ref = inputRef ?? ownRef;
@@ -119,6 +122,7 @@ export function SplashInputHeader({
119
122
  }}
120
123
  className="min-w-0 flex-1 bg-transparent text-[14px] text-foreground outline-none placeholder:text-muted-foreground/70 disabled:opacity-60"
121
124
  />
125
+ {trailing}
122
126
  </div>
123
127
  );
124
128
  }
@@ -162,8 +166,8 @@ export function SplashFooter({ children, className }: { children: ReactNode; cla
162
166
  return (
163
167
  <div
164
168
  className={cn(
165
- // 唯一保留分隔线的地方,并用与面板不同的底色把操作区托出来。
166
- "flex min-h-8 shrink-0 items-center gap-3 border-t border-border/60 bg-muted/50 px-3.5 py-1",
169
+ // 唯一保留分隔线的地方;玻璃面板上不另铺底色,只用一条极淡的线把操作区分开。
170
+ "flex min-h-9 shrink-0 items-center gap-3 border-t border-foreground/[0.06] px-3.5 py-1.5 dark:border-white/[0.07]",
167
171
  "text-[11px] text-muted-foreground/80",
168
172
  className,
169
173
  )}
@@ -19,6 +19,12 @@ export interface UpdateRestartDialogAction {
19
19
  readonly onClick: () => void;
20
20
  }
21
21
 
22
+ export interface UpdateRestartDialogEarlierNote {
23
+ readonly id: string;
24
+ readonly title: string;
25
+ readonly note: string;
26
+ }
27
+
22
28
  export interface UpdateRestartDialogViewProps {
23
29
  readonly bannerSrc: string;
24
30
  /** 无正文时的占位文案(如「暂无版本介绍」);有 releaseNote 时不显示。 */
@@ -29,6 +35,12 @@ export interface UpdateRestartDialogViewProps {
29
35
  /** 底部唯一的悬浮按钮;省略时不显示底栏,只能用右上角的关闭按钮离开。 */
30
36
  readonly primary?: UpdateRestartDialogAction;
31
37
  readonly releaseNote?: string;
38
+ /** 跨多个版本更新时更早的各版说明(从新到旧),逐版折叠,点开才显示正文。 */
39
+ readonly earlierReleaseNotes?: ReadonlyArray<UpdateRestartDialogEarlierNote>;
40
+ /** 「更早的版本」分组标题,有 earlierReleaseNotes 时显示。 */
41
+ readonly earlierTitle?: string;
42
+ /** 正文末尾的「查看全部更新记录」链接。 */
43
+ readonly viewAll?: UpdateRestartDialogAction;
32
44
  readonly status?: UpdateRestartDialogStatus;
33
45
  readonly subtitle?: string;
34
46
  readonly title: string;
@@ -44,6 +56,8 @@ const pillClass =
44
56
  export function UpdateRestartDialogView({
45
57
  bannerSrc,
46
58
  closeLabel,
59
+ earlierReleaseNotes,
60
+ earlierTitle,
47
61
  emptyText,
48
62
  loading = false,
49
63
  onClose,
@@ -53,6 +67,7 @@ export function UpdateRestartDialogView({
53
67
  status,
54
68
  subtitle,
55
69
  title,
70
+ viewAll,
56
71
  visible,
57
72
  }: UpdateRestartDialogViewProps): JSX.Element {
58
73
  // 滚动后才显示顶部渐隐,初始位置横幅完整露出。
@@ -124,6 +139,29 @@ export function UpdateRestartDialogView({
124
139
  </div>
125
140
  </div>
126
141
  )}
142
+ {earlierReleaseNotes && earlierReleaseNotes.length > 0 && (
143
+ <div className="mt-7">
144
+ {earlierTitle && (
145
+ <p className="text-[12px] font-medium text-muted-foreground/80">{earlierTitle}</p>
146
+ )}
147
+ <div className="mt-2 divide-y divide-border/60 overflow-hidden rounded-xl border border-border/60">
148
+ {earlierReleaseNotes.map((item) => (
149
+ <EarlierReleaseNote key={item.id} item={item} />
150
+ ))}
151
+ </div>
152
+ </div>
153
+ )}
154
+ {viewAll && (
155
+ <button
156
+ type="button"
157
+ onClick={viewAll.onClick}
158
+ disabled={viewAll.disabled}
159
+ className="mt-4 inline-flex items-center gap-1 rounded-sm text-[13px] text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring/50"
160
+ >
161
+ {viewAll.label}
162
+ <span className="icon-[mdi--open-in-new] h-3.5 w-3.5" />
163
+ </button>
164
+ )}
127
165
  {loading && (
128
166
  <div className="mt-5 flex items-center gap-2 text-[13px] text-muted-foreground">
129
167
  <span className="icon-[mdi--loading] h-4 w-4 animate-spin" />
@@ -168,6 +206,33 @@ export function UpdateRestartDialogView({
168
206
  );
169
207
  }
170
208
 
209
+ function EarlierReleaseNote({ item }: { readonly item: UpdateRestartDialogEarlierNote }): JSX.Element {
210
+ const [open, setOpen] = useState(false);
211
+ return (
212
+ <div>
213
+ <button
214
+ type="button"
215
+ aria-expanded={open}
216
+ onClick={() => setOpen((value) => !value)}
217
+ className="flex w-full items-center justify-between gap-3 px-4 py-2.5 text-left text-[13px] font-medium text-foreground outline-none transition-colors hover:bg-muted/50 focus-visible:bg-muted/50"
218
+ >
219
+ {item.title}
220
+ <span
221
+ className={cn(
222
+ "icon-[mdi--chevron-down] h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-150",
223
+ open && "rotate-180",
224
+ )}
225
+ />
226
+ </button>
227
+ {open && (
228
+ <div className="markdown-body px-4 pt-1 pb-4 text-[13px] leading-[1.6] break-words text-muted-foreground">
229
+ <ReleaseNoteMarkdown>{item.note}</ReleaseNoteMarkdown>
230
+ </div>
231
+ )}
232
+ </div>
233
+ );
234
+ }
235
+
171
236
  function StatusLine({ status }: { readonly status: UpdateRestartDialogStatus }): JSX.Element {
172
237
  if (status.kind === "progress") {
173
238
  const percent = Math.max(0, Math.min(100, Math.round(status.progress * 100)));
@@ -20,6 +20,14 @@ export interface CommandMenuItemView {
20
20
  /** iconify 类名,例如 `icon-[solar--folder-linear]`。 */
21
21
  readonly icon: string;
22
22
  readonly badge?: string;
23
+ /** badge 的色调:accent 用主题强调色(如「技能」),默认是中性灰。 */
24
+ readonly badgeTone?: "neutral" | "accent";
25
+ /**
26
+ * 会话的进行中状态:有值时行首图标换成与侧栏一致的状态图标,并在行尾显示 statusLabel。
27
+ * waiting 指会话正等着用户处理(提问 / 审批 / 询问 / 授权);unread 指一轮已跑完、用户还没打开看。
28
+ */
29
+ readonly status?: "running" | "waiting" | "unread";
30
+ readonly statusLabel?: string;
23
31
  /** 行尾的标签色点(管理会话用),按给定顺序排列。 */
24
32
  readonly tagColors?: readonly string[];
25
33
  /** 命中了但当前打不开(例如无权限的会话):显示但禁用,不静默过滤。 */
@@ -43,7 +51,11 @@ export interface CommandMenuViewLabels {
43
51
  readonly emptyHint: string;
44
52
  readonly loading: string;
45
53
  readonly title: string;
46
- readonly hintNavigate: string;
54
+ /** 右下角操作按钮组的无障碍名称。 */
55
+ readonly actionsLabel: string;
56
+ /** 左下角「新会话」按钮文案。 */
57
+ readonly newSession: string;
58
+ /** 按钮文案只写动作(「打开」),键帽由视图按平台渲染。 */
47
59
  readonly hintSelect: string;
48
60
  readonly hintClose: string;
49
61
  }
@@ -17,9 +17,20 @@ export type {
17
17
  export type { DetailDrawerProps } from "./DetailDrawer";
18
18
  export { DetailDrawer } from "./DetailDrawer";
19
19
  export { DetailDrawerEnter } from "./DetailDrawerEnter";
20
+ export type {
21
+ DiagnosticsExportDialogPhase,
22
+ DiagnosticsExportDialogViewLabels,
23
+ DiagnosticsExportDialogViewProps,
24
+ } from "./DiagnosticsExportDialogView";
25
+ export { DiagnosticsExportDialogView } from "./DiagnosticsExportDialogView";
20
26
  export { shouldCloseDetailDrawer } from "./detail-drawer-guard";
21
27
  export type { KnowledgeDropOverlayViewProps } from "./KnowledgeDropOverlayView";
22
28
  export { KnowledgeDropOverlayView } from "./KnowledgeDropOverlayView";
29
+ export type {
30
+ MagpieHandoverDialogViewLabels,
31
+ MagpieHandoverDialogViewProps,
32
+ } from "./MagpieHandoverDialogView";
33
+ export { MagpieHandoverDialogView } from "./MagpieHandoverDialogView";
23
34
  export type {
24
35
  RouteErrorPageViewLabels,
25
36
  RouteErrorPageViewProps,
@@ -51,6 +62,7 @@ export type {
51
62
  export { UpdateCheckerAction, UpdateCheckerDetail, UpdateCheckerView } from "./UpdateCheckerView";
52
63
  export type {
53
64
  UpdateRestartDialogAction,
65
+ UpdateRestartDialogEarlierNote,
54
66
  UpdateRestartDialogStatus,
55
67
  UpdateRestartDialogViewProps,
56
68
  } from "./UpdateRestartDialogView";
@@ -30,5 +30,7 @@ export type { VettaKbdKey, VettaKbdPlatform } from "../shared/kbd-keys";
30
30
  export type { MultiplierTagProps } from "../shared/MultiplierTag";
31
31
  export { fmtMultiplier, MultiplierTag } from "../shared/MultiplierTag";
32
32
  export { getProviderIcon, PROVIDER_ICONS, ProviderIcon } from "../shared/provider-icon";
33
+ export type { SegmentedControlItem, SegmentedControlProps } from "../shared/SegmentedControl";
34
+ export { SegmentedControl } from "../shared/SegmentedControl";
33
35
  export type { VettaKbdProps, VettaKbdSize } from "../shared/VettaKbd";
34
36
  export { VettaKbd } from "../shared/VettaKbd";
@@ -1,5 +1,6 @@
1
1
  import { cn } from "@vetta-org/ui/utils";
2
2
  import type { JSX, ReactNode } from "react";
3
+ import { SidebarSectionActionButton } from "../sidebar/SidebarSectionActionButton";
3
4
 
4
5
  export interface DefaultConversationSectionViewLabels {
5
6
  more: string;
@@ -15,10 +16,7 @@ export interface DefaultConversationSectionViewProps {
15
16
  onNewSession?: () => void;
16
17
  onOpenContextMenu: (event: React.MouseEvent) => void;
17
18
  showNewSession: boolean;
18
- /**
19
- * When the conversation list is empty, keep header actions visible so users
20
- * can discover “new session” without hovering the row.
21
- */
19
+ /** 对话列表为空时常驻标题行操作,引导开始第一个对话;有对话后只在悬停标题行时出现。 */
22
20
  actionsAlwaysVisible?: boolean;
23
21
  }
24
22
 
@@ -36,10 +34,7 @@ export function DefaultConversationSectionView({
36
34
  showNewSession,
37
35
  actionsAlwaysVisible = false,
38
36
  }: DefaultConversationSectionViewProps): JSX.Element {
39
- const actionButtonClass = actionsAlwaysVisible
40
- ? "flex items-center justify-center rounded-md p-1.5 text-foreground opacity-70 transition-opacity hover:bg-accent hover:opacity-100"
41
- : "flex items-center justify-center rounded-md p-1.5 text-foreground opacity-0 transition-opacity hover:bg-accent group-hover:opacity-60 group-hover:hover:opacity-100";
42
-
37
+ const reveal = actionsAlwaysVisible ? "always" : "hover";
43
38
  return (
44
39
  <div className={cn("flex flex-col", className)}>
45
40
  <div
@@ -48,23 +43,19 @@ export function DefaultConversationSectionView({
48
43
  >
49
44
  <div className="flex min-w-0 items-center gap-0.5">{filterSelect}</div>
50
45
  <div className="flex items-center">
51
- <button
52
- type="button"
53
- title={labels.more}
46
+ <SidebarSectionActionButton
47
+ iconClassName="icon-[solar--menu-dots-bold]"
48
+ label={labels.more}
54
49
  onClick={onMoreClick}
55
- className={actionButtonClass}
56
- >
57
- <span className="icon-[solar--menu-dots-bold] h-4 w-4" />
58
- </button>
50
+ reveal={reveal}
51
+ />
59
52
  {showNewSession && onNewSession && (
60
- <button
61
- type="button"
62
- title={labels.newSession}
53
+ <SidebarSectionActionButton
54
+ iconClassName="icon-[solar--add-linear]"
55
+ label={labels.newSession}
63
56
  onClick={onNewSession}
64
- className={actionButtonClass}
65
- >
66
- <span className="icon-[solar--add-linear] h-4 w-4" />
67
- </button>
57
+ reveal={reveal}
58
+ />
68
59
  )}
69
60
  </div>
70
61
  </div>
@@ -25,6 +25,8 @@ export interface DefaultSessionRowViewProps {
25
25
  sessionPath?: string;
26
26
  /** Tooltip / secondary label (e.g. forked-from preview). */
27
27
  titleExtra?: string;
28
+ /** 标题后的弱化短文本,例如平铺列表中会话所属的项目名。 */
29
+ secondaryLabel?: string;
28
30
  /** Session was forked from another session. */
29
31
  forked?: boolean;
30
32
  /** Tag colors carried by this conversation; replaces the leading icon when present. */
@@ -57,6 +59,7 @@ export const DefaultSessionRowView = memo(function DefaultSessionRowView({
57
59
  trailingAvatarUrls,
58
60
  sessionPath,
59
61
  titleExtra,
62
+ secondaryLabel,
60
63
  forked,
61
64
  moreLabel,
62
65
  onOpenContextMenu,
@@ -146,6 +149,11 @@ export const DefaultSessionRowView = memo(function DefaultSessionRowView({
146
149
  label={label}
147
150
  title={title}
148
151
  />
152
+ {secondaryLabel ? (
153
+ <span className="max-w-[45%] shrink-0 truncate text-[11px] text-muted-foreground/60">
154
+ {secondaryLabel}
155
+ </span>
156
+ ) : null}
149
157
  {trailingAvatarUrls && trailingAvatarUrls.length > 0 ? (
150
158
  <AvatarStackView avatarUrls={trailingAvatarUrls} />
151
159
  ) : null}