@goodandready/dsh-image-gen 0.11.2 → 0.11.3

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 (2) hide show
  1. package/lib/index.js +23 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -458,8 +458,28 @@ export async function enhancePrompt(ctx, cfg, prompt, signal, provider) {
458
458
  }
459
459
  }
460
460
 
461
+ function sanitizeRaw(raw) {
462
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {}
463
+ const cleaned = {}
464
+ for (const [k, v] of Object.entries(raw)) {
465
+ if (v && typeof v === "object" && !Array.isArray(v) && typeof v.get !== "function" && Object.keys(v).length === 0) {
466
+ continue
467
+ }
468
+ cleaned[k] = v
469
+ }
470
+ return cleaned
471
+ }
472
+
473
+ export function ensureConfig(raw) {
474
+ const cleaned = sanitizeRaw(raw)
475
+ const plain = plainConfig(cleaned)
476
+ return Config(plain)
477
+ }
478
+
479
+
461
480
  export function apply(ctx, rawConfig) {
462
- const config = Config(rawConfig ?? {})
481
+ const config = ensureConfig(rawConfig)
482
+ const baseConfig = plainConfig(config)
463
483
  if (ctx.systemPrompt && typeof ctx.systemPrompt.section === 'function') {
464
484
  ctx.systemPrompt.section({
465
485
  name: 'tool:image-generation',
@@ -474,7 +494,7 @@ export function apply(ctx, rawConfig) {
474
494
  let settingsApi
475
495
  let currentLiveConfig = null
476
496
  let getConfig = () => currentLiveConfig || config
477
- const live = () => Config(structuredClone(plainConfig(getConfig() ?? {}))) ?? config
497
+ const live = () => plainConfig(getConfig() ?? {})
478
498
 
479
499
  const createSettingsAdapter = (svc) => {
480
500
  if (!svc) return undefined
@@ -691,7 +711,7 @@ export function apply(ctx, rawConfig) {
691
711
 
692
712
  // Tool registrations live in register-tools.js; each tool is a labeled ctx.effect (#216).
693
713
  registerAllTools(ctx, {
694
- config,
714
+ config: baseConfig,
695
715
  live,
696
716
  saveAndAttachResult,
697
717
  resolveSource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-image-gen",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
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",