feat(package): 添加独立的 DeepCode HTTP/SSE server#195
Open
Ri0n72Y wants to merge 54 commits into
Open
Conversation
在输入框下方渲染由用户配置的状态栏,通过 settings.json#statusline 声明 command/module 两类 provider,无需改动 CLI 源码即可扩展。 - core: 新增 StatusLineProviderConfig/Settings 类型与 normalize/merge 逻辑, resolveSettings 返回 ResolvedStatusLineSettings - cli: 新增 statusline manager、command-provider、module-provider、sanitize; useStatusLine hook;App.tsx 组装 SessionInfo(含 model/thinking/context/ toolUsage);PromptInput.tsx 末尾渲染分段 - docs: 新增 statusline.md / statusline_en.md,configuration 表格补字段 - .deepcode/plugins: 提供 model-info / cwd / git-branch / session-stats / tool-usage 五个示例 mjs - eslint: 为 .deepcode/plugins/**/*.mjs 添加 Node 环境 globals - tests: 新增 statusline.test.ts,覆盖 normalize / merge / manager
- 添加 preview 字段,标记为预览版本 - 修正 repository URL 结构,添加目录字段 - 扩展 categories,新增 Chat 分类 - 格式化部分字段列表,使结构更清晰
- 在 App 组件中新增 resumeSessionId 属性以支持恢复会话功能 - 在 AppContainer 中传递 resumeSessionId 以贯穿组件树 - 在 cli.tsx 中解析并传递 --resume 参数,支持无 ID 列出会话选择 - 新增构建退出摘要时显示 resume 会话提示的逻辑 - 添加对应单元测试覆盖 resumeSessionId 解析及退出摘要展示 - 抽离 cli 参数解析函数,支持提取初始提示和恢复会话 ID - 修复退出摘要文本,添加 resume 使用提示,提升用户体验
- 在启动 TUI 之前校验传入的 resumeSessionId 是否在本地会话索引中存在 - 读取用户主目录下的 sessions-index.json 文件进行会话ID验证 - 未找到匹配会话时输出错误信息并退出进程 - 在 App 组件中移除对会话ID重复验证的注释补充说明 - 确保 resumeSessionId 已经校验通过后才调用 handleSelectSession
…same file When the CLI is launched from ~ (home directory), user-level and project-level settings.json resolve to the same file. This caused resolveSettingsSources to merge the same content twice, resulting in duplicate statusline segments and React non-unique key warnings. Fix: detect same-file early in resolveCurrentSettings and pass null for project settings when paths are identical.
- Project-level providers override user-level by id instead of appending - Add newLine option to break statusline into multiple rows - Remove external deepcode-core from esbuild (bundle inline) - Fix permissions.test.ts readonly array type errors
Adopt upstream's packages: "bundle" + code splitting approach which supersedes our removal of external: ["@vegamo/deepcode-core"].
Add PermissionSettings import and use explicit type annotations for settings objects with empty arrays (as const produces readonly never[] which is incompatible with Required<PermissionSettings>).
- 移除 node:fs 模块中未使用的 existsSync 导入 - 保持代码整洁,避免冗余依赖 - 优化代码可读性和维护性
- 引入并展示CLI版本及Git提交信息 - 优化退出摘要界面颜色,提升可读性 - 在会话恢复提示中添加高亮命令显示 - 在PackageInfo类型中添加gitCommit字段支持
Keep our Required<PermissionSettings> + as PermissionScope[] approach which is more explicit than upstream's bare [] fix.
Squash merge headless-server-command-map into main. - Add standalone @vegamo/deepcode-server workspace package - Split server services and HTTP/SSE runtime host - Keep server API docs concise in Chinese and English - Preserve CLI and VSCode companion as separate entrypoints
- 使用 yargs 库替代原有手写解析,增强参数解析的健壮性和可维护性 - 添加严格参数校验,提升错误提示的清晰度 - 统一处理 --resume 和 --prompt 参数的组合逻辑,避免冲突使用 - 改进启动流程,确保先恢复会话再提交初始提示 - 将 resetStaticView 方法修改为异步以支持启动流程等待 - 替换部分异步调用为 await 确保顺序执行,避免竞态问题 - 更新 CLI 帮助文案,优化用户体验和信息表达 - 调整欢迎界面文本样式,增加标题加粗显示 - 添加相关单元测试 covering 新的参数解析和校验逻辑 - 引入 yargs 及其类型依赖,更新 package.json 和锁文件依赖清单
- 使用异步方式获取包信息,替代同步读取package.json - 用yargs重构参数解析,加入严格校验和格式验证 - 新增UUID格式验证函数,确保会话ID合法性 - 改善错误输出,统一通过writeStderrLine打印错误信息 - 移除过时的手工参数解析逻辑,改用parseArguments异步解析 - 统一并简化应用启动流程,支持终端交互性检查 - 替换process.stdout.write为writeStdoutLine,增强代码一致性 - 增加对版本号、帮助信息参数的自动处理和退出 - 使用read-package-up获取package.json,保证包信息准确 - 测试覆盖parseArguments及isValidSessionId的多种场景和错误处理 - 修改构建脚本为异步导入fs模块的chmodSync操作,兼容现代Node版本
…ule provider abort handling
feat(cli): 添加可插拔状态栏 (statusline)
- 将 Windows Shell 配置逻辑调整到 --version 和 --help 参数处理之后 - 避免在 Windows 无 Git Bash 环境下配置 Shell 时提前退出进程 - 确保命令行参数如 --version 和 --help 正常工作 - 添加 configureWindowsShell 函数注释说明其调用时机和作用 - 清理 cli.tsx 中的导入和调用顺序,提高代码可读性
- 移除 packages/cli/src/common/update-check.ts 文件中未使用的 PackageInfo 类型 - 减少代码冗余,提升代码可维护性 - 保持类型定义的简洁性与准确性
feat(cli): 支持通过 --resume 参数恢复会话
- 为外层Box组件增加marginLeft样式属性 - 保持其他样式和布局不变 - 修正UI布局中提示符内容的左侧间距问题
- 修改了消息渲染输出的缩进,从无空格缩进改为增加空格 - 确保多行消息内容对齐显示更美观 - 更新相关测试断言以匹配新的缩进格式
- 将cli.tsx和cli-args.ts中stdioHelpers的导入路径调整为统一的stdio-helpers格式 - 规范了模块文件命名,提高代码一致性 - 未改动核心功能逻辑,仅更改导入路径字符串
- 将cli.tsx和cli-args.ts中stdioHelpers的导入路径调整为统一的stdio-helpers格式 - 规范了模块文件命名,提高代码一致性 - 未改动核心功能逻辑,仅更改导入路径字符串
style(MessageView): 在消息视图组件中添加左边距
…e-core, and 0.1.23 for deepcode-vscode
…e-core, and enhance package validation in prepare-package script
- 引入 writeStdoutLine 函数替代重复的 process.stdout.write 调用 - 优化多处命令行输出,提升代码一致性和可维护性 - 修改退出提示、会话渲染及屏幕清理相关逻辑使用新函数 - 防止状态行在退出时显示,提升界面表现稳定性
…achments and improve preview handling
refactor(ui): 修改退出后还展示状态提示信息
- 在选项描述外围添加了左侧外边距的容器Box - 改进了文本显示的缩进和视觉层次感 - 保持了原有的文本颜色和显示逻辑不变 - 提升了用户界面的一致性和可读性
style(cli): 优化 AskUserQuestionPrompt 组件选项描述的布局间距
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.
它为现有 DeepCode runtime 添加了一个独立的本地 HTTP/SSE server 包:
新包:deepcode-server
新 binary:deepcode-server
Runtime 依赖:@vegamo/deepcode-core
目标是让 DeepCode 可以被非终端客户端使用,例如本地桌面客户端,同时避免这些客户端耦合到交互式 CLI/TUI 包。
在我标记 ready 之前,希望先获得关于 package 边界、入口命名和 server 范围的反馈
动机
DeepCode 已经在 @vegamo/deepcode-core 中拥有可复用的 runtime 层,CLI 和 VSCode companion 都是在其上构建 UI 特定入口。
这个 PR 添加入口:
deepcode-server:本地 HTTP/SSE runtime host
该 server 面向需要稳定进程边界和简单前端契约的本地客户端。
变更内容
范围
这个 server 将现有 DeepCode runtime / CLI-TUI 能力作为本地 HTTP API 暴露。不在当前 runtime 能力范围之外添加新的产品功能。
这个 PR 目前有意保持为草稿状态。
我正在使用它配合本地 deepcode-desktop(一个对插件界面的翻版) 验证 server package,然后再将其标记为 ready for final review。