@goodandready/dsh-image-gen 0.11.26 → 0.11.28
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/lib/attachment-helper.js +25 -0
- package/lib/client.js +179 -39
- package/lib/comfy-workflow-helpers.js +14 -0
- package/lib/generation-helpers.js +20 -3
- package/lib/index.js +4 -0
- package/lib/live-progress.js +278 -0
- package/lib/providers/backends/custom.js +14 -2
- package/lib/providers/backends/fal.js +25 -3
- package/lib/providers/backends/gemini.js +12 -0
- package/lib/providers/backends/local.js +148 -48
- package/lib/providers/backends/replicate.js +5 -0
- package/lib/providers/backends/seedream.js +3 -0
- package/lib/providers/backends/subscription.js +3 -0
- package/lib/providers/shared-helpers.js +63 -1
- package/lib/providers.js +142 -71
- package/lib/register-tools.js +21 -1
- package/lib/tools/anchor.js +10 -3
- package/lib/tools/character-sheet.js +4 -0
- package/lib/tools/diagram.js +4 -0
- package/lib/tools/editing.js +17 -0
- package/lib/tools/generation-pack.js +4 -1
- package/lib/tools/generation.js +31 -4
- package/lib/tools/processing-basic.js +7 -7
- package/lib/tools/style-matrix.js +11 -3
- package/lib/tools/theme-pair.js +22 -4
- package/lib/tools/ui-asset.js +3 -3
- package/lib/tools/vision-ocr.js +4 -0
- package/package.json +2 -2
|
@@ -107,7 +107,15 @@ export function registerStyleMatrixTools(ctx, deps) {
|
|
|
107
107
|
blindMode: value.blind_mode,
|
|
108
108
|
cells: value.cells || [],
|
|
109
109
|
})
|
|
110
|
-
|
|
110
|
+
const metaTag = `<dsh-image-gen-matrix>${JSON.stringify({ cells: value.cells, base_prompt: value.base_prompt, blind_mode: value.blind_mode })}</dsh-image-gen-matrix>`
|
|
111
|
+
return [{ type: 'text', text: `${summary}\n\n${metaTag}` }]
|
|
112
|
+
},
|
|
113
|
+
presentationMeta(args, value) {
|
|
114
|
+
return {
|
|
115
|
+
base_prompt: value.base_prompt,
|
|
116
|
+
blind_mode: value.blind_mode,
|
|
117
|
+
cells: value.cells || [],
|
|
118
|
+
}
|
|
111
119
|
},
|
|
112
120
|
},
|
|
113
121
|
isConcurrencySafe: () => false,
|
|
@@ -143,7 +151,7 @@ export function registerStyleMatrixTools(ctx, deps) {
|
|
|
143
151
|
const quadrantIds = ['A', 'B', 'C', 'D']
|
|
144
152
|
const matrixId = `matrix-${Date.now().toString(36)}`
|
|
145
153
|
|
|
146
|
-
const sessionCwd = exec
|
|
154
|
+
const sessionCwd = exec?.agent?.session?.header?.cwd
|
|
147
155
|
const targetDir = cfg.outputDir || 'generated/images'
|
|
148
156
|
const outDir = path.resolve(sessionCwd || process.cwd(), targetDir)
|
|
149
157
|
await mkdir(outDir, { recursive: true })
|
|
@@ -160,7 +168,7 @@ export function registerStyleMatrixTools(ctx, deps) {
|
|
|
160
168
|
size: 'custom',
|
|
161
169
|
format: 'png',
|
|
162
170
|
seed: cellSeed,
|
|
163
|
-
signal: exec
|
|
171
|
+
signal: exec?.signal,
|
|
164
172
|
aspectPixels,
|
|
165
173
|
aspectRatio,
|
|
166
174
|
},
|
package/lib/tools/theme-pair.js
CHANGED
|
@@ -99,7 +99,25 @@ export function registerThemePairTools(ctx, deps) {
|
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
render(_args, value) {
|
|
102
|
-
|
|
102
|
+
const blocks = renderToolOutput(value)
|
|
103
|
+
const metaTag = `<dsh-image-gen-theme-pair>${JSON.stringify({
|
|
104
|
+
light: value.light,
|
|
105
|
+
dark: value.dark,
|
|
106
|
+
html_snippet: value.html_snippet,
|
|
107
|
+
css_snippet: value.css_snippet,
|
|
108
|
+
})}</dsh-image-gen-theme-pair>`
|
|
109
|
+
if (blocks[0] && blocks[0].type === 'text') {
|
|
110
|
+
blocks[0].text += `\n\n${metaTag}`
|
|
111
|
+
}
|
|
112
|
+
return blocks
|
|
113
|
+
},
|
|
114
|
+
presentationMeta(_args, value) {
|
|
115
|
+
return {
|
|
116
|
+
light: value.light,
|
|
117
|
+
dark: value.dark,
|
|
118
|
+
html_snippet: value.html_snippet,
|
|
119
|
+
css_snippet: value.css_snippet,
|
|
120
|
+
}
|
|
103
121
|
},
|
|
104
122
|
},
|
|
105
123
|
isConcurrencySafe: () => false,
|
|
@@ -140,7 +158,7 @@ export function registerThemePairTools(ctx, deps) {
|
|
|
140
158
|
const chain = resolveFallbackChain(primaryProvider, cfg.fallbackProviders, PROVIDER_KEYS)
|
|
141
159
|
const baseSeed = typeof args.seed === 'number' ? args.seed : Math.floor(Math.random() * 1000000)
|
|
142
160
|
|
|
143
|
-
const sessionCwd = exec
|
|
161
|
+
const sessionCwd = exec?.agent?.session?.header?.cwd
|
|
144
162
|
const targetDir = cfg.outputDir || 'generated/images'
|
|
145
163
|
const outDir = path.resolve(sessionCwd || process.cwd(), targetDir)
|
|
146
164
|
await mkdir(outDir, { recursive: true })
|
|
@@ -158,7 +176,7 @@ export function registerThemePairTools(ctx, deps) {
|
|
|
158
176
|
aspectPixels,
|
|
159
177
|
aspectRatio,
|
|
160
178
|
seed: baseSeed,
|
|
161
|
-
signal: exec
|
|
179
|
+
signal: exec?.signal,
|
|
162
180
|
}
|
|
163
181
|
const lightProviders = makeProviders(
|
|
164
182
|
{ fetchImpl: fetch, resolveKey: (ref) => resolveApiKey(ctx, ref), cfg, subscriptionImages },
|
|
@@ -196,7 +214,7 @@ export function registerThemePairTools(ctx, deps) {
|
|
|
196
214
|
aspectPixels,
|
|
197
215
|
aspectRatio,
|
|
198
216
|
seed: baseSeed,
|
|
199
|
-
signal: exec
|
|
217
|
+
signal: exec?.signal,
|
|
200
218
|
}
|
|
201
219
|
const darkProviders = makeProviders(
|
|
202
220
|
{ fetchImpl: fetch, resolveKey: (ref) => resolveApiKey(ctx, ref), cfg, subscriptionImages },
|
package/lib/tools/ui-asset.js
CHANGED
|
@@ -156,7 +156,7 @@ export function registerUiAssetTools(ctx, deps) {
|
|
|
156
156
|
size: 'custom',
|
|
157
157
|
format: 'png',
|
|
158
158
|
seed: args.seed,
|
|
159
|
-
signal: exec
|
|
159
|
+
signal: exec?.signal,
|
|
160
160
|
aspectPixels,
|
|
161
161
|
aspectRatio,
|
|
162
162
|
},
|
|
@@ -187,7 +187,7 @@ export function registerUiAssetTools(ctx, deps) {
|
|
|
187
187
|
try {
|
|
188
188
|
const bgResult = await removeBackgroundFal(
|
|
189
189
|
{ fetchImpl: fetch, resolveKey: (ref) => resolveApiKey(ctx, ref), cfg },
|
|
190
|
-
{ imageBytes: finalBytes, mediaType, signal: exec
|
|
190
|
+
{ imageBytes: finalBytes, mediaType, signal: exec?.signal },
|
|
191
191
|
)
|
|
192
192
|
if (bgResult && bgResult.bytes) {
|
|
193
193
|
finalBytes = bgResult.bytes
|
|
@@ -216,7 +216,7 @@ export function registerUiAssetTools(ctx, deps) {
|
|
|
216
216
|
meta: { provider, model: cfg.model || cfg.customModel, prompt: synthesizedPrompt, seed: seedVal },
|
|
217
217
|
})
|
|
218
218
|
|
|
219
|
-
const sessionCwd = exec
|
|
219
|
+
const sessionCwd = exec?.agent?.session?.header?.cwd
|
|
220
220
|
const targetDir = cfg.outputDir || 'generated/images'
|
|
221
221
|
const outDir = path.resolve(sessionCwd || process.cwd(), targetDir)
|
|
222
222
|
await mkdir(outDir, { recursive: true })
|
package/lib/tools/vision-ocr.js
CHANGED
|
@@ -137,6 +137,10 @@ export function registerVisionOcrTools(ctx, deps) {
|
|
|
137
137
|
throw new Error('Image generation is disabled in settings.')
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
if (!args?.image || typeof args.image !== 'string' || !args.image.trim()) {
|
|
141
|
+
throw new Error('Parameter "image" (URL, file path, or sha256 attachment ID) is required for text replacement.')
|
|
142
|
+
}
|
|
143
|
+
|
|
140
144
|
const provider = PROVIDER_KEYS.includes(args.provider || cfg.provider)
|
|
141
145
|
? (args.provider || cfg.provider)
|
|
142
146
|
: (PROVIDER_KEYS.includes(cfg.provider) ? cfg.provider : 'fal')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-image-gen",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"description": "Image generation for DeepSeek Harness: a generate_image tool with pluggable providers
|
|
3
|
+
"version": "0.11.28",
|
|
4
|
+
"description": "Image generation for DeepSeek Harness: a generate_image tool with pluggable providers — the FAL queue, any OpenAI-compatible images API, or a ChatGPT/Grok subscription with no API key at all. The picture is shown inline in the conversation; the model receives either a link (works with any chat model) or the image itself (needs dsh-vision-bridge or a vision-capable model).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
7
7
|
"dsh",
|