* fix(deps): patch tauri-plugin-shell CVE (GHSA-c9pr-q8gx-3mgp) @tauri-apps/plugin-shell (npm) 与 tauri-plugin-shell (crate) 的声明下限 ——npm `^2.0.1`、crate `"2"`——都落在 GHSA-c9pr-q8gx-3mgp 影响范围 (`< 2.2.1`,CRITICAL:`open` 端点作用域校验绕过,可致 RCE)。本项目 src/lib/ipc/utils.ts 正是通过该 `open` 端点打开外链,属受影响用法。 两个 lockfile 实际已解析到 2.3.5,但清单声明的下限仍是漏洞版本,供应链 扫描(SkillSpector SC4)因此读取到 2.0.1 报警。此处仅把两侧声明下限抬到 最新安全版 2.3.5,使清单与锁定版本一致、扫描不再命中;解析版本不变,无 运行时行为变化。 Closes #668 * fix(audit): 1.3.14 审计修复一批(Apple Speech 取消/IME 保存锁死/侧向键卡死/火山429 等) - CRIT Apple Speech 取消/超时不终止 SFSpeechRecognitionTask(SendableTask+cancel_flag+[task cancel]+100ms 轮询) - HIGH windows_ime 未安装分支反致设置保存事务锁死(抽纯函数 keyboard_list_pref_short_circuit) - HIGH 侧向键 Released 卡死自愈 + macOS flags 类位竞态 + Linux 显式拒绝 - HIGH coordinator/hotkey_loops unused_assignments clippy 回归 - MED 火山 429 限流不重试(RateLimited)/ Heatmap clamp / 授权失败反馈 / SendInput 分类单一真相 / SendInputOptions 收敛 - 清理 删死码 ?? '重启' / side_aware 死字段 / 孤儿 MarketplaceModal cargo test 552-0 / npm build 绿。windows cfg 部分需 CI 四平台验证。 * feat(chat): 统一聊天面板组件库——官方 shadcn base 组件按 CLI 规则内嵌 @shadcn/react 官方 primitive + base-rhea registry 原文内嵌 components/chat/ui/ (message-scroller/marker/bubble/message/card/empty/input-group/button/input/ textarea/spinner,仅按 CLI 规则改 import 路径;button 保留 3 行 React18 inert 归一)。Tailwind v4 作用域隔离:utilities source(none) + @source 只扫聊天文件、 无层导入压过 global.css;官方主题 shadcn/tailwind.css + tw-animate-css。 胶囊同款思考动画(orbFeed 单 GL 源镜像多头像)、GitHub 头像(CSP img-src 放行)、 出现/消失生命周期 hook。平台门控:非 darwin 构建 DCE 掉 Less Computer chunk。 删除旧自制 Marker/MessageScroller 组件。 * feat(panels): QA/LC 浮窗重写为官方 message-scroller-demo 同款骨架 Card + Empty + InputGroup + MessageScroller 官方组合;QA=Message 带头像形态 (右 GitHub / 左旋转 orb),LC=Marker 工具行形态(无头像)。 语音状态只在输入区:录音红光/转译黑光绕输入组跑圈,问题落定即停; 思考头像行门控在用户消息落定之后(修「AI 头像先出现、动画抽搐」)。 LC 事件空轮自愈 + mount 后 less_computer_sync 重放(webview 冷加载丢 user 事件导致「后端在跑前端空白/用户的话不显示」)。纯白背景、官方 24px 圆角、出现/消失动画(chat-panel:shown/closing)。 * fix(backend): 聊天面板后端配套——命令注册/非激活面板/事件缓冲/生命周期 - 恢复桌面 invoke_handler 的 qa_submit_text / qa_toggle_recording(此前删 qa_window_pin 时误删相邻项,真机报 Command qa_submit_text not found) - QA/LC 窗口转非激活 NSPanel(胶囊同管线:NonactivatingPanelMask + CanJoinAllSpaces|FullScreenAuxiliary),chat_panel_focus_keyboard 改主线程 makeKeyAndOrderFront:打字不激活 app、主窗口不再被带出、frontmost 保持 用户原 app(划词选区在多轮期间仍可读) - Less Computer 事件按全局单调 seq 写入环形缓冲(fresh user 清空、cap 2048 丢最旧),新命令 less_computer_sync 供前端 mount 重放(仅 less-computer 窗口可调);附 2 个单测 - show/hide 生命周期:show 发 chat-panel:shown 并作废挂起 hide;hide 先发 chat-panel:closing、240ms 后真正隐藏(AtomicU64 世代防快速关-开竞态) - QA/LC 窗口统一固定 420×540;删除 qa_window_pin / less_computer_window_resize 整链(无消费方) --------- Co-authored-by: sim <sim@local>
129 lines
3.9 KiB
TypeScript
129 lines
3.9 KiB
TypeScript
import * as React from "react"
|
|
import {
|
|
MessageScroller as MessageScrollerPrimitive,
|
|
useMessageScroller,
|
|
useMessageScrollerScrollable,
|
|
useMessageScrollerVisibility,
|
|
} from "@shadcn/react/message-scroller"
|
|
|
|
import { cn } from "../lib/utils"
|
|
import { Button } from "./button"
|
|
import { ArrowDownIcon } from "lucide-react"
|
|
|
|
function MessageScrollerProvider(
|
|
props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>
|
|
) {
|
|
return <MessageScrollerPrimitive.Provider {...props} />
|
|
}
|
|
|
|
function MessageScroller({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
|
|
return (
|
|
<MessageScrollerPrimitive.Root
|
|
data-slot="message-scroller"
|
|
className={cn(
|
|
"group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function MessageScrollerViewport({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
|
|
return (
|
|
<MessageScrollerPrimitive.Viewport
|
|
data-slot="message-scroller-viewport"
|
|
className={cn(
|
|
"size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function MessageScrollerContent({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
|
|
return (
|
|
<MessageScrollerPrimitive.Content
|
|
data-slot="message-scroller-content"
|
|
className={cn("flex h-max min-h-full flex-col gap-8", className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function MessageScrollerItem({
|
|
className,
|
|
scrollAnchor = false,
|
|
...props
|
|
}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
|
|
return (
|
|
<MessageScrollerPrimitive.Item
|
|
data-slot="message-scroller-item"
|
|
scrollAnchor={scrollAnchor}
|
|
className={cn(
|
|
"min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]",
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
function MessageScrollerButton({
|
|
direction = "end",
|
|
className,
|
|
children,
|
|
render,
|
|
variant = "secondary",
|
|
size = "icon-sm",
|
|
...props
|
|
}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
|
|
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
|
return (
|
|
<MessageScrollerPrimitive.Button
|
|
data-slot="message-scroller-button"
|
|
data-direction={direction}
|
|
data-variant={variant}
|
|
data-size={size}
|
|
direction={direction}
|
|
className={cn(
|
|
"absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
|
|
className
|
|
)}
|
|
render={render ?? <Button variant={variant} size={size} />}
|
|
{...props}
|
|
>
|
|
{children ?? (
|
|
<>
|
|
<ArrowDownIcon />
|
|
<span className="sr-only">
|
|
{direction === "end" ? "Scroll to end" : "Scroll to start"}
|
|
</span>
|
|
</>
|
|
)}
|
|
</MessageScrollerPrimitive.Button>
|
|
)
|
|
}
|
|
|
|
export {
|
|
MessageScrollerProvider,
|
|
MessageScroller,
|
|
MessageScrollerViewport,
|
|
MessageScrollerContent,
|
|
MessageScrollerItem,
|
|
MessageScrollerButton,
|
|
useMessageScroller,
|
|
useMessageScrollerScrollable,
|
|
useMessageScrollerVisibility,
|
|
}
|