# @aetheri-ai/dsh-show-image

English | [README.md](README.md)

一个 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 插件，添加 `show_image` 工具：模型可以把本地现有的 PNG、JPEG、WebP 或 GIF 文件展示给人类观众，在 Web 会话记录中内联渲染。

## 安装

在提供文件系统、工具运行时与持久附件的基础 profile（`dsh-base` 三者齐备）上安装。按 dsh 的安装方式选择对应命令：

```sh
# 已全局安装 dsh
dsh plugin --profile web add @aetheri-ai/dsh-show-image

# 直接从 npm 运行 dsh
npx @deepseek-ai/dsh plugin --profile web add @aetheri-ai/dsh-show-image

# deepseek-harness 源码 checkout
pnpm dsh plugin --profile web add @aetheri-ai/dsh-show-image
```

重启 Web profile 后新建会话。新发布版本可能尚未同步到配置的镜像源；需要时在安装命令末尾追加 `--registry=https://registry.npmjs.org`。

用以下命令确认 bundle 已进入组合树：

```sh
dsh --profile web --dump-config
```

输出中会有 `@aetheri-ai/dsh-show-image` 段和 `show-image` 行。卸载命令：

```sh
dsh plugin --profile web remove @aetheri-ai/dsh-show-image
```

## 使用

在新会话中让模型展示一张已有的受支持图片，例如“在会话中展示 `docs/architecture.png`”。模型会调用：

```json
{ "file_path": "docs/architecture.png" }
```

相对路径按会话工作区解析。工具把图片提交到持久附件存储，返回 image block，Web 客户端内联渲染（复用既有的加载、重试与放大查看行为）。实际发起工具调用的模型路由仍需具备正常的 dsh provider/API key 配置。

## 设计

- **纯展示**：工具面向人类观众，不要求模型具备视觉路由——模型需要检查像素时用 `read_image`。
- **尊重策略**：路径经文件系统提供方解析，沙箱限制与文件策略原样生效。
- **持久化**：图片以内容寻址附件存储，日志中不出现临时路径或内联 base64。
- **条件注册**：仅在持久附件存储挂载时注册。

## 兼容性

peer 依赖跟随 dsh 的 npm 发版线（`^0.1.1-rc.2`，cordis `^4.0.1`）。dsh 处于 developer preview，破坏性发版时本插件同步更新。

## 开发

```sh
pnpm install
pnpm run test        # 单元 + 真实 Loader 组合测试
pnpm run build       # tsdown 产出到 lib/
pnpm run typecheck
```

## 许可

[MIT](../../LICENSE)
