Bundle
dsh-envelope-highlight
Restore syntax highlighting of read/write tool envelopes inside run_code (PTC / Code Mode) result cards
- Source
- flashyiyi
- License
- MIT
- Updated
- Updated 6 hours ago
Readme
# dsh-envelope-highlight
Restore syntax highlighting of read-tool results inside `run_code` (PTC / Code Mode).
## Problem
In native mode, the `read` tool's result renders as a line-numbered,
syntax-highlighted code view (`ReadBlock` + shiki). In **PTC / Code Mode**,
the model calls tools through `run_code` programs, and read results arrive in
two shapes — both rendered as **plain text** by the official UI:
1. **Structured object** `{ path, lines, totalLines }` — returned from the
program, it lands in the `run_code` card's OUT area as raw JSON;
2. **Envelope text** (`<path>…</path>\n<type>file</type>\n<content>…\n</content>`,
tool-fs's `formatReadOutput`) — the read sub-call (code-dispatch) content.
The syntax highlighting is lost in both cases.
## Solution
This plugin registers two keyed `tool.call.toolview` views:
- **`run_code`** (not registered by the shipped UI — zero replacement risk):
read envelopes and read-result JSON in the OUT area are parsed and rendered
as `ReadBlock` — file line numbers in the gutter, shiki syntax
highlighting, the same visual language as the native read card.
- **`read`** (`priority: -1`, shadowing the official row): code-dispatch
sub-calls (whose `resultView` is always null) get their envelope content
rendered as `ReadBlock`; native read calls are reproduced exactly like the
official `ReadRow`.
Non-read output stays exactly as before.
## Install
```bash
dsh plugin --profile <profile> add dsh-envelope-highlight
```
## Build (from source)
```bash
# requires a dsh source checkout (DSH_CHECKOUT) with tsc/tsdown
npm run build # host (tsc) + client (tsdown) → lib/
npm pack
```
## Scope
- ✅ `run_code` chat-row result card: read envelopes + read-result JSON →
highlighted `ReadBlock`
- ✅ `read` sub-call rows under the run_code tree (code-dispatch) →
highlighted `ReadBlock`; native read rows unchanged
- ❌ Details panel (`conversation.details.tool`) — not covered yet
## License
MIT
Install
dsh plugin --profile web add github:flashyiyi/dsh-envelope-highlight
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-envelope-highlight from the hub
- 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.
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.