@aryacode/dsh-arya-image-gen 0.0.0-stage → 0.20.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 +201 -0
- package/NOTICE +24 -0
- package/README.md +292 -2
- package/cordis.patch.yml +5 -0
- package/docs/assets/readme/canvas-edit.webp +0 -0
- package/docs/assets/readme/canvas-generate.webp +0 -0
- package/docs/assets/readme/chat-example.webp +0 -0
- package/docs/assets/readme/chat-generate.webp +0 -0
- package/docs/assets/readme/comfyui-workflows.webp +0 -0
- package/docs/assets/readme/gallery-management.webp +0 -0
- package/docs/assets/readme/hero-arya-wide.webp +0 -0
- package/docs/assets/readme/hero-arya.webp +0 -0
- package/docs/assets/readme/inspiration-arya.webp +0 -0
- package/docs/assets/readme/inspiration-library.webp +0 -0
- package/docs/assets/readme/install-arya.webp +0 -0
- package/docs/assets/readme/multi-model-compare.webp +0 -0
- package/docs/assets/readme/other-features.webp +0 -0
- package/docs/assets/readme/plugin-detail.webp +0 -0
- package/docs/assets/readme/plugins-entry.webp +0 -0
- package/docs/assets/readme/regenerating.webp +0 -0
- package/docs/assets/readme/revision-switcher.webp +0 -0
- package/docs/assets/readme/studio-arya.webp +0 -0
- package/docs/assets/readme/studio-workbench.webp +0 -0
- package/docs/assets/readme/workflow-overview-en.webp +0 -0
- package/docs/assets/readme/workflow-overview.webp +0 -0
- package/docs/workflows/arya-qwen-image-pack.zip +0 -0
- package/docs/workflows/qwen-image-compose.json +1 -0
- package/docs/workflows/qwen-image-create.json +142 -0
- package/docs/workflows/qwen-image-cutout.json +142 -0
- package/docs/workflows/qwen-image-edit.json +1 -0
- package/docs/workflows/qwen-image-remove-bg.json +1 -0
- package/lib/agent-toolset.js +51 -0
- package/lib/client.js +127081 -0
- package/lib/index.js +28598 -0
- package/lib/types/agent-preset/billion-context.d.ts +150 -0
- package/lib/types/agent-preset/definition.d.ts +75 -0
- package/lib/types/agent-preset/persona.d.ts +10 -0
- package/lib/types/agent-preset/register.d.ts +40 -0
- package/lib/types/agent-preset/toolset.d.ts +36 -0
- package/lib/types/baoyu-compose.d.ts +59 -0
- package/lib/types/canvas-asset-route.d.ts +12 -0
- package/lib/types/canvas-state-route.d.ts +37 -0
- package/lib/types/canvas-state.d.ts +80 -0
- package/lib/types/canvas-tools.d.ts +44 -0
- package/lib/types/client/browser-image-utils.d.ts +23 -0
- package/lib/types/client/conversation-image-revisions.d.ts +24 -0
- package/lib/types/client/conversation-regenerate.d.ts +8 -0
- package/lib/types/client/gallery-store.d.ts +137 -0
- package/lib/types/client/gallery-view.d.ts +255 -0
- package/lib/types/client/generation-activity.d.ts +62 -0
- package/lib/types/client/image-cache.d.ts +26 -0
- package/lib/types/client/image-ref.d.ts +31 -0
- package/lib/types/client/image-result-node.d.ts +81 -0
- package/lib/types/client/index.d.ts +113 -0
- package/lib/types/client/inspiration-catalog-cache.d.ts +4 -0
- package/lib/types/client/inspiration-image-cache.d.ts +3 -0
- package/lib/types/client/inspiration-style.d.ts +1 -0
- package/lib/types/client/inspiration-view.d.ts +9 -0
- package/lib/types/client/multi-model-compare.d.ts +20 -0
- package/lib/types/client/settings-state.d.ts +12 -0
- package/lib/types/client/settings-write.d.ts +4 -0
- package/lib/types/client/studio-style.d.ts +1 -0
- package/lib/types/client/studio-view.d.ts +48 -0
- package/lib/types/client/tl/canvas-selection.d.ts +13 -0
- package/lib/types/client/tl/canvas-sync.d.ts +30 -0
- package/lib/types/client/tl/conversation-landings.d.ts +48 -0
- package/lib/types/client/tl/css-supports-shim.d.ts +21 -0
- package/lib/types/client/tl/gallery-canvas-button.d.ts +10 -0
- package/lib/types/client/tl/gallery-image-transfer.d.ts +12 -0
- package/lib/types/client/tl/studio-tl-canvas.d.ts +16 -0
- package/lib/types/client/tl/tl-brand-theme.d.ts +10 -0
- package/lib/types/client/tl/tl-brand-tokens.d.ts +24 -0
- package/lib/types/client/tl/tl-canvas-bridge.d.ts +39 -0
- package/lib/types/client/tl/tl-css.d.ts +2 -0
- package/lib/types/client/tl/tl-theme-css.d.ts +17 -0
- package/lib/types/comfyui-progress.d.ts +78 -0
- package/lib/types/comfyui-server-route.d.ts +10 -0
- package/lib/types/comfyui-server.d.ts +61 -0
- package/lib/types/comfyui-workflow.d.ts +80 -0
- package/lib/types/comfyui.d.ts +52 -0
- package/lib/types/config.d.ts +87 -0
- package/lib/types/fetch-diagnostics.d.ts +10 -0
- package/lib/types/generated/default-workflows.d.ts +16 -0
- package/lib/types/image-route.d.ts +35 -0
- package/lib/types/image-tool-context.d.ts +3 -0
- package/lib/types/import-route.d.ts +16 -0
- package/lib/types/index.d.ts +16 -0
- package/lib/types/inspiration-route.d.ts +6 -0
- package/lib/types/inspiration.d.ts +92 -0
- package/lib/types/progress-route.d.ts +10 -0
- package/lib/types/redact.d.ts +2 -0
- package/lib/types/reference-image.d.ts +56 -0
- package/lib/types/reference-import.d.ts +66 -0
- package/lib/types/save-generated.d.ts +83 -0
- package/lib/types/settings-health.d.ts +6 -0
- package/lib/types/shared.d.ts +519 -0
- package/lib/types/studio-route.d.ts +15 -0
- package/lib/types/studio.d.ts +14 -0
- package/lib/types/validate-workflows.d.ts +48 -0
- package/lib/types/workspace-save.d.ts +103 -0
- package/package.json +143 -5
- package/skills/arya-image-references/SKILL.md +74 -0
- package/skills/arya-image-workflows/SKILL.md +75 -0
- package/skills/install-arya-image-gen/SKILL.md +28 -0
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
/** Values shared by the Host and browser Bundle faces. ComfyUI-only build. */
|
|
2
|
+
import type { ImageAttachmentRef, ImageMediaType } from '@deepseek-ai/dsh-attachment';
|
|
3
|
+
/** Browser route used by the generated-image card. */
|
|
4
|
+
export declare const IMAGE_ROUTE = "/plugins/dsh-image-gen/image";
|
|
5
|
+
/** Browser route that uploads user-picked images as DSH attachments. */
|
|
6
|
+
export declare const IMPORT_ROUTE = "/plugins/dsh-image-gen/import";
|
|
7
|
+
/** Browser route used for deleting generated images and workspace files. */
|
|
8
|
+
export declare const DELETE_ROUTE = "/plugins/dsh-image-gen/delete";
|
|
9
|
+
/** Same-origin route used by the browser image workbench. */
|
|
10
|
+
export declare const STUDIO_ROUTE = "/plugins/dsh-image-gen/studio";
|
|
11
|
+
/** Same-origin route for built-in prompt inspiration metadata and images. */
|
|
12
|
+
export declare const INSPIRATION_ROUTE = "/plugins/dsh-image-gen/inspiration";
|
|
13
|
+
/** Browser route used for saving generated images to workspace on demand. */
|
|
14
|
+
export declare const SAVE_WORKSPACE_ROUTE = "/plugins/dsh-image-gen/save-workspace";
|
|
15
|
+
/** Same-origin route that starts, stops, restarts, and probes the local ComfyUI server. */
|
|
16
|
+
export declare const COMFYUI_SERVER_ROUTE = "/plugins/dsh-image-gen/comfyui-server";
|
|
17
|
+
/** Deterministic progress job id for one chat tool call. */
|
|
18
|
+
export declare function progressJobIdForCall(callId: string): string;
|
|
19
|
+
/** Prefix for live job snapshots, previews, and cancellation. */
|
|
20
|
+
export declare const COMFYUI_PROGRESS_ROUTE = "/plugins/dsh-image-gen/progress";
|
|
21
|
+
/** Non-secret settings capability probe, available even when the host cannot serve a form. */
|
|
22
|
+
export declare const SETTINGS_HEALTH_ROUTE = "/plugins/dsh-image-gen/settings-health";
|
|
23
|
+
export interface SettingsHealth {
|
|
24
|
+
settings: 'unavailable' | 'legacy' | 'live';
|
|
25
|
+
liveSchema: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Browser route the workbench infinite canvas pushes live state through. */
|
|
28
|
+
export declare const CANVAS_STATE_ROUTE = "/plugins/dsh-image-gen/canvas-state";
|
|
29
|
+
/** Upload a selected canvas original to the host attachment store. */
|
|
30
|
+
export declare const CANVAS_ASSET_ROUTE = "/plugins/dsh-image-gen/canvas-asset";
|
|
31
|
+
/** Pre-flight the configured workflows against the running ComfyUI. */
|
|
32
|
+
export declare const CHECK_WORKFLOWS_ROUTE = "/plugins/dsh-image-gen/check-workflows";
|
|
33
|
+
/**
|
|
34
|
+
* Model-facing tool names this Bundle registers.
|
|
35
|
+
*
|
|
36
|
+
* Single source of truth: the registrations below use these values, and the
|
|
37
|
+
* Arya Image agent preset sees them as this bundle's host-wide tools, so the
|
|
38
|
+
* names cannot drift.
|
|
39
|
+
*/
|
|
40
|
+
export declare const IMAGE_TOOL_NAMES: {
|
|
41
|
+
readonly generateImage: "generate_image";
|
|
42
|
+
readonly generateImages: "generate_images";
|
|
43
|
+
readonly editImage: "edit_image";
|
|
44
|
+
readonly findInspiration: "find_inspiration";
|
|
45
|
+
readonly importReference: "import_reference_image";
|
|
46
|
+
readonly listWorkflows: "list_workflows";
|
|
47
|
+
readonly canvasState: "canvas_state";
|
|
48
|
+
readonly viewCanvas: "view_canvas";
|
|
49
|
+
};
|
|
50
|
+
/** Every image tool name, in registration order. */
|
|
51
|
+
export declare const IMAGE_TOOL_NAME_LIST: readonly string[];
|
|
52
|
+
/** Coarse model-facing kind of one shape on the workbench infinite canvas. */
|
|
53
|
+
export type CanvasNodeKind = 'image' | 'draw' | 'text' | 'note' | 'geo' | 'arrow' | 'frame' | 'other';
|
|
54
|
+
/** Every accepted canvas node kind, for validating untrusted pushes. */
|
|
55
|
+
export declare const CANVAS_NODE_KINDS: readonly CanvasNodeKind[];
|
|
56
|
+
/**
|
|
57
|
+
* Cap on the selection identity list: the client trims `selection.items` to
|
|
58
|
+
* this size and the canvas-state route rejects pushes carrying more, so the
|
|
59
|
+
* two ends can never drift apart.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CANVAS_MAX_SELECTION_ITEMS = 16;
|
|
62
|
+
/**
|
|
63
|
+
* Cap on the node inventory: the client trims `nodes` to this size and the
|
|
64
|
+
* canvas-state route rejects pushes carrying more, so the two ends can never
|
|
65
|
+
* drift apart. Sized to keep the model-facing digest compact.
|
|
66
|
+
*/
|
|
67
|
+
export declare const CANVAS_MAX_NODES = 48;
|
|
68
|
+
/** Same shared-cap contract as CANVAS_MAX_NODES, for the selection kind list. */
|
|
69
|
+
export declare const CANVAS_MAX_SELECTION_KINDS = 8;
|
|
70
|
+
/**
|
|
71
|
+
* Cap on the generation prompt copied onto canvas image shapes and into the
|
|
72
|
+
* model-facing summaries. The landing path truncates to this and the
|
|
73
|
+
* canvas-state route rejects longer values, so the two ends can never drift.
|
|
74
|
+
* The gallery keeps the full prompt; this is only the canvas-side digest view.
|
|
75
|
+
*/
|
|
76
|
+
export declare const CANVAS_MAX_PROMPT_CHARS = 120;
|
|
77
|
+
/** One shape on the workbench infinite canvas, summarized for the model. */
|
|
78
|
+
export interface CanvasNodeSummary {
|
|
79
|
+
kind: CanvasNodeKind;
|
|
80
|
+
/** Gallery id when the shape is a generated image landed from the bus. */
|
|
81
|
+
galleryId?: string;
|
|
82
|
+
/** Conversation attachment id for generated images; edit_image can target it directly. */
|
|
83
|
+
attachmentId?: string;
|
|
84
|
+
/** Complete host reference; remains usable after switching conversations. */
|
|
85
|
+
attachment?: ImageAttachmentRef;
|
|
86
|
+
/** Human-facing label: image name, geo variant, or similar. */
|
|
87
|
+
name?: string;
|
|
88
|
+
width?: number;
|
|
89
|
+
height?: number;
|
|
90
|
+
/** Short text preview for text-bearing shapes. */
|
|
91
|
+
text?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Truncated generation prompt for landed generated images: the model can
|
|
94
|
+
* reproduce or precisely vary a canvas image instead of guessing from pixels.
|
|
95
|
+
*/
|
|
96
|
+
prompt?: string;
|
|
97
|
+
/** Provider id (always "comfyui" in this build) the landed image was generated with. */
|
|
98
|
+
provider?: string;
|
|
99
|
+
/** ComfyUI workflow label the landed image was generated with. */
|
|
100
|
+
model?: string;
|
|
101
|
+
}
|
|
102
|
+
/** What is currently selected on the canvas. */
|
|
103
|
+
export interface CanvasSelectionSummary {
|
|
104
|
+
count: number;
|
|
105
|
+
kinds: readonly CanvasNodeKind[];
|
|
106
|
+
/**
|
|
107
|
+
* Capped identity list of the selected shapes, using the same summary shape
|
|
108
|
+
* as canvas nodes: the model learns WHICH images or strokes are selected
|
|
109
|
+
* (name, attachment id, dimensions), not just how many. Without this, two
|
|
110
|
+
* selections of the same size and kind are indistinguishable.
|
|
111
|
+
*/
|
|
112
|
+
items?: readonly CanvasNodeSummary[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* One live state push from a browser tldraw instance of the workbench canvas.
|
|
116
|
+
* The browser owns the canvas; the host keeps only this compact mirror, so
|
|
117
|
+
* the conversation agent can reason about (and look at) what the user sees.
|
|
118
|
+
*/
|
|
119
|
+
export interface CanvasStatePush {
|
|
120
|
+
/** Tldraw editor id; distinguishes simultaneously mounted canvases. */
|
|
121
|
+
clientInstance: string;
|
|
122
|
+
/** False on the final push right before a canvas unmounts. */
|
|
123
|
+
connected: boolean;
|
|
124
|
+
/** Total shape count on the current page (the node list may be capped). */
|
|
125
|
+
nodeCount: number;
|
|
126
|
+
/** Capped shape inventory, capped client-side before transport. */
|
|
127
|
+
nodes?: readonly CanvasNodeSummary[];
|
|
128
|
+
selection?: CanvasSelectionSummary;
|
|
129
|
+
/**
|
|
130
|
+
* PNG data-URL screenshot of the current selection, pushed whenever a
|
|
131
|
+
* selection settles. It shows the selection as it looks on the canvas —
|
|
132
|
+
* including annotations drawn over generated images — so the model sees the
|
|
133
|
+
* live canvas state, not just the original conversation attachment.
|
|
134
|
+
*/
|
|
135
|
+
selectionImage?: string;
|
|
136
|
+
/** Changes whenever the selection or its contents change. */
|
|
137
|
+
selectionRevision?: string;
|
|
138
|
+
selectionStatus?: 'preparing' | 'ready' | 'error';
|
|
139
|
+
selectionError?: string;
|
|
140
|
+
/** Monotonic per mounted editor, including its final disconnect. */
|
|
141
|
+
sequence?: number;
|
|
142
|
+
updatedAt: number;
|
|
143
|
+
}
|
|
144
|
+
/** Namespace persisted through DSH Settings. */
|
|
145
|
+
export declare const IMAGE_GENERATION_NAMESPACE = "image-generation";
|
|
146
|
+
/**
|
|
147
|
+
* Loader entry id of this plugin's composition entry (see cordis.patch.yml).
|
|
148
|
+
* DSH 0.1.7 serves a plugin's settings under its entry id as the namespace,
|
|
149
|
+
* so browser-side reads/writes bind `configForms` to this id.
|
|
150
|
+
*/
|
|
151
|
+
export declare const IMAGE_GENERATION_ENTRY_ID = "image-gen";
|
|
152
|
+
/** The only provider: diffusion through ComfyUI. */
|
|
153
|
+
export declare const IMAGE_PROVIDERS: readonly ["comfyui"];
|
|
154
|
+
export type ImageProvider = typeof IMAGE_PROVIDERS[number];
|
|
155
|
+
/** Providers the browser workbench drives as workflows: ComfyUI only. */
|
|
156
|
+
export declare const STUDIO_PROVIDERS: readonly ["comfyui"];
|
|
157
|
+
export type StudioProvider = typeof STUDIO_PROVIDERS[number];
|
|
158
|
+
/** True when the provider is selectable in the workflow workbench. */
|
|
159
|
+
export declare function isStudioProvider(provider: ImageProvider): provider is StudioProvider;
|
|
160
|
+
/** Display name per provider, for status lines and provenance. */
|
|
161
|
+
export declare const PROVIDER_DISPLAY_NAMES: Record<ImageProvider, string>;
|
|
162
|
+
/** One selectable option exposed by a provider profile. */
|
|
163
|
+
export interface StudioOption {
|
|
164
|
+
value: string;
|
|
165
|
+
label: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Browser-safe workbench profile. One profile is emitted per imported ComfyUI
|
|
169
|
+
* workflow: `model` carries the workflow name, so the model picker doubles as
|
|
170
|
+
* the workflow picker. Ratio/quality pickers stay empty — the workflow itself
|
|
171
|
+
* defines the canvas size — and the client hides those selects when the option
|
|
172
|
+
* lists are empty.
|
|
173
|
+
*/
|
|
174
|
+
export interface StudioProviderProfile {
|
|
175
|
+
provider: StudioProvider;
|
|
176
|
+
label: string;
|
|
177
|
+
/** Workflow name this profile runs. */
|
|
178
|
+
model: string;
|
|
179
|
+
/** All imported workflows; the model picker lists them. */
|
|
180
|
+
modelOptions: StudioOption[];
|
|
181
|
+
configured: boolean;
|
|
182
|
+
supportsEditing: boolean;
|
|
183
|
+
ratioOptions: StudioOption[];
|
|
184
|
+
qualityOptions: StudioOption[];
|
|
185
|
+
defaultRatio: string;
|
|
186
|
+
defaultQuality: string;
|
|
187
|
+
/** Role the workflow runs as, so the workbench can filter by mode. */
|
|
188
|
+
role?: ComfyUIWorkflowRole;
|
|
189
|
+
/** Numeric parameters this workflow accepts through placeholders. */
|
|
190
|
+
params?: {
|
|
191
|
+
width: boolean;
|
|
192
|
+
height: boolean;
|
|
193
|
+
steps: boolean;
|
|
194
|
+
cfg: boolean;
|
|
195
|
+
};
|
|
196
|
+
/** Canvas presets offered when the workflow accepts width/height. */
|
|
197
|
+
sizePresets?: {
|
|
198
|
+
id: string;
|
|
199
|
+
label: string;
|
|
200
|
+
width: number;
|
|
201
|
+
height: number;
|
|
202
|
+
}[];
|
|
203
|
+
/** Size the workflow bakes when it has no size placeholders. */
|
|
204
|
+
bakedSize?: {
|
|
205
|
+
width: number;
|
|
206
|
+
height: number;
|
|
207
|
+
};
|
|
208
|
+
/** Compatibility fields: ComfyUI profiles never carry these values. */
|
|
209
|
+
channel?: string;
|
|
210
|
+
editModel?: string;
|
|
211
|
+
defaultResolution?: string;
|
|
212
|
+
defaultGenerationQuality?: string;
|
|
213
|
+
resolutionOptions?: Record<string, StudioOption[]>;
|
|
214
|
+
generationQualityOptions?: StudioOption[];
|
|
215
|
+
}
|
|
216
|
+
export declare function studioModelOptionsForMode(profile: StudioProviderProfile, _mode?: 'generate' | 'edit'): StudioOption[];
|
|
217
|
+
/** The workflow a profile runs in either mode; ComfyUI has one model per workflow. */
|
|
218
|
+
export declare function studioModelForMode(profile: StudioProviderProfile, _mode?: 'generate' | 'edit'): string;
|
|
219
|
+
/** Identifier for one workbench target; ComfyUI registers one row per workflow. */
|
|
220
|
+
export declare function studioTargetKey(provider: string, channel?: string): string;
|
|
221
|
+
/** ComfyUI has no subscription channels. */
|
|
222
|
+
export declare function isSubscriptionProvider(_provider: string): boolean;
|
|
223
|
+
/** How a mode's watermark control should render; ComfyUI never offers one. */
|
|
224
|
+
export type StudioWatermark = 'default' | 'on' | 'off' | 'auto';
|
|
225
|
+
export declare const STUDIO_WATERMARK_VALUES: readonly StudioWatermark[];
|
|
226
|
+
export interface WatermarkCapability {
|
|
227
|
+
status: 'supported' | 'unsupported' | 'unknown';
|
|
228
|
+
values?: readonly StudioWatermark[];
|
|
229
|
+
}
|
|
230
|
+
/** ComfyUI workflows embed no watermark parameter, so the control stays hidden. */
|
|
231
|
+
export declare function studioWatermarkCapability(_profile?: StudioProviderProfile, _mode?: 'generate' | 'edit'): WatermarkCapability;
|
|
232
|
+
/** Upstream default quality value used by compatibility pickers. */
|
|
233
|
+
export declare const PROVIDER_DEFAULT_QUALITY = "auto";
|
|
234
|
+
/**
|
|
235
|
+
* Choose the workflow a mode should use without asking the user. Image-to-image
|
|
236
|
+
* only considers edit-capable workflows; a remembered choice wins when it is
|
|
237
|
+
* compatible, otherwise the first compatible workflow applies.
|
|
238
|
+
*/
|
|
239
|
+
export declare function pickStudioWorkflow(profiles: readonly StudioProviderProfile[], mode: 'generate' | 'edit', preferred?: string): StudioProviderProfile | undefined;
|
|
240
|
+
/** Lightweight workspace description exposed to the client for scoping. */
|
|
241
|
+
export interface StudioWorkspaceInfo {
|
|
242
|
+
workspaceId: string;
|
|
243
|
+
path: string;
|
|
244
|
+
title: string;
|
|
245
|
+
sessionIds: string[];
|
|
246
|
+
}
|
|
247
|
+
/** Read capability state for the workbench without exposing secrets. */
|
|
248
|
+
export interface StudioConfigResponse {
|
|
249
|
+
providers: StudioProviderProfile[];
|
|
250
|
+
activeProvider: StudioProvider;
|
|
251
|
+
/** Workflow the workbench preselects. */
|
|
252
|
+
activeWorkflow?: string;
|
|
253
|
+
workspaceRoot?: string | undefined;
|
|
254
|
+
workspaces?: StudioWorkspaceInfo[] | undefined;
|
|
255
|
+
}
|
|
256
|
+
/** A browser-uploaded reference image used for one editing request. */
|
|
257
|
+
export interface StudioEncodedReference {
|
|
258
|
+
mediaType: ImageMediaType;
|
|
259
|
+
data: string;
|
|
260
|
+
name?: string;
|
|
261
|
+
}
|
|
262
|
+
/** A durable image reference selected from the existing gallery. */
|
|
263
|
+
export interface StudioAttachmentReference {
|
|
264
|
+
attachment: ImageAttachmentRef;
|
|
265
|
+
}
|
|
266
|
+
export type StudioReference = StudioEncodedReference | StudioAttachmentReference;
|
|
267
|
+
/** One browser workbench generation or editing request. */
|
|
268
|
+
export interface StudioGenerateRequest {
|
|
269
|
+
mode: 'generate' | 'edit';
|
|
270
|
+
provider: StudioProvider;
|
|
271
|
+
/** Workflow name to run; must be one of the profile's modelOptions. */
|
|
272
|
+
model: string;
|
|
273
|
+
prompt: string;
|
|
274
|
+
/** Client-generated job id used to follow live progress for this request. */
|
|
275
|
+
jobId?: string | undefined;
|
|
276
|
+
reference?: StudioReference;
|
|
277
|
+
references?: StudioReference[];
|
|
278
|
+
count?: number | undefined;
|
|
279
|
+
workspaceRoot?: string | undefined;
|
|
280
|
+
/** Numeric parameters, accepted only when the chosen workflow declares them. */
|
|
281
|
+
width?: number | undefined;
|
|
282
|
+
height?: number | undefined;
|
|
283
|
+
steps?: number | undefined;
|
|
284
|
+
cfg?: number | undefined;
|
|
285
|
+
/** Compatibility fields accepted from older clients and ignored by ComfyUI. */
|
|
286
|
+
channel?: string;
|
|
287
|
+
ratio?: string;
|
|
288
|
+
quality?: string;
|
|
289
|
+
resolution?: string;
|
|
290
|
+
generationQuality?: string;
|
|
291
|
+
watermark?: StudioWatermark;
|
|
292
|
+
}
|
|
293
|
+
/** One individual generated image item in a workbench batch. */
|
|
294
|
+
export interface StudioGeneratedItem {
|
|
295
|
+
attachment: ImageAttachmentRef;
|
|
296
|
+
output: string;
|
|
297
|
+
savedTo?: string | undefined;
|
|
298
|
+
seed?: number;
|
|
299
|
+
/** ComfyUI workflow that produced this image. */
|
|
300
|
+
workflow?: string;
|
|
301
|
+
/** Timing split and provenance from the ComfyUI job. */
|
|
302
|
+
queueMs?: number;
|
|
303
|
+
execMs?: number;
|
|
304
|
+
totalMs?: number;
|
|
305
|
+
queueAhead?: number;
|
|
306
|
+
comfyVersion?: string;
|
|
307
|
+
}
|
|
308
|
+
/** One completed workbench request. */
|
|
309
|
+
export interface StudioGenerateResponse extends StudioGeneratedItem {
|
|
310
|
+
provider: StudioProvider;
|
|
311
|
+
model: string;
|
|
312
|
+
prompt: string;
|
|
313
|
+
createdAt: number;
|
|
314
|
+
elapsedMs: number;
|
|
315
|
+
items?: StudioGeneratedItem[] | undefined;
|
|
316
|
+
requestedCount?: number | undefined;
|
|
317
|
+
failedCount?: number | undefined;
|
|
318
|
+
errors?: Array<{
|
|
319
|
+
index: number;
|
|
320
|
+
message: string;
|
|
321
|
+
}> | undefined;
|
|
322
|
+
/** Compatibility field; ComfyUI runs no named channel. */
|
|
323
|
+
channel?: string;
|
|
324
|
+
}
|
|
325
|
+
/** Default endpoints and base URLs. */
|
|
326
|
+
export declare const DEFAULT_COMFYUI_BASE_URL = "http://127.0.0.1:8188";
|
|
327
|
+
export declare const DEFAULT_COMFYUI_TIMEOUT_MS = 300000;
|
|
328
|
+
export declare const DEFAULT_COMFYUI_WORKFLOW_LABEL = "API workflow";
|
|
329
|
+
export declare const MAX_COMFYUI_WORKFLOW_BYTES: number;
|
|
330
|
+
/**
|
|
331
|
+
* Local launch values are intentionally empty: the server layout differs per
|
|
332
|
+
* machine, and a prefilled path from another computer is worse than none.
|
|
333
|
+
*/
|
|
334
|
+
export declare const DEFAULT_COMFYUI_PYTHON_EXE = "";
|
|
335
|
+
export declare const DEFAULT_COMFYUI_SERVER_DIR = "";
|
|
336
|
+
export declare const DEFAULT_COMFYUI_EXTRA_ARGS = "--listen 127.0.0.1 --disable-auto-launch";
|
|
337
|
+
/** True when the endpoint points at this machine, so process controls apply. */
|
|
338
|
+
export declare function isLocalComfyUIEndpoint(baseURL: string): boolean;
|
|
339
|
+
/** Parse the optional custom request headers (JSON object of strings). */
|
|
340
|
+
export declare function parseComfyUIHeaders(value: string | undefined): Record<string, string>;
|
|
341
|
+
/**
|
|
342
|
+
* Escape double braces before text reaches a system-prompt context: AryaCode
|
|
343
|
+
* 0.2 fails a turn when it sees an unknown {{variable}}.
|
|
344
|
+
*/
|
|
345
|
+
export declare function safePromptText(value: string): string;
|
|
346
|
+
/** Resolve a ComfyUI API path against the configured base URL, keeping any subpath. */
|
|
347
|
+
export declare function comfyUIEndpointURL(baseURL: string, path: string): URL;
|
|
348
|
+
/** What a workflow is used for; auto-detected from `{{image}}` unless overridden. */
|
|
349
|
+
export type ComfyUIWorkflowRole = 'text-to-image' | 'image-to-image';
|
|
350
|
+
/** Generation parameters a workflow may expose through numeric placeholders. */
|
|
351
|
+
export interface ComfyUIGenerationParams {
|
|
352
|
+
width?: number;
|
|
353
|
+
height?: number;
|
|
354
|
+
steps?: number;
|
|
355
|
+
cfg?: number;
|
|
356
|
+
}
|
|
357
|
+
/** Which parameters one workflow exposes, plus the size it bakes when fixed. */
|
|
358
|
+
export interface ComfyUIWorkflowCapabilities {
|
|
359
|
+
role: ComfyUIWorkflowRole;
|
|
360
|
+
placeholders: {
|
|
361
|
+
width: boolean;
|
|
362
|
+
height: boolean;
|
|
363
|
+
steps: boolean;
|
|
364
|
+
cfg: boolean;
|
|
365
|
+
resolution?: boolean;
|
|
366
|
+
};
|
|
367
|
+
bakedSize?: {
|
|
368
|
+
width: number;
|
|
369
|
+
height: number;
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Canvas presets offered wherever a workflow accepts width/height.
|
|
374
|
+
*
|
|
375
|
+
* They mirror the sizes the Qwen Turbo graphs ship with, so one templated
|
|
376
|
+
* workflow replaces the square/portrait/wide trio.
|
|
377
|
+
*/
|
|
378
|
+
export declare const COMFYUI_SIZE_PRESETS: readonly {
|
|
379
|
+
id: string;
|
|
380
|
+
label: string;
|
|
381
|
+
width: number;
|
|
382
|
+
height: number;
|
|
383
|
+
}[];
|
|
384
|
+
/**
|
|
385
|
+
* Read a workflow's role, adjustable parameters and baked size from its JSON.
|
|
386
|
+
*
|
|
387
|
+
* Browser-safe and total: malformed JSON yields a text-to-image workflow with
|
|
388
|
+
* no adjustable parameters, so the settings card can describe a broken import
|
|
389
|
+
* instead of throwing while rendering.
|
|
390
|
+
*
|
|
391
|
+
* @param json - API-format workflow JSON.
|
|
392
|
+
* @returns detected capabilities.
|
|
393
|
+
*/
|
|
394
|
+
export declare function describeWorkflowJson(json: string): ComfyUIWorkflowCapabilities;
|
|
395
|
+
/** One named ComfyUI API-format workflow imported through settings. */
|
|
396
|
+
export interface ComfyUIWorkflowEntry {
|
|
397
|
+
/** Unique human-readable label; used as the result model and by tool calls. */
|
|
398
|
+
name: string;
|
|
399
|
+
/** API-format workflow JSON with {{prompt}} / {{seed}} and optional {{image}} placeholders. */
|
|
400
|
+
json: string;
|
|
401
|
+
/** Optional preset prepended to the user prompt on every call of this workflow. */
|
|
402
|
+
presetPrompt?: string;
|
|
403
|
+
/** Explicit role; omitted means it is detected from the JSON. */
|
|
404
|
+
role?: ComfyUIWorkflowRole;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* The role a workflow runs as.
|
|
408
|
+
*
|
|
409
|
+
* A workflow that declares `{{image}}` cannot run without a source image, so it
|
|
410
|
+
* is image-to-image; everything else is text-to-image. An explicit role wins,
|
|
411
|
+
* which is how a workflow can be reclassified without editing its JSON.
|
|
412
|
+
*
|
|
413
|
+
* @param entry - workflow entry.
|
|
414
|
+
* @returns the role it should appear under.
|
|
415
|
+
*/
|
|
416
|
+
export declare function resolveWorkflowRole(entry: ComfyUIWorkflowEntry): ComfyUIWorkflowRole;
|
|
417
|
+
/** Workflows belonging to one role, in import order. */
|
|
418
|
+
export declare function workflowsByRole(entries: readonly ComfyUIWorkflowEntry[], role: ComfyUIWorkflowRole): ComfyUIWorkflowEntry[];
|
|
419
|
+
/**
|
|
420
|
+
* The workflow generation or editing should use without an explicit choice.
|
|
421
|
+
*
|
|
422
|
+
* Each role has its own remembered selection. The legacy single active workflow
|
|
423
|
+
* still seeds the text-to-image slot, so existing configs keep generating.
|
|
424
|
+
*
|
|
425
|
+
* @param source - workflow settings.
|
|
426
|
+
* @param role - which role is asking.
|
|
427
|
+
* @returns the active entry for that role, or undefined.
|
|
428
|
+
*/
|
|
429
|
+
export declare function activeWorkflowForRole(source: ComfyUIWorkflowSource, role: ComfyUIWorkflowRole): ComfyUIWorkflowEntry | undefined;
|
|
430
|
+
/** One workflow as the agent sees it when choosing deliberately. */
|
|
431
|
+
export interface WorkflowCatalogEntry {
|
|
432
|
+
name: string;
|
|
433
|
+
role: ComfyUIWorkflowRole;
|
|
434
|
+
/** Which parameters a call may set. */
|
|
435
|
+
adjustable: {
|
|
436
|
+
width: boolean;
|
|
437
|
+
height: boolean;
|
|
438
|
+
steps: boolean;
|
|
439
|
+
cfg: boolean;
|
|
440
|
+
};
|
|
441
|
+
/** Size the workflow bakes when it takes no size parameters. */
|
|
442
|
+
bakedSize?: {
|
|
443
|
+
width: number;
|
|
444
|
+
height: number;
|
|
445
|
+
};
|
|
446
|
+
/** True when this is the workflow a role would pick without naming one. */
|
|
447
|
+
active: boolean;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Describe every configured workflow for the model, with which one each role
|
|
451
|
+
* would pick by default.
|
|
452
|
+
*
|
|
453
|
+
* This is what lets the agent choose a workflow on purpose instead of relying on
|
|
454
|
+
* whatever the last session left active.
|
|
455
|
+
*
|
|
456
|
+
* @param source - workflow settings.
|
|
457
|
+
* @returns one entry per workflow, in configured order.
|
|
458
|
+
*/
|
|
459
|
+
export declare function describeWorkflowCatalog(source: ComfyUIWorkflowSource): WorkflowCatalogEntry[];
|
|
460
|
+
/** Raw ComfyUI workflow fields as persisted through DSH Settings. */
|
|
461
|
+
export interface ComfyUIWorkflowSource {
|
|
462
|
+
/** Named workflows managed by the Web settings page. */
|
|
463
|
+
comfyuiWorkflows?: readonly ComfyUIWorkflowEntry[];
|
|
464
|
+
/** Name of the entry ComfyUI calls use by default. */
|
|
465
|
+
comfyuiActiveWorkflow?: string;
|
|
466
|
+
/** Active workflow for generation. */
|
|
467
|
+
comfyuiActiveTextWorkflow?: string;
|
|
468
|
+
/** Active workflow for image-to-image editing. */
|
|
469
|
+
comfyuiActiveEditWorkflow?: string;
|
|
470
|
+
/** Legacy single-workflow storage; synced to the active entry for downgrades. */
|
|
471
|
+
comfyuiWorkflowJson?: string;
|
|
472
|
+
comfyuiWorkflowName?: string;
|
|
473
|
+
}
|
|
474
|
+
/** Named workflows, falling back to the legacy single-workflow fields when the list is empty. */
|
|
475
|
+
export declare function resolveComfyUIWorkflows(source: ComfyUIWorkflowSource): ComfyUIWorkflowEntry[];
|
|
476
|
+
/** The workflow ComfyUI calls use by default: the configured active name, else the first entry. */
|
|
477
|
+
export declare function activeComfyUIWorkflow(source: ComfyUIWorkflowSource): ComfyUIWorkflowEntry | undefined;
|
|
478
|
+
/** Derive a workflow label that does not collide with the given existing names. */
|
|
479
|
+
export declare function uniqueComfyUIWorkflowName(name: string, existing: readonly string[]): string;
|
|
480
|
+
/**
|
|
481
|
+
* Combine a workflow's preset with the user prompt: preset first, user second,
|
|
482
|
+
* joined by one comma — never doubled when the preset already ends in a
|
|
483
|
+
* separator, and reduced to the non-empty side when the other is blank.
|
|
484
|
+
*/
|
|
485
|
+
export declare function mergeComfyUIPrompt(preset: string | undefined, user: string): string;
|
|
486
|
+
/** How the plugin starts this machine's ComfyUI. */
|
|
487
|
+
export declare const COMFYUI_LAUNCH_MODES: readonly ["auto", "scheduled-task", "process"];
|
|
488
|
+
export type ComfyUILaunchMode = typeof COMFYUI_LAUNCH_MODES[number];
|
|
489
|
+
/** Windows scheduled task the plugin looks for, the name the tray helper uses. */
|
|
490
|
+
export declare const DEFAULT_COMFYUI_TASK_NAME = "ComfyUI";
|
|
491
|
+
/** Local ComfyUI server lifecycle state, surfaced through the server route. */
|
|
492
|
+
export interface ComfyUIServerStatus {
|
|
493
|
+
/** Up when /system_stats answered; independent of who launched the process. */
|
|
494
|
+
up: boolean;
|
|
495
|
+
/** True when this plugin process launched (and can stop) the server. */
|
|
496
|
+
managed: boolean;
|
|
497
|
+
/** Python PIDs whose command line runs ComfyUI main.py on the configured port. */
|
|
498
|
+
pids: number[];
|
|
499
|
+
/** ComfyUI version reported by /system_stats, when up. */
|
|
500
|
+
version?: string;
|
|
501
|
+
pythonVersion?: string;
|
|
502
|
+
/** First device line, e.g. "cuda:0 (NVIDIA GeForce RTX 4090)". */
|
|
503
|
+
device?: string;
|
|
504
|
+
vramFreeBytes?: number;
|
|
505
|
+
vramTotalBytes?: number;
|
|
506
|
+
baseUrl: string;
|
|
507
|
+
/** True while a start/stop transition is in flight. */
|
|
508
|
+
busy: boolean;
|
|
509
|
+
/** Launch path the settings asked for. */
|
|
510
|
+
launchMode: ComfyUILaunchMode;
|
|
511
|
+
/** Launch path actually used for this machine (auto resolves to one of the others). */
|
|
512
|
+
effectiveLaunch: 'scheduled-task' | 'process' | 'external';
|
|
513
|
+
/** Scheduled task name the plugin looks for. */
|
|
514
|
+
taskName: string;
|
|
515
|
+
/** State the Task Scheduler reports, when the task exists. */
|
|
516
|
+
taskState?: string;
|
|
517
|
+
/** Why the launch path resolved the way it did, for the card to show. */
|
|
518
|
+
launchHint: string;
|
|
519
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Same-origin HTTP bridge used by the browser image workbench. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import { type StudioConfigResponse, type StudioGenerateRequest, type StudioGenerateResponse } from './shared.js';
|
|
4
|
+
export interface StudioRouteDeps {
|
|
5
|
+
describe(): Promise<StudioConfigResponse>;
|
|
6
|
+
generate(input: StudioGenerateRequest, signal: AbortSignal): Promise<StudioGenerateResponse>;
|
|
7
|
+
maxBodyBytes: number;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
/** Heartbeat cadence for the streaming generation response; tests shrink it. */
|
|
10
|
+
heartbeatMs?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Serve workbench capabilities and generation requests without exposing endpoints. */
|
|
13
|
+
export declare function serveStudio(req: IncomingMessage, res: ServerResponse, deps: StudioRouteDeps): Promise<void>;
|
|
14
|
+
/** Strictly validate the small untrusted workbench wire contract. */
|
|
15
|
+
export declare function parseStudioGenerateRequest(value: unknown): StudioGenerateRequest;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { type Config } from './config.js';
|
|
3
|
+
import { type StudioConfigResponse, type StudioGenerateRequest, type StudioGenerateResponse } from './shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* ComfyUI has no ratio/quality matrix: each imported workflow defines its own
|
|
6
|
+
* canvas size, so one profile per workflow populates the model picker and the
|
|
7
|
+
* ratio/quality pickers stay empty (the client hides those selects).
|
|
8
|
+
*/
|
|
9
|
+
export declare function describeStudio(config: Config): StudioConfigResponse;
|
|
10
|
+
/** Execute one validated browser workbench request against a ComfyUI workflow. */
|
|
11
|
+
export declare function generateFromStudio(ctx: Context, config: Config, input: StudioGenerateRequest, signal: AbortSignal, fallbackWorkspaceRoot?: string | undefined): Promise<StudioGenerateResponse>;
|
|
12
|
+
export declare function runPool<T>(tasks: Array<() => Promise<T>>, concurrency?: number): Promise<PromiseSettledResult<T>[]>;
|
|
13
|
+
export declare const STUDIO_TIMEOUT_MS = 300000;
|
|
14
|
+
export declare const STUDIO_PROVIDER_LABEL: string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-flight the configured workflows against a running ComfyUI.
|
|
3
|
+
*
|
|
4
|
+
* This mirrors what ComfyUI's own `validate_workflow` does for a concrete graph,
|
|
5
|
+
* but for *templated* workflows: it checks the classes and the loader file names,
|
|
6
|
+
* which are the two things that survive placeholder substitution unchanged. Type
|
|
7
|
+
* checking a `{{width}}` string would only ever report the placeholder.
|
|
8
|
+
*
|
|
9
|
+
* @module @aryacode/dsh-arya-image-gen/validate-workflows
|
|
10
|
+
*/
|
|
11
|
+
import type { ComfyUIWorkflowEntry } from './shared.js';
|
|
12
|
+
/** Result for one configured workflow. */
|
|
13
|
+
export interface WorkflowCheck {
|
|
14
|
+
name: string;
|
|
15
|
+
role: 'text-to-image' | 'image-to-image';
|
|
16
|
+
ok: boolean;
|
|
17
|
+
/** Node classes the running ComfyUI does not know. */
|
|
18
|
+
missingClasses: string[];
|
|
19
|
+
/** Loader file names the running ComfyUI cannot offer. */
|
|
20
|
+
missingModels: string[];
|
|
21
|
+
/** Set when the workflow JSON itself could not be read. */
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
/** The object_info shape this module relies on. */
|
|
25
|
+
type ObjectInfo = Record<string, {
|
|
26
|
+
input?: {
|
|
27
|
+
required?: Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Check every workflow against one ComfyUI `/object_info` payload.
|
|
32
|
+
*
|
|
33
|
+
* @param entries - configured workflows.
|
|
34
|
+
* @param info - the server's object_info map.
|
|
35
|
+
* @returns one result per workflow, in input order.
|
|
36
|
+
*/
|
|
37
|
+
export declare function checkWorkflows(entries: readonly ComfyUIWorkflowEntry[], info: ObjectInfo): WorkflowCheck[];
|
|
38
|
+
/**
|
|
39
|
+
* Fetch the live object_info and check the configured workflows.
|
|
40
|
+
*
|
|
41
|
+
* @param entries - configured workflows.
|
|
42
|
+
* @param baseURL - ComfyUI endpoint.
|
|
43
|
+
* @param headers - extra request headers.
|
|
44
|
+
* @param signal - cancellation.
|
|
45
|
+
* @returns one result per workflow.
|
|
46
|
+
*/
|
|
47
|
+
export declare function checkWorkflowsAgainstInstall(entries: readonly ComfyUIWorkflowEntry[], baseURL: string, headers: Record<string, string>, signal?: AbortSignal): Promise<WorkflowCheck[]>;
|
|
48
|
+
export {};
|