openpencil
ZSeven-W
The world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:IWAIBAOLI/dsh-with-pencil
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Use the official pen.dev Pencil editing capabilities inside DeepSeek Harness. DeepSeek remains the design agent; this community DSH plugin makes its model tools, the active conversation, and the Pencil canvas work together.
This is not a Pencil rewrite or a standalone design product. It integrates the
official @pen.dev/cli headless engine and a compatible official browser editor
with DSH. It is independent and is not endorsed by pen.dev or DeepSeek.
The plugin registers seven core model tools:
pencil_mcp_openpencil_mcp_get_app_statepencil_mcp_get_guidelinespencil_mcp_executepencil_mcp_get_screenshotpencil_mcp_export_htmlpencil_mcp_export_nodesSend this prompt once in a normal Harness conversation:
Create and validate a Harness Agent Preset named Pencil Designer; do not merely explain the steps. Base it on the standard coding preset and retain the fixed official tools.
Assign these Pencil design tools to the preset, and no other design tools:
pencil_mcp_open,pencil_mcp_get_app_state,pencil_mcp_get_guidelines,pencil_mcp_execute,pencil_mcp_get_screenshot,pencil_mcp_export_html, andpencil_mcp_export_nodes. Also bind one available vision tool and put its exact name in the persona; if none is available, ask the user.The persona must tell the Agent to complete
.pendesign tasks directly using only the design and vision tools assigned to this preset. Before calling a tool, read its own description and parameter definitions in the Agent's available-tools list; those descriptions are the complete usage reference — do not search for, probe, or verify usage anywhere else.The persona must require the Agent, when starting a new design, to first use
pencil_mcp_opento create a.penfile inside the workspace, then edit, take screenshots, and visually verify it until it is saved. Verify visually withpencil_mcp_get_screenshot(a visual-fidelity spot check: colors, font rendering, alignment/spacing, layout positions; large nodes render at high resolution automatically). Verify text and property content withpencil_mcp_batch_get(node reads). Usepencil_mcp_export_nodesonly for deliverable files. Do not use unspecified design tools or inspect any source code or repository to find tools or study their usage. Prefer the assigned design tools for.penedits; do not treat direct JSON editing as the default.When finished, report the preset name/path, the bound vision tool, and how to select the preset. Do not modify any other preset.
Five legacy one-shot CLI helpers are hidden by default to avoid duplicated
capabilities and irrelevant model context. Set DSH_PEN_LEGACY_TOOLS=1 only
when compatibility requires status, login, workspaces, design, and
export.
pencil_mcp_open — open/switch the conversation's .pen file; call FIRST
for any design work.pencil_mcp_get_app_state — current document state; include_schema: true
returns the .pen schema.pencil_mcp_batch_get — read node data (text content, properties) by ID or
pattern — the authoritative way to verify text and attribute values.pencil_mcp_get_guidelines — design guides and styles.pencil_mcp_execute — edit the document with a JS snippet
(Update/Insert/Copy/Delete/Move/Set/Replace).pencil_mcp_get_screenshot — visual-fidelity spot check (colors, fonts,
alignment). Large nodes and whole documents render at high resolution
automatically; with the canvas closed you get a compressed screenshot and a
hint to open the canvas.pencil_mcp_export_html — export nodes to HTML.pencil_mcp_export_nodes — export nodes to image files (deliverables).visionMode (Settings → Plugins → dsh-with-pencil, default text):
text — for DeepSeek and other non-multimodal models. Screenshots route to
high-resolution rendering so image transcription stays reliable. Image
transcription itself is not provided by this plugin: it depends on the
deployment's vision plugin (e.g. dsh-vision-proxy). Without one, images
reach the model only as markers.multimodal — native screenshots; the model sees the pixels itself.The setting card lives in Settings → Plugins → dsh-with-pencil and takes
effect immediately after saving. First installs default to text.
For implementation details see docs/ARCHITECTURE.md.
With a working DeepSeek Harness Web profile, install the npm bundle:
npx @deepseek-ai/dsh plugin --profile web add dsh-with-pencil@beta
Restart DSH Web after installation (Ctrl-C the running process first):
npx @deepseek-ai/dsh web
That is the complete normal installation. The npm bundle installs the pinned
official @pen.dev/cli. The first time you open a canvas, the plugin downloads
editor 0.1.94 directly from the official pen.dev release source, verifies its
pinned SHA-256 checksum, and atomically caches it under
~/.dsh/dsh-with-pencil/editor/0.1.94/. Harness startup does not download or
open anything, and subsequent canvas opens use the verified cache.
The browser editor is not copied into or redistributed through this npm
package. For offline use, download and extract the same official bundle ahead
of time and point DSH_PEN_EDITOR_DIR to its out directory.
For local development from this checkout:
npx @deepseek-ai/dsh plugin --profile web add file:/absolute/path/to/dsh-with-pencil
Use file: rather than link: so the target profile receives a complete
dependency tree. When migrating from an older development build, remove
pen-dev-bridge-bundle and pen-dev-bridge first so the same canvas routes are
not registered twice.
The development-only profile fixture is available at
profiles/dsh-with-pencil-template/.
| Variable | Purpose |
|---|---|
DSH_PEN_EDITOR_DIR |
Optional offline/development override for an official editor out directory |
DSH_PEN_EDITOR_CACHE_DIR |
Override the automatic editor cache root; defaults to ~/.dsh/dsh-with-pencil/editor |
DSH_PEN_FILE |
Initial workspace-relative .pen path; defaults to designs/design.pen |
DSH_PEN_CLI_BIN / DSH_PEN_MCP_BIN |
Override official CLI/MCP paths; normally unnecessary |
DSH_PEN_MCP_APP |
Explicitly connect an external Pencil app; no automatic probing |
DSH_PEN_LEGACY_TOOLS |
Set to 1 to register five legacy CLI helpers |
PEN_CLI_KEY / PENCIL_CLI_KEY |
pen.dev organization CLI key |
DSH_PEN_STATE_FILE |
Browser session file; defaults to ~/.dsh/dsh-with-pencil/state.json and reads the old location for compatibility |
.pen file, export, layout, and close
controls. These plugin-owned controls follow the active Harness language;
the official Pencil editor keeps its upstream English interface..pen inside the workspace, never overwrites an existing
target, switches the canvas to the copy, and leaves the source unchanged.exports/<document-name>/. The result menu can open that folder directly.images/
directory. SVG is converted into nodes by the official editor.*.lib.pen files and read-only libraries shipped with the official
CLI appear in the editor library list.Maintainers: see docs/ARCHITECTURE.md for the
runtime design and docs/RELEASING.md for release gates.
This integration is MIT licensed; official pen.dev and DeepSeek components are
not. See THIRD_PARTY_NOTICES.md.
让 DeepSeek Harness 使用官方 pen.dev(Pencil)的编辑能力。DeepSeek 仍然是设计 Agent; 这个社区 DSH 插件只负责让模型工具、当前会话和 Pencil 画布协同工作。
它不是 Pencil 的重写版,也不是独立设计产品。插件对接官方 @pen.dev/cli headless
引擎和兼容的官方浏览器编辑器,项目独立维护,未获得 pen.dev 或 DeepSeek 的背书。
插件默认注册 7 个核心模型工具:
pencil_mcp_openpencil_mcp_get_app_statepencil_mcp_get_guidelinespencil_mcp_executepencil_mcp_get_screenshotpencil_mcp_export_htmlpencil_mcp_export_nodes在普通 Harness 会话中发送一次以下提示词:
请实际创建并验证一个名为「Pencil 设计」的 Harness Agent Preset,不要只说明步骤。 基于标准编码 Preset,保留官方固定工具。
为该 Preset 指定以下 Pencil 设计工具:
pencil_mcp_open、pencil_mcp_get_app_state、pencil_mcp_get_guidelines、pencil_mcp_execute、pencil_mcp_get_screenshot、pencil_mcp_export_html、pencil_mcp_export_nodes,不再指定其他设计工具。 同时绑定一个可用的视觉工具,并把准确工具名写入 Persona;没有视觉工具则询问用户。Persona 应要求 Agent 直接完成
.pen设计任务,只使用该 Preset 指定的设计工具和视觉 工具。调用前查看 Agent 可用工具列表中这些工具自带的说明和参数定义;这些说明即完整 用法,不得再去其他地方查找、试探测或验证用法。Persona 应要求 Agent 在新建设计时,先用
pencil_mcp_open创建工作区内的.pen文件,再使用指定工具编辑、截图并进行视觉验证,直至保存完成。视觉验证使用pencil_mcp_get_screenshot做视觉保真抽查(颜色、字体渲染、对齐/间距、布局 位置;大节点与整文档自动走高清渲染)。文字与属性内容用pencil_mcp_batch_get按节点读取验证。pencil_mcp_export_nodes仅用于交付 文件产物。不得使用未指定的设计工具,不得通过翻查任何源码或仓库来寻找工具、研究 用法。编辑.pen时优先使用指定设计工具,不把直接修改 JSON 作为默认方式。创建完成后,报告 Preset 名称或路径、绑定的视觉工具和选择方法;不要修改其他 Preset。
为避免重复能力和无关上下文,5 个旧的一次性 CLI 助手默认隐藏。仅在兼容需要时设置
DSH_PEN_LEGACY_TOOLS=1,恢复 status、login、workspaces、design 和
export。
pencil_mcp_open — 打开/切换会话的 .pen 文件;任何设计任务先调用它。pencil_mcp_get_app_state — 当前文档状态;include_schema: true 返回 .pen schema。pencil_mcp_batch_get — 按节点 ID/模式读取节点数据(文字内容、属性)——验证文字与
属性值的权威方式。pencil_mcp_get_guidelines — 设计指南与样式。pencil_mcp_execute — 用 JS 片段编辑文档(Update/Insert/Copy/Delete/
Move/Set/Replace)。pencil_mcp_get_screenshot — 视觉保真抽查(颜色、字体、对齐)。大节点与整文档自动
走高清渲染;画布未打开时返回压缩截图并提示打开画布。pencil_mcp_export_html — 导出节点为 HTML。pencil_mcp_export_nodes — 导出节点为图片文件(交付物)。visionMode(设置 → 插件 → dsh-with-pencil,默认 text):
text — 适用于 DeepSeek 等非多模态模型。截图自动走高清渲染,保证图片转译的可靠性。
本插件不提供图片转译模块:转译依赖部署方的视觉插件(如 dsh-vision-proxy);
没有视觉插件时,图片对模型只显示为标记。multimodal — 使用原生截图,模型自己看像素。配置卡片位于 设置 → 插件 → dsh-with-pencil,保存后立即生效;首次安装默认
text。
实现细节见 docs/ARCHITECTURE.md。
在已有可用 DeepSeek Harness Web profile 的前提下,安装 npm Bundle:
npx @deepseek-ai/dsh plugin --profile web add dsh-with-pencil@beta
安装完成后重启 DSH Web(先用 Ctrl-C 停止正在运行的进程):
npx @deepseek-ai/dsh web
这就是正常情况下的完整安装步骤。npm Bundle 会安装固定版本的官方 @pen.dev/cli。
用户第一次打开画布时,插件才会从 pen.dev 官方发行源直接下载 editor 0.1.94,核对
固定的 SHA-256 校验值,并原子缓存到
~/.dsh/dsh-with-pencil/editor/0.1.94/。Harness 启动时不会下载或打开画布,之后再次
打开会直接使用已验证缓存。
npm 包本身不复制或再分发 browser editor。离线环境可以预先下载并解压相同的官方版本,
再用 DSH_PEN_EDITOR_DIR 指向它的 out 目录。
从本仓库进行本地开发安装:
npx @deepseek-ai/dsh plugin --profile web add file:/absolute/path/to/dsh-with-pencil
这里使用 file: 而不是 link:,让目标 profile 得到完整依赖树。从旧开发版迁移时,先移除
pen-dev-bridge-bundle 和 pen-dev-bridge,避免相同画布路由被注册两次。
开发用 profile 模板位于 profiles/dsh-with-pencil-template/。
| 变量 | 说明 |
|---|---|
DSH_PEN_EDITOR_DIR |
可选的离线/开发覆盖项,指向官方 editor 的 out 目录 |
DSH_PEN_EDITOR_CACHE_DIR |
覆盖自动下载缓存根目录;默认 ~/.dsh/dsh-with-pencil/editor |
DSH_PEN_FILE |
会话首次打开的 .pen 相对路径,默认 designs/design.pen |
DSH_PEN_CLI_BIN / DSH_PEN_MCP_BIN |
覆盖官方 CLI/MCP 路径;通常无需设置 |
DSH_PEN_MCP_APP |
显式连接外部 Pencil app;默认不自动探测 |
DSH_PEN_LEGACY_TOOLS |
设为 1 时注册 5 个旧 CLI 助手 |
PEN_CLI_KEY / PENCIL_CLI_KEY |
pen.dev 组织 CLI key |
DSH_PEN_STATE_FILE |
Browser 登录态文件,默认 ~/.dsh/dsh-with-pencil/state.json,并兼容读取旧路径 |
.pen 文件、导出、布局和关闭操作。这些插件自有控件跟随当前 Harness
语言;官方 Pencil editor 保持其上游英文界面。.pen,拒绝覆盖已有文件,自动切换到副本并保持原文件不变。exports/<文档名>/,并从结果菜单直接打开该文件夹。images/;SVG 由官方 editor 转换成节点。*.lib.pen 和官方 CLI 随附的只读库会出现在 editor 设计库列表中。维护者请参阅 docs/ARCHITECTURE.md(运行时设计)和
docs/RELEASING.md(发布门槛)。本对接代码采用 MIT 许可;
官方 pen.dev 与 DeepSeek 组件不属于该许可,详见
THIRD_PARTY_NOTICES.md。
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: mcp。