lehhair/dsh-html-artifact
lehhair★ 2TypeScriptLast synced: 2026-08-15
—
README excerpt
dsh-html-artifact HTML 实时渲染插件:模型通过专门的 artifact 工具创建/修补 HTML 文档,GUI 在沙箱 iframe 里 实时渲染 。核心区别:模型 打 patch ( old string / new string ,和文件 edit 工具同一套语义),而不是每次重发整个 HTML —— 只传增量,预览原地更新。 纯扩展实现, 不改 harness core : - 服务端: artifact 工具(create / patch / read / destroy / list),per-session 注册表; card: 'artifact' 渲染意图通过 presentResult 走线(core 的 union 不认识这个 card,返回值做了边界强转,客户端未知 card 自动降级 generic)。 - 客户端: tool.call.toolview keyed slot 注册 artifact 行的原子视图,沙箱 iframe(CSP default-src 'none' + sandbox="allow-scripts" 不透明源 + 主题变量 + 尺寸桥 + 存储 shim),同一 artifact id 的后续 patch 调用原地更新预览。 安装 发布版走 GitHub Releases 的 tarball( dsh plugin 安装后自动加入 profile 层栈), releases/latest 永远指向最新版本,链接不用随版本改动: 然后重启 dsh web 服务,刷新页面。 不要 用 dsh plugin add github:lehhair/dsh-html-artifact 安装源码(仓库的 lib/ 被 gitignore,源码安装没有构建产物)。 ⚠️ 升级注意:pnpm 会按 URL 缓存 tarball——同一 latest 链接在新版本发布后可能命中旧缓存。装到旧版时先 dsh plugin --profile web remove @dsh-external/dsh-html-artifact 再重新安装(必要时 pnpm store prune )。 用法 模型侧(工具描述已内置): 1. artifact create { title?, html? } —— 创建,GUI 立即渲染沙箱预览。 2. artifact patch { id, old string, new string, replace all? } —— 对已有 artifact 打补丁,只发变更;每个 patch 调用结算后预览原地更新,会话里显示一行旧/新对比。 3. artifact read { id } / artifact destroy { id } / artifact list —…
View full README on GitHub →