v1.2.1: edit toolview uses DSH's native ToolRow/DiffBlock chrome (DisclosureRow, collapsed by default, file link, hover diff stat, Output card on error, code-card header with icon actions, 9-row fold); keeps line-number gutter; client render smoke test

This commit is contained in:
Deepseek Harness committed 2026-10-11 08:11:31 +00:00
1 parent 26dabbba88
commit ee78e6d3a8
4 files changed
+389 -105

No files matched your search

+8 -5
View File
@@ -103,10 +103,13 @@ Turn the guard off with `guard: false`, or change the list of blocked tools with
## Diff cards in the Web UI
The plugin ships a web client (`client.js`) that registers an `edit` tool view. Hashline, sloppy and apply_patch calls render as a diff card instead of raw patch text:
- green added rows, red removed rows and gray context, using only DSH's theme tokens (`--dsw-alias-code-diff-added/-deleted`, `--dsw-alias-state-success/error-primary`, the code-block font), so it follows the active theme like the stock diff view;
- a **line-number gutter** with the old and new file line of every row;
- `+N -M` counts in the header, plus Wrap and Copy buttons.
The plugin ships a web client (`client.js`) that registers an `edit` tool view. Hashline, sloppy and apply_patch calls would otherwise show raw patch JSON; instead they render with the **same chrome as DSH's own tool rows**, built from DSH's primitives (`DisclosureRow`, `TextShimmer`, `Tooltip`, its icons) with CSS copied from the stock `ToolRow`, `CodeCard` and `DiffBlock` modules:
- the standard 24px row: edit icon, `Edit` title, a dot separator, the file path as a dotted link that opens the file, and a small monospace `+N -M` that turns green/red on hover or when expanded. Rows start collapsed and follow the turn's expand/collapse state, like every other tool;
- a failed edit shows its first error line in red, and expanding it shows the standard **Output** card;
- the expanded diff is the stock code card: a language header with the wrap and copy icon buttons, 22px-padded rows with the inset +/- bar, and the head/tail fold after 9 rows;
- one addition: a **line-number gutter** with the old and new file line of every row.
Colors come only from DSH theme tokens, so the view follows the active theme.
The host attaches `oldStart`, `newStart` and `rows` to every hunk in `meta.diffs`, next to the standard `path`/`oldText`/`newText` fields. Older results without them still render, just without numbers.
@@ -195,7 +198,7 @@ npm test # node --test test/*.test.mjs — 34 tests (engine + integration on
| File | Role |
| --- | --- |
| `index.js` | DSH plugin: per-agent tool registration, mode selection, fs policy, paging, guard rule |
| `client.js` | Web client: `edit` tool view rendering hashline/patch results as the native diff card |
| `client.js` | Web client: `edit` tool view rendering hashline/patch results with DSH's native tool-row and diff-card chrome |
| `lib/hashline.js` | Hashline parser and applier |
| `lib/block.js` | `N*` block resolution (brackets, indentation, Markdown, decorators) |
| `lib/store.js` | Session snapshot store, Myers line diff, stale-tag rebase |