feat: 合并上游 Rust 实现,扩展 API/运行时/工具链能力

将 claw-code/rust/crates 的完整实现合并到主 workspace,涵盖
  9 个 crate 的更新与 2 个新 crate 的引入。

  API 层:
  - 用原生 Anthropic 客户端(anthropic.rs)替换 claw_provider,
    新增 prompt cache 减少重复请求开销
  - 新增 HTTP 客户端构建器统一代理配置,OpenAI 兼容端增加
    DashScope/Qwen 支持与抖动重试
  - MessageRequest 扩展 temperature/top_p 等模型调参字段
  - SSE 解析器增加 provider 上下文感知的错误信息

  运行时(~11,000 行新增):
  - 新增 bash 命令安全校验、分支锁碰撞检测、配置文件校验
  - 新增会话存储与控制面、MCP 生命周期状态机与服务端实现
  - 新增权限执行引擎、策略引擎、插件生命周期管理
  - 新增 worker 启动编排、任务/定时任务注册表、信任解析器
  - 保留 Windows cmd /C fallback

  命令/插件/工具:
  - commands 大幅重写,扩展 sandbox、doctor、plan 等 slash 命令
  - plugins 新增 PostToolUseFailure hook 与宽容加载机制
  - tools 新增 PDF 提取与 lane 补全工具

  新增 crate:mock-anthropic-service(测试)、telemetry(遥测)

  适配 claw-cli/server:ClawApiClient→AnthropicClient 重命名,
  SlashCommand::parse 返回 Result,移除 session 级 Thinking 变体,
  TokenUsage/ConversationMessage 补充序列化支持
This commit is contained in:
fengmengqi
2026-04-13 14:39:17 +08:00
parent 4a04faf926
commit d8d77824f4
94 changed files with 49049 additions and 4429 deletions
+3 -7
View File
@@ -5,9 +5,9 @@ import { theme, Skeleton, Spin, Popover } from 'antd';
import { XMarkdown } from '@ant-design/x-markdown';
// 助手气泡 body 撑满可用宽度,避免 Mermaid 等内容宽度受文本行长度影响
const bubbleStyle = document.createElement('style');
bubbleStyle.textContent = '.ant-bubble-start > .ant-bubble-body { width: 80%; }';
document.head.appendChild(bubbleStyle);
// const bubbleStyle = document.createElement('style');
// bubbleStyle.textContent = '.ant-bubble-start > .ant-bubble-body { width: 100%; }';
// document.head.appendChild(bubbleStyle);
import type { ComponentProps, Token } from '@ant-design/x-markdown';
import Latex from '@ant-design/x-markdown/plugins/latex';
import '@ant-design/x-markdown/themes/light.css';
@@ -18,8 +18,6 @@ import WelcomeScreen from './WelcomeScreen';
// ── XMarkdown 插件配置 ────────────────────────────────────────────────
// LaTeX 数学公式插件:解析 $...$ / $$...$$ / \(...\) / \[...\]
// 自定义脚注插件:解析 [^1] 语法 → <footnote> 标签
const footnoteExtension = {
name: 'footnote',
level: 'inline' as const,
@@ -281,14 +279,12 @@ const ChatView: React.FC<ChatViewProps> = ({
variant: 'filled' as const,
shape: 'round' as const,
avatar: <UserOutlined />,
// styles: { content: { width: '80%' } },
},
assistant: {
placement: 'start' as const,
variant: 'borderless' as const,
avatar: <RobotOutlined />,
streaming: true,
styles: { content: { width: '80%' } },
header: (_content: unknown, { status }: { status?: string }) => {
if (status === 'loading' || status === 'updating') {
return (