dsh-blue/blue

blue

Blue: a TUI is not a package, it is a Cordis plugin tree — a modern terminal UI for DeepSeek Harness with hot-swappable render, interaction, and command plugins.

待分类ai-agentclicoding-agent

Blue

Blue 已演进为 Mayfly——一个基于 dsh 的多 Agent 终端。本仓库已归档、不再维护;项目现位于 may-fly.dev。

English | 中文

Blue 是 DeepSeek Harness (dsh)的交互式终端界面。它是叠加在 dsh-base 上的树外 Cordis bundle,针对 Harness 0.1.2-alpha.3 构建。Blue 0.2.0-alpha.1 刻意与 dsh Web 使用同一种插件模型:插件是普通 Cordis sibling,直接消费 dsh 原生服务。

Blue 可以直接在终端显示 Markdown 表格、assistant 消息中的闭合 Mermaid fence, 以及 renderer-neutral 的 line、point、bar、sparkline 与 heatmap 节点;超宽或不支持 的内容会安全回退为源码或文本。

Blue 演示:流式会话、工具卡片与面板

插件模型

插件通过 inject 声明服务,然后直接从 Cordis context 使用:

  • ctx.commands、ctx.sessionProjections、ctx.tools 以及其他有文档的 dsh 服务直接复用,不经过 Blue 适配。
  • ctx.bluePanes、ctx.blueStatus、ctx.blueOverlays 与 ctx.blueEditorExtensions 是仅有的 Blue 专属 UI 贡献服务。
  • Agent-scoped 原生服务需要当前对象时,通过 ctx.blueCurrentAgent.current() 获取这个 Blue frontend 当前选择的精确 Agent。
  • 每次注册都属于调用方的 Cordis Fiber;插件卸载会移除命令和 UI 贡献。

Blue 不再有专用插件 manifest、能力协商、适配 facade、私有插件域或独立的 插件作者 CLI。Blue 官方功能与外部插件注册到完全相同的服务。

插件始终只返回普通的 renderer-neutral 节点。Blue 会自动窗口化大型 list 节点,并延迟隐藏的响应式分支;插件无需管理 viewport range、overscan、renderer cache 或 scroll controller。数据库与网络取数仍由插件负责。

import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-commands'
import type {} from '@dsh-blue/blue-api'
import { ui } from '@dsh-blue/blue-ui'

export const name = '@acme/build-health'
export const inject = ['commands', 'bluePanes']

export function apply(ctx: Context): void {
  ctx.commands.register({
    name: 'health',
    description: 'Show build health',
    handler: () => ({ kind: 'success', text: 'healthy' }),
  })
  ctx.bluePanes.register({
    id: 'acme.build-health',
    placement: 'right',
    narrow: 'bottom',
    render: () => ui.text('healthy'),
  })
}

用法

前置条件为 Node ^22.19 || >=24 与 pnpm 11。

npm i -g @deepseek-ai/dsh
dsh plugin --profile blue add @dsh-blue/blue@alpha
dsh --profile blue

也可以安装包含已测试 dsh runtime 的独立启动器:

npm i -g @dsh-blue/blue-cli@alpha
blue

首次运行前设置 DEEPSEEK_API_KEY。/help 会列出当前有效的命令和键位。

架构

flowchart TB
    ROOT["一个 dsh 进程 · 一张 Cordis service graph"]
    DSH["dsh 原生服务<br/>commands · sessionProjections · tools · agents"]
    PLUGIN["普通 Cordis 插件<br/>Blue 官方行与外部 sibling"]
    AGENT["blueCurrentAgent<br/>当前选择的精确 Agent"]
    UI["Blue 直接 UI 服务<br/>bluePanes · blueStatus<br/>blueOverlays · blueEditorExtensions"]
    CORE["blue-core renderer<br/>唯一 pi-tui 与原始终端 owner"]
    TERM["终端"]

    ROOT --> DSH
    ROOT --> PLUGIN
    DSH --> PLUGIN
    AGENT --> PLUGIN
    PLUGIN --> UI
    UI --> CORE
    CORE --> TERM

只有 packages/core 可以导入 pi-tui 或处理原始终端行为。API/UI 包定义 renderer-neutral 节点和直接 registry;app 选择当前 Agent 并协调启动; transcript 与 interaction 消费 dsh 原生服务并发布 UI 贡献。

进一步阅读:架构、服务 seam、 开发手册。

社区

Blue 已迁移至 Mayfly。问题、反馈与 bug 请提交到 Mayfly 的 issues。

许可证

MIT。