Skip to content
dsh.fish
Bundle

dsh-turtle-ui-prompt-extra

Extra prompt slots (${provider} ${thinking} ${time} ...) for the official turtle-ui TUI of DeepSeek Harness

Source
changguo1998
License
MIT
Updated
Updated 22 days ago

Readme

# 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        |
| `${thinking}` | reasoning effort (`high`)       | 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

```bash
# 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`:

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

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

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

```yaml
- 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
      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

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

## License

MIT

---

Also available in [简体中文](README.zh-CN.md).

Install

dsh plugin --profile web add github:changguo1998/dsh-turtle-ui-prompt-extra#dd82a5e39802d6d64598bddc333b929d04027086

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
Source