@qzsy/dsh-image-generation 0.1.3 → 0.2.0
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.
- package/LICENSE +21 -21
- package/README.md +105 -111
- package/cordis.patch.yml +5 -5
- package/dist/client.js +1091 -756
- package/dist/index.js +200 -207
- package/icon.svg +14 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +15 -7
- package/NOTICE +0 -6
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 qzsy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,129 +1,123 @@
|
|
|
1
1
|
# @qzsy/dsh-image-generation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generate images from a DeepSeek Harness conversation. Providers and models live
|
|
4
|
+
in Settings; the conversation only sees one `image_generate` tool and the active
|
|
5
|
+
model selected for it.
|
|
6
|
+
|
|
7
|
+
The Host half talks to the provider, writes files and stores attachments. The
|
|
8
|
+
client half renders the settings cards and the image gallery, and asks the Host
|
|
9
|
+
for image bytes over a package-private RPC channel, so API keys never reach the
|
|
10
|
+
browser.
|
|
4
11
|
|
|
5
12
|
## Install
|
|
6
13
|
|
|
7
14
|
~~~bash
|
|
8
|
-
dsh plugin add @qzsy/dsh-image-generation
|
|
15
|
+
dsh plugin add @qzsy/dsh-image-generation@0.2.0
|
|
9
16
|
~~~
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
> DSH 在进程**启动时**组合插件。先启动再安装时,必须完全退出并重新打开 DSH(不是刷新页面)。
|
|
78
|
-
|
|
79
|
-
装完后可用:
|
|
80
|
-
|
|
81
|
-
```sh
|
|
82
|
-
dsh --profile <name> --dump-config | grep image-gen
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## 使用
|
|
86
|
-
|
|
87
|
-
1. 打开 **设置 → 生图配置**,添加供应商和模型,填 Base URL / API 格式 / API Key,点保存。
|
|
88
|
-
2. 打开 **设置 → 插件 → 插件配置**,展开 **图形生成**,选择刚才配置的某一个模型并保存。
|
|
89
|
-
3. 在对话里让 Agent 生图,它会调用 `image_generate`。
|
|
90
|
-
|
|
91
|
-
可选参数:`prompt`(必填)、`size`(`1024x1024` / `1024x1536` / `1536x1024` / `auto`)、`quality`(`low` / `medium` / `high` / `auto`)、`referenceImages`(1–5 张已有图片引用,用于编辑;本地文件先 `read_image`)。
|
|
92
|
-
|
|
93
|
-
## 配置项默认值
|
|
94
|
-
|
|
95
|
-
| 配置项 | 默认值 | 说明 |
|
|
96
|
-
|--------|--------|------|
|
|
97
|
-
| `enabled` | `true` | 是否启用 `image_generate` 工具(关闭时工具仍注册,调用会被拒绝) |
|
|
98
|
-
| `providerId` / `modelId` | 空 | 当前选中的生图供应商与模型 |
|
|
99
|
-
| `defaultSize` | `1024x1024` | 工具未显式传 `size` 时的默认尺寸 |
|
|
100
|
-
| `defaultQuality` | `auto` | 工具未显式传 `quality` 时的默认质量 |
|
|
101
|
-
| `apiFormat`(供应商级) | `openai-images` | 新建供应商时的默认 API 格式 |
|
|
102
|
-
|
|
103
|
-
## 与现有插件的关系
|
|
18
|
+
Open **Settings → Image generation**, add a provider, then pick the active model
|
|
19
|
+
under **Settings → Plugins → Plugin configuration → Image generation**.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Provider catalog.** Any number of providers, each with a Base URL, one API
|
|
24
|
+
format, a credential reference and a model list. Editing a provider never
|
|
25
|
+
reorders the conversation or restarts the Host.
|
|
26
|
+
- **One active model.** `image_generate` resolves `providerId` + `modelId` at
|
|
27
|
+
call time; the picker in the bundle card is the single source of truth.
|
|
28
|
+
- **Four request shapes.**
|
|
29
|
+
- `openai-images` — `POST /images/generations`, `POST /images/edits` when
|
|
30
|
+
reference images are supplied, `response_format: b64_json`.
|
|
31
|
+
- `xai-images` — `POST /images/generations` with `aspect_ratio`, quality
|
|
32
|
+
folded to `low`/`medium`.
|
|
33
|
+
- `gemini-image` — `:generateContent` for Gemini image models and `:predict`
|
|
34
|
+
for Imagen, with `x-goog-api-key`.
|
|
35
|
+
- `openai-chat-image` — `POST /chat/completions` for gateways that return
|
|
36
|
+
images inside a chat reply.
|
|
37
|
+
- **Reference images.** Up to five complete image references (attachment id,
|
|
38
|
+
media type, bytes, dimensions) can be passed as `referenceImages`; the tool
|
|
39
|
+
inlines them as data URLs for edits.
|
|
40
|
+
- **Files and attachments.** PNG, JPEG, WebP and GIF responses are sniffed from
|
|
41
|
+
their magic bytes and written to `<workspace>/generate/image/`. The same bytes
|
|
42
|
+
are saved as a DSH attachment so the transcript can replay the image without
|
|
43
|
+
reading the disk again.
|
|
44
|
+
- **Inline gallery.** The `image_generate` tool view shows a 240px thumbnail and
|
|
45
|
+
a full-screen lightbox; missing files fall back to a retry button instead of a
|
|
46
|
+
broken image.
|
|
47
|
+
|
|
48
|
+
## Where it plugs in
|
|
49
|
+
|
|
50
|
+
| Surface | What it contributes |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| Host tool registry | `image_generate` with prompt, size, quality and up to five reference images |
|
|
53
|
+
| Host RPC | `/image-gen` channel: `image` (attachment → base64) and `file` (workspace image → base64) |
|
|
54
|
+
| System prompt | A short `tool:image-gen` section that tells the model where images are saved and how to pass references |
|
|
55
|
+
| Settings | `Settings → Image generation` provider catalog |
|
|
56
|
+
| Plugins page | Bundle configuration card, keyed by package name `@qzsy/dsh-image-generation` |
|
|
57
|
+
| Tool view | `tool.call.toolview` key `image_generate` |
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
The Cordis patch mounts the Host half under the entry id `image-gen`. The entry
|
|
62
|
+
config has two halves that are edited through the cards but can also be written
|
|
63
|
+
by hand in a profile patch:
|
|
64
|
+
|
|
65
|
+
~~~yaml
|
|
66
|
+
- id: image-gen
|
|
67
|
+
name: '@qzsy/dsh-image-generation'
|
|
68
|
+
config:
|
|
69
|
+
providers:
|
|
70
|
+
- id: example
|
|
71
|
+
name: Example gateway
|
|
72
|
+
baseUrl: https://api.example.com/v1
|
|
73
|
+
apiFormat: openai-images
|
|
74
|
+
apiKeyEnv: IMAGE_GEN_EXAMPLE_API_KEY
|
|
75
|
+
models:
|
|
76
|
+
- id: image-model
|
|
77
|
+
name: Image model
|
|
78
|
+
enabled: true
|
|
79
|
+
providerId: example
|
|
80
|
+
modelId: image-model
|
|
81
|
+
defaultSize: 1024x1024
|
|
82
|
+
defaultQuality: auto
|
|
83
|
+
~~~
|
|
104
84
|
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
|
|
85
|
+
- `apiKeyEnv` is a credential reference, not a secret. The provider id is
|
|
86
|
+
slugified from the display name on creation; the default reference is
|
|
87
|
+
`IMAGE_GEN_<PROVIDER_ID_UPPER>_API_KEY`.
|
|
88
|
+
- A key typed into the provider editor is written through the DSH credentials
|
|
89
|
+
service and never appears in the settings file or a log line.
|
|
90
|
+
- `enabled` gates the tool. Disabled providers are reported as an error that
|
|
91
|
+
names the Settings path instead of failing inside the provider call.
|
|
108
92
|
|
|
109
|
-
##
|
|
93
|
+
## Requirements
|
|
110
94
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
95
|
+
- DSH 0.1.6 or newer for the bundle configuration card. On older releases the
|
|
96
|
+
client falls back to the legacy `settingsScope` and `settings.plugin.item`
|
|
97
|
+
surfaces.
|
|
98
|
+
- Node.js 20.9 or newer on the Host.
|
|
99
|
+
- A provider that returns image bytes as base64 JSON. The tool does not download
|
|
100
|
+
remote URLs returned by an API.
|
|
114
101
|
|
|
115
|
-
|
|
102
|
+
## Migration from `dsh-image-generation`
|
|
116
103
|
|
|
117
|
-
|
|
104
|
+
The config schema, the entry id (`image-gen`) and the credential references are
|
|
105
|
+
compatible with the upstream package's 0.1.x line. To switch:
|
|
118
106
|
|
|
119
|
-
|
|
107
|
+
1. Install this package and point the profile patch entry name at
|
|
108
|
+
`@qzsy/dsh-image-generation`.
|
|
109
|
+
2. Remove the old `dsh-image-generation` dependency from the profile.
|
|
110
|
+
3. Restart DSH. Existing providers, model selection and keys keep working; the
|
|
111
|
+
old package's client bundle is no longer loaded, so its Settings section and
|
|
112
|
+
tool view disappear.
|
|
120
113
|
|
|
121
|
-
|
|
114
|
+
## Acknowledgements
|
|
122
115
|
|
|
123
|
-
|
|
116
|
+
The `image_generate` tool contract and the settings shape follow the original
|
|
117
|
+
[`dsh-image-generation`](https://github.com/whiteS18/dsh-image-generation) by
|
|
118
|
+
whiteS18, MIT licensed. This package is an independent implementation for the
|
|
119
|
+
`@qzsy` scope and does not bundle the upstream runtime.
|
|
124
120
|
|
|
125
|
-
|
|
126
|
-
dsh plugin --profile <name> add dsh-image-generation
|
|
127
|
-
```
|
|
121
|
+
## License
|
|
128
122
|
|
|
129
|
-
|
|
123
|
+
MIT © 2026 qzsy.
|
package/cordis.patch.yml
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Bundle self-activation patch: when this package is installed into a profile
|
|
2
|
-
# via `dsh plugin --profile <name> add @qzsy/dsh-image-generation`, this patch
|
|
3
|
-
# plugin's node half
|
|
4
|
-
# the
|
|
5
|
-
# in package.json.
|
|
2
|
+
# via `dsh plugin --profile <name> add @qzsy/dsh-image-generation`, this patch
|
|
3
|
+
# mounts the plugin's node half under a stable entry id. The client half
|
|
4
|
+
# (Settings > Image generation, the bundle config card, and the image_generate
|
|
5
|
+
# tool view) is discovered from the `dsh.client` declaration in package.json.
|
|
6
6
|
- insert:
|
|
7
7
|
- id: image-gen
|
|
8
|
-
name: @qzsy/dsh-image-generation
|
|
8
|
+
name: '@qzsy/dsh-image-generation'
|