dsh-turtle-ui-prompt-extra
界面增强 已归档

dsh-turtle-ui-prompt-extra

changguo1998/dsh-turtle-ui-prompt-extra

为官方终端UI工具包@deepseek-ai/dsh-tui扩展额外顶部栏插槽,无需修改原包源码即可自定义顶部栏内容,轻松满足个性化使用需求。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
29 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:changguo1998/dsh-turtle-ui-prompt-extra
git clone https://github.com/changguo1998/dsh-turtle-ui-prompt-extra.git
git clone git@github.com:changguo1998/dsh-turtle-ui-prompt-extra.git
README.md main

dsh-turtle-ui-prompt-extra

Extra top-bar slots for the official turtle-ui TUI of DeepSeek Harness.

turtle-ui (package @deepseek-ai/dsh-tui) lets a profile compose its top bar
via theme.leftPrompt from a shared slot registry, ctx.tuiPrompt. It ships
eight built-in slots (cwd, git/worktree, token_meter/cache_hit_rate,
model, context, queued, symbol, indicator) — but no provider, no
reasoning-effort, no clock. This plugin adds those.

Slot Widget Source Default on
${provider} current provider route (ustc) session request header → agentDefaultModel yes
${route} atomic ${provider}/${model}:${thinking} (ustc/deepseek-v4-flash:none) same yes
${thinking} reasoning effort (high, falls back to none) same yes
${time} wall clock, 24h/12h Date on a timer yes
${date} calendar date YYYY-MM-DD Date on a timer no
${session} short session id running agent id no

Unlike whole-TUI replacements (dsh-tui-pi, dsh-cc-tui), this plugin adds
only prompt variables to the official TUI. No config here changes the
top bar composition — that stays in your profile's theme.leftPrompt, exactly
like turtle-ui's own built-in-slots-on-profile pattern.

Install

# in your profile dir (e.g. ~/.dsh/profiles/tui)
dsh plugin --profile tui add dsh-turtle-ui-prompt-extra

or, for a local checkout with a manual file-path row, see examples/.

Quick start

Append to your profile's cordis.patch.yml:

- insert:
    - id: prompt-extra
      name: "dsh-turtle-ui-prompt-extra"

- id: tui
  config:
    theme:
      leftPrompt: "${cwd} ${git/worktree} ${route} ${context} ${token_meter/cache_hit_rate} ${time}"
      rightPrompt: "${queued}"

Tip: prefer the atomic ${route} slot (provider/model:thinking) over gluing
${provider}/${model}:${thinking}. turtle-ui's built-in ${model} value
carries its own leading whitespace (a glue-free default-template convention),
so ${provider}/${model} renders a stray gap between the slash and the
model. ${route} composes all three atomically instead — ustc/deepseek-v4-flash:none — and falls back to none while no session has started.

The - id: tui override replaces the bundle default, so any listed slot not
registered (or empty at that moment) is pruned from the rendered bar. Run
dsh --profile tui to see the new slots.

Config

- id: prompt-extra
  config:
    prefix: extra # namespace all slots: `${extra/time}`
    timeFormat: "24h" # or '12h'
    tickMs: 1000 # clock + lazy probe interval
    warnOnCollision: true # log instead of silently skip a collision
    slots: # absence keeps DEFAULT_SLOTS
      provider: true
      route: true
      thinking: true
      time: true
      date: false
      session: false

Slots are registered with the pattern prefix/name when prefix is set.
Colliding names (already registered — e.g. a future turtle-ui builtin) are
skipped, never thrown through the plugin boundary.

Degradation contract

  • No ctx.tuiPrompt service → the plugin stays silent (retries on each tick).
  • Non-turtle-ui host → no-op; never throws, never blocks boot.
  • Settings fetch failure → the slot value is undefined for that tick.

Development

pnpm install
pnpm typecheck
pnpm test       # > tests in src/index.test.ts
pnpm build      # emits dist/src/index.js

License

MIT


Also available in 简体中文.