dsh-image-gen 0.2.3 → 0.2.5

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.
@@ -1,7 +1,7 @@
1
1
  /** User-facing configuration for supported image providers. */
2
2
  import z from '@deepseek-ai/schemastery';
3
- import { DEFAULT_DASHSCOPE_ENDPOINT, DEFAULT_DASHSCOPE_MODEL, DEFAULT_COMFYUI_BASE_URL, DEFAULT_COMFYUI_TIMEOUT_MS, DEFAULT_COMFYUI_WORKFLOW_LABEL, DEFAULT_GOOGLE_ENDPOINT, DEFAULT_GOOGLE_MODEL, DEFAULT_OPENAI_BASE_URL, DEFAULT_OPENAI_MODEL, DEFAULT_SEEDREAM_BASE_URL, DEFAULT_SEEDREAM_MODEL, IMAGE_PROVIDERS, type ImageProvider } from './shared.js';
4
- export { DEFAULT_DASHSCOPE_ENDPOINT, DEFAULT_DASHSCOPE_MODEL, DEFAULT_COMFYUI_BASE_URL, DEFAULT_COMFYUI_TIMEOUT_MS, DEFAULT_COMFYUI_WORKFLOW_LABEL, DEFAULT_GOOGLE_ENDPOINT, DEFAULT_GOOGLE_MODEL, DEFAULT_OPENAI_BASE_URL, DEFAULT_OPENAI_MODEL, DEFAULT_SEEDREAM_BASE_URL, DEFAULT_SEEDREAM_MODEL, IMAGE_PROVIDERS, type ImageProvider, };
3
+ import { DEFAULT_DASHSCOPE_ENDPOINT, DEFAULT_DASHSCOPE_MODEL, DEFAULT_COMFYUI_BASE_URL, DEFAULT_COMFYUI_TIMEOUT_MS, DEFAULT_COMFYUI_WORKFLOW_LABEL, DEFAULT_GOOGLE_ENDPOINT, DEFAULT_GOOGLE_MODEL, DEFAULT_OPENAI_BASE_URL, DEFAULT_OPENAI_MODEL, DEFAULT_SEEDREAM_BASE_URL, DEFAULT_SEEDREAM_MODEL, IMAGE_PROVIDERS, activeComfyUIWorkflow, resolveComfyUIWorkflows, type ComfyUIWorkflowEntry, type ImageProvider } from './shared.js';
4
+ export { DEFAULT_DASHSCOPE_ENDPOINT, DEFAULT_DASHSCOPE_MODEL, DEFAULT_COMFYUI_BASE_URL, DEFAULT_COMFYUI_TIMEOUT_MS, DEFAULT_COMFYUI_WORKFLOW_LABEL, DEFAULT_GOOGLE_ENDPOINT, DEFAULT_GOOGLE_MODEL, DEFAULT_OPENAI_BASE_URL, DEFAULT_OPENAI_MODEL, DEFAULT_SEEDREAM_BASE_URL, DEFAULT_SEEDREAM_MODEL, IMAGE_PROVIDERS, activeComfyUIWorkflow, resolveComfyUIWorkflows, type ComfyUIWorkflowEntry, type ImageProvider, };
5
5
  /** Default workspace subfolder that receives generated image files. */
6
6
  export declare const DEFAULT_WORKSPACE_FOLDER = "dsh-image-gen";
7
7
  /** Google API credential reference. */
@@ -29,9 +29,13 @@ export interface Config {
29
29
  dashscopeEndpoint?: string;
30
30
  dashscopeModel?: string;
31
31
  comfyuiBaseURL?: string;
32
- /** ComfyUI API-format workflow JSON imported through the Web settings page. */
32
+ /** Named ComfyUI workflows managed by the Web settings page. */
33
+ comfyuiWorkflows?: ComfyUIWorkflowEntry[];
34
+ /** Name of the workflow ComfyUI calls use by default. */
35
+ comfyuiActiveWorkflow?: string;
36
+ /** Legacy single-workflow storage; synced to the active entry for downgrades. */
33
37
  comfyuiWorkflowJson?: string;
34
- /** Original imported file name, used as a human-readable result label. */
38
+ /** Original imported file name of the legacy single workflow. */
35
39
  comfyuiWorkflowName?: string;
36
40
  comfyuiTimeoutMs?: number;
37
41
  /** Also write every generated image as a file under the session workspace. */
@@ -70,7 +74,12 @@ export declare function resolveProvider(config: Config): {
70
74
  } | {
71
75
  provider: 'comfyui';
72
76
  baseURL: string;
73
- workflowJson: string;
74
- workflowName: string;
77
+ workflows: ComfyUIWorkflowEntry[];
78
+ workflow?: ComfyUIWorkflowEntry;
75
79
  timeoutMs: number;
76
80
  };
81
+ /** The workflow a ComfyUI call runs: the requested name when given, else the active one. */
82
+ export declare function selectComfyUIWorkflow(active: {
83
+ workflows: ComfyUIWorkflowEntry[];
84
+ workflow?: ComfyUIWorkflowEntry;
85
+ }, requested?: string): ComfyUIWorkflowEntry;
@@ -20,5 +20,36 @@ export declare const DEFAULT_GOOGLE_MODEL = "gemini-3.1-flash-image";
20
20
  export declare const DEFAULT_OPENAI_MODEL = "gpt-image-2";
21
21
  export declare const DEFAULT_SEEDREAM_MODEL = "doubao-seedream-5-0-260128";
22
22
  export declare const DEFAULT_DASHSCOPE_MODEL = "qwen-image-3.0";
23
+ /** One named ComfyUI API-format workflow imported through settings. */
24
+ export interface ComfyUIWorkflowEntry {
25
+ /** Unique human-readable label; used as the result model and by tool calls. */
26
+ name: string;
27
+ /** API-format workflow JSON with {{prompt}} / {{seed}} and optional {{image}} placeholders. */
28
+ json: string;
29
+ /** Optional preset prepended to the user prompt on every call of this workflow. */
30
+ presetPrompt?: string;
31
+ }
32
+ /** Raw ComfyUI workflow fields as persisted through DSH Settings. */
33
+ export interface ComfyUIWorkflowSource {
34
+ /** Named workflows managed by the Web settings page. */
35
+ comfyuiWorkflows?: readonly ComfyUIWorkflowEntry[];
36
+ /** Name of the entry ComfyUI calls use by default. */
37
+ comfyuiActiveWorkflow?: string;
38
+ /** Legacy single-workflow storage; synced to the active entry for downgrades. */
39
+ comfyuiWorkflowJson?: string;
40
+ comfyuiWorkflowName?: string;
41
+ }
42
+ /** Named workflows, falling back to the legacy single-workflow fields when the list is empty. */
43
+ export declare function resolveComfyUIWorkflows(source: ComfyUIWorkflowSource): ComfyUIWorkflowEntry[];
44
+ /** The workflow ComfyUI calls use by default: the configured active name, else the first entry. */
45
+ export declare function activeComfyUIWorkflow(source: ComfyUIWorkflowSource): ComfyUIWorkflowEntry | undefined;
46
+ /** Derive a workflow label that does not collide with the given existing names. */
47
+ export declare function uniqueComfyUIWorkflowName(name: string, existing: readonly string[]): string;
48
+ /**
49
+ * Combine a workflow's preset with the user prompt: preset first, user second,
50
+ * joined by one comma — never doubled when the preset already ends in a
51
+ * separator, and reduced to the non-empty side when the other is blank.
52
+ */
53
+ export declare function mergeComfyUIPrompt(preset: string | undefined, user: string): string;
23
54
  export declare const DEFAULT_MODELS: Record<ImageProvider, string>;
24
55
  export declare const DEFAULT_BASE_URLS: Record<ImageProvider, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-image-gen",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Bring ChatGPT-like image generation to DeepSeek Harness — Gemini, OpenAI, Seedream, DashScope, local ComfyUI & more.",
5
5
  "type": "module",
6
6
  "author": "shanliuling",
@@ -119,7 +119,7 @@
119
119
  "@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
120
120
  "@deepseek-ai/dsh-host-webserver": "0.1.1-rc.2",
121
121
  "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
122
- "@deepseek-ai/dsh-settings": "0.1.1-rc.2",
122
+ "@deepseek-ai/dsh-settings": "0.1.2-alpha.2",
123
123
  "@deepseek-ai/dsh-tools": "0.1.1-rc.2",
124
124
  "@deepseek-ai/schemastery": "3.18.1",
125
125
  "@types/node": "^22.20.0",
@@ -127,6 +127,7 @@
127
127
  "react": "^18.2.0",
128
128
  "tsdown": "^0.22.2",
129
129
  "typescript": "^6.0.3",
130
+ "unrun": "^0.3.1",
130
131
  "vitest": "^4.1.8"
131
132
  },
132
133
  "packageManager": "pnpm@11.7.0"