Adds a "Text Injection" section to the DSH Settings sidebar: user-maintained blocks in a standalone Markdown file are injected into the system prompt every turn or into session context with keyword gating, with hot reload and automatic history backups.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:1497105876/dsh-text-inject
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
在 dsh(DeepSeek Harness)官方设置页左侧栏添加一个「文字注入」分区:把文字注入到 系统提示词(每轮生效)或会话上下文;内容存于独立文件,支持热加载与历史备份。
不碰官方 inject-system-prompt 那种"在官方配置里塞字段"的做法——你的文字写在你自己的一份
inject.md 里,随手可改。
功能
| 能力 | 说明 |
|---|---|
| 提示词注入 | ## [system] 名称 块 → 追加进系统提示词,每轮对话生效 |
| 上下文注入 | ## [context] 名称 块 → 合成一条 user 消息注入会话;kind 去重、trigger 关键词门控 |
| 增删改 | 设置页以卡片列出所有块,支持新增 / 编辑 / 删除 / 启停 |
| 独立文件 | 内容全部写在你自己的一份 inject.md,与官方配置隔离 |
| 热加载 | 改文件保存即生效(fs.watch),或在设置页点保存;都不用重启 dsh |
| 历史备份 | 每次保存自动把上一版存进 history/,可查看 / 一键恢复(保留最近 30 份) |
安装
把本包放进对应 profile 的 node_modules(scope 目录
@gw):# web profile(桌面客户端则换成 profiles/desktop) cp -r dsh-text-inject ~/.dsh/profiles/web/node_modules/@gw/在 profile 的
cordis.patch.yml追加 loader 入口:- insert: - id: gw-text-inject name: '@gw/dsh-text-inject'重启 dsh,打开设置页 → 左侧栏出现「文字注入」。
数据文件默认在 ~/.dsh/profiles/<profile>/text-inject/inject.md(识别到 dsh profile 时;未识别则回落 ~/.dsh/text-inject/inject.md),插件首次加载会自动创建(含示例块)。
想换位置,在 loader 入口加 config.file:
- insert:
- id: gw-text-inject
name: '@gw/dsh-text-inject'
config:
file: 'C:/Users/<你的用户名>/Desktop/文字注入.md'
数据文件格式
# 任意标题(说明用,忽略)
## [system] 我的常驻规则
order: 40
这段会追加进系统提示词,每轮生效。
## [context] 项目背景
kind: gw-project
trigger: 项目,需求
当消息里出现「项目」或「需求」时,这段作为一条 user 消息注入会话。
- 块头:
## [system] 名称或## [context] 名称(大小写不敏感)。 - 元数据:紧跟在块头之后、正文之前,英文冒号,只认
order/kind/trigger/enabled。 一旦出现非元数据、非空行,后面就全是正文——所以正文里的「中文:」不会被误解析。 [context]块必须有kind(唯一,用于去重);trigger留空 = 每轮注入。enabled: false可临时禁用某块。
设置页数据通道
前端无本地文件桥,读写经 host 的 webServer 路由(同源,无 CORS、不额外占端口):
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /gw-text-inject/state |
{ file, raw, blocks, history } |
| POST | /gw-text-inject/save |
body { blocks } → 保存 + 自动备份 |
| POST | /gw-text-inject/restore |
body { name } → 恢复某份备份 |
| GET | /gw-text-inject/raw?name=<备份名> |
读某份备份原文 |
依赖与兼容
- host 半依赖服务:
systemPrompt(@deepseek-ai/dsh-base提供)、webServer(@deepseek-ai/dsh-host-webserver提供)。 - client 半依赖服务:
slots、locale;dsh.client.inject声明@deepseek-ai/dsh-client-locale、@deepseek-ai/dsh-client-ui-settings。 dsh.client.platform = "web";exports含"."与"./client"。- 兼容 dsh 0.1.2-rc.1 及以上(含 0.1.7、0.2.0 全系列),通过
peerDependencies["@deepseek-ai/dsh"]声明;同一份代码通吃,无需按 dsh 版本挑插件版本(最后验证 2026-10-01)。 - 官方
@deepseek-ai/*包未列入dependencies,由宿主 profile 提供。
单版本通吃,无需按 dsh 版本挑
dsh 在加载前只校验插件 peerDependencies["@deepseek-ai/dsh"] 是否满足当前运行版本(不满足会禁用该插件并提示 dsh plugin allow-version ... --accept-risk)。本插件声明为 >=0.1.2-rc.1,因此 0.1.x 与 0.2.0 直接装同一份、加载同一份,不必区分版本、不必挑 tag。
仓库根目录的
tools/install.sh/tools/install.ps1是可选的本地小工具(已 gitignore,不随发布走),只在你想把插件固定到某个 git tag 时才用;默认安装直接取本仓库main或最新 tag 即可。
卸载
- 删掉 profile
cordis.patch.yml里的gw-text-injectinsert 块。 - 删除
node_modules/@gw/dsh-text-inject/。 - 数据文件
~/.dsh/text-inject/(旧全局目录)与各 profile 的~/.dsh/profiles/<profile>/text-inject/(含history/)可按需保留或删除。 - 重启 dsh。
权限与数据
- 读写的只有一份文件:默认 profile 专属目录下的
inject.md及其history/备份(识别不到 profile 时回落~/.dsh/text-inject/;可在 loader 配置里改到任意路径)。 - 不访问网络、不读凭据、不上报任何数据。
- 前端与 host 之间走 dsh 自己的 webServer 同源路由(
/gw-text-inject/*),不额外开端口、无跨域。 - 注入的内容会进入每一轮请求,等于放大提示词体积——
[context]块建议配trigger,别全量常驻,否则白白烧 token。
常见问题
| 现象 | 原因 / 处理 |
|---|---|
| 设置页左侧栏没有「文字注入」 | 包没进 node_modules,或 cordis.patch.yml 的 insert 块用了 file:// 路径。带 dsh.client 的插件必须真装进 node_modules,绝对路径挂载会让整站前端 bundle 连坐失败 |
| 改了文件没生效 | 热加载靠 fs.watch;部分编辑器「原子保存」会丢事件,去设置页点一次保存即可 |
| 上下文块一直重复注入 | [context] 块缺 kind(去重键),或 trigger 太宽泛 |
| 元数据行没被识别 | 必须用英文冒号,且要紧跟块头、在正文之前 |
整站前端报 Failed to load plugins |
见第一条:摘掉本插件的 insert 块并重启,前端即恢复 |
回滚:按「卸载」四步走,数据文件可保留。插件自身不落盘日志,排障看 dsh 启动日志。
许可证与安全
MIT,见 LICENSE。本插件不接触密钥、不产生外发流量,安全问题直接在仓库提 issue。
结构
dsh-text-inject/
├─ package.json # npm 元数据 + dsh.bundle.patch + dsh.client 声明
├─ cordis.patch.yml # loader 入口(insert 块)
├─ inject.md # 数据文件种子模板(首次加载复制到用户数据文件)
├─ lib/
│ ├─ index.js # host 半:注入 + 热加载 + webServer 数据路由 + 备份
│ ├─ client.js # client 半:设置页「文字注入」UI(lazy-CJS bundle)
│ └─ parser.js # inject.md 的纯解析 / 序列化
└─ README.md
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 10562
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 10562
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
ccch1mneyyy/dsh-TUI★ 8043
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 7387
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
omdsh-dev/DSH-better-sidebar★ 5269
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
omdsh-dev/dsh-genui★ 1040
Interactive UI components rendered inline in replies: layout, charts, forms, quizzes, mermaid, 3D scenes, and an action event loop back to the model.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.