InfinitePersistence/dsh-serial-console
Unofficial DeepSeek Harness plugin for board serial console, logging, and model-visible interaction.
编辑导读Editor's Brief
## 核心特性
- 该插件将用户终端输入、模型工具调用、开发板输出和会话记录整合到 DeepSeek Harness 的同一个串口控制台中。
- 支持在浏览器中查看启动日志和实时串口输出,并提供键盘输入、Tab 补全、方向键、退格、粘贴、输入法以及常用终端控制键。
- 允许选择串口、波特率,以及 CR、LF 或 CRLF 换行模式,并提供 Text 和 HEX 视图。
- 它为 DeepSeek 模型提供工具,可列出端口、连接、发送文本或原始字节、读取有限事件窗口、等待预期内容、添加审计标记并断开连接。
- 它会记录 RX 和 TX 原始字节及事件元数据,包括会话、序列、时间和来源;清除浏览器视图不会删除主机端记录。
## 使用场景
- README 列出了 Linux 开发板启动与登录控制台、U-Boot 环境变量、启动流程和镜像调试等场景。
- 它也覆盖 MCU 命令行、固件诊断接口、调制解调器、GNSS 以及其他 AT 命令设备。
- 它可用于烧录后的自动启动检查、长时间串口日志采集、故障复盘,以及 AI 辅助硬件调试或远程协作。
## 技术细节
- 该包发布为 @infinitepersistence/dsh-serial-console,可通过 dsh plugin add 安装到 DSH web profile 中。
- 它暴露了多个库入口,包括共享协议类型与编解码器、Node.js 主机串口管理与审计、DSH 主机串口服务、模型工具插件、预构建 Web 客户端,以及 React xterm.js 控制台。
- 切换页面时,终端会从内存中的 xterm 检查点恢复显示、光标和来源标记;当检查点不连续或事件窗口被截断时,则回退为完整重建。
- 界面将来源标记为 U 表示用户输入、M 表示模型输入、B 表示开发板输出、S 表示连接状态、错误或审计标记;这些标记不会写入串口数据。
## 注意事项
- 该项目要求 Node.js ^22.19.0 或 >=24.0.0、DeepSeek Harness 0.1.0-rc.7、pnpm 11.22.0,以及 Windows 或 Linux 串口环境。
- 当前限制包括同一时间只能启用一个物理串口、不支持自动重连或命令重放,以及 Text 模式依赖开发板回显。
- 该项目由社区维护,并非 DeepSeek 官方产品;终端检查点保存在当前浏览器内存中,因此刷新页面或事件缺失时会重建视图。
## Core Features
- The plugin places user terminal input, model tool calls, board output, and session records in one serial console for DeepSeek Harness.
- It supports browser-based viewing of boot logs and live serial output, with keyboard input, tab completion, arrow keys, backspace, paste, input methods, and common terminal control keys.
- It allows selection of serial port, baud rate, and CR, LF, or CRLF line-ending modes, and provides Text and HEX views.
- It gives DeepSeek models tools to list ports, connect, send text or raw bytes, read bounded event windows, wait for expected content, add audit markers, and disconnect.
- It records RX and TX original bytes and event metadata including session, sequence, time, and source, while browser view clearing does not delete host-side records.
## Use Cases
- The README lists Linux development board boot and login consoles, U-Boot environment variables, boot flows, and image debugging.
- It also covers MCU command lines, firmware diagnostic interfaces, modems, GNSS, and other AT command devices.
- It can be used for automated post-flash boot checks, long-running serial log collection, fault review, and AI-assisted hardware debugging or remote collaboration.
## Technical Details
- The package is published as @infinitepersistence/dsh-serial-console and can be installed into a DSH web profile with dsh plugin add.
- It exposes library entries for shared protocol types and codecs, Node.js host serial management and audit, DSH host serial service, model tool plugin, prebuilt web client, and React xterm.js console.
- The terminal restores display, cursor, and source markers from an in-memory xterm checkpoint when switching pages and falls back to full rebuild when checkpoints are discontinuous or event windows are truncated.
- The interface marks sources as U for user input, M for model input, B for board output, and S for connection status, errors, or audit markers without writing those markers into serial data.
## Notes
- The project requires Node.js ^22.19.0 or >=24.0.0, DeepSeek Harness 0.1.0-rc.7, pnpm 11.22.0, and a Windows or Linux serial environment.
- Current limitations include one active physical serial port at a time, no automatic reconnection or command replay, and Text mode dependence on board echo.
- The project is community-maintained, not an official DeepSeek product, and terminal checkpoints remain in current browser memory, so page refreshes or event gaps rebuild the view.
安装Install
dsh.cmd plugin --profile web add '@infinitepersistence/dsh-serial-console@0.1.0-rc.2' --save-exact
把 InfinitePersistence/dsh-serial-console 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
DSH Serial Console
用户与 AI 模型共享同一个可审计的嵌入式串口会话。(D指导,我不想再复制粘贴了,你直接干活吧)
DSH Serial Console 是一个面向 DeepSeek Harness 的社区串口控制台项目。它把人工终端操作、模型工具调用、板卡输出和会话记录汇集在同一个控制台中,适用于 Linux 开发板、U-Boot、MCU Shell、AT 指令设备和其他串口调试场景。
本项目由社区独立维护,不代表 DeepSeek 官方产品或官方背书。
可以用它做什么
- 在浏览器中查看板卡启动日志和实时串口输出。
- 使用键盘直接操作设备,包括 Tab 补全、方向键、退格、粘贴、输入法和常用终端控制键。
- 选择串口、波特率和 CR、LF、CRLF 等行尾模式。
- 让 DeepSeek 模型与用户操作同一个串口,而不是分别占用设备。
- 让模型发现端口、建立连接、发送命令、读取输出、等待特定内容和添加审计标记。
- 在串口页右侧直接查看模型思考、工具进度和最终回复,无需来回切换会话标签。
- 在 Text 与 HEX 视图之间切换,兼顾命令行操作和原始字节排查。
- 导出会话事件,并保留独立的串口审计记录。
终端体验
Text 模式提供真实的 VT 终端交互。板卡返回的提示符、ANSI 颜色、光标移动和同行刷新会直接呈现在当前终端画面中。
在对话页与串口页之间切换时,控制台会从内存中的 xterm 检查点恢复终端画面、光标和来源标记,只增量处理离开后收到的事件;检查点不连续或事件窗口已截断时会自动回退到完整重建。
终端左侧提供独立来源标记:
| 标记 | 来源 |
|---|---|
U |
用户输入 |
M |
模型输入 |
B |
板卡输出 |
S |
连接状态、错误或审计标记 |
这些标记只属于界面展示,不会写入串口数据或改变板卡收到的命令。
串口页内置可折叠的 AI 浏览窗。桌面端默认显示在右侧,可拖动分隔线调整宽度;窄屏下自动改为覆盖式抽屉。浏览窗只读呈现当前 DSH 会话的实时思考、工具状态、最终回复和错误,底部仍使用 DSH 原生输入栏。折叠浏览窗不会卸载 xterm,终端内容、光标和滚动位置保持不变;开关和宽度仅保存在本机浏览器中。
用户与模型协作
用户和模型看到的是同一个串口会话:
- 用户可以随时观察模型命令及板卡响应。
- 模型可以读取受限范围内的串口事件。
- 每次发送都会记录来源,便于区分人工操作和模型调用。
- 所有写入按顺序发送,避免单次请求之间相互越过。
项目提供以下模型能力:
| 工具 | 用途 |
|---|---|
serial_list_ports |
枚举可用串口 |
serial_connect |
连接设备 |
serial_send |
发送文本或原始字节 |
serial_read |
读取有界事件窗口 |
serial_expect |
等待提示符或指定内容 |
serial_mark |
标记关键证据位置 |
serial_disconnect |
安全断开设备 |
可追溯性
- RX 与 TX 都保留原始字节,文本仅用于友好显示。
- 事件包含会话、顺序、时间和来源信息。
- 浏览器清空视图不会删除 Host 侧记录。
- 内存事件过期时会明确报告缺口。
- 审计记录可用于复查模型操作、人工命令和板卡响应的先后关系。
适用场景
- 嵌入式!
- Linux 开发板启动与登录控制台
- U-Boot 环境变量、启动流程和镜像调试
- MCU 命令行与固件诊断接口
- Modem、GNSS 和其他 AT 指令设备
- 自动化烧录后的启动检查
- 长时间串口日志采集与故障复盘
- AI 辅助硬件调试和远程协作
快速开始
环境要求
- Node.js
^22.19.0或>=24.0.0 - DeepSeek Harness
0.1.0-rc.7 - pnpm
11.22.0 - Windows 或 Linux 串口环境
已有 DSH:一行安装并启用
项目发布在 @infinitepersistence/dsh-serial-console。已经安装 DSH 0.1.0-rc.7 的用户,可以用一条命令将插件安装到 web profile,并同时启用 Host、网页串口页和模型工具:
dsh.cmd plugin --profile web add '@infinitepersistence/dsh-serial-console@0.1.0-rc.2' --save-exact
停止仍在运行的旧 Host 后,启动同一个 profile:
dsh.cmd --profile web
dsh.cmd web 与 dsh.cmd --profile web 等价。安装和启动必须使用同一个 profile;升级后请重启 Host,并在浏览器中使用 Ctrl+F5 刷新页面。
全新 Windows:安装环境、DSH 与插件
在 PowerShell 中依次执行:
# 基础环境
winget install --id Git.Git --exact --source winget --accept-package-agreements --accept-source-agreements
winget install --id OpenJS.NodeJS.LTS --exact --source winget --accept-package-agreements --accept-source-agreements
winget install --id Microsoft.VCRedist.2015+.x64 --exact --source winget --accept-package-agreements --accept-source-agreements
# 让当前 PowerShell 识别新安装的软件
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
$env:Path = "$machinePath;$userPath"
# 安装经过验证的 pnpm 与 DSH 版本
& npm.cmd install --global pnpm@11.22.0 '@deepseek-ai/dsh@0.1.0-rc.7'
# 定位全局 dsh 命令
$npmGlobal = (& npm.cmd prefix --global).Trim()
$dsh = Join-Path $npmGlobal 'dsh.cmd'
$env:Path = "$npmGlobal;$env:Path"
# 安装并启用串口插件
& $dsh plugin --profile web add '@infinitepersistence/dsh-serial-console@0.1.0-rc.2' --save-exact
# 启动 DSH Web
& $dsh --profile web
启动后访问 http://127.0.0.1:3080,进入任意对话并选择“串口”标签。dsh plugin add 与普通 npm install/pnpm add 不同:它会读取包内的 bundle 清单,将插件 patch 加入指定 profile,并在下次启动时自动挂载。插件携带 serialport 的官方多平台预编译二进制,无需从源码构建。
Linux 与 macOS
确认 Node.js 与 DSH 版本满足上面的要求后执行:
dsh plugin --profile web add '@infinitepersistence/dsh-serial-console@0.1.0-rc.2' --save-exact
dsh --profile web
作为程序库安装
如果只是把控制台作为 React/Node.js 库嵌入自己的程序,可以使用:
pnpm add '@infinitepersistence/dsh-serial-console@0.1.0-rc.2' --save-exact
包提供以下公开入口:
@infinitepersistence/dsh-serial-console/protocol:共享串口协议类型与编解码。@infinitepersistence/dsh-serial-console/serial:Node.js Host 串口管理与审计能力。@infinitepersistence/dsh-serial-console:DSH Host 串口服务。@infinitepersistence/dsh-serial-console/tool:模型串口工具插件。@infinitepersistence/dsh-serial-console/client:DSH Web 预构建客户端。@infinitepersistence/dsh-serial-console/react:可嵌入其他 React 应用的 xterm.js 控制台。
从源码构建
git clone https://github.com/InfinitePersistence/dsh-serial-console.git
cd dsh-serial-console
corepack enable
pnpm install
pnpm build
本项目是 DeepSeek Harness 的可安装组合插件,同时也提供可复用的协议、Node.js 串口核心和 React 控制台;它不是一个双击即可运行的独立桌面应用。
当前状态
项目目前处于 0.1.0-rc.2 候选阶段。该候选版将串口页内的可折叠 AI 浏览窗纳入首版范围;完成真机与 DSH Web 验证后,稳定版发布前只接受缺陷修复、兼容性改进和文档完善。
当前限制:
- 一次只管理一个活动物理串口。
- 暂不自动重连,也不会在重连后自动重放命令。
- 当前 Text 模式依赖板卡回显;关闭 Shell echo 时不会显示用户正在键入的字符。
- 用户与模型共享发送队列,但尚未提供整条命令级别的输入租约。
- 实时画面会在新的串口事件到达后及时刷新;连接旧版 Host 时会自动切换到兼容模式,无新事件且连接元数据未变化时不会重复刷新界面。
- 终端检查点仅保存在当前浏览器内存中;刷新页面、重载插件或事件出现缺口后会重新构建画面。
- 来源 gutter 的历史行归属属于辅助展示,原始审计事件才是权威记录。
- 多板卡管理、稳定 USB 身份绑定和审计完整性增强仍在规划中。
项目文档
参与贡献
欢迎通过 Issue 报告设备兼容性、终端行为和 Harness 接入问题,也欢迎提交 Pull Request。涉及真实设备的反馈,请提供必要的复现条件,但不要上传串口凭据、访问令牌、私有固件、设备序列号或包含敏感信息的完整日志。
许可证
本项目采用 MIT License。第三方组件的许可证信息见 THIRD_PARTY_NOTICES.md。
amruthpillai/reactive-resume
tt-a1i/archify
zhu1090093659/dsh-web-ui
strukto-ai/mirage
liustack/modlens
omdsh-dev/DSH-better-sidebar
dsh-market/dsh-market