Preface¶
DeepSeek Harness (DSH) adopts a plugin-based architecture. The default renderer usually only meets basic display requirements. If you need richer message formatting, variable handling, or structured document rendering, you can add a plugin to DSH. dsh-tavern-renderer is a self-contained “tavern-style” message rendering plugin for DeepSeek Harness. It does not modify persistent session events, only changes the DOM presentation, and does not change the prompt sent to the model.
Core Capabilities¶
The plugin provides a complete rendering pipeline and supports the following features:
- Ordered regex replacement: Supports
$1,$<name>,$&,$$, and{{match}}interpolation; rules are executed serially in array order. - Macro and variable system: Built-in variables for character (
{{char}}), user ({{user}}), time, date, etc., and supports custom variables ({{setvar}},{{addvar}}). - Safe inline expressions: Supports restricted JavaScript expressions (e.g.,
{{js::1 + 2 * 3}}), while prohibiting prototype access, function calls, andeval. - Markdown and HTML/CSS sanitization: Supports full Markdown syntax and strictly sanitizes HTML/CSS by removing dangerous tags, attributes, and remote resources.
- Character templates: Allows custom HTML wrapping structures for different roles.
- Theme system: Supports preset theme switching and custom CSS injection.
- Eight immersive document templates: Including letter, exam, postcard, telegram, dossier, etc.
Installation and Activation¶
The current target is DeepSeek Harness 0.1.7-rc.2. Use the following command to install:
npx --yes @deepseek-ai/dsh@0.1.7-rc.2 plugin --profile web add .
After startup, enter using the full Web URL printed in the terminal (including the one-time token). Authentication is handled by the host; the plugin does not manage tokens by itself.
Usage Examples¶
Regex Configuration¶
The plugin supports two configuration styles: compact syntax and object structure:
DeepSeekTavernRenderer.configure({
regexRules: [
'/([A-Z]+)-(\\d+)/编号 $2,角色 {{char}},类型 $1/g',
],
})
Macro and Variable Calls¶
Use built-in variables and custom variables:
// 内置变量
{{char}}, {{user}}, {{time}}, {{date}}
// 自定义变量
{{setvar::mood::calm}}
{{getvar::mood}}
{{incvar::turn}}
Immersive Document Templates¶
The model only needs to output a specific fence to generate a structured document:
:::letter
from: {{char}}
to: {{user}}
date: {{date}}
subject: The signal after midnight
---
Dear **{{user}}**,
The receiver woke at 23:40.
:::
Theme Switching¶
Switch preset themes or inject custom CSS via the API:
DeepSeekTavernRenderer.setTheme('harness')
DeepSeekTavernRenderer.setCustomCss(`
.dsh-tr-message { line-height: 1.85 }
`)
Notes¶
- Rendering boundary: The plugin only consumes display nodes for
assistant-step/user/steering; it neither reads nor writes persistent session events, and does not participate in RP settlement. Streamingrunningand finalsettled/interruptedsemantics are preserved. - Security mechanisms: HTML sanitization uses a DOM tree and explicit tag/attribute whitelists. Message class names are uniformly rewritten to
custom-*, and CSS is scoped under.dsh-tr-message-content. - No backend dependency: There is no ApiProxy, backend Remote service, or custom settings card. Theme and macro configurations are managed by browser APIs and localStorage.
- Permission scope: The plugin runs with the permissions of the current DSH process (browser side); the source code should be reviewed before installation.
Ecosystem Context¶
The DSH philosophy is “everything is a plugin.” The community catalog (https://www.skillhub.cn/plugins) is an independent site and has no official affiliation with DeepSeek / Huanfang.