@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,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH image-gen brand skin for the tldraw surface.
|
|
3
|
+
*
|
|
4
|
+
* Injected AFTER the bundled tldraw styles (tl-css.ts): it only re-declares
|
|
5
|
+
* tldraw's own CSS variables and restyles tldraw's own chrome classes, scoped
|
|
6
|
+
* to our canvas container, so upgrading tldraw never requires edits here. This
|
|
7
|
+
* layer owns the UI chrome (panels, toolbars, hover/active feedback, grid
|
|
8
|
+
* dots); colors painted onto the canvas itself (shape palette, selection
|
|
9
|
+
* handles, marquee) come from the runtime theme patch in tl-brand-theme.ts.
|
|
10
|
+
* Dark chrome keeps stock tldraw colors: the plugin lives in DSH's light shell.
|
|
11
|
+
*
|
|
12
|
+
* Beyond re-tinting, this pass reshapes tldraw's signature chrome so the
|
|
13
|
+
* surface no longer reads as "stock tldraw": the grey corner strips (top-left
|
|
14
|
+
* menu zone, bottom-left navigation) become floating white cards with hairline
|
|
15
|
+
* borders, matching the workbench card language.
|
|
16
|
+
*/
|
|
17
|
+
export declare const TL_THEME_CSS = "\n/* DSH image-gen skin for the tldraw surface (light chrome only). */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light {\n\t/* Canvas surface: a clearly cool blue-grey board, distinguishable from the\n\t pure-white floating cards at a glance. Same token feeds the runtime\n\t theme patch (CANVAS_BG in tl-brand-theme.ts). */\n\t--tl-color-background: #e6ebf5;\n\t--tl-color-grid: rgba(88, 110, 158, 0.5);\n\n\t/* Brand accents: selection outlines, active tool, chips, focus rings. */\n\t--tl-color-selected: #2f64f5;\n\t--tl-color-primary: #2f64f5;\n\t--tl-color-focus: #2f64f5;\n\t--tl-color-selection-stroke: #2f64f5;\n\t--tl-color-selection-fill: rgba(47, 100, 245, 0.14);\n\n\t/* Interaction feedback: hover chips and active-tool highlight are tinted\n\t brand blue instead of tldraw's neutral grey-black. */\n\t--tl-color-hint: rgba(47, 100, 245, 0.14);\n\t--tl-color-muted-1: rgba(47, 100, 245, 0.14);\n\t--tl-color-muted-2: rgba(47, 100, 245, 0.07);\n\n\t/* Chrome: panels, borders, and text aligned with the workbench tokens. */\n\t--tl-color-panel: #ffffff;\n\t--tl-color-panel-contrast: #ffffff;\n\t--tl-color-low: #ffffff;\n\t--tl-color-low-border: #d9e2f2;\n\t--tl-color-divider: #dfe6f3;\n\t--tl-color-text: #182033;\n\t--tl-color-text-0: #182033;\n\t--tl-color-text-1: #242f44;\n\t--tl-color-text-3: #6b7690;\n\n\t/* Shadows: the workbench's cold blue-grey instead of tldraw's black. */\n\t--tl-shadow-1: 0px 1px 2px rgba(30, 42, 76, 0.24), 0px 1px 3px rgba(30, 42, 76, 0.08);\n\t--tl-shadow-2:\n\t\t0px 0px 2px rgba(30, 42, 76, 0.14), 0px 2px 3px rgba(30, 42, 76, 0.2),\n\t\t0px 2px 6px rgba(30, 42, 76, 0.08), inset 0px 0px 0px 1px var(--tl-color-panel-contrast);\n\t--tl-shadow-3:\n\t\t0px 1px 2px rgba(30, 42, 76, 0.24), 0px 2px 6px rgba(30, 42, 76, 0.12),\n\t\tinset 0px 0px 0px 1px var(--tl-color-panel-contrast);\n\t--tl-shadow-4:\n\t\t0px 0px 3px rgba(30, 42, 76, 0.16), 0px 5px 4px rgba(30, 42, 76, 0.13),\n\t\t0px 2px 16px rgba(30, 42, 76, 0.05), inset 0px 0px 0px 1px var(--tl-color-panel-contrast);\n\n\t/* Noticeably rounder chrome than tldraw's stock 4/6/9/11px. */\n\t--tl-radius-1: 6px;\n\t--tl-radius-2: 10px;\n\t--tl-radius-3: 13px;\n\t--tl-radius-4: 16px;\n}\n\n/* ---------------------------------------------------------------\n * De-tldraw pass: reshape tldraw's signature corner strips and\n * floating chrome into the workbench's card language.\n * ------------------------------------------------------------- */\n\n/* Canvas backdrop: subtle vertical gradient (light at top, a touch deeper at\n the bottom) for an airy, lit-from-above feel. Painted on the UI background\n layer ONLY \u2014 --tl-color-background stays a flat color because tldraw reuses\n it for export backgrounds and edge highlight lines, which must stay clean. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tl-background {\n\tbackground-image: linear-gradient(180deg, #eef2fa 0%, #e6ebf5 60%, #dfe6f4 100%);\n}\n\n/* Top-left menu strip -> floating white card (Page menu + quick actions). */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-menu-zone {\n\tmargin: 10px;\n\tbackground-color: #ffffff;\n\tborder: 1px solid #d9e2f2;\n\tborder-radius: 12px;\n\tbox-shadow: 0px 1px 2px rgba(30, 42, 76, 0.06), 0px 4px 12px rgba(30, 42, 76, 0.08);\n}\n\n/* Bottom-left navigation strip -> floating white card (zoom, pages, minimap).\n Offsets detach it from the screen corner; the ::before paints the card. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-navigation-panel {\n\tleft: 12px;\n\tbottom: 12px;\n}\n.dsh-ig-tl-canvas .tl-container.tl-theme__light[dir='rtl'] .tlui-navigation-panel {\n\tleft: auto;\n\tright: 12px;\n}\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-navigation-panel::before {\n\tinset: -6px -6px -6px -6px;\n\tbackground-color: #ffffff;\n\tborder: 1px solid #d9e2f2;\n\tborder-radius: 12px;\n\tbox-shadow: 0px 1px 2px rgba(30, 42, 76, 0.06), 0px 4px 12px rgba(30, 42, 76, 0.08);\n}\n\n/* Bottom toolbar pill -> bordered card so it matches the other cards. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-main-toolbar__tools {\n\tborder: 1px solid #d9e2f2;\n}\n\n/* Vertical left rail (Figma-style, set via components.Toolbar): float it off\n the screen edge like the other cards. Stock offsets (top 90px / bottom\n 140px) already clear the top-left menu card and bottom-left minimap card. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-main-toolbar--vertical {\n\tleft: 12px;\n\tpadding-left: 0;\n}\n\n/* Compact rail buttons (40px instead of stock 48px) for an app-like density\n that differs from tldraw's chunky mobile-sized chrome. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-main-toolbar--vertical .tlui-button__tool {\n\twidth: 40px;\n\theight: 40px;\n}\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-main-toolbar--vertical .tlui-button__tool::after {\n\tinset: 3px;\n\tborder-radius: 9px;\n}\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-main-toolbar--vertical .tlui-main-toolbar__extras {\n\twidth: 40px;\n}\n\n/* Right style panel -> bordered card. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-style-panel__wrapper {\n\tborder: 1px solid #d9e2f2;\n}\n\n/* Dropdown menus and popovers -> hairline border for definition. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-menu,\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-popover__content {\n\tborder: 1px solid #d9e2f2;\n}\n\n/* Active menu chips (e.g. style panel selections): brand tint instead of grey. */\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-button[data-isactive='true'] {\n\tcolor: #2f64f5;\n}\n.dsh-ig-tl-canvas .tl-container.tl-theme__light .tlui-button[data-isactive='true']::after {\n\tbackground: rgba(47, 100, 245, 0.14);\n}\n";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live ComfyUI job telemetry: a per-job WebSocket subscription to ComfyUI's
|
|
3
|
+
* /ws endpoint, reduced to a small snapshot the workbench can poll, plus the
|
|
4
|
+
* latest latent preview frame and cancellation.
|
|
5
|
+
*
|
|
6
|
+
* Progress is strictly best-effort: an unreachable socket, an old server, or a
|
|
7
|
+
* proxy that rejects the upgrade must never fail the generation itself.
|
|
8
|
+
*/
|
|
9
|
+
export type ComfyUIJobPhase = 'queued' | 'running' | 'done' | 'error' | 'cancelled';
|
|
10
|
+
export interface ComfyUIJobSnapshot {
|
|
11
|
+
jobId: string;
|
|
12
|
+
promptId?: string | undefined;
|
|
13
|
+
phase: ComfyUIJobPhase;
|
|
14
|
+
queueRemaining?: number | undefined;
|
|
15
|
+
nodeId?: string | undefined;
|
|
16
|
+
nodeLabel?: string | undefined;
|
|
17
|
+
/** Step progress of the executing node (0 when unknown). */
|
|
18
|
+
value: number;
|
|
19
|
+
max: number;
|
|
20
|
+
elapsedMs: number;
|
|
21
|
+
queueAhead?: number;
|
|
22
|
+
startedAt: number;
|
|
23
|
+
finishedAt?: number | undefined;
|
|
24
|
+
error?: string | undefined;
|
|
25
|
+
previewVersion: number;
|
|
26
|
+
/** Whether the live WebSocket is connected; false means timing-only. */
|
|
27
|
+
live: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface ComfyUIPreview {
|
|
30
|
+
data: Uint8Array;
|
|
31
|
+
version: number;
|
|
32
|
+
}
|
|
33
|
+
/** Structural WebSocket face; Node's global WebSocket satisfies it. */
|
|
34
|
+
interface SocketLike {
|
|
35
|
+
readyState: number;
|
|
36
|
+
onopen: (() => void) | null;
|
|
37
|
+
onmessage: ((event: {
|
|
38
|
+
data: unknown;
|
|
39
|
+
}) => void) | null;
|
|
40
|
+
onerror: ((event: unknown) => void) | null;
|
|
41
|
+
onclose: (() => void) | null;
|
|
42
|
+
close(): void;
|
|
43
|
+
}
|
|
44
|
+
type SocketFactory = (url: string) => SocketLike;
|
|
45
|
+
export declare class ComfyUIProgressRegistry {
|
|
46
|
+
private readonly jobs;
|
|
47
|
+
private readonly now;
|
|
48
|
+
private readonly socketFactory;
|
|
49
|
+
constructor(options?: {
|
|
50
|
+
now?: () => number;
|
|
51
|
+
socketFactory?: SocketFactory;
|
|
52
|
+
});
|
|
53
|
+
/** Start or refresh one job. Returns undefined for an unusable job id. */
|
|
54
|
+
ensure(jobId: string, options: {
|
|
55
|
+
baseURL: string;
|
|
56
|
+
headers?: Record<string, string>;
|
|
57
|
+
workflowJson?: string;
|
|
58
|
+
queueAhead?: number;
|
|
59
|
+
}): ComfyUIJobSnapshot | undefined;
|
|
60
|
+
/** Mark the job terminal; the snapshot stays readable briefly for late polls. */
|
|
61
|
+
finish(jobId: string, phase?: 'done' | 'error' | 'cancelled', error?: string): void;
|
|
62
|
+
setQueueAhead(jobId: string, queueAhead: number): void;
|
|
63
|
+
snapshot(jobId: string): ComfyUIJobSnapshot | undefined;
|
|
64
|
+
subscribe(jobId: string, listener: () => void): () => void;
|
|
65
|
+
preview(jobId: string): ComfyUIPreview | undefined;
|
|
66
|
+
/** Remove a queued/running prompt, then mark the job cancelled. */
|
|
67
|
+
cancel(jobId: string): Promise<ComfyUIJobSnapshot | undefined>;
|
|
68
|
+
private connect;
|
|
69
|
+
private onMessage;
|
|
70
|
+
private onEvent;
|
|
71
|
+
private notify;
|
|
72
|
+
private closeSocket;
|
|
73
|
+
private webSocketURL;
|
|
74
|
+
private post;
|
|
75
|
+
}
|
|
76
|
+
/** Process-wide registry shared by the Studio route and the progress route. */
|
|
77
|
+
export declare const comfyProgress: ComfyUIProgressRegistry;
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Same-origin route that probes, starts, stops, and restarts the local ComfyUI server. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import type { ComfyUIServerStatus } from './shared.js';
|
|
4
|
+
export interface ComfyUIServerRouteDeps {
|
|
5
|
+
status(): Promise<ComfyUIServerStatus>;
|
|
6
|
+
start(): Promise<ComfyUIServerStatus>;
|
|
7
|
+
stop(): Promise<ComfyUIServerStatus>;
|
|
8
|
+
restart(): Promise<ComfyUIServerStatus>;
|
|
9
|
+
}
|
|
10
|
+
export declare function serveComfyUIServer(req: IncomingMessage, res: ServerResponse, deps: ComfyUIServerRouteDeps): Promise<void>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type ComfyUILaunchMode, type ComfyUIServerStatus } from './shared.js';
|
|
2
|
+
export interface ComfyUIServerConfig {
|
|
3
|
+
baseURL: string;
|
|
4
|
+
pythonExe: string;
|
|
5
|
+
serverDir: string;
|
|
6
|
+
extraArgs: string;
|
|
7
|
+
headers: Record<string, string>;
|
|
8
|
+
launchMode: ComfyUILaunchMode;
|
|
9
|
+
taskName: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function comfyUIServerConfigOf(config: {
|
|
12
|
+
comfyuiBaseURL?: string;
|
|
13
|
+
comfyuiPythonExe?: string;
|
|
14
|
+
comfyuiServerDir?: string;
|
|
15
|
+
comfyuiExtraArgs?: string;
|
|
16
|
+
comfyuiHeadersJson?: string;
|
|
17
|
+
comfyuiLaunchMode?: string;
|
|
18
|
+
comfyuiScheduledTaskName?: string;
|
|
19
|
+
}): ComfyUIServerConfig;
|
|
20
|
+
export declare class ComfyUIServerManager {
|
|
21
|
+
private deps;
|
|
22
|
+
private warn;
|
|
23
|
+
private childPid;
|
|
24
|
+
private busy;
|
|
25
|
+
private readonly logDir;
|
|
26
|
+
constructor(deps: () => ComfyUIServerConfig, warn: (message: string) => void);
|
|
27
|
+
private portOf;
|
|
28
|
+
start(): Promise<ComfyUIServerStatus>;
|
|
29
|
+
stop(): Promise<ComfyUIServerStatus>;
|
|
30
|
+
restart(): Promise<ComfyUIServerStatus>;
|
|
31
|
+
status(): Promise<ComfyUIServerStatus>;
|
|
32
|
+
/** Poll /system_stats until the server answers, or fail with the log tail. */
|
|
33
|
+
private waitUntilUp;
|
|
34
|
+
/** Wait (bounded) for the scheduled task to stop reporting Running. */
|
|
35
|
+
private waitForTaskIdle;
|
|
36
|
+
/**
|
|
37
|
+
* Kill ComfyUI processes that hold the port without answering.
|
|
38
|
+
*
|
|
39
|
+
* Called only after the probe said the server is down, so anything matching
|
|
40
|
+
* is a leftover of a killed launcher: it would block the next instance's bind
|
|
41
|
+
* and turn a clean start into a timeout.
|
|
42
|
+
*/
|
|
43
|
+
private clearStaleProcesses;
|
|
44
|
+
/**
|
|
45
|
+
* Decide how Start and Stop should reach this machine's ComfyUI.
|
|
46
|
+
*
|
|
47
|
+
* With `auto`, a scheduled task by the configured name wins (that is how a
|
|
48
|
+
* tray/service install starts it), then the process path. `scheduled-task`
|
|
49
|
+
* and `process` force one. State is read on every call so the card can show
|
|
50
|
+
* "via scheduled task ComfyUI (Ready)" without the user configuring a script.
|
|
51
|
+
*/
|
|
52
|
+
private launchPlan;
|
|
53
|
+
private assertNotBusy;
|
|
54
|
+
private readLogTail;
|
|
55
|
+
/** GET /system_stats: the ground truth for "is ComfyUI answering". */
|
|
56
|
+
private probe;
|
|
57
|
+
/** Python processes whose command line runs ComfyUI main.py on this port.
|
|
58
|
+
* The command-line match is deliberate: it never returns the Tailscale
|
|
59
|
+
* daemon that also holds the port, matching comfyui.ps1's Get-ComfyProcess. */
|
|
60
|
+
private findComfyPids;
|
|
61
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/** Pure ComfyUI API-workflow validation and placeholder injection. */
|
|
2
|
+
import { type ComfyUIWorkflowCapabilities, type ComfyUIGenerationParams } from './shared.js';
|
|
3
|
+
export declare const COMFYUI_PROMPT_PLACEHOLDER = "{{prompt}}";
|
|
4
|
+
export declare const COMFYUI_SEED_PLACEHOLDER = "{{seed}}";
|
|
5
|
+
export declare const COMFYUI_IMAGE_PLACEHOLDER = "{{image}}";
|
|
6
|
+
/**
|
|
7
|
+
* Dynamic reference list: a link whose node id is this token expands into one
|
|
8
|
+
* LoadImage node per supplied reference, in order.
|
|
9
|
+
*
|
|
10
|
+
* Declared as `"images.image_1": ["{{images}}", 0]`, it lets one workflow take
|
|
11
|
+
* as many references as a call supplies (up to the encoder's slot count)
|
|
12
|
+
* instead of hard-coding a slot per photo.
|
|
13
|
+
*/
|
|
14
|
+
export declare const COMFYUI_IMAGES_PLACEHOLDER = "{{images}}";
|
|
15
|
+
/** Slots this plugin will fill for one call; ComfyUI's Qwen encoder tops out here. */
|
|
16
|
+
export declare const MAX_COMFYUI_REFERENCE_IMAGES = 16;
|
|
17
|
+
export declare const COMFYUI_WIDTH_PLACEHOLDER = "{{width}}";
|
|
18
|
+
export declare const COMFYUI_HEIGHT_PLACEHOLDER = "{{height}}";
|
|
19
|
+
export declare const COMFYUI_STEPS_PLACEHOLDER = "{{steps}}";
|
|
20
|
+
export declare const COMFYUI_CFG_PLACEHOLDER = "{{cfg}}";
|
|
21
|
+
/** Canvas edge used when a workflow declares width/height but a call omits them. */
|
|
22
|
+
export declare const DEFAULT_CANVAS_SIDE = 1024;
|
|
23
|
+
/**
|
|
24
|
+
* Derived placeholder: the canvas' long side, rounded to the 32-pixel step
|
|
25
|
+
* Qwen-Image conditioning expects.
|
|
26
|
+
*
|
|
27
|
+
* Qwen Image 2.1 conditions the text encoder on a `resolution` value; leaving it
|
|
28
|
+
* at its 1024 default while rendering 1344x768 tells the model the wrong canvas,
|
|
29
|
+
* which shows up as weaker composition at non-square sizes. It is derived from
|
|
30
|
+
* width/height rather than passed by the caller, so a call cannot set it wrong.
|
|
31
|
+
*/
|
|
32
|
+
export declare const COMFYUI_RESOLUTION_PLACEHOLDER = "{{resolution}}";
|
|
33
|
+
type JsonRecord = Record<string, unknown>;
|
|
34
|
+
/** Options accepted by the placeholder injector. */
|
|
35
|
+
export interface PrepareWorkflowOptions extends ComfyUIGenerationParams {
|
|
36
|
+
prompt: string;
|
|
37
|
+
seed?: number;
|
|
38
|
+
image?: string;
|
|
39
|
+
/** Ordered reference image names for a workflow that declares `{{images}}`. */
|
|
40
|
+
images?: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** Validate imported JSON without exposing workflow graph details to callers. */
|
|
43
|
+
export declare function validateComfyUIWorkflowJson(workflowJson: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Read what a workflow can do: its role, which parameters it exposes, and the
|
|
46
|
+
* size it bakes when it has no size placeholders.
|
|
47
|
+
*
|
|
48
|
+
* @param workflowJson - API-format workflow JSON.
|
|
49
|
+
* @returns detected capabilities.
|
|
50
|
+
*/
|
|
51
|
+
export declare function detectWorkflowCapabilities(workflowJson: string): ComfyUIWorkflowCapabilities;
|
|
52
|
+
/**
|
|
53
|
+
* Parse, clone, and inject the prompt plus whatever generation parameters the
|
|
54
|
+
* caller supplied.
|
|
55
|
+
*
|
|
56
|
+
* Two call shapes are accepted: the object form used by new code, and the
|
|
57
|
+
* historical positional form `(json, prompt, seed?, image?)` still used by
|
|
58
|
+
* older call sites and tests.
|
|
59
|
+
*
|
|
60
|
+
* Prompt and seed placeholders are replaced inside any string so existing
|
|
61
|
+
* workflows that embed them in longer text keep working. Numeric placeholders
|
|
62
|
+
* are stricter: they must be the whole value of a field, so the result stays
|
|
63
|
+
* valid JSON with real numbers. The image placeholder is stricter still: it
|
|
64
|
+
* only matches a dedicated `inputs.image` field whose value is exactly the
|
|
65
|
+
* placeholder, and at most one may exist.
|
|
66
|
+
*
|
|
67
|
+
* @param workflowJson - API-format workflow JSON.
|
|
68
|
+
* @param optionsOrPrompt - parameter object, or the prompt string in the legacy form.
|
|
69
|
+
* @param legacySeed - seed for the legacy form.
|
|
70
|
+
* @param legacyImage - image name for the legacy form.
|
|
71
|
+
* @returns a prepared workflow ready to POST to ComfyUI.
|
|
72
|
+
*/
|
|
73
|
+
export declare function prepareComfyUIWorkflow(workflowJson: string, optionsOrPrompt: PrepareWorkflowOptions | string, legacySeed?: number, legacyImage?: string): JsonRecord;
|
|
74
|
+
/** Random seed in the 32-bit range ComfyUI samplers accept. */
|
|
75
|
+
export declare function randomSeed(): number;
|
|
76
|
+
/** True when the workflow JSON declares an image input, so it can run edits. */
|
|
77
|
+
export declare function hasComfyUIImagePlaceholder(workflowJson: string): boolean;
|
|
78
|
+
/** True when the workflow takes a variable number of references. */
|
|
79
|
+
export declare function hasDynamicImagePlaceholder(workflowJson: string): boolean;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** ComfyUI text-to-image and image-to-image adapters using an imported API-format workflow. */
|
|
2
|
+
import type { ImageMediaType } from '@deepseek-ai/dsh-attachment';
|
|
3
|
+
import type { ComfyUIGenerationParams } from './shared.js';
|
|
4
|
+
export interface ComfyUIJobTimings {
|
|
5
|
+
/** Jobs already queued ahead of this one when it was submitted. */
|
|
6
|
+
queueAhead: number;
|
|
7
|
+
/** Wall time from submission until the job started executing. */
|
|
8
|
+
queueMs: number;
|
|
9
|
+
/** Wall time the job spent executing before its output was history-visible. */
|
|
10
|
+
execMs: number;
|
|
11
|
+
/** Submission to completion, including upload and download. */
|
|
12
|
+
totalMs: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GeneratedComfyUIImage {
|
|
15
|
+
data: Uint8Array;
|
|
16
|
+
mediaType: ImageMediaType;
|
|
17
|
+
/** Concrete seed injected into the workflow, surfaced for provenance metadata. */
|
|
18
|
+
seed: number;
|
|
19
|
+
timings: ComfyUIJobTimings;
|
|
20
|
+
comfyVersion?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Source image bytes a ComfyUI workflow accepts through its image input. */
|
|
23
|
+
export interface ComfyUISourceImage {
|
|
24
|
+
data: Uint8Array;
|
|
25
|
+
mediaType: ImageMediaType;
|
|
26
|
+
}
|
|
27
|
+
interface ComfyUIJobInput {
|
|
28
|
+
baseURL: string;
|
|
29
|
+
timeoutMs: number;
|
|
30
|
+
signal: AbortSignal;
|
|
31
|
+
/** Extra request headers, e.g. a reverse-proxy Authorization token. */
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
/** ComfyUI client id; the /ws progress socket must use the same value. */
|
|
34
|
+
clientId?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Run one ComfyUI text-to-image workflow and return its first final image. */
|
|
37
|
+
export declare function generateComfyUIImage(input: ComfyUIJobInput & ComfyUIGenerationParams & {
|
|
38
|
+
workflowJson: string;
|
|
39
|
+
prompt: string;
|
|
40
|
+
maxBytes: number;
|
|
41
|
+
}): Promise<GeneratedComfyUIImage>;
|
|
42
|
+
/** Upload the source image(s), run the workflow, and return its first final image. */
|
|
43
|
+
export declare function editComfyUIImage(input: ComfyUIJobInput & ComfyUIGenerationParams & {
|
|
44
|
+
workflowJson: string;
|
|
45
|
+
prompt: string;
|
|
46
|
+
/** Single reference; kept for callers that pass one image. */
|
|
47
|
+
sourceImage?: ComfyUISourceImage;
|
|
48
|
+
/** Ordered references for a workflow that declares `{{images}}`. */
|
|
49
|
+
sourceImages?: readonly ComfyUISourceImage[];
|
|
50
|
+
maxBytes: number;
|
|
51
|
+
}): Promise<GeneratedComfyUIImage>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** User-facing configuration for the local ComfyUI image provider. */
|
|
2
|
+
import z from '@deepseek-ai/schemastery';
|
|
3
|
+
import { DEFAULT_COMFYUI_BASE_URL, DEFAULT_COMFYUI_EXTRA_ARGS, DEFAULT_COMFYUI_PYTHON_EXE, DEFAULT_COMFYUI_SERVER_DIR, DEFAULT_COMFYUI_TIMEOUT_MS, DEFAULT_COMFYUI_WORKFLOW_LABEL, IMAGE_PROVIDERS, activeComfyUIWorkflow, resolveComfyUIWorkflows, type ComfyUIWorkflowEntry, type ComfyUIWorkflowRole, type ImageProvider } from './shared.js';
|
|
4
|
+
export { DEFAULT_COMFYUI_BASE_URL, DEFAULT_COMFYUI_EXTRA_ARGS, DEFAULT_COMFYUI_PYTHON_EXE, DEFAULT_COMFYUI_SERVER_DIR, DEFAULT_COMFYUI_TIMEOUT_MS, DEFAULT_COMFYUI_WORKFLOW_LABEL, IMAGE_PROVIDERS, activeComfyUIWorkflow, resolveComfyUIWorkflows, type ComfyUIWorkflowEntry, type ImageProvider, };
|
|
5
|
+
/** Default workspace subfolder that receives generated image files. */
|
|
6
|
+
export declare const DEFAULT_WORKSPACE_FOLDER = "dsh-arya-image-gen";
|
|
7
|
+
/** Bundle configuration from the profile patch and the Web settings page. */
|
|
8
|
+
export interface Config {
|
|
9
|
+
/** Legacy persisted provider; this fork only understands "comfyui". */
|
|
10
|
+
provider?: ImageProvider;
|
|
11
|
+
comfyuiBaseURL?: string;
|
|
12
|
+
/** Named ComfyUI workflows managed by the Web settings page. */
|
|
13
|
+
comfyuiWorkflows?: ComfyUIWorkflowEntry[];
|
|
14
|
+
/** Name of the workflow ComfyUI calls use by default. */
|
|
15
|
+
comfyuiActiveWorkflow?: string;
|
|
16
|
+
/** Active workflow for text-to-image generation. */
|
|
17
|
+
comfyuiActiveTextWorkflow?: string;
|
|
18
|
+
/** Active workflow for image-to-image editing. */
|
|
19
|
+
comfyuiActiveEditWorkflow?: string;
|
|
20
|
+
/** Legacy single-workflow storage; synced to the active entry for downgrades. */
|
|
21
|
+
comfyuiWorkflowJson?: string;
|
|
22
|
+
/** Original imported file name of the legacy single workflow. */
|
|
23
|
+
comfyuiWorkflowName?: string;
|
|
24
|
+
comfyuiTimeoutMs?: number;
|
|
25
|
+
/** Optional request headers as a JSON object, e.g. a reverse-proxy Authorization token. */
|
|
26
|
+
comfyuiHeadersJson?: string;
|
|
27
|
+
/** Python interpreter used by the built-in ComfyUI server launcher. */
|
|
28
|
+
comfyuiPythonExe?: string;
|
|
29
|
+
/** ComfyUI checkout directory the server is launched from (main.py lives here). */
|
|
30
|
+
comfyuiServerDir?: string;
|
|
31
|
+
/** Extra main.py arguments appended on launch, e.g. "--listen 127.0.0.1 --disable-auto-launch". */
|
|
32
|
+
comfyuiExtraArgs?: string;
|
|
33
|
+
/** Launch the ComfyUI server automatically when the plugin boots and it is down. */
|
|
34
|
+
comfyuiAutoStart?: boolean;
|
|
35
|
+
/** How Start/Stop reach this machine's ComfyUI. */
|
|
36
|
+
comfyuiLaunchMode?: 'auto' | 'scheduled-task' | 'process';
|
|
37
|
+
/** Task Scheduler task the plugin runs and ends when using the scheduled-task launch. */
|
|
38
|
+
comfyuiScheduledTaskName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Register the Arya Image agent preset: the full DSH standard tool row set plus
|
|
41
|
+
* this plugin's image tools; tools from other installed bundles stay out of it.
|
|
42
|
+
*/
|
|
43
|
+
agentPreset?: boolean;
|
|
44
|
+
/** Also write every generated image as a file under the session workspace. */
|
|
45
|
+
saveToWorkspace?: boolean;
|
|
46
|
+
/** Workspace subfolder for generated images; empty means the workspace root. */
|
|
47
|
+
workspaceFolder?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Cordis configuration schema. Volatile marking happens per field (see
|
|
51
|
+
* `volatile`); the `z<Config>` annotation keeps the plain output type for the
|
|
52
|
+
* rest of the codebase because the wrapping is unwrapped at the entry.
|
|
53
|
+
*/
|
|
54
|
+
/** Workflows a fresh configuration starts with: the shipped pack. */
|
|
55
|
+
export declare const DEFAULT_WORKFLOWS: {
|
|
56
|
+
name: string;
|
|
57
|
+
json: string;
|
|
58
|
+
}[];
|
|
59
|
+
export declare const Config: z<Config>;
|
|
60
|
+
/** Resolve the single (ComfyUI) provider profile for a tool call. */ export declare function resolveProvider(config: Config): {
|
|
61
|
+
provider: 'comfyui';
|
|
62
|
+
baseURL: string;
|
|
63
|
+
headers: Record<string, string>;
|
|
64
|
+
workflows: ComfyUIWorkflowEntry[];
|
|
65
|
+
workflow?: ComfyUIWorkflowEntry;
|
|
66
|
+
timeoutMs: number;
|
|
67
|
+
};
|
|
68
|
+
/** The workflow a ComfyUI call runs: the requested name when given, else the active one. */
|
|
69
|
+
export declare function selectComfyUIWorkflow(active: {
|
|
70
|
+
workflows: ComfyUIWorkflowEntry[];
|
|
71
|
+
workflow?: ComfyUIWorkflowEntry;
|
|
72
|
+
}, requested?: string): ComfyUIWorkflowEntry;
|
|
73
|
+
/**
|
|
74
|
+
* Pick the workflow a call runs, honouring the role it needs.
|
|
75
|
+
*
|
|
76
|
+
* Generation resolves the active text-to-image workflow and editing resolves
|
|
77
|
+
* the active image-to-image one, so a caller never has to know which graph is
|
|
78
|
+
* which. Naming a workflow explicitly still works, but naming one from the
|
|
79
|
+
* other role fails with the name of the workflow that would have worked.
|
|
80
|
+
*
|
|
81
|
+
* @param config - current plugin configuration.
|
|
82
|
+
* @param role - role the call needs.
|
|
83
|
+
* @param requested - optional workflow name from the tool arguments.
|
|
84
|
+
* @returns the workflow to run.
|
|
85
|
+
*/
|
|
86
|
+
export declare function selectWorkflowForRole(config: Config, role: ComfyUIWorkflowRole, requested?: string): ComfyUIWorkflowEntry;
|
|
87
|
+
/** Parse the space-separated extra main.py arguments; quotes keep grouped values together. */ export declare function parseComfyUIExtraArgs(value: string | undefined): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** One line describing why a provider fetch failed: the abort reason when the caller cancelled, the cause chain otherwise. */
|
|
2
|
+
export declare function describeTransportFailure(error: unknown, signal?: AbortSignal): string;
|
|
3
|
+
/**
|
|
4
|
+
* Await one provider fetch and rethrow transport failures as
|
|
5
|
+
* `${label} failed after 12.3s: ${cause chain}`. The original error stays
|
|
6
|
+
* reachable on `cause` for host-side error rendering.
|
|
7
|
+
*/
|
|
8
|
+
export declare function guardedFetch(label: string, signal: AbortSignal | undefined, run: () => Promise<Response>, ...secrets: Array<string | undefined>): Promise<Response>;
|
|
9
|
+
/** Guard only body I/O; parsing, HTTP checks and size enforcement stay with the adapter. */
|
|
10
|
+
export declare function readResponseBody<T>(response: Response, read: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED by scripts/sync-default-workflows.mjs - do not edit.
|
|
3
|
+
*
|
|
4
|
+
* The workflows below are prefilled into a fresh configuration so a new install
|
|
5
|
+
* has a working ComfyUI setup without hunting for files. Source of truth:
|
|
6
|
+
* docs/workflows/*.json.
|
|
7
|
+
*/
|
|
8
|
+
export interface ShippedWorkflow {
|
|
9
|
+
/** Pack file name, for traceability. */
|
|
10
|
+
file: string;
|
|
11
|
+
/** Display name used as the workflow label. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** API-format workflow JSON. */
|
|
14
|
+
json: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const SHIPPED_WORKFLOWS: readonly ShippedWorkflow[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Same-origin HTTP bridge from the Web result card to the Attachment service. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import type { ImageAttachmentRef, StoredImageAttachment } from '@deepseek-ai/dsh-attachment';
|
|
4
|
+
export { IMAGE_ROUTE, DELETE_ROUTE, SAVE_WORKSPACE_ROUTE } from './shared.js';
|
|
5
|
+
/** Dependencies required by the save-workspace route. */
|
|
6
|
+
export interface SaveWorkspaceRouteDeps {
|
|
7
|
+
readImage(ref: ImageAttachmentRef): Promise<{
|
|
8
|
+
data: Uint8Array;
|
|
9
|
+
}>;
|
|
10
|
+
saveToWorkspace(options: {
|
|
11
|
+
workspaceRoot: string;
|
|
12
|
+
attachmentId: string;
|
|
13
|
+
mediaType: ImageAttachmentRef['mediaType'];
|
|
14
|
+
data: Uint8Array;
|
|
15
|
+
}): Promise<string>;
|
|
16
|
+
getActiveWorkspaceRoot(): string;
|
|
17
|
+
getAllowedWorkspaceRoots(): Promise<Iterable<string>> | Iterable<string>;
|
|
18
|
+
isSaveEnabled(): boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Dependencies required by the image route. */
|
|
21
|
+
export interface ImageRouteDeps {
|
|
22
|
+
readImage(ref: ImageAttachmentRef): Promise<StoredImageAttachment>;
|
|
23
|
+
}
|
|
24
|
+
/** Dependencies required by the delete route. */
|
|
25
|
+
export interface DeleteRouteDeps {
|
|
26
|
+
deleteWorkspaceImage(filePath: string): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/** Serve one verified durable image reference to a same-origin browser request. */
|
|
29
|
+
export declare function serveImage(req: IncomingMessage, res: ServerResponse, deps: ImageRouteDeps): Promise<void>;
|
|
30
|
+
/** Safely delete one or more generated image files from the workspace disk. */
|
|
31
|
+
export declare function serveDelete(req: IncomingMessage, res: ServerResponse, deps: DeleteRouteDeps): Promise<void>;
|
|
32
|
+
/** Serve on-demand image persistence into the workspace. */
|
|
33
|
+
export declare function serveSaveWorkspace(req: IncomingMessage, res: ServerResponse, deps: SaveWorkspaceRouteDeps): Promise<void>;
|
|
34
|
+
/** Validate the persisted reference carried by a tool presentation. */
|
|
35
|
+
export declare function imageAttachmentFromMeta(meta: unknown): ImageAttachmentRef | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Upload endpoint turning browser-picked image files into DSH attachments. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import type { ImageAttachmentRef, ImageMediaType } from '@deepseek-ai/dsh-attachment';
|
|
4
|
+
export interface ImportRouteDeps {
|
|
5
|
+
/** Durable attachment store; computes dimensions and content-addresses the bytes. */
|
|
6
|
+
saveImage(image: {
|
|
7
|
+
data: Uint8Array;
|
|
8
|
+
mediaType: ImageMediaType;
|
|
9
|
+
name?: string;
|
|
10
|
+
}): Promise<ImageAttachmentRef>;
|
|
11
|
+
/** Per-image byte cap from the host attachment limits. */
|
|
12
|
+
maxImageBytes: number;
|
|
13
|
+
/** Accepted media types from the host attachment limits. */
|
|
14
|
+
mediaTypes: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function serveImport(req: IncomingMessage, res: ServerResponse, deps: ImportRouteDeps): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Local-ComfyUI image-generation Bundle for DeepSeek Harness. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import { Config } from './config.js';
|
|
4
|
+
import { type ComfyUIServerStatus } from './shared.js';
|
|
5
|
+
export { Config } from './config.js';
|
|
6
|
+
export { IMAGE_ROUTE, DELETE_ROUTE, SAVE_WORKSPACE_ROUTE, imageAttachmentFromMeta } from './image-route.js';
|
|
7
|
+
export { IMPORT_ROUTE } from './shared.js';
|
|
8
|
+
export { STUDIO_ROUTE } from './shared.js';
|
|
9
|
+
export { INSPIRATION_ROUTE } from './shared.js';
|
|
10
|
+
export { COMFYUI_SERVER_ROUTE, COMFYUI_PROGRESS_ROUTE } from './shared.js';
|
|
11
|
+
export { CANVAS_STATE_ROUTE } from './shared.js';
|
|
12
|
+
export declare const name = "dsh-image-gen";
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
export declare function apply(ctx: Context, config?: Config): void;
|
|
15
|
+
/** Re-exported for the server-control route's typed status payload. */
|
|
16
|
+
export type { ComfyUIServerStatus };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
export interface InspirationRouteDeps {
|
|
3
|
+
fetch?: typeof fetch;
|
|
4
|
+
}
|
|
5
|
+
export declare function createInspirationRoute(deps?: InspirationRouteDeps): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
6
|
+
export declare function drainCacheWrites(): Promise<void>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export declare const INSPIRATION_SOURCE_ID = "awesome-gpt-image-2";
|
|
2
|
+
export declare const INSPIRATION_SOURCE_VERSION = "c7d293963b21c60bf338003915438cc5c39dd3ca";
|
|
3
|
+
export declare const INSPIRATION_SOURCE_UPDATED_AT = "2026-08-28T10:24:55Z";
|
|
4
|
+
export declare const INSPIRATION_SOURCE_REPOSITORY = "https://github.com/freestylefly/awesome-gpt-image-2";
|
|
5
|
+
/** Public mirror for the bundled cases' image assets; checked before GitHub. */
|
|
6
|
+
export declare const INSPIRATION_SOURCE_IMAGE_MIRROR = "https://gpt-image2.canghe.ai";
|
|
7
|
+
export declare const MAX_INSPIRATION_CASES = 2000;
|
|
8
|
+
export declare const HANDDRAW_SOURCE_ID = "handraw-style";
|
|
9
|
+
export declare const HANDDRAW_SOURCE_VERSION = "50998b094866e22007001161bca12c892a3796b1";
|
|
10
|
+
export declare const HANDDRAW_SOURCE_UPDATED_AT = "2026-09-27T14:24:28+08:00";
|
|
11
|
+
export declare const HANDDRAW_SOURCE_REPOSITORY = "https://github.com/yang0/handraw-style";
|
|
12
|
+
/**
|
|
13
|
+
* Image revision for the handdraw source. The upstream pin stays fixed while
|
|
14
|
+
* the referenced image paths change (sheet crops → upstream individuals);
|
|
15
|
+
* browsers key their persistent image cache on this value, so bump it
|
|
16
|
+
* whenever the source's images change.
|
|
17
|
+
*/
|
|
18
|
+
export declare const HANDDRAW_IMAGE_REVISION = "3";
|
|
19
|
+
export interface InspirationCase {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
imageAlt: string;
|
|
23
|
+
sourceLabel?: string | undefined;
|
|
24
|
+
sourceUrl?: string | undefined;
|
|
25
|
+
githubUrl?: string | undefined;
|
|
26
|
+
prompt: string;
|
|
27
|
+
promptPreview: string;
|
|
28
|
+
category: string;
|
|
29
|
+
styles: string[];
|
|
30
|
+
scenes: string[];
|
|
31
|
+
featured: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface InspirationSource {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
repository: string;
|
|
37
|
+
version: string;
|
|
38
|
+
integritySha256?: string | undefined;
|
|
39
|
+
updatedAt?: string | undefined;
|
|
40
|
+
/** Content revision of the source's images; absent means `version` covers it. */
|
|
41
|
+
imageRevision?: string | undefined;
|
|
42
|
+
categories: string[];
|
|
43
|
+
styles: string[];
|
|
44
|
+
scenes: string[];
|
|
45
|
+
cases: InspirationCase[];
|
|
46
|
+
}
|
|
47
|
+
export interface InspirationCatalog {
|
|
48
|
+
schemaVersion: 1;
|
|
49
|
+
sources: InspirationSource[];
|
|
50
|
+
}
|
|
51
|
+
interface ResolvedCase extends InspirationCase {
|
|
52
|
+
imagePath: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ResolvedSource extends InspirationSource {
|
|
55
|
+
cases: ResolvedCase[];
|
|
56
|
+
}
|
|
57
|
+
export interface ResolvedInspirationCatalog {
|
|
58
|
+
schemaVersion: 1;
|
|
59
|
+
sources: ResolvedSource[];
|
|
60
|
+
}
|
|
61
|
+
/** Parse the upstream snapshot defensively before it becomes application data. */
|
|
62
|
+
export declare function parseInspirationSnapshot(value: unknown, version?: string, updatedAt?: string | undefined): ResolvedInspirationCatalog;
|
|
63
|
+
export declare function publicInspirationCatalog(catalog: ResolvedInspirationCatalog): InspirationCatalog;
|
|
64
|
+
export declare function findInspirationCase(catalog: ResolvedInspirationCatalog, sourceId: string, caseId: string): ResolvedCase | undefined;
|
|
65
|
+
/** One model-ready search hit: where the case lives plus its full reusable prompt. */
|
|
66
|
+
export interface InspirationSearchHit {
|
|
67
|
+
sourceId: string;
|
|
68
|
+
sourceLabel: string;
|
|
69
|
+
id: string;
|
|
70
|
+
title: string;
|
|
71
|
+
category: string;
|
|
72
|
+
prompt: string;
|
|
73
|
+
}
|
|
74
|
+
export interface InspirationSearchRequest {
|
|
75
|
+
/** Substring matched case-insensitively against titles, prompts, categories, and style/scene tags; empty matches everything. */
|
|
76
|
+
query: string;
|
|
77
|
+
/** Restrict the search to one source id. */
|
|
78
|
+
sourceId?: string | undefined;
|
|
79
|
+
/** Restrict the search to one exact category name. */
|
|
80
|
+
category?: string | undefined;
|
|
81
|
+
/** Maximum hits to return; defaults to 8, clamped to 1-20. */
|
|
82
|
+
limit?: number | undefined;
|
|
83
|
+
}
|
|
84
|
+
export interface InspirationSearchResult {
|
|
85
|
+
/** Total matching cases before the limit; lets the caller refine instead of re-querying blindly. */
|
|
86
|
+
total: number;
|
|
87
|
+
hits: InspirationSearchHit[];
|
|
88
|
+
}
|
|
89
|
+
/** Search a resolved catalog for reusable prompts; bounded hits even with an empty query. */
|
|
90
|
+
export declare function searchInspirationCases(catalog: ResolvedInspirationCatalog, request: InspirationSearchRequest): InspirationSearchResult;
|
|
91
|
+
export declare const BUNDLED_INSPIRATION_CATALOG: ResolvedInspirationCatalog;
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Same-origin route for live ComfyUI job snapshots, previews, and cancellation. */
|
|
2
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import type { ComfyUIJobSnapshot, ComfyUIPreview } from './comfyui-progress.js';
|
|
4
|
+
export interface ComfyUIProgressRouteDeps {
|
|
5
|
+
snapshot(jobId: string): ComfyUIJobSnapshot | undefined;
|
|
6
|
+
subscribe(jobId: string, listener: () => void): () => void;
|
|
7
|
+
preview(jobId: string): ComfyUIPreview | undefined;
|
|
8
|
+
cancel(jobId: string): Promise<ComfyUIJobSnapshot | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export declare function serveComfyUIProgress(req: IncomingMessage, res: ServerResponse, deps: ComfyUIProgressRouteDeps, pathname: string): Promise<void>;
|