跳到正文
dsh-market 浏览插件 GitHub EN

PerryLink/dsh-draw

多引擎文生图(OpenAI Images 与智谱 CogView 预设):按会话配额、引擎故障切换、凭证安全配置,结果卡片支持重新生成。

Star 数 ★ 9 分类 视觉与多模态 收录于 2026-09-03 npm dsh-draw

安装

在 DeepSeek Harness 里通过 dsh-market 安装

dsh plugin --profile web add dshmarket

或使用命令行

dsh plugin --profile web add dsh-draw

装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络。请先审阅源码,并尽量锁定 commit(github:owner/repo#sha)。

README

🎨 dsh-draw

  • 1024 商店渠道:先 npm i -g dsh1024,再 dsh1024 plugin --profile web add dsh-draw(计入 deepseek1024.com 安装排行)。

DeepSeek Harness 的统一静态图像生成路由。

一个工具、多个引擎 —— 健康感知回退、结果持久、用量记账。

dsh-doctor DSH Market

English · 简体中文 · Español · Português · हिन्दी


⭐ 如果它帮到了你

这个插件是 DSH 插件家族的一员(40+ 个,全部 Apache-2.0)。如果你在用,给个 star —— 它不会解锁任何功能,但会让下一个人在搜索里更容易找到它。

English: part of a 40+ plugin family for DeepSeek Harness. If it is useful, a star helps the next person find it — nothing is gated behind it.

兼容性

方面 状态
Harness DeepSeek Harness dsh-v0.1.7-rc.2(声明兼容 0.1.5-rc.2)
Node ^22.19.0 || >=24.0.0
引擎 任意 OpenAI 兼容图像端点;内置 OpenAI Images(gpt-image-1)与智谱 CogView(cogview-3-flash)预设
界面 Host image_generate 工具 + Web 结果卡片 + Plugins 设置页签

浏览器半边基于 cordis Context 与已发布的客户端包(dsh-client-ui-slots、dsh-client-ui-settings、dsh-client-ui-tool、dsh-client-locale、dsh-client-connection);它不再依赖已移除的 dsh-client-runtime 包(工具调用块经本地结构契约读取),因此客户端接口面同样对齐 0.1.2-rc.1 宿主。 0.1.2-rc.1(2026-09-02 已适配):会话信封保留 ignorable 字段但仅用于存量日志读取兼容——Session.append 仍无法盖章,门控行为不变。已于 2026-09-06 对照 dsh-v0.1.7-alpha.1 master 检出核验(完整门禁链 + profile 安装冒烟)。 0.1.6-alpha.2(2026-09-18 已适配):Session.append 的第三参仅对表面事件类型存在且为 SurfaceIntent,绝非 ignorable 信封,因此非表面的 draw/generated 在该线上仍不落盘——配额按会话内存计数、会话重启归零(与下方「配额持久性」一致)。已于 2026-09-18 核验(双 typecheck 尺子 + 全量测试 + self-contained/artifacts/readme 门)。 0.1.7-rc.2(2026-09-23 已适配):客户端 tool.call.toolview 契约把 owner 拆成三个阶段(preparing / start / result),且参数仍在流式到达时就会派发带 key 的卡片。因此结果卡片现在也为这些更早的阶段渲染「进行中」行——已占用的 keyed 槽位永远不会落到宿主自带的通用行,所以对准备阶段不作回应会让整行在整个流式窗口内空白。其余行为不变:结算后的卡片、账目行与重新生成与之前完全一致。已于 2026-09-23 核验(双 typecheck 尺子 + 全量测试 + 新增 host-contract 门)。

你能得到什么

dsh-draw 给 harness 一个统一的 image_generate 工具,标准参数(prompt/size/count/quality/style/engine)按引擎翻译:

  • 多引擎路由 —— 配置驱动的引擎链(OpenAI Images、智谱 CogView 或任意 OpenAI 兼容端点)自上而下执行,健康感知回退:连续失败让引擎进入冷却,由下一个健康引擎接单。
  • 结果持久化 —— 生成的图片存为工作区附件(内容寻址、受 harness 附件策略约束),返回规范文件引用。
  • 配额记账 —— 按会话的调用次数与图片字节上限,从持久会话日志折叠计算,引擎开销前与落盘前双重强制。
  • 凭据即引用 —— 引擎 API 密钥是环境变量名,每次调用经官方 ctx.credentials 接缝解析;配置里绝不写明文、日志里绝不出现。
  • Web 界面 —— 会话内结果卡片(图片、引擎、配额、一键重新生成)与 Plugins 设置页签(引擎链、凭据状态、探测、配额上限)。
模型                           harness
  │ image_generate {prompt, ...} ──▶ 校验 ──▶ 配额检查 ──▶ 路由
  │                                  openai ──(失败)──▶ cogview ──▶ 图片
  │ ◀── 规范 JSON + 图片块(持久附件引用)
  │                       └── draw/generated 会话事件(配额 + 审计)

快速开始

# 1. 把 bundle 装进你的 profile
dsh plugin --profile web add "github:PerryLink/dsh-draw#main"

# 或从 npm 安装(正式发布版)
dsh plugin --profile web add dsh-draw

# 2. 以凭据引用(环境变量)提供引擎密钥
#    OPENAI_API_KEY 和/或 ZHIPU_API_KEY —— 绝不写进 profile patch

# 3. 重启并核实行
dsh --profile web --dump-config | grep -A2 'id: dsh-draw'

然后让 agent 画图:

> 画一张 1536x1024 的黄昏灯塔风景,vivid 风格。

安装与卸载

  • git 通道(最新 main):dsh plugin --profile web add "github:PerryLink/dsh-draw#main" —— prepare 脚本仅用生产依赖构建。
  • npm 通道(正式发布版):dsh plugin --profile web add dsh-draw。
  • tarball 通道:在本仓库执行 pnpm pack,然后 dsh plugin --profile web add ./dsh-draw-<version>.tgz。
  • 卸载:dsh plugin --profile web remove dsh-draw(或从 profile patch 中删除该行)。

如果 pnpm 对本包报 ERR_PNPM_IGNORED_BUILDS(esbuild 的平台二进制无害校验),在你的 pnpm-workspace.yaml 中加入 allowBuilds: { esbuild: true } —— dsh CLI 会打印确切片段。

配置

所有可调项都是 Schemastery Config 字段(可在 cordis.yml 中修改)。按 id 定向覆盖会替换整行 —— 需要重新声明每个键。cordis.patch.yml 内联说明了每个键。

键 默认值 含义
engines OpenAI + CogView 预设 有序引擎链,自上而下带回退;每项:id、baseUrl(不含凭据)、model、apiKeyRef(环境变量名)、enabled、sizeMap、qualitySupported、styleSupported、responseFormat(b64_json/url)、imageMediaType
defaultEngine openai 路由首选引擎 id;必须是已配置引擎
requestTimeoutMs 120000 每次生成 HTTP 超时(1000..600000)
maxImagesPerCall 4 单次调用可生成图片上限(1..10)
maxPromptLength 4000 提示词字符上限(1..32000)
maxGenerationsPerSession 200 每会话生成调用上限(1..100000)
maxBytesPerSession 209715200 每会话图片字节上限(1048576..4294967296)
failureThreshold 2 引擎进入冷却前的连续失败次数(1..10)
cooldownMs 60000 触发阈值后的冷却时长(1000..3600000)

profile patch 中的覆盖示例:

- insert:
    - id: dsh-draw
      name: dsh-draw
      config:
        defaultEngine: cogview
        maxImagesPerCall: 2

工具与界面

界面 说明
image_generate 标准参数;返回规范 JSON(引擎/模型/尺寸、图片引用、配额、回退标志、尝试记录)加图片内容块
结果卡片(tool.call.toolview,key image_generate) 覆盖调用的每个阶段:参数流式到达时先显示进行中行,结算后显示图片、引擎/配额行与一键重新生成(完整 drawer 路径:配额 + 路由 + 审计)
设置页签(Plugins → 图像生成) 引擎链、凭据状态、设置/移除 API 密钥(凭据引用)、连通性探测、配额上限

权限与数据

  • 权限:插件仅对配置的引擎端点发起 HTTPS 出站请求;其余界面全部只读。设置页签唯一的写入是对官方 ctx.credentials 接缝的凭据设置/移除。
  • 数据:生成的图片经官方附件存储落盘,受 harness 附件策略约束。配额用量从 draw/generated 会话事件折叠;在无法安全落盘该事件的宿主上另加内存兜底账簿 —— 除此之外不存储任何东西。
  • 会话日志:draw/generated 事件记录引擎、模型、标准化请求、字节总量与附件 id —— 审计事实,绝不包含 API 密钥。仅当宿主收录该类型或支持 ignorable 信封时才落盘(挂载期探测);在 rc.6/rc.7 宿主与 0.1.2-rc.1 线(append 无法盖章、读取时对未知类型失败关闭)上,载荷改记内存兜底账簿,生成图片不再导致会话重启后无法打开。

安全边界

  • 凭据即引用,绝不写明文。 apiKeyRef 命名环境变量;baseUrl 内嵌凭据会在加载期大声失败。
  • 展示脱敏。 URL、探测备注与错误文本在展示或写日志前脱敏(userinfo 密码、凭据查询值、bearer token、JWT)。
  • 配额先于开销。 调用与字节上限在引擎调用前与附件落盘前检查;超限会话快速失败、不烧引擎额度。
  • 大声失败、刻意回退。 畸形响应给出结构化错误;引擎达到冷却阈值后被跳过;整条链耗尽时返回完整尝试记录而非假装成功。

已知限制

  • 仅图像模型。 无视频、音频或编辑端点;无视觉理解。
  • 引擎兼容性。 引擎需支持 OpenAI POST /images/generations 形状(base64 或 URL 交付);厂商专属扩展不在范围内。
  • 成本感知是结构性的。 插件统计调用次数与字节,但不了解引擎定价 —— 与 dsh-budget 配合做成本治理。
  • rc.6/rc.7、0.1.2-rc.1 与 0.1.6-alpha.2 上的配额持久性。 会话日志无法安全携带 draw/generated 的宿主(静态事件白名单、无 ignorable 信封;0.1.2-rc.1 无法盖章并在读取时对未知事件类型失败关闭;0.1.6-alpha.2 上 append 第三参仅对表面类型存在,非表面事件无法盖章)上,配额经内存兜底账簿在活会话内保持精确,但重启后重置;宿主具备插件事件面后恢复持久记账。首次被拒的提交会告警一次,降级不再静默。

开发

pnpm install        # node ^22.19 || >=24
pnpm run typecheck  # tsc:src + tests,对照本地 harness checkout
pnpm run typecheck:ci  # tsc:对照已发布的 0.1.7-rc.2 类型(无 paths)
pnpm test           # vitest:19 个 spec 文件(scripted 传输、真实 Context/Session/ToolRuntime)
pnpm run build      # tsc 声明 + tsdown 打包(lib/)
pnpm run verify:self-contained  # 依赖声明全部来自 registry
pnpm run verify:host-contract   # 宿主 tool-view 契约仍与本插件声明一致
pnpm run verify:artifacts       # host ESM 面 + typert manifest + 浏览器包 + 配置文件
pnpm pack           # 发布用 tarball

Topics

dsh, dsh-plugin, deepseek-harness, deepseek, cordis, image-generation, openai-images, cogview, zhipu, text-to-image

Contributors

  • @PerryLink —— 创建者与维护者:引擎路由、drawer、配额记账、Typert wire 词汇、浏览器半与五语文档。
  • @Mohei-Muun —— 报告了 rc.7 主机上 draw/generated 会话日志导致会话无法重载的缺陷(#2),推动了自适应事件门控的实现。

PerryLink DSH Plugin Family

This project is one of the 45 DeepSeek Harness plugins maintained by PerryLink. If this one helps you, the others likely will too:

Plugin One-liner
dsh-auto-review Second-model auto-review on the approval chain, fail-closed by default
dsh-autotier Automatic strong/cheap model-tier routing with deterministic risk guards and a /tier command
dsh-background-agents Durable background child agents with a Web UI sidebar, messaging and interrupt
dsh-budget Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.
dsh-catalog DSH Desktop Market standard catalog source for the PerryLink family
dsh-cert-mcp Read-only MCP server exposing the certification registry: grades, snapshots and five-dimension evidence
dsh-checkpoint-rewind Claude Code /rewind-equivalent: snapshots, session forks, one-shot restore
dsh-claude-move Migrate Claude Code sessions, memory, skills and CLAUDE.md into DSH
dsh-click Cross-platform native desktop control for DeepSeek Harness — Windows first.
dsh-composer-history Terminal-style input history for the web composer: arrows, Ctrl+R search
dsh-data-quality Dataset quality checks and citation cross-checks (the optional numeric bridge consumed here)
dsh-defend Prompt-injection, jailbreak, and secret-leak defense for DeepSeek Harness.
dsh-doublecheck Engineering-discipline guard: requirements grill, test gates, adversary review
dsh-draw Unified static-image generation routing for DeepSeek Harness.
dsh-fast Read-only performance diagnostics for DeepSeek Harness.
dsh-fund-research Deterministic research reports for Chinese public mutual funds
dsh-github GitHub PR/issues integration for DSH, every write gated by approval
dsh-industry-research Industry research orchestration that seals its deliverables through this plugin's ctx.researchReport.assemble
dsh-laya Laya typed decisions (noul/choice/score) as a first-class Cordis service and model-visible tools
dsh-library Local document knowledge base for DeepSeek Harness.
dsh-local-ai Local-model (Ollama) integration for DeepSeek Harness.
dsh-lsp-actions LSP diagnostics, formatting, completion, code actions and rename over language servers
dsh-mask PII masking middleware: anonymize at the model boundary, restore at the display layer
dsh-mcp-panel Read-only MCP runtime panel: /mcp command + Settings tab with status, tools and errors
dsh-memento Approval-gated cross-session memory: ctx.memory seam + SQLite + memory tool
dsh-observe OpenTelemetry and Langfuse observability exporter for DeepSeek Harness.
dsh-output-styles Claude Code outputStyles-equivalent runtime style switching
dsh-permission-rules Claude Code-style declarative allow/deny/ask permission rules with audit
dsh-plugin-certification Community certification registry with repro-checkable grades and badges
dsh-plugin-doctor Zero-dependency static + sandbox smoke detector for DSH plugins
dsh-plugin-guide Plugin-development knowledge base as an on-demand agent skill
dsh-plugin-kit Shared zero-runtime-dependency toolkit for the PerryLink DSH plugins
dsh-plugin-upgrade One-package, one-corridor-index plugin upgrade skill: routes a repository to the matching closed corridor card
dsh-plugin-upgrade-015 Merged 0.1.3-alpha.1 → 0.1.5-rc.1 upgrade corridor card plus a zero-dependency seam scanner
dsh-reach Multi-channel approval/question bridge: WeChat/Telegram/Feishu, session console
dsh-research-report Verifiable research-report engine: content-addressed evidence ledger and sealed versions
dsh-score Multi-dimensional quality scoring for DeepSeek Harness plugins.
dsh-session-pin Pin sessions in the Web sidebar with durable ordering
dsh-session-sync Cross-device session sync for DeepSeek Harness — a dedicated git mirror of your session store.
dsh-skill-pack-security Security-audit skill pack: secret scan, dependency and supply-chain review
dsh-talk Voice-first session loop for DeepSeek Harness: talk to it, hear it answer.
dsh-team-rooms Cross-session team rooms: shared message bus, task board and timeline
dsh-test-drive Isolated install-and-smoke test drives for DeepSeek Harness plugins.
dsh-ticktick TickTick/Dida365 task bridge: session-header panel + 11 tools
dsh-translate Vendor parameter translation and deterministic JSON repair for DeepSeek Harness.

License

Apache License 2.0 © 2026 dsh-draw contributors

从 DSH Desktop 市场安装

所有 PerryLink 插件均可在 DSH Desktop 内置市场中浏览:市场 → 来源 → 添加来源 → 粘贴 https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json → 选中。安装仍需通过市场的 npm 身份校验与你的确认。

内容来自项目 README(GitHub)↗

评论存放在 GitHub Discussions。用 GitHub 账号登录后可发表评论或点表情。