Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .dsh-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
]
},
"dsh-editor": {
"version": "0.1.0-alpha.15",
"version": "0.1.0-alpha.16",
"rows": [
"editor"
],
"rowOverrides": [],
"role": "Editor: the tab type for text and code - a vendored CodeMirror 6 fetched lazily - with create-on-save inside the session workspace through this package's own authenticated routes. Markdown is claimed too, and hands off to the shipped preview. See packages/dsh-editor/README.md.",
"role": "Editor: the tab type for text and code - a vendored CodeMirror 6 fetched lazily - with create-on-save inside the session workspace through this package's own authenticated routes. Markdown is claimed too, and hands off to the shipped preview, whose rendered body exports the file to a PDF on the Desktop. See packages/dsh-editor/README.md.",
"uses": [
"dsh-modal",
"@deepseek-ai/dsh-client-ui-theme",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ way and what it touches. The exact versions are in
| [`dsh-deckcraft`](packages/dsh-deckcraft/README.md) | Slides from the chat: four `deck_*` tools over the DeckCraft CLI (MIT OR Apache-2.0). `deck_commands` lists the command ids the build offers, `deck_run` saves a `.deckcraft` in the workspace, `deck_export` renders the slides to PNG so you can look at them. Nothing is hardcoded: DeckCraft's "every button is a command" contract is the API. |
| [`dsh-diagrams`](packages/dsh-diagrams/README.md) | Mermaid, TikZ and the Diagram Design kit as tabs and as seven `diagram_*` tools. The kit 204 examples and 44 documented types are vendored at a pinned commit and browsable on the index page. Every write, including a self-contained HTML document, is validated before it is stored. |
| [`dsh-docker`](packages/dsh-docker/README.md) | Docker or Podman as a surface: nine `docker_*` tools over the machine's own CLI, argv-only, with every removal confirmed by repeating the target. `docker_start` launches Docker Desktop or a podman machine and waits for the **daemon**. A Docker tab lists containers and images with their logs, and there is no `exec`, no `system prune` and no free-form `run`. |
| [`dsh-editor`](packages/dsh-editor/README.md) | Text and code tabs over a vendored CodeMirror 6, with save/create and a Markdown preview. Every extension is mapped through a guard, so an older engine opens the document unhighlighted instead of killing the tab. It also backs the `.scd`, diagram-source and research-document editors. |
| [`dsh-editor`](packages/dsh-editor/README.md) | Text and code tabs over a vendored CodeMirror 6, with save/create and a Markdown preview. The preview exports the file as a PDF on the Desktop (the browser on the machine does the printing). Every extension is mapped through a guard, so an older engine opens the document unhighlighted instead of killing the tab. It also backs the `.scd`, diagram-source and research-document editors. |
| [`dsh-frontend-craft`](packages/dsh-frontend-craft/README.md) | Front-end design craft: Impeccable's Apache-2.0 corpus vendored at a pinned commit, plus its 61-rule detector built to WebAssembly inside the package. Five `fe_*` tools include `fe_render`, which renders a page in headless Chrome or Edge and measures contrast, tap targets and overflow. There is no `npx impeccable`, no engine download and no network. A Frontend tab shows findings, artifacts and the direction round. |
| [`dsh-gittree`](packages/dsh-gittree/README.md) | A read-only History tab: the workspace commits as a graph rail with lanes, merges and PR chips. Each commit lists the files it touched. It never runs a write. |
| [`dsh-huggingface`](packages/dsh-huggingface/README.md) | The Hub as a surface the agent can interrogate before it downloads: five `hf_*` tools over the machine's own `hf` CLI and the cache on disk. `hf_repo` gives one repo's licence, gated flag, weight (the Hub's `used_storage`, labelled as such) and whether this disk already has it — complete, metadata-only, stale or absent; `hf_status` counts the stubs that look cached and cannot load; `hf_cache` verifies and reclaims, with an unconfirmed removal being the CLI's own dry run; `hf_download` reports the weight, refuses over a ceiling, and needs the repo id repeated back. For a repo already cached it also sizes the LOAD — parameters from the weight bytes, the KV cache per token from the checkpoint's own attention heads, and a context table that says FITS against the `freeBytes` you pass — without loading the model. Two skills teach the CLI and the cache layout. Host-only, zero npm dependencies, no bundled engine. |
Expand Down
2 changes: 1 addition & 1 deletion docs/COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ person's own browser, which the launcher finds (Chrome first, the OS opener as t
| `dsh-vn-master` | `master` | the pack's final layer (installs last). Carries pack-wide row decisions; today it disables the `browser` row (the Browser tab is built and shipped but off, which also removes its routes and tools) and the four feedback rows `ui-message-feedback`, `message-feedback`, `command-feedback`, `session-telemetry-otel` |
| `dsh-rightbar` | `rightbar` | the right bar, a fork of the shipped bundle; disables `ui-sidebar-right` and `ui-sidebar-files` |
| `dsh-rightbar-files` | `rightbar-files` | the Files tab on that bar (fork) |
| `dsh-editor` | `editor` | CodeMirror tab type for text and code, Markdown included, blank documents from "+", Preview/Edit hand-off to the rendered view |
| `dsh-editor` | `editor` | CodeMirror tab type for text and code, Markdown included, blank documents from "+", Preview/Edit hand-off to the rendered view, and Export PDF to the Desktop |
| `dsh-gittree` | `gittree` | **History**: read-only commit list with a branch-lane graph; needs `git` on `PATH` |
| `dsh-image` | `image` | image viewer (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO, SVG, TIFF) |
| `dsh-docker` | `docker` | Docker or Podman as tools and a tab; needs `docker`/`podman` on `PATH`, and `docker_start` needs Docker Desktop where it is installed |
Expand Down
8 changes: 6 additions & 2 deletions packages/dsh-editor/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dsh-editor (alpha.14)
# dsh-editor (alpha.16)

**A CodeMirror 6 tab type for the pack's right bar (`dsh-rightbar`) that opens text files editable.** It registers the id `dsh-editor` and the kind `editor` through the bar's own tab-type registry, with its body and chip title in the keyed `sidebar.right.pane.tab` / `sidebar.right.pane.tab.title` seats and a guide entry at `order: 20` for the "+" control. It is text-only (strict UTF-8, binary refused), starts blank documents, and writes through authenticated Node routes because `remote.workspaceFiles` exposes no mutation operation.

Expand All @@ -11,6 +11,7 @@
- **The language map.** Every extension is mapped in `languageExtensionFor` and every lookup goes through a guard, so an engine older than the bundle opens the document unhighlighted rather than killing the tab. Lezer factories (function shape) via `engineLanguage` cover javascript (js/mjs/cjs/jsx/ts/tsx), json (json/jsonc), markdown (md/markdown/mdown), python (py/pyw), html (html/htm/xhtml), css and yaml (yaml/yml). CM5-style **StreamParser objects** (found by their `token()`, via `engineStreamMode`) cover shell (sh/bash/zsh/ksh/dash), powerShell (ps1/psm1/psd1), batch (bat/cmd, from the pack's own `vendor/batch-mode.js`), rust (rs) and toml (toml) from the vendored `@codemirror/legacy-modes`. Each returns `null` plus one console warning naming the missing factory and the rebuild command, so `languageExtensionFor` has no direct `CM.<name>(...)` call.
- **The palette follows the app's theme**: **oneDark only while the app is dark**, a token-driven transparent light layer otherwise, switched live through a CodeMirror `Compartment` reconfigured off `ctx.get('theme')` / `theme/change`, with `body[data-ds-dark-theme]` as the fallback. Both theme services are resolved lazily.
- **The rendered Markdown body is shadowed.** The keyed `sidebar.right.tab.document` slot is registered at `priority: -10` (lowest renders), so only the page body is this package's while the shipped preview keeps its chrome; uninstalling brings the shipped body back. That body carries an **Edit** pill back to the editor and undoes what the preview's plain-text scrollport imposes (`white-space:pre` and the mono stack).
- **Export PDF, left of Edit (alpha.16).** The rendered body carries a second pill, the same size as Edit: it saves **the file on disk** as a PDF on the Desktop. The client sends only `{session, path}`; the Node half reads the file itself (never a body the tab could have edited), renders it as one **self-contained HTML page** and asks the browser already on the machine to print it (`lib/export-pdf.js`). The destination is the host's real Desktop - a OneDrive-redirected Windows profile, a `XDG_DESKTOP_DIR` Linux folder, or the home folder as the last resort - resolved per request, and `DSH_EDITOR_PDF_DIR` redirects it for a test or for someone whose Desktop is elsewhere. An export never replaces a file: the second one is `name (2).pdf`. The button reports `Exporting…`, then `Saved ✓` with the path in its tooltip, or `Export failed` with the route's reason.
- **Authored HTML is rendered, and images resolve (alpha.14).** The shipped Markdown primitive draws raw HTML as literal text and only resolves an image when it is handed a `pathImages` vocabulary, so a README with a centred badge row, a `<table>`, `<details>` or `![shot](docs/shot.png)` showed its own markup and broken pictures. The shadow body now parses **block-level HTML** itself and rebuilds it as **React elements over an allowlist** — nothing becomes an HTML string, so there is no `innerHTML` to poison and no attribute spelling that can smuggle an `onerror=` through: `<script>`, `<style>`, `<iframe>`, `<object>`, `<embed>`, form controls and SVG are dropped **with their contents**, every `on*` attribute is refused, a `javascript:` URL is refused, and an unknown structural tag loses the tag but keeps its children. **Images** resolve through the harness's authenticated `/api/file?path=` route, against the **document's own absolute path** (read off the resource, the same way the shipped body does), for a Markdown image and for an `<img src>` inside authored HTML alike; an absolute `http(s)` image is left exactly as written, and a source the route cannot vouch for degrades to its alt text. A fenced code block is never split, so an example's `<div>` still renders as code.

## How it plugs in
Expand All @@ -21,6 +22,7 @@
| `PUT /api/dsh-editor/file` | save `{session, path, text, expected?: {mtimeMs, size}}` - atomic temp+rename, `409` when the file moved on disk |
| `PUT /api/dsh-editor/file` with `{create: true}` | create a file: the parent must exist inside the workspace and is realpath-checked, the target must not exist - `409 EXISTS`, create-exclusive |
| `GET /api/dsh-editor/vendor?v=<bundle version>` | the vendored CodeMirror 6 classic bundle (`window.DSHEditorCM`), fetched lazily on first open |
| `POST /api/dsh-editor/export-pdf` | print `{session, path}` to `~/Desktop/<name>.pdf` (create-exclusive; `503 NO_ENGINE` when the host has no Chromium-family browser) |

The workspace root is resolved host-side (live session header first, session persistence second, typed `NO_WORKSPACE` otherwise) from the `session` id the tab's address already carries, `dsh-resource://file/session/<sessionId>/<path>`; the client never names a root. The engine request is version-qualified, and the route answers `cache-control: no-cache` over a content-hash ETag, re-`stat`ing the artifact per request, so a rebuild needs no restart.

Expand All @@ -32,6 +34,8 @@ The workspace root is resolved host-side (live session header first, session per
- Unsaved work is lost on tab close or restart.
- The HTML allowlist draws **block-level** authored markup: a line that starts with an allowed tag opens an HTML run, so `<kbd>` in the middle of a prose sentence is still the shipped renderer's literal text. An unclosed block with no closing line anywhere below it stays Markdown rather than swallowing every section after it.
- A **container** holds Markdown and HTML alike: `<div align="center">` on its own line, a blank line, then `# Title` draws the title as an `h1` **inside** the div, which is what GitHub does (CommonMark ends an HTML block at the blank line, and the browser nests what follows in the element still open). Only one element left open, closed on a line of its own, becomes a container; anything else - several elements open at once, a dropped tag like `<svg>`, no closing line - keeps the conservative fallback and renders as literal Markdown.
- **Export PDF needs a browser.** It uses the Chromium-family browser on the machine (Chrome, Edge or Chromium; `DSH_EDITOR_PDF_ENGINE` points at one, and `DSH_SCREENSHOT_ENGINE` is honoured too). No browser is installed, no PDF is produced, and the route says `NO_ENGINE` rather than quietly doing something worse. Nothing is downloaded.
- The export prints the **document**, not a screenshot of the bar: a light A4 page with real fonts (a Chinese README prints its Chinese), tables, code and links. A **local** image is embedded as a data URI; a **remote** (`http(s)`) image is not fetched and keeps its alt text, because this plugin starts no network egress of its own. `<details>` is drawn open, since a PDF has nothing to click. The PDF is not theme-styled: it is the paper print of the Markdown.

## Verify

Expand All @@ -40,7 +44,7 @@ node scripts/checks/check-client-bundles.mjs
node scripts/checks/check-node-routes.mjs
```

`check-client-bundles.mjs` drives the browser half through a real React runtime: the registration and guide order, the seats, the shadowed document body, the language-map guard, the Preview hand-off, the authored-HTML splitter (fenced examples excluded, an unclosed block left as Markdown, a div holding a heading drawn as a container), the allowlist (a `<script>` dropped with its contents, `onerror` and `javascript:` refused, no HTML string injected) and the image resolver (a relative destination rewritten to `/api/file?path=`, an `http` one left alone, an unresolvable one left as alt text). It also renders **this repository's own README header** and asserts that the title reaches the Markdown renderer as a heading inside the centred div, because that is the first thing a reader sees in the pane. `check-node-routes.mjs` drives the routes against a scratch workspace.
`check-client-bundles.mjs` drives the browser half through a real React runtime: the registration and guide order, the seats, the shadowed document body, the language-map guard, the Preview hand-off, the authored-HTML splitter (fenced examples excluded, an unclosed block left as Markdown, a div holding a heading drawn as a container), the allowlist (a `<script>` dropped with its contents, `onerror` and `javascript:` refused, no HTML string injected) and the image resolver (a relative destination rewritten to `/api/file?path=`, an `http` one left alone, an unresolvable one left as alt text). It also renders **this repository's own README header** and asserts that the title reaches the Markdown renderer as a heading inside the centred div, because that is the first thing a reader sees in the pane, and asserts the rendered body's **Export PDF** pill sits to the LEFT of Edit and shares its size rule. `check-node-routes.mjs` drives the routes against a scratch workspace, and for Export PDF it drives the renderer (headings, tables, fenced code, Chinese, an embedded local image, a remote image left as alt text, a fenced `<script>` left as text, a container and an open `<details>`) and the route end to end against a scratch Desktop: the PDF starts `%PDF-`, a second export becomes `name (2).pdf`, and a binary file is refused. A host with no Chromium-family browser says so and skips only the print half.

## Install

Expand Down
Loading