dsh-image-gen 0.4.1 → 0.5.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/README.en.md +344 -338
- package/README.md +344 -338
- package/README.zh-CN.md +3 -3
- package/lib/client.js +1514 -388
- package/lib/client.js.map +1 -1
- package/lib/index.js +761 -214
- package/lib/types/client/conversation-image-revisions.d.ts +1 -1
- package/lib/types/client/gallery-view.d.ts +8 -2
- package/lib/types/client/index.d.ts +17 -1
- package/lib/types/client/inspiration-api.d.ts +10 -0
- package/lib/types/client/inspiration-detail.d.ts +14 -0
- package/lib/types/client/provider-pill.d.ts +49 -0
- package/lib/types/config.d.ts +39 -10
- package/lib/types/credentials.d.ts +15 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/inspiration/cache.d.ts +20 -0
- package/lib/types/inspiration/downloader.d.ts +27 -0
- package/lib/types/inspiration/routes.d.ts +13 -0
- package/lib/types/inspiration/sources.d.ts +33 -0
- package/lib/types/inspiration/types.d.ts +65 -0
- package/lib/types/inspiration/updater.d.ts +7 -0
- package/lib/types/openai-compatible.d.ts +1 -1
- package/lib/types/redact.d.ts +2 -0
- package/lib/types/shared.d.ts +37 -2
- package/lib/types/test-route.d.ts +73 -0
- package/package.json +1 -1
- package/skills/install-dsh-image-gen/SKILL.md +22 -22
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
2
|
-
import type
|
|
2
|
+
import { type CloudImageProvider } from '../shared.js';
|
|
3
3
|
/** One regenerated version displayed in place of an original conversation image. */
|
|
4
4
|
export interface ConversationImageRevision {
|
|
5
5
|
attachment: ImageAttachmentRef;
|
|
@@ -22,9 +22,12 @@ declare const DICT: {
|
|
|
22
22
|
readonly tabTasks: "任务";
|
|
23
23
|
readonly filterAllProviders: "全部提供商";
|
|
24
24
|
readonly filterGoogle: "Google Gemini";
|
|
25
|
-
readonly filterOpenAI: "OpenAI
|
|
25
|
+
readonly filterOpenAI: "OpenAI";
|
|
26
|
+
readonly filterOpenAICompat: "OpenAI 兼容";
|
|
26
27
|
readonly filterSeedream: "字节 Seedream";
|
|
27
28
|
readonly filterDashScope: "阿里 DashScope";
|
|
29
|
+
readonly filterXAI: "xAI Grok";
|
|
30
|
+
readonly filterZhipu: "智谱 GLM";
|
|
28
31
|
readonly filterComfyUI: "本地 ComfyUI";
|
|
29
32
|
readonly filterAllModels: "全部模型";
|
|
30
33
|
readonly filterAllRatios: "全部比例";
|
|
@@ -104,9 +107,12 @@ declare const DICT: {
|
|
|
104
107
|
readonly tabTasks: "Tasks";
|
|
105
108
|
readonly filterAllProviders: "All Providers";
|
|
106
109
|
readonly filterGoogle: "Google Gemini";
|
|
107
|
-
readonly filterOpenAI: "OpenAI
|
|
110
|
+
readonly filterOpenAI: "OpenAI";
|
|
111
|
+
readonly filterOpenAICompat: "OpenAI-compatible";
|
|
108
112
|
readonly filterSeedream: "ByteDance Seedream";
|
|
109
113
|
readonly filterDashScope: "Aliyun DashScope";
|
|
114
|
+
readonly filterXAI: "xAI Grok";
|
|
115
|
+
readonly filterZhipu: "Zhipu GLM";
|
|
110
116
|
readonly filterComfyUI: "Local ComfyUI";
|
|
111
117
|
readonly filterAllModels: "All Models";
|
|
112
118
|
readonly filterAllRatios: "All Ratios";
|
|
@@ -19,10 +19,16 @@ interface ImageSettings {
|
|
|
19
19
|
googleEndpoint?: string;
|
|
20
20
|
openaiBaseURL?: string;
|
|
21
21
|
openaiModel?: string;
|
|
22
|
+
openaiCompatBaseURL?: string;
|
|
23
|
+
openaiCompatModel?: string;
|
|
22
24
|
seedreamBaseURL?: string;
|
|
23
25
|
seedreamModel?: string;
|
|
24
26
|
dashscopeEndpoint?: string;
|
|
25
27
|
dashscopeModel?: string;
|
|
28
|
+
xaiBaseURL?: string;
|
|
29
|
+
xaiModel?: string;
|
|
30
|
+
zhipuBaseURL?: string;
|
|
31
|
+
zhipuModel?: string;
|
|
26
32
|
comfyuiBaseURL?: string;
|
|
27
33
|
comfyuiWorkflows?: ComfyUIWorkflowEntry[];
|
|
28
34
|
comfyuiActiveWorkflow?: string;
|
|
@@ -31,9 +37,12 @@ interface ImageSettings {
|
|
|
31
37
|
comfyuiTimeoutMs?: number;
|
|
32
38
|
saveToWorkspace?: boolean;
|
|
33
39
|
workspaceFolder?: string;
|
|
40
|
+
showProviderPill?: boolean;
|
|
34
41
|
}
|
|
35
42
|
interface CredentialInfo {
|
|
36
43
|
configured?: boolean;
|
|
44
|
+
source?: string;
|
|
45
|
+
writable?: boolean;
|
|
37
46
|
}
|
|
38
47
|
interface CredentialResult {
|
|
39
48
|
ok: boolean;
|
|
@@ -48,11 +57,18 @@ interface CredentialMutationResult {
|
|
|
48
57
|
interface CredentialsRemote {
|
|
49
58
|
describe(refs: string[]): Promise<CredentialResult>;
|
|
50
59
|
set(ref: string, value: string): Promise<CredentialMutationResult>;
|
|
60
|
+
/** Present only on modern hosts; feature-detected before use. */
|
|
61
|
+
unset?(ref: string): Promise<CredentialMutationResult>;
|
|
62
|
+
}
|
|
63
|
+
/** Notifies the settings card whenever any credential reference changes on the host. */
|
|
64
|
+
interface CredentialEvents {
|
|
65
|
+
listen(callback: () => void): () => void;
|
|
51
66
|
}
|
|
52
67
|
interface SettingsFace {
|
|
53
68
|
scope: SettingsScope<ImageSettings>;
|
|
54
69
|
credentials: CredentialsRemote;
|
|
55
70
|
locale?: LocaleService | undefined;
|
|
71
|
+
credentialEvents?: CredentialEvents | undefined;
|
|
56
72
|
}
|
|
57
73
|
interface ImageCardFace {
|
|
58
74
|
locale?: LocaleService | undefined;
|
|
@@ -72,7 +88,7 @@ interface ImageResultNodeProps {
|
|
|
72
88
|
export declare const inject: string[];
|
|
73
89
|
/** Mount the settings card, generated-image card, and native conversation gallery view. */
|
|
74
90
|
export declare function apply(ctx: Context): void;
|
|
75
|
-
/** Edit provider
|
|
91
|
+
/** Edit each provider independently, pick an explicit default, and verify keys inline. */
|
|
76
92
|
export declare function ImageGenerationSettingsCard(props: SettingsCardProps): import("react").JSX.Element;
|
|
77
93
|
/** Keep the legacy Tool row for old DSH and hand modern results to the independent Chat node. */
|
|
78
94
|
export declare function GeneratedImageCard(props: ImageCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { InspirationCasesResponse } from '../inspiration/types.js';
|
|
2
|
+
export declare function getInspirationImageUrl(sourceId: string, caseId: string): string;
|
|
3
|
+
export declare function fetchInspirationCases(): Promise<InspirationCasesResponse | null>;
|
|
4
|
+
export interface UpdateResponse {
|
|
5
|
+
updated: boolean;
|
|
6
|
+
currentCount: number;
|
|
7
|
+
newCount?: number;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function triggerInspirationUpdate(): Promise<UpdateResponse | null>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal detail view for a specific Inspiration Library case.
|
|
3
|
+
*/
|
|
4
|
+
import { type FC } from 'react';
|
|
5
|
+
import type { PromptCase, PromptSource } from '../inspiration/types.js';
|
|
6
|
+
export interface InspirationDetailProps {
|
|
7
|
+
promptCase: PromptCase;
|
|
8
|
+
source: PromptSource;
|
|
9
|
+
lang?: 'zh' | 'en';
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onUsePrompt: (prompt: string) => void;
|
|
12
|
+
onToast: (msg: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const InspirationDetail: FC<InspirationDetailProps>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ComfyUIWorkflowEntry, type ImageProvider } from '../shared.js';
|
|
2
|
+
import type { SettingsScope } from './index.js';
|
|
3
|
+
import type { LocaleService } from './gallery-view.js';
|
|
4
|
+
/** Settings fields the pill reads; a structural subset of the full settings shape. */
|
|
5
|
+
export interface PillSettings {
|
|
6
|
+
provider?: ImageProvider;
|
|
7
|
+
googleModel?: string;
|
|
8
|
+
openaiModel?: string;
|
|
9
|
+
openaiCompatModel?: string;
|
|
10
|
+
seedreamModel?: string;
|
|
11
|
+
dashscopeModel?: string;
|
|
12
|
+
xaiModel?: string;
|
|
13
|
+
zhipuModel?: string;
|
|
14
|
+
comfyuiWorkflows?: readonly ComfyUIWorkflowEntry[];
|
|
15
|
+
comfyuiActiveWorkflow?: string;
|
|
16
|
+
comfyuiWorkflowJson?: string;
|
|
17
|
+
comfyuiWorkflowName?: string;
|
|
18
|
+
/** Opt-in toggle persisted by the settings card; the pill stays hidden until enabled. */
|
|
19
|
+
showProviderPill?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Minimal credential face the pill needs; structurally satisfied by the settings card's remote. */
|
|
22
|
+
interface PillCredentials {
|
|
23
|
+
describe(refs: string[]): Promise<{
|
|
24
|
+
ok: boolean;
|
|
25
|
+
value?: Readonly<Record<string, {
|
|
26
|
+
configured?: boolean;
|
|
27
|
+
}>>;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
/** Notifies the pill whenever any credential reference changes on the host. */
|
|
31
|
+
interface PillCredentialEvents {
|
|
32
|
+
listen(callback: () => void): () => void;
|
|
33
|
+
}
|
|
34
|
+
/** Business face injected at registration time by the client entry. */
|
|
35
|
+
export interface ProviderPillFace {
|
|
36
|
+
scope: SettingsScope<PillSettings>;
|
|
37
|
+
credentials: PillCredentials;
|
|
38
|
+
locale?: LocaleService | undefined;
|
|
39
|
+
credentialEvents?: PillCredentialEvents | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Whether the user opted into the composer pill; hidden (not merely inert) when off. */
|
|
42
|
+
export declare function pillVisible(value: PillSettings | undefined): boolean;
|
|
43
|
+
/** Model (or ComfyUI workflow) a provider row will use with the persisted settings. */
|
|
44
|
+
export declare function pillModelOf(provider: ImageProvider, value: PillSettings | undefined): string;
|
|
45
|
+
/** One fixed-position provider menu anchored to the pill button. */
|
|
46
|
+
export declare function ImageProviderPill(props: ProviderPillFace): import("react").JSX.Element | null;
|
|
47
|
+
/** Styles for the pill and its fixed-position menu; injected by the client entry. */
|
|
48
|
+
export declare const PROVIDER_PILL_STYLE = "\n.dsh-ig-pill-root{position:relative;display:inline-flex;align-items:center;height:26px}\n.dsh-ig-pill-button{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 8px 0 7px;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:13px;background:var(--dsw-alias-bg-layer-3,#fff);color:var(--dsw-alias-label-secondary,#4b5563);font:inherit;font-size:12px;line-height:1;cursor:pointer;transition:border-color .15s,background .15s,color .15s;-webkit-user-select:none;user-select:none}\n.dsh-ig-pill-button:hover:not(:disabled){border-color:var(--dsw-alias-label-dimmed,#9ca3af);color:var(--dsw-alias-label-primary,#111827)}\n.dsh-ig-pill-button:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4c78ff);outline-offset:1px}\n.dsh-ig-pill-button:disabled{opacity:.5;cursor:not-allowed}\n.dsh-ig-pill-button-open{border-color:var(--dsw-alias-brand-primary,#4c78ff);color:var(--dsw-alias-label-primary,#111827)}\n.dsh-ig-pill-icon{flex:none;color:var(--dsw-alias-brand-primary,#4c78ff)}\n.dsh-ig-pill-provider{max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.dsh-ig-pill-caret{display:inline-flex;flex:none;transition:transform .15s}\n.dsh-ig-pill-caret-open{transform:rotate(180deg)}\n.dsh-ig-pill-menu{position:fixed;z-index:1000;min-width:264px;max-width:min(320px,calc(100vw - 24px));padding:6px;border:1px solid var(--dsw-alias-border-l2,#e5e7eb);border-radius:12px;background:var(--dsw-alias-bg-layer-3,#fff);box-shadow:0 12px 32px rgba(0,0,0,.16),0 2px 8px rgba(0,0,0,.08);max-height:min(320px,calc(100vh - 48px));overflow-y:auto}\n.dsh-ig-pill-menu-title{padding:6px 8px 4px;font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary,#6b7280)}\n.dsh-ig-pill-option{display:flex;width:100%;align-items:center;gap:9px;padding:7px 8px;border:0;border-radius:8px;background:none;font:inherit;color:inherit;text-align:left;cursor:pointer}\n.dsh-ig-pill-option:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2,#f3f4f6)}\n.dsh-ig-pill-option:disabled{opacity:.6;cursor:default}\n.dsh-ig-pill-option:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4c78ff);outline-offset:-2px}\n.dsh-ig-pill-option-active{background:var(--dsw-alias-brand-primary-soft,rgba(76,120,255,.10))}\n.dsh-ig-pill-dot{flex:none;width:7px;height:7px;border-radius:50%}\n.dsh-ig-pill-dot-ok{background:#22c55e}\n.dsh-ig-pill-dot-missing{background:var(--dsw-alias-border-l2,#d1d5db)}\n.dsh-ig-pill-dot-neutral{background:var(--dsw-alias-brand-primary,#4c78ff)}\n.dsh-ig-pill-option-text{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}\n.dsh-ig-pill-option-name{font-size:12.5px;font-weight:500;color:var(--dsw-alias-label-primary,#111827);line-height:1.2}\n.dsh-ig-pill-option-sub{font-size:11px;color:var(--dsw-alias-label-tertiary,#6b7280);line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.dsh-ig-pill-check{flex:none;color:var(--dsw-alias-brand-primary,#4c78ff)}\n.dsh-ig-pill-error{margin-top:4px;padding:6px 8px;border-radius:8px;background:rgba(239,68,68,.08);color:#ef4444;font-size:11.5px;line-height:1.4;word-break:break-all}\n";
|
|
49
|
+
export {};
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
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, 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, };
|
|
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, DEFAULT_XAI_BASE_URL, DEFAULT_XAI_MODEL, DEFAULT_ZHIPU_BASE_URL, DEFAULT_ZHIPU_MODEL, DASHSCOPE_API_KEY_ENV, GOOGLE_API_KEY_ENV, IMAGE_PROVIDERS, OPENAI_API_KEY_ENV, OPENAI_COMPAT_API_KEY_ENV, SEEDREAM_API_KEY_ENV, XAI_API_KEY_ENV, ZHIPU_API_KEY_ENV, 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, DEFAULT_XAI_BASE_URL, DEFAULT_XAI_MODEL, DEFAULT_ZHIPU_BASE_URL, DEFAULT_ZHIPU_MODEL, DASHSCOPE_API_KEY_ENV, GOOGLE_API_KEY_ENV, IMAGE_PROVIDERS, OPENAI_API_KEY_ENV, OPENAI_COMPAT_API_KEY_ENV, SEEDREAM_API_KEY_ENV, XAI_API_KEY_ENV, ZHIPU_API_KEY_ENV, 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
|
-
/** Google API credential reference. */
|
|
8
|
-
export declare const GOOGLE_API_KEY_ENV = "GEMINI_API_KEY";
|
|
9
|
-
/** OpenAI Platform or compatible relay credential reference. */
|
|
10
|
-
export declare const OPENAI_API_KEY_ENV = "OPENAI_API_KEY";
|
|
11
|
-
/** Volcengine Ark credential reference. */
|
|
12
|
-
export declare const SEEDREAM_API_KEY_ENV = "ARK_API_KEY";
|
|
13
|
-
/** DashScope credential reference. */
|
|
14
|
-
export declare const DASHSCOPE_API_KEY_ENV = "DASHSCOPE_API_KEY";
|
|
15
7
|
/** Google tool-level controls. */
|
|
16
8
|
export declare const ASPECT_RATIOS: readonly ["1:1", "3:2", "2:3", "4:3", "3:4", "16:9", "9:16"];
|
|
17
9
|
export declare const IMAGE_SIZES: readonly ["1K", "2K", "4K"];
|
|
@@ -24,10 +16,17 @@ export interface Config {
|
|
|
24
16
|
googleEndpoint?: string;
|
|
25
17
|
openaiBaseURL?: string;
|
|
26
18
|
openaiModel?: string;
|
|
19
|
+
/** OpenAI-compatible relay settings; independent from the official OpenAI row. */
|
|
20
|
+
openaiCompatBaseURL?: string;
|
|
21
|
+
openaiCompatModel?: string;
|
|
27
22
|
seedreamBaseURL?: string;
|
|
28
23
|
seedreamModel?: string;
|
|
29
24
|
dashscopeEndpoint?: string;
|
|
30
25
|
dashscopeModel?: string;
|
|
26
|
+
xaiBaseURL?: string;
|
|
27
|
+
xaiModel?: string;
|
|
28
|
+
zhipuBaseURL?: string;
|
|
29
|
+
zhipuModel?: string;
|
|
31
30
|
comfyuiBaseURL?: string;
|
|
32
31
|
/** Named ComfyUI workflows managed by the Web settings page. */
|
|
33
32
|
comfyuiWorkflows?: ComfyUIWorkflowEntry[];
|
|
@@ -59,6 +58,12 @@ export declare function resolveProvider(config: Config): {
|
|
|
59
58
|
model: string;
|
|
60
59
|
baseURL: string;
|
|
61
60
|
imageSize: string;
|
|
61
|
+
} | {
|
|
62
|
+
provider: 'openai-compat';
|
|
63
|
+
apiKeyEnv: string;
|
|
64
|
+
model: string;
|
|
65
|
+
baseURL: string;
|
|
66
|
+
imageSize: string;
|
|
62
67
|
} | {
|
|
63
68
|
provider: 'seedream';
|
|
64
69
|
apiKeyEnv: string;
|
|
@@ -71,6 +76,18 @@ export declare function resolveProvider(config: Config): {
|
|
|
71
76
|
model: string;
|
|
72
77
|
endpoint: string;
|
|
73
78
|
imageSize: string;
|
|
79
|
+
} | {
|
|
80
|
+
provider: 'xai';
|
|
81
|
+
apiKeyEnv: string;
|
|
82
|
+
model: string;
|
|
83
|
+
baseURL: string;
|
|
84
|
+
imageSize: string;
|
|
85
|
+
} | {
|
|
86
|
+
provider: 'zhipu';
|
|
87
|
+
apiKeyEnv: string;
|
|
88
|
+
model: string;
|
|
89
|
+
baseURL: string;
|
|
90
|
+
imageSize: string;
|
|
74
91
|
} | {
|
|
75
92
|
provider: 'comfyui';
|
|
76
93
|
baseURL: string;
|
|
@@ -78,6 +95,18 @@ export declare function resolveProvider(config: Config): {
|
|
|
78
95
|
workflow?: ComfyUIWorkflowEntry;
|
|
79
96
|
timeoutMs: number;
|
|
80
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Apply a per-call provider and/or model override on top of the saved config.
|
|
100
|
+
* `model` is ignored for ComfyUI, whose per-call equivalent is `workflow`.
|
|
101
|
+
*/
|
|
102
|
+
export declare function withProviderOverrides(config: Config, provider?: ImageProvider, model?: string): Config;
|
|
103
|
+
/**
|
|
104
|
+
* One-time migration: when the legacy single OpenAI slot points at a relay
|
|
105
|
+
* (non-official base URL) and the compat row is empty, move the relay config
|
|
106
|
+
* to the compat row so both can coexist. Returns the input untouched when
|
|
107
|
+
* nothing needs moving.
|
|
108
|
+
*/
|
|
109
|
+
export declare function migrateOpenAICompatConfig(config: Config): Config;
|
|
81
110
|
/** The workflow a ComfyUI call runs: the requested name when given, else the active one. */
|
|
82
111
|
export declare function selectComfyUIWorkflow(active: {
|
|
83
112
|
workflows: ComfyUIWorkflowEntry[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { type CloudImageProvider } from './shared.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve one provider's stored API key to a non-blank value. Blank values
|
|
5
|
+
* never count as configured: the host treats an empty stored value as absent,
|
|
6
|
+
* and a whitespace-only key is never sent to a provider.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveApiKey(ctx: Context, provider: CloudImageProvider): Promise<string | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve one provider's API key or fail with a user-facing message that says
|
|
11
|
+
* where to configure it. Passing `tool` selects the Agent-facing English
|
|
12
|
+
* wording; without it the message is the browser-facing Chinese one used by
|
|
13
|
+
* the Studio route.
|
|
14
|
+
*/
|
|
15
|
+
export declare function requireApiKey(ctx: Context, provider: CloudImageProvider, tool?: string): Promise<string>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { Config } from './config.js';
|
|
|
5
5
|
export { IMAGE_ROUTE, DELETE_ROUTE, SAVE_WORKSPACE_ROUTE, imageAttachmentFromMeta } from './image-route.js';
|
|
6
6
|
export { STUDIO_ROUTE } from './shared.js';
|
|
7
7
|
export { INSPIRATION_ROUTE } from './shared.js';
|
|
8
|
+
export { TEST_CONNECTION_ROUTE } from './shared.js';
|
|
8
9
|
export declare const name = "dsh-image-gen";
|
|
9
10
|
export declare const inject: string[];
|
|
10
11
|
export declare function apply(ctx: Context, config?: Config): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const DEFAULT_MAX_CACHE_BYTES: number;
|
|
2
|
+
export declare function setInspirationCacheDir(dir: string): void;
|
|
3
|
+
export declare function getInspirationCacheDir(): string;
|
|
4
|
+
export declare function cacheKey(sourceId: string, caseId: string): string;
|
|
5
|
+
export interface CachedImageMetadata {
|
|
6
|
+
contentType: string;
|
|
7
|
+
sourceId: string;
|
|
8
|
+
caseId: string;
|
|
9
|
+
savedAt: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function getCachedImagePath(key: string): string | null;
|
|
12
|
+
export declare function readCachedImage(key: string): {
|
|
13
|
+
data: Buffer;
|
|
14
|
+
contentType: string;
|
|
15
|
+
} | null;
|
|
16
|
+
export declare function writeCachedImage(key: string, data: Buffer, contentType: string, sourceId: string, caseId: string, maxBytes?: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Enforce max cache size constraint by evicting oldest accessed files.
|
|
19
|
+
*/
|
|
20
|
+
export declare function evictCacheIfNeeded(maxBytes?: number): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PromptCase, PromptSource } from './types.js';
|
|
2
|
+
export declare const MAX_IMAGE_BYTES: number;
|
|
3
|
+
export declare const FETCH_TIMEOUT_MS = 6000;
|
|
4
|
+
/**
|
|
5
|
+
* Validate that an IP or hostname is not private/loopback (SSRF protection).
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPrivateOrLocalAddress(hostname: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check binary magic bytes to verify genuine image type.
|
|
10
|
+
* Rejects SVGs, HTML, scripts, executables.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sniffImageMimeType(buf: Buffer): 'image/jpeg' | 'image/png' | 'image/webp' | null;
|
|
13
|
+
/**
|
|
14
|
+
* Safely fetch a single URL with strict checks.
|
|
15
|
+
*/
|
|
16
|
+
export declare function fetchSingleImageUrl(urlStr: string, allowedDomains: string[]): Promise<{
|
|
17
|
+
data: Buffer;
|
|
18
|
+
contentType: string;
|
|
19
|
+
} | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Multi-tier racing / fallback fetcher:
|
|
22
|
+
* Tries candidate URLs in order until a valid image is retrieved.
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchInspirationImage(source: PromptSource, promptCase: PromptCase): Promise<{
|
|
25
|
+
data: Buffer;
|
|
26
|
+
contentType: string;
|
|
27
|
+
} | null>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side route handlers for the Inspiration Library.
|
|
3
|
+
*/
|
|
4
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
|
+
export declare function serveInspirationCases(_req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Handle GET /plugins/dsh-image-gen/inspiration/image/:sourceId/:caseId
|
|
8
|
+
*/
|
|
9
|
+
export declare function serveInspirationImage(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Handle POST /plugins/dsh-image-gen/inspiration/update
|
|
12
|
+
*/
|
|
13
|
+
export declare function serveInspirationUpdate(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PromptCase, PromptSource } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Find the path to the inspiration snapshots folder.
|
|
4
|
+
* Supports both development (src/) and built distribution (root / lib).
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSnapshotsDir(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Load built-in prompt sources from packaged JSON snapshots.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadBuiltinSources(): PromptSource[];
|
|
11
|
+
/**
|
|
12
|
+
* Clear cached sources to allow reloading upon update.
|
|
13
|
+
*/
|
|
14
|
+
export declare function invalidateSourcesCache(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Get a specific prompt source by ID.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getPromptSource(sourceId: string): PromptSource | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Find a specific case within a source.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPromptCase(sourceId: string, caseId: string): {
|
|
23
|
+
source: PromptSource;
|
|
24
|
+
promptCase: PromptCase;
|
|
25
|
+
} | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve candidate URLs for downloading an inspiration case's image.
|
|
28
|
+
* Uses a prioritized multi-tier fallback:
|
|
29
|
+
* 1. Fast, reliable global CDN (fastly.jsdelivr.net) - free, doesn't load author's server
|
|
30
|
+
* 2. Canghe.ai official website static origin (fast in mainland China)
|
|
31
|
+
* 3. GitHub raw official fallback
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveCaseImageCandidateUrls(source: PromptSource, promptCase: PromptCase): string[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions and contracts for the Prompt Library / Inspiration system.
|
|
3
|
+
*/
|
|
4
|
+
export interface PromptCase {
|
|
5
|
+
/** Unique case ID within the source (e.g. "544" or "case-544") */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Human-readable title */
|
|
8
|
+
title: string;
|
|
9
|
+
/** The full prompt text to be reused */
|
|
10
|
+
prompt: string;
|
|
11
|
+
/** Image identifier or path (e.g. "/images/case544.jpg" or "case544.jpg") */
|
|
12
|
+
image?: string | undefined;
|
|
13
|
+
/** Primary category (e.g. "UI & Interfaces", "Products & E-commerce") */
|
|
14
|
+
category?: string | undefined;
|
|
15
|
+
/** Visual styles (e.g. ["UI", "Poster", "Realistic"]) */
|
|
16
|
+
styles?: string[] | undefined;
|
|
17
|
+
/** Application scenarios (e.g. ["Tech", "Commerce"]) */
|
|
18
|
+
scenes?: string[] | undefined;
|
|
19
|
+
/** Original creator or source platform display name */
|
|
20
|
+
sourceLabel?: string | undefined;
|
|
21
|
+
/** Link to original social post or source article */
|
|
22
|
+
sourceUrl?: string | undefined;
|
|
23
|
+
/** Original author name if known */
|
|
24
|
+
author?: string | undefined;
|
|
25
|
+
/** Author homepage or profile */
|
|
26
|
+
authorUrl?: string | undefined;
|
|
27
|
+
/** License name if explicitly declared */
|
|
28
|
+
license?: string | undefined;
|
|
29
|
+
/** License URL if explicitly declared */
|
|
30
|
+
licenseUrl?: string | undefined;
|
|
31
|
+
/** Recommended model hint if available */
|
|
32
|
+
modelHint?: string | undefined;
|
|
33
|
+
/** Whether the case is marked as featured / staff pick */
|
|
34
|
+
featured?: boolean | undefined;
|
|
35
|
+
/** Direct link back to upstream repository documentation */
|
|
36
|
+
githubUrl?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface PromptSource {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
homepage?: string | undefined;
|
|
42
|
+
version: string;
|
|
43
|
+
schemaVersion: number;
|
|
44
|
+
/** Domain whitelist allowed for fetching images for this source */
|
|
45
|
+
allowedDomains: string[];
|
|
46
|
+
/** Array of prompt cases */
|
|
47
|
+
cases: PromptCase[];
|
|
48
|
+
/** Available categories extracted from cases */
|
|
49
|
+
categories?: string[] | undefined;
|
|
50
|
+
/** Available styles extracted from cases */
|
|
51
|
+
styles?: string[] | undefined;
|
|
52
|
+
/** Available scenes extracted from cases */
|
|
53
|
+
scenes?: string[] | undefined;
|
|
54
|
+
}
|
|
55
|
+
export interface InspirationManifest {
|
|
56
|
+
schemaVersion: number;
|
|
57
|
+
sourceVersion: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
sha256: string;
|
|
60
|
+
totalCases: number;
|
|
61
|
+
}
|
|
62
|
+
export interface InspirationCasesResponse {
|
|
63
|
+
sources: PromptSource[];
|
|
64
|
+
activeSourceId: string;
|
|
65
|
+
}
|
|
@@ -9,7 +9,7 @@ export interface CompatibleReferenceImage {
|
|
|
9
9
|
mediaType: ImageMediaType;
|
|
10
10
|
}
|
|
11
11
|
export declare function generateOpenAICompatibleImage(input: {
|
|
12
|
-
provider: 'openai' | 'seedream';
|
|
12
|
+
provider: 'openai' | 'openai-compat' | 'seedream' | 'xai' | 'zhipu';
|
|
13
13
|
apiKey: string;
|
|
14
14
|
baseURL: string;
|
|
15
15
|
model: string;
|
package/lib/types/shared.d.ts
CHANGED
|
@@ -10,14 +10,45 @@ export declare const STUDIO_ROUTE = "/plugins/dsh-image-gen/studio";
|
|
|
10
10
|
export declare const INSPIRATION_ROUTE = "/plugins/dsh-image-gen/inspiration";
|
|
11
11
|
/** Browser route used for saving generated images to workspace on demand. */
|
|
12
12
|
export declare const SAVE_WORKSPACE_ROUTE = "/plugins/dsh-image-gen/save-workspace";
|
|
13
|
+
/** Browser route the settings card probes provider connectivity through. */
|
|
14
|
+
export declare const TEST_CONNECTION_ROUTE = "/plugins/dsh-image-gen/test";
|
|
13
15
|
/** Namespace persisted through DSH Settings. */
|
|
14
16
|
export declare const IMAGE_GENERATION_NAMESPACE = "image-generation";
|
|
15
17
|
/** Supported providers. */
|
|
16
|
-
export declare const IMAGE_PROVIDERS: readonly ["google", "openai", "seedream", "dashscope", "comfyui"];
|
|
18
|
+
export declare const IMAGE_PROVIDERS: readonly ["google", "openai", "openai-compat", "seedream", "dashscope", "xai", "zhipu", "comfyui"];
|
|
17
19
|
export type ImageProvider = typeof IMAGE_PROVIDERS[number];
|
|
18
20
|
/** Providers supported by the first browser workbench release. */
|
|
19
|
-
export declare const CLOUD_IMAGE_PROVIDERS: readonly ["google", "openai", "seedream", "dashscope"];
|
|
21
|
+
export declare const CLOUD_IMAGE_PROVIDERS: readonly ["google", "openai", "openai-compat", "seedream", "dashscope", "xai", "zhipu"];
|
|
20
22
|
export type CloudImageProvider = typeof CLOUD_IMAGE_PROVIDERS[number];
|
|
23
|
+
/**
|
|
24
|
+
* Credential references resolved through the DSH Credentials service (BYOK).
|
|
25
|
+
* These are POSIX-style reference names, not environment variables: the host
|
|
26
|
+
* layers the process environment and its managed store behind them, so a name
|
|
27
|
+
* like OPENAI_API_KEY is shared with any other plugin resolving the same ref.
|
|
28
|
+
*/
|
|
29
|
+
export declare const GOOGLE_API_KEY_ENV = "GEMINI_API_KEY";
|
|
30
|
+
/** OpenAI Platform credential reference. */
|
|
31
|
+
export declare const OPENAI_API_KEY_ENV = "OPENAI_API_KEY";
|
|
32
|
+
/**
|
|
33
|
+
* OpenAI-compatible relay credential reference. Deliberately distinct from
|
|
34
|
+
* OPENAI_API_KEY so an official key and a relay key can coexist without
|
|
35
|
+
* overwriting each other.
|
|
36
|
+
*/
|
|
37
|
+
export declare const OPENAI_COMPAT_API_KEY_ENV = "DSH_IMAGE_GEN_OPENAI_COMPAT_KEY";
|
|
38
|
+
/** Volcengine Ark credential reference. */
|
|
39
|
+
export declare const SEEDREAM_API_KEY_ENV = "ARK_API_KEY";
|
|
40
|
+
/** DashScope credential reference. */
|
|
41
|
+
export declare const DASHSCOPE_API_KEY_ENV = "DASHSCOPE_API_KEY";
|
|
42
|
+
/** xAI credential reference; matches the official xAI SDK environment name. */
|
|
43
|
+
export declare const XAI_API_KEY_ENV = "XAI_API_KEY";
|
|
44
|
+
/** Zhipu credential reference; matches the official Zhipu SDK environment name. */
|
|
45
|
+
export declare const ZHIPU_API_KEY_ENV = "ZHIPUAI_API_KEY";
|
|
46
|
+
/** The credential reference each cloud provider's API key is stored under. */
|
|
47
|
+
export declare const CLOUD_CREDENTIAL_REFS: Record<CloudImageProvider, string>;
|
|
48
|
+
/** The credential reference storing this provider's API key, when it uses one. */
|
|
49
|
+
export declare function cloudCredentialRef(provider: ImageProvider): string | undefined;
|
|
50
|
+
/** Locale-neutral provider names for user-facing errors and status lines. */
|
|
51
|
+
export declare const PROVIDER_DISPLAY_NAMES: Record<ImageProvider, string>;
|
|
21
52
|
/** One selectable output option exposed by a provider profile. */
|
|
22
53
|
export interface StudioOption {
|
|
23
54
|
value: string;
|
|
@@ -99,6 +130,8 @@ export declare const DEFAULT_GOOGLE_ENDPOINT = "https://generativelanguage.googl
|
|
|
99
130
|
export declare const DEFAULT_OPENAI_BASE_URL = "https://api.openai.com/v1";
|
|
100
131
|
export declare const DEFAULT_SEEDREAM_BASE_URL = "https://ark.cn-beijing.volces.com/api/v3";
|
|
101
132
|
export declare const DEFAULT_DASHSCOPE_ENDPOINT = "https://dashscope.aliyuncs.com/api/v1";
|
|
133
|
+
export declare const DEFAULT_XAI_BASE_URL = "https://api.x.ai/v1";
|
|
134
|
+
export declare const DEFAULT_ZHIPU_BASE_URL = "https://open.bigmodel.cn/api/paas/v4";
|
|
102
135
|
export declare const DEFAULT_COMFYUI_BASE_URL = "http://127.0.0.1:8188";
|
|
103
136
|
export declare const DEFAULT_COMFYUI_TIMEOUT_MS = 300000;
|
|
104
137
|
export declare const DEFAULT_COMFYUI_WORKFLOW_LABEL = "API workflow";
|
|
@@ -108,6 +141,8 @@ export declare const DEFAULT_GOOGLE_MODEL = "gemini-3.1-flash-image";
|
|
|
108
141
|
export declare const DEFAULT_OPENAI_MODEL = "gpt-image-2";
|
|
109
142
|
export declare const DEFAULT_SEEDREAM_MODEL = "doubao-seedream-5-0-260128";
|
|
110
143
|
export declare const DEFAULT_DASHSCOPE_MODEL = "qwen-image-3.0";
|
|
144
|
+
export declare const DEFAULT_XAI_MODEL = "grok-imagine-image";
|
|
145
|
+
export declare const DEFAULT_ZHIPU_MODEL = "glm-image";
|
|
111
146
|
/** One named ComfyUI API-format workflow imported through settings. */
|
|
112
147
|
export interface ComfyUIWorkflowEntry {
|
|
113
148
|
/** Unique human-readable label; used as the result model and by tool calls. */
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Same-origin connection probe the settings card runs per provider. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import type { Config, ImageProvider } from './config.js';
|
|
4
|
+
import { type CloudImageProvider } from './shared.js';
|
|
5
|
+
export { TEST_CONNECTION_ROUTE } from './shared.js';
|
|
6
|
+
/** One probe target a provider resolves to: a URL plus its auth headers. */
|
|
7
|
+
export interface ProbeTarget {
|
|
8
|
+
url: string;
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The endpoint each provider is probed on. All four cloud providers expose a
|
|
13
|
+
* model-list GET that authenticates with the same credential image generation
|
|
14
|
+
* uses; ComfyUI exposes its standard `system_stats` health endpoint.
|
|
15
|
+
*/
|
|
16
|
+
export declare function probeTarget(provider: ImageProvider, config: Config, apiKey?: string | undefined): ProbeTarget;
|
|
17
|
+
/** Structured probe outcome the settings card maps onto localized text. */
|
|
18
|
+
export type ProbeResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
} | {
|
|
21
|
+
ok: false;
|
|
22
|
+
reason: 'missing-key' | 'unauthorized' | 'error';
|
|
23
|
+
message?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Model-pull outcome: a filtered list of image-capable model ids on success. */
|
|
26
|
+
export type ModelsResult = {
|
|
27
|
+
ok: true;
|
|
28
|
+
models: string[];
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
reason: 'missing-key' | 'unauthorized' | 'error';
|
|
32
|
+
message?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Extract bare model ids from a Google `list models` payload (`models/{id}`). */
|
|
35
|
+
export declare function parseGoogleModelIds(payload: unknown): string[];
|
|
36
|
+
/** Heuristic filter: Gemini image models carry `image`/`imagen` in the id. */
|
|
37
|
+
export declare function filterImageModelIds(ids: readonly string[]): string[];
|
|
38
|
+
/** Narrow filter for the official OpenAI catalog: gpt-image and DALL·E families. */
|
|
39
|
+
export declare function filterOpenAIImageModelIds(ids: readonly string[]): string[];
|
|
40
|
+
/** Broad filter for relays: common image-model id fragments across vendors. */
|
|
41
|
+
export declare function filterRelayImageModelIds(ids: readonly string[]): string[];
|
|
42
|
+
/** Ark catalog filter: the Seedream (generation) and SeedEdit (editing) families. */
|
|
43
|
+
export declare function filterSeedreamImageModelIds(ids: readonly string[]): string[];
|
|
44
|
+
/** Zhipu catalog filter: GLM-Image and CogView families. */
|
|
45
|
+
export declare function filterZhipuImageModelIds(ids: readonly string[]): string[];
|
|
46
|
+
/** Extract model ids from an OpenAI-style `{data:[{id}]}` or xAI-style `{models:[{id}]}` payload. */
|
|
47
|
+
export declare function parseOpenAIModelIds(payload: unknown): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Extract image-capable model ids from a DashScope native
|
|
50
|
+
* `{output:{models:[{model,capabilities}]}}` payload. The `capabilities`
|
|
51
|
+
* array marks image generation as `IG`; name fragments are a fallback for
|
|
52
|
+
* payloads that omit the field.
|
|
53
|
+
*/
|
|
54
|
+
export declare function parseDashScopeImageModelIds(payload: unknown): string[];
|
|
55
|
+
/** Pull and filter the image-capable models from the Google endpoint. */
|
|
56
|
+
export declare function fetchGoogleImageModels(config: Config, apiKey: string | undefined, signal?: AbortSignal | undefined): Promise<ModelsResult>;
|
|
57
|
+
/** Pull and filter image-capable models from an OpenAI-compatible endpoint (official, relay, Ark, xAI, Zhipu). */
|
|
58
|
+
export declare function fetchOpenAIImageModels(provider: 'openai' | 'openai-compat' | 'seedream' | 'xai' | 'zhipu', config: Config, apiKey: string | undefined, signal?: AbortSignal | undefined): Promise<ModelsResult>;
|
|
59
|
+
/** Pull and filter image-capable models from the DashScope native model list (`capabilities=IG`). */
|
|
60
|
+
export declare function fetchDashScopeImageModels(config: Config, apiKey: string | undefined, signal?: AbortSignal | undefined): Promise<ModelsResult>;
|
|
61
|
+
/** Run one provider probe and classify the outcome; secrets never leave redacted. */
|
|
62
|
+
export declare function probeProviderConnection(provider: CloudImageProvider, config: Config, apiKey: string | undefined, signal?: AbortSignal | undefined): Promise<ProbeResult>;
|
|
63
|
+
/** Probe the local ComfyUI service without any credential. */
|
|
64
|
+
export declare function probeComfyUIConnection(config: Config, signal?: AbortSignal | undefined): Promise<ProbeResult>;
|
|
65
|
+
/** Dependencies the test route needs from the plugin entry. */
|
|
66
|
+
export interface TestRouteDeps {
|
|
67
|
+
/** The credential each cloud provider probes with, when one is stored. */
|
|
68
|
+
resolveKey(provider: CloudImageProvider): Promise<string | undefined>;
|
|
69
|
+
/** The currently authoritative config, including unsaved defaults. */
|
|
70
|
+
config(): Config;
|
|
71
|
+
}
|
|
72
|
+
/** Serve the settings card's per-provider connectivity probe. */
|
|
73
|
+
export declare function serveTestConnection(req: IncomingMessage, res: ServerResponse, deps: TestRouteDeps): Promise<void>;
|
package/package.json
CHANGED