Files
claude-code/packages/remote-control-server/web/src/index.css
claude-code-best 2e9aaf4993 feat: ACP 协议版本 remote control (#293)
* fix: 添加 usage 字段缺失时的防御性防护

第三方 API(如智谱 GLM)在某些流式响应中不返回 usage 字段,
导致 usage.input_tokens 访问 undefined 崩溃并连锁影响后续所有请求。

- claude.ts: content_block_stop 创建消息时 fallback 到 EMPTY_USAGE
- LocalAgentTask.tsx: usage 为 undefined 时提前返回
- tokens.ts: getTokenCountFromUsage 加 null guard 和 ?? 0
- cost-tracker.ts: input_tokens/output_tokens 加 ?? 0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: ACP Plan 展示 — 支持 session/update plan 类型的可视化

补全 PlanUpdate 类型定义(PlanEntry/Priority/Status),新建 PlanView 组件
渲染进度条、状态图标和优先级标签,在 ChatInterface 中处理 plan 更新逻辑。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: 穷鬼模式下跳过 verification agent 以节省 token

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: 补充 RCS 后端 + 前端测试覆盖 (+116 tests)

后端新增 3 个测试文件 (70 tests):
- automationState: normalize/snapshot/equals 纯函数
- client-payload: toClientPayload 协议转换
- transport-normalize: normalizePayload + extractContent

前端新增 2 个测试文件 (46 tests):
- utils: formatTime/statusClass/truncate/extractEventText 等
- api-client: getUuid/setUuid/api GET/POST 错误处理

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: RCS ACP 页面添加权限模式选择器 + 权限响应修复

- 新增权限模式选择器 UI(6种模式:默认/自动接受编辑/跳过权限/规划/不询问/自动判断)
- 权限模式通过 ACP _meta 从 web → acp-link → agent 全链路传递
- 修复 PermissionPanel 点击"允许"发送 cancelled 而非 selected 的 bug
- 权限模式和模型选择持久化到 localStorage
- acp-link 直接连接路径同步支持 permissionMode 透传

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: RCS Web UI 重构 + QR 修复 + ACP 扫描自动跳转

- RCS Web UI 组件全面重构: Dialog 迁移 Radix UI, lazy loading,
  主题系统改进, 组件样式优化
- IdentityPanel QR 码显示修复: requestAnimationFrame 延迟绘制
  解决 Radix Dialog Portal 挂载时序问题
- ACP QR 扫描自动跳转: IdentityPanel 扫描 ACP 格式 { url, token }
  后存储 sessionStorage 并跳转 /code/?acp=1
- 新增 ACPDirectView 组件: ACP 直连视图, 用 ACPClient 连接并
  渲染 ACPMain 聊天界面

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: ACP 权限管道改进 — 模式同步 + bypass 检测 + 统一权限流水线

- agent.ts: applySessionMode 同步 appState.toolPermissionContext.mode
- agent.ts: bypassPermissions 可用性检测 (非 root 或 sandbox 环境)
- permissions.ts: createAcpCanUseTool 接入 hasPermissionsToUseTool
  统一权限流水线, 替代原来分散的处理逻辑
- permissions.ts: 支持 onModeChange 回调, 模式变更时实时同步

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: acp-link 支持 permissionMode 默认值传递给 agent

客户端 (Zed/VS Code 等) 的 new_session 不一定携带 permissionMode,
导致 agent 收到 _meta: undefined, permission 回退到 default。

修复: handleNewSession 使用 fallback 链:
  客户端传值 > config.permissionMode > ACP_PERMISSION_MODE 环境变量

使用: ACP_PERMISSION_MODE=auto acp-link claude

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: 更新文档及说明

* fix: 修复类型错误

* chore: 提交脚本

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 21:54:22 +08:00

228 lines
6.7 KiB
CSS

/* Font imports must precede @import "tailwindcss" per CSS spec */
@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Poppins:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");
@import "tailwindcss";
/* ============================================================
Theme — Refined stone palette (warm gray, not beige)
Hue shifted from 85 (yellow-cream) to 65 (warm stone)
Brand orange pops harder against cleaner neutrals
============================================================ */
@theme {
/* Fonts — Lora (serif body) + Poppins (sans-serif UI) + JetBrains Mono */
--font-sans: "Lora", Georgia, serif;
--font-display: "Poppins", sans-serif;
--font-mono: "JetBrains Mono", monospace;
/* Brand — signature orange (unchanged) */
--color-brand: #C96442;
--color-brand-light: #B55838;
--color-brand-subtle: oklch(0.65 0.12 30 / 0.08);
/* Surfaces — warm stone gray (not yellow-beige) */
--color-surface-0: #EFEEE9;
--color-surface-1: #F6F5F2;
--color-surface-2: #FBFAF8;
--color-surface-3: #DFDDD8;
/* Text — warm near-black tones */
--color-text-primary: #1A1917;
--color-text-secondary: #5E5A54;
--color-text-muted: #969088;
/* Inverted — for user message bubbles */
--color-bg-inverted: #2C2A27;
--color-text-inverted: #F6F5F2;
/* User bubble — brand-tinted surface */
--color-user-bubble: #C96442;
--color-user-bubble-border: #B55838;
/* Warning — refined amber (less construction-zone) */
--color-warning-bg: oklch(0.96 0.02 85);
--color-warning-border: oklch(0.75 0.14 75);
--color-warning-text: oklch(0.40 0.08 60);
/* Status */
--color-status-active: #5D8A3C;
--color-status-running: #3D72A8;
--color-status-idle: #7C3aed;
--color-status-error: #B83B31;
--color-status-warning: #B88630;
/* Tool card */
--color-tool-card: #F6F5F2;
/* shadcn/ui tokens (oklch — warm stone hue ~65) */
--color-background: oklch(0.955 0.006 65);
--color-foreground: oklch(0.19 0.008 65);
--color-card: oklch(0.975 0.005 65);
--color-card-foreground: oklch(0.19 0.008 65);
--color-popover: oklch(0.975 0.005 65);
--color-popover-foreground: oklch(0.19 0.008 65);
--color-primary: oklch(0.19 0.008 65);
--color-primary-foreground: oklch(0.97 0.005 65);
--color-secondary: oklch(0.955 0.006 65);
--color-secondary-foreground: oklch(0.19 0.008 65);
--color-muted: oklch(0.935 0.006 65);
--color-muted-foreground: oklch(0.48 0.015 65);
--color-accent: oklch(0.955 0.006 65);
--color-accent-foreground: oklch(0.19 0.008 65);
--color-destructive: oklch(0.577 0.245 27.325);
/* Border / Input / Ring */
--color-border: oklch(0.905 0.008 65);
--color-border-light: #DFDDD8;
--color-input: oklch(0.905 0.008 65);
--color-ring: oklch(0.65 0.10 40);
/* Default utility values */
--default-border-color: var(--color-border);
--default-ring-color: var(--color-ring);
/* Radius */
--radius: 0.625rem;
}
/* ============================================================
Dark mode — warm stone dark palette
============================================================ */
.dark {
--color-surface-0: #1A1917;
--color-surface-1: #222120;
--color-surface-2: #2C2A28;
--color-surface-3: #3A3835;
--color-text-primary: #EFEEE9;
--color-text-secondary: #969088;
--color-text-muted: #5E5A54;
--color-bg-inverted: #F6F5F2;
--color-text-inverted: #2C2A28;
--color-user-bubble: #C96442;
--color-user-bubble-border: #B55838;
--color-border: #3A3835;
--color-border-light: #2C2A28;
--color-tool-card: #2C2A28;
--color-warning-bg: oklch(0.22 0.03 75);
--color-warning-border: oklch(0.62 0.12 75);
--color-warning-text: oklch(0.82 0.08 85);
}
/* ============================================================
Base styles — layered so they coexist with Tailwind preflight
============================================================ */
@layer base {
html,
body {
background-color: var(--color-surface-0);
color: var(--color-text-primary);
font-family: var(--font-sans);
-webkit-font-smoothing: antialiased;
}
*,
::before,
::after {
border-color: var(--color-border);
}
}
/* ============================================================
Custom utilities (unlayered so they always win)
============================================================ */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--color-surface-3);
border-radius: 3px;
}
/* Glimmer sweep — opacity pulse for thinking indicator */
.glimmer-text {
color: var(--color-text-secondary);
animation: glimmer-pulse 2s ease-in-out infinite;
}
@keyframes glimmer-pulse {
0%, 100% { opacity: 0.5; }
50% { opacity: 1; }
}
/* ============================================================
Chat UI — Anthropic style overrides
============================================================ */
/* Chat input — warm orange focus ring */
.chat-input-focus:focus-within {
box-shadow: 0 0 0 2px oklch(0.65 0.12 30 / 0.20);
}
/* Markdown content in message bubbles */
.message-content pre {
background-color: var(--color-surface-1);
border-radius: 0.5rem;
padding: 0.75rem;
overflow-x: auto;
font-size: 0.8125rem;
line-height: 1.5;
}
.message-content code {
font-family: var(--font-mono);
font-size: 0.8125rem;
}
.message-content :not(pre) > code {
background-color: var(--color-surface-1);
padding: 0.125rem 0.375rem;
border-radius: 0.25rem;
}
/* ============================================================
Reduced motion — respect user preference
============================================================ */
@media (prefers-reduced-motion: reduce) {
*,
::before,
::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* ============================================================
Animations — Anthropic entrance effects
============================================================ */
@keyframes fadeUp {
from { opacity: 0; transform: translateY(24px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes typing-bounce {
0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
30% { transform: translateY(-5px); opacity: 1; }
}
/* Typing indicator dots */
.chat-typing-indicator {
display: inline-flex;
gap: 4px;
align-items: center;
height: 20px;
}
.chat-typing-indicator span {
width: 6px;
height: 6px;
border-radius: 9999px;
background: var(--color-brand);
animation: typing-bounce 1.2s ease-in-out infinite;
}
.chat-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }