Gan332/dsh-typography

dsh-typography

Typography plugin for DeepSeek Harness - independent interface & code fonts, online presets, zero-conversion local font library (woff2/ttf/otf)

Uncategorizeddeepseek-harnessfontstypography

dsh-typography

Typography plugin for DeepSeek Harness — independent interface & code fonts · online presets · zero-conversion local font library

中文 | English

Introduction

The DeepSeek Harness Web UI exposes two font entry points as CSS variables: --dsw-font-family (interface) and --ds-font-family-code (code), consumed by every component through var(). dsh-typography turns them into two fully independent selections:

  • Separate interface / code fonts: each group has its own preset cards, import editor, and persisted state
  • Online presets: Inter + JetBrains Mono, IBM Plex Sans + Fira Code, Noto Sans SC (full Simplified Chinese coverage); font files ship via the jsDelivr CDN and fall back to system stacks offline
  • Local font library: drop any woff2/ttf/otf into %DSH_HOME%\typography\, refresh, apply with one click — TTF works directly, no woff2 conversion needed
  • Variable-font friendly: pick "variable · all weights" to emit a font-weight: 100 900 descriptor with real weight rendering
  • Hands-off defaults: a group set to "Default" writes no styles at all, coexisting with other font plugins
  • Cross-DSH-version compatibility: adapted for DSH 0.1.6-alpha.2 — the defineStore engine lives in @deepseek-ai/dsh-client-store, but that package carries no dsh.client declaration and never becomes a row in the client module table, so the plugin bundles its own minimal snapshot store engine (action signature matches the official contract: (draft, ...args) => void); dsh.client.inject only declares the core services present in every supported DSH version (slots / locale)

Usage

This is a dual-face plugin: the host half serves local font files while the browser half provides the registry and settings row. After install it appears under Settings → General → Fonts (interface / code).

Install:

DeepSeek Harness has two entry points with independent profiles — install into whichever you use:

# DSH Desktop app (default port 43120)
dsh plugin --profile desktop add github:Gan332/dsh-typography

# CLI `dsh web` (default port 3080)
dsh plugin --profile web add -w /path/to/dsh-typography
# local directory (the profile dir is a pnpm workspace root; -w is required)

Then restart the matching entry. Desktop note: a terminal install records a recovery transaction that the app verifies and clears on its next start; when installing several plugins in a row, restart between installs.

Switching fonts: click a card in either group to apply live; "Default" restores the system stack.

Importing custom fonts: fill three fields in the group's editor and press "Add":

FieldDescription
Familyany name used in the font stack (e.g. MiSans)
Font URLsee "Font URL formats" below; woff2 / ttf / otf supported
Weight400 Regular · 500 Medium · 600 Semibold · 700 Bold · Variable · all weights. For static fonts choose the weight matching the file; for variable fonts (e.g. MiSans VF) choose "Variable · all weights" to get every real weight

Entries apply immediately, survive refreshes; re-adding the same family + weight replaces the old one, "Remove" deletes.

Local font library:

copy C:\Users\fish\Downloads\MiSansVF.ttf $env:USERPROFILE\.dsh\typography\

Refresh → your group → Local font library → click MiSansVF. Zero conversion, all variable weights.

Font URL formats — same-origin relative paths are recommended (port-independent):

/plugins/dsh-typography/files/MiSansVF.ttf          ✅ recommended (same-origin)
http://127.0.0.1:43120/plugins/dsh-typography/...   ⚠️ works, but breaks if the port shifts
https://cdn.example.com/some-font.woff2             ✅ external CDN direct link

Plugin API

The browser half provides the registry on the root context; other plugins can consume it via ctx.get("typography"):

const typography = ctx.get("typography")
// two independent groups: "ui" | "code"
typography?.select("code", "inter-jetbrains")
typography?.setCustom("ui", [
  { family: "MiSans", weight: "100 900", src: ["/plugins/dsh-typography/files/MiSansVF.ttf"] },
])
const off = typography?.subscribe((snapshot) => {
  console.log(snapshot.ui.selected, snapshot.revision)
})

Full types live in lib/types/client/index.d.ts.

How it works

  • On apply the browser half publishes the registry via ctx.provide("typography", registry); selection changes rewrite the injected <style id="dsh-typography-style"> sheet: @font-face rules plus CSS-variable overrides for non-default groups only
  • The host half registers /plugins/dsh-typography/files/* through ctx.webServer, serving files from %DSH_HOME%\typography (font/woff2 | font/ttf | font/otf by extension; ?list=1 returns the index JSON)
  • Selections persist in browser localStorage (dsh-typography:prefs) and are restored on boot; stale preset ids are ignored during restore
  • The settings row registers into the Settings → General item slot (ctx.slots, id typography) with bilingual copy from ctx.locale

Known limitations

  • Online presets need internet; offline they fall back along the stack tail to system fonts
  • Library file names must start with a letter/digit (Unicode letters fine; Chinese names work)
  • A few components hardcode an Inter, var(--dsw-font-family) head (e.g. the workspace browser) and still show Inter where it is installed
  • When installed alongside dsh-fonts: any non-default selection here wins for its variables (our sheet mounts later); to keep only one, dsh plugin --profile <name> remove <the-other>

💝 Acknowledgements

  • zhijun-dai/dsh-Fonts — the direct reference and inspiration for this project: the bundle-patch layout (single cordis.patch.yml insert), the dsh.client dual-face declaration, settings-slot integration, localStorage persistence, and the "presets + custom import" product shape all follow that repository. dsh-Fonts proved a font system was possible on DSH; this plugin stands on its shoulders and adds independent interface/code groups plus a zero-conversion local library. Thanks to @zhijun-dai
  • DeepSeek Harness — the plugin architecture and the dsh.client dual-face mechanism
  • Fontsource — webfont distribution for the online presets
  • Upstream typefaces: Inter, JetBrains Mono, IBM Plex, Fira Code, Noto Sans SC — all under OFL/SIL

dsh-typography · MIT License