dsh-plugin-read-image-preview 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +6 -3
  2. package/client.js +20 -14
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -2,16 +2,19 @@
2
2
 
3
3
  会话里的图片(read_image 读到的图、computer-use 截图、你自己贴进来的图)共用一个全屏查看器:放大、平移、圈红框、加字、裁剪,然后**回车直接放进输入框**。输入框旁的 `✂ 截图` 抓屏后直接框选,选完回车同样进输入框——给模型看一个前端问题,不用再开外部截图器。
4
4
 
5
+ > 兼容性:`engines.dsh` = `>=0.2.0-rc.2 <0.3.0-0`,已在 dsh 0.2.1-rc.3 上实测运行。
6
+
5
7
  ## 接在哪里
6
8
 
7
9
  | 位置 | 做法 |
8
10
  | --- | --- |
9
- | read_image 行、用户消息里的图、助手消息里的图、轨迹里的图 | 只替换官方的**图库**位置(`tool.call.images`、`conversation.chat.user.images` / `conversation.chat.message.images`,0.2.0 叫 `conversation.message.images`;`conversation.trajectory.images`),priority `-1`。官方行自己的标题、路径、尺寸、Inspect 原样保留 |
10
- | computer-use 各工具、generate_image | 这些工具没有官方图片行,继续整格认领 `tool.call.toolview`(priority `-1`),渲染同一个图库加一行信息(路径、尺寸、体积、格式、复制路径、在编辑器中打开) |
11
+ | read_image 行 | **整行认领** `tool.call.toolview`(key `read_image`,priority `-1`),图片直接展开显示,下面一行路径/尺寸/体积/格式(v1.7 恢复 1.4 的自动展开;官方行默认折叠所以不再使用官方行头与 Inspect) |
12
+ | 用户消息里的图、助手消息里的图、轨迹里的图 | 只替换官方的**图库**位置(`conversation.chat.user.images` / `conversation.chat.message.images`,0.2.0 叫 `conversation.message.images`;`conversation.trajectory.images`),priority `-1`;官方行自己的标题、路径、尺寸、Inspect 原样保留 |
13
+ | computer-use 各工具、generate_image | 这些工具没有官方图片行,整格认领 `tool.call.toolview`(priority `-1`),渲染同一个图库加一行信息(路径、尺寸、体积、格式、复制路径、在编辑器中打开) |
11
14
  | 输入框右侧 | `✂ 截图` 按钮 |
12
15
  | 设置 → 截图与标注 | 截图目录管理与按期清理 |
13
16
 
14
- > **v1.6 起 read_image 不再整行接管。** 官方 read_image 行从 0.2.0 起把图片交给 `tool.call.images` 子 slot 渲染,并自带路径与尺寸信息;本插件只填这个图库,和官方重合的部分全部交还。代价是官方行默认折叠,点开才看到图。两版 dsh 的消息图片 slot 名不同,全部注册是安全的:`slots.inject` 会一直等到 slot 被声明,没有的名字永远不会激活。
17
+ > **v1.7:read_image 恢复自动展开。** v1.6 曾把 read_image 行交还官方(只填官方图库 slot),代价是官方行默认折叠、要点开才看到图;v1.7 重新整行接管该工具,图片默认展开显示,同时保留 v1.6 的查看器(缩放/标注/裁剪/发输入框)。官方 read_image 行头与 Inspect 在该工具上不再出现。两版 dsh 的消息图片 slot 名不同,全部注册是安全的:`slots.inject` 会一直等到 slot 被声明,没有的名字永远不会激活。
15
18
 
16
19
  图库:单张按真实宽高比显示缩略图(`min(420px, 100%)` × `max-height: 300px`),`<img>` 在字节到达前就带好 `width/height`,晚到的图片不会引起布局跳变(v1.4.1 修过的聊天吸底问题);多张一律平铺成小图,全部可点开,查看器里 `←`/`→` 切换;透明 PNG/WebP/GIF 自动铺棋盘格;加载失败点一下重试。
17
20
 
package/client.js CHANGED
@@ -4,13 +4,17 @@
4
4
  * Three surfaces share one full-screen viewer (zoom, pan, annotate, then send
5
5
  * to the composer, copy, or save):
6
6
  *
7
- * - Image galleries. The official image positions — `tool.call.images` inside
8
- * the read_image row, user and assistant message images, trajectory images —
9
- * are filled at priority -1 with this plugin's gallery, so the official rows
10
- * keep their own chrome (title, path, sizes, Inspect) and only the pictures
11
- * and the viewer are ours. Older and newer hosts name the message slots
12
- * differently; registering every name is safe because `slots.inject` waits
13
- * for a declaration that never comes.
7
+ * - Image galleries. The official image positions — user and assistant message
8
+ * images, trajectory images — are filled at priority -1 with this plugin's
9
+ * gallery, so the official rows keep their own chrome (title, path, sizes,
10
+ * Inspect) and only the pictures and the viewer are ours. Older and newer
11
+ * hosts name the message slots differently; registering every name is safe
12
+ * because `slots.inject` waits for a declaration that never comes.
13
+ * - The whole `read_image` card (1.7): the official row renders its picture
14
+ * inside a collapsed-by-default body, so the plugin claims the `read_image`
15
+ * key of `tool.call.toolview` and renders the image expanded with a
16
+ * path/size bar. The result content already carries the durable image
17
+ * attachment, so the same card renders it without the host route 1.4 used.
14
18
  * - Tool cards for image-bearing tools that have no official image row
15
19
  * (computer-use, generate_image): their keyed `tool.call.toolview` cell is
16
20
  * claimed at priority -1 and renders the same gallery plus one metadata line.
@@ -1006,9 +1010,10 @@ window.__ModuleLoader__.load({
1006
1010
 
1007
1011
  /**
1008
1012
  * The claim list: every tool whose whole card this plugin owns, with the
1009
- * Chinese label shown while the call runs. read_image is not here: its
1010
- * official row hands its gallery to the `tool.call.images` slot, which this
1011
- * plugin fills instead. Adding an image-bearing tool = adding one line.
1013
+ * Chinese label shown while the call runs. `read_image` is prepended (1.7):
1014
+ * the official row shows its picture inside a collapsed-by-default body, so
1015
+ * this plugin claims the whole card to render it expanded. Adding an
1016
+ * image-bearing tool = adding one line.
1012
1017
  */
1013
1018
  const TOOL_LABELS = {
1014
1019
  generate_image: '绘图',
@@ -1025,7 +1030,7 @@ window.__ModuleLoader__.load({
1025
1030
  computer_sequence: '连续动作',
1026
1031
  }
1027
1032
 
1028
- const IMAGE_TOOL_KEYS = Object.keys(TOOL_LABELS)
1033
+ const IMAGE_TOOL_KEYS = ['read_image'].concat(Object.keys(TOOL_LABELS))
1029
1034
 
1030
1035
  /**
1031
1036
  * Every official image position this plugin's gallery fills. The message
@@ -2966,9 +2971,10 @@ window.__ModuleLoader__.load({
2966
2971
  * Wire the plugin into the page.
2967
2972
  *
2968
2973
  * - the image galleries of the official image positions, at priority -1;
2969
- * - the whole card of every image-bearing tool without an official image
2970
- * row, at priority -1 (if one of our entries ever throws, the slot's
2971
- * error boundary abdicates it and the previous card returns);
2974
+ * - the whole card of `read_image` and of every image-bearing tool without
2975
+ * an official image row, at priority -1 (if one of our entries ever
2976
+ * throws, the slot's error boundary abdicates it and the previous card
2977
+ * returns);
2972
2978
  * - the composer's ✂ button and the 截图与标注 settings page.
2973
2979
  */
2974
2980
  function apply(ctx) {
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "dsh-plugin-read-image-preview",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
+ "engines": { "dsh": ">=0.2.0-rc.2 <0.3.0-0" },
4
5
  "license": "MIT",
5
6
  "keywords": ["dsh-plugin", "deepseek-harness", "dsh", "image", "preview", "screenshot", "tool-card", "ui"],
6
7
  "publishConfig": { "registry": "https://registry.npmjs.org" },