@goodandready/dsh-image-gen 0.8.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-fal-image-gen contributors
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 ADDED
@@ -0,0 +1,202 @@
1
+ # dsh-image-gen
2
+
3
+ **Image generation** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh).
4
+
5
+ The plugin gives the agent one tool, `generate_image`, and puts the result where
6
+ a picture belongs — in the conversation. Which service actually draws it is a
7
+ setting, not a rewrite: a paid API key, your own OpenAI-compatible endpoint, or a
8
+ consumer subscription you are already paying for.
9
+
10
+ A generated image is:
11
+
12
+ - shown inline in the conversation, in the plugin's own tool card;
13
+ - saved into the session working directory (`<session cwd>/generated/images/*.png`);
14
+ - returned to the model with its path, size and seed.
15
+
16
+ > **Renamed.** This plugin used to be `dsh-fal-image-gen`. FAL is now one
17
+ > provider out of four, and the old name said otherwise. Upgrading carries your
18
+ > settings over by itself, and images in existing conversations keep working —
19
+ > see [Upgrading from dsh-fal-image-gen](#upgrading-from-dsh-fal-image-gen).
20
+
21
+ ## Providers
22
+
23
+ | `provider` | What it is | What it needs |
24
+ |---|---|---|
25
+ | `fal` (default) | the [FAL](https://fal.ai) queue, default model `fal-ai/flux-2/klein/9b` | a FAL API key |
26
+ | `custom` | any OpenAI-compatible images API — OpenAI itself, a local gateway, anything speaking that shape | a base URL, a model id, usually a key |
27
+ | `codex` | ChatGPT's image model (`gpt-image-2`) on your ChatGPT subscription | no key — a ChatGPT account connected in `dsh-subscriptions` |
28
+ | `grok` | Grok's image model (`grok-imagine-image-2.0`) on your Grok subscription | no key — a Grok account connected in `dsh-subscriptions` |
29
+
30
+ The named sizes stay the same whichever provider runs — they are the tool's
31
+ language, and the agent should not have to know who is drawing. FAL takes them as
32
+ they are; an OpenAI-compatible API gets them translated into pixels (`square_hd`
33
+ → `1024x1024`, `landscape_4_3` → `1024x768`); Grok thinks in aspect ratios and
34
+ gets `1:1`, `2:3`, `3:2`. An API picky about sizes gets `customSize`, which is
35
+ sent verbatim instead.
36
+
37
+ `response_format` is deliberately not sent: newer OpenAI models reject it, and
38
+ the answer is accepted either way — base64 inline, or a link that gets
39
+ downloaded.
40
+
41
+ ### Drawing on a subscription
42
+
43
+ `codex` and `grok` need no API key at all. They borrow an account that
44
+ [`dsh-subscriptions`](https://github.com/GooDAnDReaDY/dsh-subscriptions) already
45
+ holds: connect ChatGPT or Grok there once, pick the provider here, and generation
46
+ goes through the same subscription you use for chat.
47
+
48
+ The token never leaves the Host. The two plugins talk through a service inside
49
+ the process rather than over the network — a route handing out a live
50
+ subscription token would be a hole in a harness that is otherwise reachable
51
+ without a password.
52
+
53
+ If `dsh-subscriptions` is not installed, or no account of that vendor is
54
+ connected, these two providers say so instead of failing silently.
55
+
56
+ ### Example: OpenAI
57
+
58
+ ```yaml
59
+ - id: dsh-image-gen
60
+ config:
61
+ provider: custom
62
+ customBaseURL: https://api.openai.com/v1
63
+ customModel: gpt-image-1
64
+ customKeyEnv: OPENAI_API_KEY
65
+ ```
66
+
67
+ An empty `customKeyEnv` means no authorization header at all, for a local
68
+ gateway that needs none.
69
+
70
+ ## Two delivery modes
71
+
72
+ The picture appears in the conversation either way. What differs is **what the
73
+ chat model receives** — and that decides whether the turn survives a text-only
74
+ model.
75
+
76
+ | | `link` (default) | `image` |
77
+ |---|---|---|
78
+ | The model receives | text and a link | the image itself |
79
+ | Shown in the chat | yes, the card renders it from the link | yes |
80
+ | Works with a text-only chat model | **yes, on its own** | **no** — needs [`dsh-vision-bridge`](https://github.com/GooDAnDReaDY/dsh-vision-bridge) or a vision-capable chat model |
81
+ | The model can reason about the picture | no, only about the prompt and the link | yes |
82
+ | The link points to | this plugin's own route, as durable as the attachment | the provider's CDN, which expires |
83
+
84
+ Pick `image` when the conversation should be able to discuss what was drawn —
85
+ "make the cat bluer" needs a model that can actually see it. Without a vision
86
+ model in the chat that mode fails the turn with `does not support image input`,
87
+ which is precisely what `dsh-vision-bridge` exists to prevent: it swaps the
88
+ picture for a description from a vision model you choose.
89
+
90
+ ## Install
91
+
92
+ ```bash
93
+ # From npm:
94
+ dsh plugin --profile web add @goodandready/dsh-image-gen
95
+
96
+ # From GitHub:
97
+ dsh plugin --profile web add github:GooDAnDReaDY/dsh-image-gen
98
+
99
+ # Locally from a checkout:
100
+ dsh plugin --profile web add /path/to/dsh-image-gen
101
+ ```
102
+
103
+ Restart the Web UI afterwards.
104
+
105
+ ## Configure
106
+
107
+ Everything lives in its own settings section: **Settings → Image generation**.
108
+
109
+ | Field | Default | Description |
110
+ |---|---|---|
111
+ | `provider` | `fal` | Who draws: `fal`, `custom`, `codex` or `grok`. |
112
+ | `model` | `fal-ai/flux-2/klein/9b` | FAL model id, called as `{baseURL}/{model}`. Used when `provider` is `fal`. |
113
+ | `apiKeyEnv` | `FAL_API_KEY` | API key reference (credentials / env var). |
114
+ | `baseURL` | `https://queue.fal.run` | FAL queue base URL. |
115
+ | `defaultSize` | `landscape_4_3` | Default image size when the tool call omits one. |
116
+ | `defaultFormat` | `png` | Default output format: `png`, `jpeg` or `webp`. |
117
+ | `pollIntervalMs` | `2000` | Job status poll interval. |
118
+ | `timeoutMs` | `180000` | Total generation timeout — submit, poll and download together. |
119
+ | `deliverAs` | `link` | `link` — the result is text with a link, works with any chat model. `image` — the result carries the picture, needs `dsh-vision-bridge` or a vision-capable model. |
120
+ | `customBaseURL` | — | `provider=custom`: API root, e.g. `https://api.openai.com/v1`. |
121
+ | `customModel` | — | `provider=custom`: model id, e.g. `gpt-image-1`. |
122
+ | `customKeyEnv` | `OPENAI_API_KEY` | `provider=custom`: key reference. Empty means no authorization header. |
123
+ | `customSize` | — | `provider=custom`: fixed size sent verbatim. Empty means the named size is translated. |
124
+ | `subscriptionQuality` | — | `provider=codex` or `grok`: quality asked of the subscription — `low`, `medium`, `high`, or empty for the vendor default. |
125
+ | `outputDir` | `generated/images` | Output folder. A relative path resolves against the session working directory; an absolute path is used as given. |
126
+
127
+ The same values can be set in `$DSH_HOME/settings.yaml` under `dsh-image-gen:`.
128
+ The card writes to that same document, so neither way is second-class.
129
+
130
+ ## API key
131
+
132
+ Only `fal` and `custom` need one. Store it in **Credentials** (Web:
133
+ **Settings → Credentials**) or in `$DSH_HOME/.credentials.yaml`:
134
+
135
+ ```yaml
136
+ FAL_API_KEY: <your key from https://fal.ai/dashboard/keys>
137
+ ```
138
+
139
+ The plugin prepends FAL's `Key ` auth prefix automatically when it is missing.
140
+
141
+ ## Usage
142
+
143
+ Just ask the model to draw something:
144
+
145
+ > Generate an image: neon cyberpunk city at night in the rain, 16:9
146
+
147
+ Tool parameters (all except `prompt` are optional):
148
+
149
+ | Parameter | Description |
150
+ |---|---|
151
+ | `prompt` | required, detailed image description |
152
+ | `image_size` | `square_hd` / `square` / `portrait_4_3` / `portrait_16_9` / `landscape_4_3` / `landscape_16_9` |
153
+ | `seed` | seed for reproducibility |
154
+ | `output_format` | `png` (default) / `jpeg` / `webp` |
155
+ | `output_name` | file name without extension |
156
+
157
+ ## Upgrading from dsh-fal-image-gen
158
+
159
+ Install `@goodandready/dsh-image-gen` and remove
160
+ `@goodandready/dsh-fal-image-gen` from the profile. Two things are carried for
161
+ you:
162
+
163
+ - **Your settings.** They lived under the `dsh-fal-image-gen` namespace. On the
164
+ first start the plugin reads that block and copies it under the new name —
165
+ once, and only when you have not configured the new name yourself. The old
166
+ block is left in the file untouched: deleting lines from someone's settings is
167
+ not a plugin's business.
168
+ - **Images in existing conversations.** Their links point at the old route, so
169
+ the plugin still answers on it alongside the new one. Nothing in your history
170
+ goes blank.
171
+
172
+ The npm package `@goodandready/dsh-fal-image-gen` is deprecated and will not
173
+ receive further releases.
174
+
175
+ ## Structure
176
+
177
+ ```
178
+ dsh-image-gen/
179
+ ├── package.json # dsh bundle/plugin metadata + peerDependencies
180
+ ├── cordis.patch.yml # bundle layer: inserts the plugin row
181
+ ├── lib/index.js # host: generate_image tool, attachment and file handling
182
+ ├── lib/providers.js # host: the providers — FAL queue, OpenAI-compatible API, subscriptions
183
+ ├── lib/client.js # browser: settings card + the generate_image tool card
184
+ ├── test/ # unit tests for the providers, on a fake fetch
185
+ ├── README.md
186
+ └── LICENSE # MIT
187
+ ```
188
+
189
+ ## Why the plugin ships its own tool card
190
+
191
+ Tool cards in dsh do not render image blocks — only user and assistant messages
192
+ do — so a picture returned by a tool would otherwise show up as JSON. The plugin
193
+ registers a keyed `tool.call.toolview` entry for `generate_image` and serves the
194
+ stored bytes from its own route (`GET /dsh-image-gen/image`), which is what puts
195
+ the image in the conversation.
196
+
197
+ No npm runtime dependencies (the `@deepseek-ai/*` peer deps resolve from the dsh
198
+ install), no build step — plain ESM.
199
+
200
+ ## License
201
+
202
+ MIT
@@ -0,0 +1,7 @@
1
+ # dsh-image-gen bundle layer: applied automatically when the package is
2
+ # installed as a profile bundle (package.json declares dsh.bundle.patch).
3
+ # Override any field in the profile's own cordis.patch.yml or in
4
+ # $DSH_HOME/settings.yaml under `dsh-image-gen:`.
5
+ - insert:
6
+ - id: dsh-image-gen
7
+ name: '@goodandready/dsh-image-gen'