Merged
Conversation
在 WebUI 的底部 TerminalPanel 中新增 Logs Tab,实时显示 runtime.log 日志内容,支持级别过滤和自动刷新。 ## 后端改动 - **types.ts**: 新增 LogLevel 和 LogEntry 类型定义,添加日志相关的 WebSocket 消息类型(logs:read、logs:subscribe、logs:unsubscribe、logs:data、logs:tail) - **websocket.ts**: - 导入 logger 模块 - 新增 logSubscriptions Map 管理客户端日志订阅 - 实现三个日志消息处理:logs:read(读取)、logs:subscribe(订阅)、logs:unsubscribe(取消订阅) - 在 cleanupClientSubscriptions 中添加断开连接时的订阅清理 ## 前端改动 - **LogsView.tsx**: 新建日志查看器组件(282行) - 纯 HTML 渲染(不使用 xterm) - 显示时间、级别(彩色标签)、模块、消息 - 支持 ALL/ERROR/WARN/INFO 级别过滤 - 自动滚动到底部,用户手动上滚时暂停 - 点击展开查看 stack 和 data 字段 - 清屏功能 - **LogsView.css**: 日志查看器样式(256行) - 背景色匹配终端面板(#0a0e1a) - 等宽字体,紧凑行高 - 级别标签用彩色圆角小色块 - 滚动条样式与终端一致 - **TerminalPanel.tsx**: 集成 Logs Tab - 导入 LogsView 组件 - 新增 panelMode state('terminal' | 'logs') - 在 header 左侧添加 Terminal/Logs 模式切换按钮 - Terminal 模式显示终端 Tab 列表和重启按钮 - Logs 模式显示 LogsView 组件 - 终端实例保持始终挂载(通过 display:none 控制) - **TerminalPanel.css**: 新增模式切换按钮样式 - panel-mode-tabs 和 panel-mode-btn 样式 - active 状态底部下划线高亮 ## 验收标准 ✅ TerminalPanel 底部面板有 Terminal / Logs 两个模式切换按钮 ✅ 点击 Logs 按钮显示日志查看器,展示 runtime.log 最近日志 ✅ 日志条目包含时间、级别(彩色)、模块、消息 ✅ 支持按级别过滤(ALL/ERROR/WARN/INFO) ✅ 新日志自动追加并滚动到底部 ✅ 切回 Terminal 模式时,终端实例状态完好 ✅ npx tsc --noEmit 通过 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…upport Add sessionId parameter to session memory functions to enable concurrent session handling in web mode. Replace global state singleton with Map-based storage keyed by sessionId, maintaining backward compatibility with CLI single-session mode via DEFAULT_SESSION_KEY. Add logger initialization in CLI and UTF-16 surrogate character sanitization in message formatting to prevent JSON parsing errors.
Move logs view from artifacts panel tab to independent side panel for better UX separation. Add new showLogsPanel state with proper panel toggle logic and mutual exclusion with git and artifacts panels. Remove logs-related props from ArtifactsPanel and update styling accordingly.
- CLI 端语言包新增 62 个翻译 key (en.ts + zh.ts) - file 工具: mustReadBeforeEdit, modifiedSinceRead, confirmationRequired, stringNotFound, multipleMatches, blockedByHook - agent 工具: executionFailed, executionInterrupted, taskNotFound - ask 工具: noQuestions, maxQuestions, headerTooLong, invalidOptionCount, optionMissingLabel, optionMissingDescription - lsp 工具: notInitialized, noServerAvailable, noCallHierarchy - mcp 工具: toolCallFailed, resourceNotFound, serverAndUriRequired, unknownAction - planmode 工具: alreadyInPlanMode, notInPlanMode - sandbox 工具: noSandboxAvailable, executionFailed - notebook 工具: cellNotFoundById, cellNotFound, cellOutOfRange, cellIdRequired - skill 工具: notFound, modelInvocationDisabled - bash 工具: commandBlocked, blockedByHook, shellNotFound - loop 核心: userCancelled, handlerError - web: redirectDetected - 替换 CLI 端工具文件中的硬编码字符串 (共 33 处) - file.ts: 7 处 - agent.ts: 4 处 - ask.ts: 6 处 - lsp.ts: 3 处 - planmode.ts: 2 处 - sandbox.ts: 1 处 - notebook.ts: 5 处 - skill.ts: 2 处 - mcp.ts: 4 处 - bash.ts: 3 处 - loop.ts: 2 处 - Web UI 语言包新增 12 个翻译 key (locales.ts en + zh) - Git 错误: gitStatusFailed, gitLogFailed - 配置错误: loadConfigFailed, saveConfigFailed, saveLoggingFailed, saveProxyFailed, saveCacheFailed, saveSecurityFailed - 认证错误: checkAuthFailed, logoutFailed - 通用: noOutput, mermaidLoadFailed - 替换 Web UI 组件中的硬编码字符串 (共 7 处) - GitPanel/index.tsx: 2 处 - config/SystemConfigPanel.tsx: 4 处 - CodeView/CompactMessage.tsx: 1 处 (添加 useLanguage Hook) - TypeScript 编译检查通过 - 添加缺失的 i18n import (loop.ts, skill.ts) - 所有类型检查通过
主要优化: 1. **persistSession 优化** (conversation.ts) - 添加 SessionState.lastPersistedMessageCount 字段 - 通过对比内存中的消息数量判断是否需要持久化 - 避免从磁盘加载会话数据做变化检测 2. **initializeGitInfo 非阻塞化** (conversation.ts) - 将 resumeSession 中的 initializeGitInfo 改为 fire-and-forget - Git 信息在后台异步获取,不阻塞会话切换 - 消除每次切换时 6 个 git 子进程的阻塞等待 3. **消除重复加载** (websocket.ts + conversation.ts) - 添加 ConversationManager.getSessionProjectPath() 方法 - 从内存 SessionState 获取项目路径,避免重复读磁盘 - handleSessionSwitch 中会话最多只从磁盘加载 1 次 4. **cleanupOldSessions 节流** (session/index.ts) - 添加 lastCleanupTime 节流变量 - 只在距上次清理超过 10 分钟时才执行 - 使用 fs.statSync 获取 mtime,不读取完整 JSON 5. **移除 JSON pretty-print** (session/index.ts) - saveSession 输出紧凑 JSON,减少 20-30% 文件大小 - 提升序列化速度 性能提升: - 会话切换速度提升 50-80%(消除 git 阻塞 + 减少磁盘IO) - persistSession 在无变化时几乎零开销 - cleanupOldSessions 开销减少 90%+ 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
feat(auth): add settings.json support and improve process management Add support for reading API key from settings.json file in Web UI configuration, with higher priority than OAuth tokens. Simplify cross-platform process existence check using process.kill(pid, 0). Add windowsHide option to execSync calls to prevent console window flashing on Windows. Enhance session cleanup to properly manage WAL files and implement deleteSessionFiles helper function. Add ErrorWatcher hook support in logger for evolve mode. ```
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Related Issue
Testing
npx tsc --noEmitpassesnpm test -- --runpassesScreenshots