@genfeedai/workflows 0.1.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.md ADDED
@@ -0,0 +1,96 @@
1
+ # @genfeedai/workflows
2
+
3
+ Official workflow templates for Genfeed - the AI-first content creation platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @genfeedai/workflows
9
+ # or
10
+ bun add @genfeedai/workflows
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Using the Registry
16
+
17
+ ```typescript
18
+ import {
19
+ WORKFLOW_REGISTRY,
20
+ getWorkflowIds,
21
+ getWorkflowMetadata,
22
+ getWorkflowsByCategory,
23
+ searchWorkflowsByTag,
24
+ } from '@genfeedai/workflows';
25
+
26
+ // List all workflow IDs
27
+ const ids = getWorkflowIds();
28
+ // ['single-image', 'single-video', 'image-series', ...]
29
+
30
+ // Get metadata for a specific workflow
31
+ const metadata = getWorkflowMetadata('single-image');
32
+ // { id: 'single-image', name: 'Single Image Generation', ... }
33
+
34
+ // Get workflows by category
35
+ const imageWorkflows = getWorkflowsByCategory('image');
36
+
37
+ // Search by tag
38
+ const simpleWorkflows = searchWorkflowsByTag('simple');
39
+ ```
40
+
41
+ ### Accessing Workflow Files
42
+
43
+ The actual workflow JSON files are in the `workflows/` directory:
44
+
45
+ ```typescript
46
+ import singleImage from '@genfeedai/workflows/workflows/single-image.json';
47
+ import singleVideo from '@genfeedai/workflows/workflows/single-video.json';
48
+ ```
49
+
50
+ ## Available Workflows
51
+
52
+ ### Image Workflows
53
+
54
+ | ID | Name | Description |
55
+ |----|------|-------------|
56
+ | `single-image` | Single Image Generation | Generate an AI image from a source image (img2img) |
57
+ | `image-series` | Image Series | Generate related images using LLM expansion |
58
+
59
+ ### Video Workflows
60
+
61
+ | ID | Name | Description |
62
+ |----|------|-------------|
63
+ | `single-video` | Single Video Generation | Generate a video from a source image (img2video) |
64
+ | `image-to-video` | Image to Video | Create interpolated video between two images |
65
+
66
+ ### Full Pipeline Workflows
67
+
68
+ | ID | Name | Description |
69
+ |----|------|-------------|
70
+ | `full-pipeline` | Full Content Pipeline | Complete workflow: concept → images → videos → stitched output |
71
+
72
+ ## Workflow Schema
73
+
74
+ Each workflow follows the `WorkflowFile` interface from `@genfeedai/types`:
75
+
76
+ ```typescript
77
+ interface WorkflowFile {
78
+ version: number;
79
+ name: string;
80
+ description: string;
81
+ nodes: WorkflowNode[];
82
+ edges: WorkflowEdge[];
83
+ edgeStyle: 'bezier' | 'smoothstep' | 'straight';
84
+ groups?: NodeGroup[];
85
+ createdAt: string;
86
+ updatedAt: string;
87
+ }
88
+ ```
89
+
90
+ ## Contributing
91
+
92
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on submitting new workflows.
93
+
94
+ ## License
95
+
96
+ AGPL-3.0
@@ -0,0 +1,185 @@
1
+ import { ComfyUIPrompt, ComfyUIQueuePromptResponse, ComfyUIHistoryEntry, ComfyUIWorkflowTemplate, WorkflowNode, WorkflowEdge } from '@genfeedai/types';
2
+
3
+ interface ComfyUIClientOptions {
4
+ /** Polling interval in ms when waiting for completion */
5
+ pollMs?: number;
6
+ /** Max time to wait for completion in ms */
7
+ timeoutMs?: number;
8
+ }
9
+ /**
10
+ * Lightweight HTTP client for the ComfyUI REST API.
11
+ *
12
+ * Talks to:
13
+ * POST /prompt — queue a new prompt
14
+ * GET /history/{id} — check prompt status + outputs
15
+ * GET /view — download an output file
16
+ * GET /system_stats — health check
17
+ */
18
+ declare class ComfyUIClient {
19
+ private readonly baseUrl;
20
+ constructor(baseUrl: string);
21
+ /**
22
+ * Queue a prompt for execution on ComfyUI.
23
+ */
24
+ queuePrompt(prompt: ComfyUIPrompt): Promise<ComfyUIQueuePromptResponse>;
25
+ /**
26
+ * Get history for a specific prompt execution.
27
+ */
28
+ getHistory(promptId: string): Promise<ComfyUIHistoryEntry | undefined>;
29
+ /**
30
+ * Download an output file (image/video) from ComfyUI.
31
+ */
32
+ getOutput(filename: string, subfolder: string): Promise<Buffer>;
33
+ /**
34
+ * Poll ComfyUI until the prompt completes or times out.
35
+ * Returns the history entry with outputs.
36
+ */
37
+ waitForCompletion(promptId: string, opts?: ComfyUIClientOptions): Promise<ComfyUIHistoryEntry>;
38
+ /**
39
+ * Health check — pings the ComfyUI instance.
40
+ */
41
+ ping(): Promise<boolean>;
42
+ private sleep;
43
+ }
44
+
45
+ /**
46
+ * Resolves a ComfyUI workflow template with user-provided inputs,
47
+ * then executes it on a ComfyUI instance.
48
+ */
49
+ declare class ComfyUITemplateRunner {
50
+ private readonly client;
51
+ constructor(client: ComfyUIClient);
52
+ /**
53
+ * Resolve template inputs into a concrete prompt.
54
+ * Injects user values into the template's node graph.
55
+ */
56
+ resolvePrompt(template: ComfyUIWorkflowTemplate, values: Record<string, unknown>): ComfyUIPrompt;
57
+ /**
58
+ * Run a template with the given inputs and wait for completion.
59
+ */
60
+ run(template: ComfyUIWorkflowTemplate, values: Record<string, unknown>): Promise<ComfyUIHistoryEntry>;
61
+ }
62
+
63
+ interface FluxDevParams {
64
+ prompt: string;
65
+ seed?: number;
66
+ width?: number;
67
+ height?: number;
68
+ steps?: number;
69
+ cfg?: number;
70
+ negativePrompt?: string;
71
+ }
72
+ declare function buildFluxDevPrompt(params: FluxDevParams): ComfyUIPrompt;
73
+ interface PulidFluxParams {
74
+ prompt: string;
75
+ faceImage: string;
76
+ seed?: number;
77
+ width?: number;
78
+ height?: number;
79
+ steps?: number;
80
+ cfg?: number;
81
+ pulidStrength?: number;
82
+ }
83
+ declare function buildPulidFluxPrompt(params: PulidFluxParams): ComfyUIPrompt;
84
+ interface ZImageTurboParams {
85
+ prompt: string;
86
+ seed?: number;
87
+ width?: number;
88
+ height?: number;
89
+ steps?: number;
90
+ }
91
+ declare function buildZImageTurboPrompt(params: ZImageTurboParams): ComfyUIPrompt;
92
+ interface Flux2DevParams {
93
+ prompt: string;
94
+ seed?: number;
95
+ width?: number;
96
+ height?: number;
97
+ steps?: number;
98
+ guidance?: number;
99
+ }
100
+ declare function buildFlux2DevPrompt(params: Flux2DevParams): ComfyUIPrompt;
101
+ interface Flux2PulidParams extends Flux2DevParams {
102
+ faceImage: string;
103
+ pulidStrength?: number;
104
+ }
105
+ declare function buildFlux2DevPulidPrompt(params: Flux2PulidParams): ComfyUIPrompt;
106
+ interface Flux2PulidLoraParams extends Flux2PulidParams {
107
+ loraPath: string;
108
+ loraStrength?: number;
109
+ realismLora?: string;
110
+ realismLoraStrength?: number;
111
+ }
112
+ declare function buildFlux2DevPulidLoraPrompt(params: Flux2PulidLoraParams): ComfyUIPrompt;
113
+ interface Flux2KleinParams {
114
+ prompt: string;
115
+ seed?: number;
116
+ width?: number;
117
+ height?: number;
118
+ steps?: number;
119
+ }
120
+ declare function buildFlux2KleinPrompt(params: Flux2KleinParams): ComfyUIPrompt;
121
+
122
+ /**
123
+ * Workflow Registry for @genfeedai/workflows
124
+ *
125
+ * This registry contains metadata for all official workflow templates.
126
+ * The actual workflow JSON files are stored in the `workflows/` directory.
127
+ */
128
+
129
+ interface WorkflowJson {
130
+ version: number;
131
+ name: string;
132
+ description: string;
133
+ edgeStyle: string;
134
+ createdAt: string;
135
+ updatedAt: string;
136
+ nodes: WorkflowNode[];
137
+ edges: WorkflowEdge[];
138
+ }
139
+ interface WorkflowMetadata {
140
+ slug: string;
141
+ title: string;
142
+ description: string;
143
+ category: 'image-generation' | 'video-generation' | 'full-pipeline';
144
+ tags: string[];
145
+ tier: 'free' | 'paid' | 'premium';
146
+ icon: string;
147
+ defaultModel: string;
148
+ inputTypes: string[];
149
+ outputTypes: string[];
150
+ version: number;
151
+ }
152
+ /**
153
+ * Registry of all available workflow templates
154
+ */
155
+ declare const WORKFLOW_REGISTRY: Record<string, WorkflowMetadata>;
156
+ /**
157
+ * Get all workflows
158
+ */
159
+ declare function getAllWorkflows(): WorkflowMetadata[];
160
+ /**
161
+ * Get workflow metadata by slug
162
+ */
163
+ declare function getWorkflow(slug: string): WorkflowMetadata | undefined;
164
+ /**
165
+ * Get workflow JSON by slug
166
+ */
167
+ declare function getWorkflowJson(slug: string): WorkflowJson | undefined;
168
+ /**
169
+ * Get all workflow IDs (legacy compatibility)
170
+ */
171
+ declare function getWorkflowIds(): string[];
172
+ /**
173
+ * Get workflow metadata by ID (legacy compatibility)
174
+ */
175
+ declare function getWorkflowMetadata(id: string): WorkflowMetadata | undefined;
176
+ /**
177
+ * Get workflows by category
178
+ */
179
+ declare function getWorkflowsByCategory(category: WorkflowMetadata['category']): WorkflowMetadata[];
180
+ /**
181
+ * Search workflows by tag
182
+ */
183
+ declare function searchWorkflowsByTag(tag: string): WorkflowMetadata[];
184
+
185
+ export { ComfyUIClient, type ComfyUIClientOptions, ComfyUITemplateRunner, type Flux2DevParams, type Flux2KleinParams, type Flux2PulidLoraParams, type Flux2PulidParams, type FluxDevParams, type PulidFluxParams, WORKFLOW_REGISTRY, type WorkflowJson, type WorkflowMetadata, type ZImageTurboParams, buildFlux2DevPrompt, buildFlux2DevPulidLoraPrompt, buildFlux2DevPulidPrompt, buildFlux2KleinPrompt, buildFluxDevPrompt, buildPulidFluxPrompt, buildZImageTurboPrompt, getAllWorkflows, getWorkflow, getWorkflowIds, getWorkflowJson, getWorkflowMetadata, getWorkflowsByCategory, searchWorkflowsByTag };
@@ -0,0 +1,185 @@
1
+ import { ComfyUIPrompt, ComfyUIQueuePromptResponse, ComfyUIHistoryEntry, ComfyUIWorkflowTemplate, WorkflowNode, WorkflowEdge } from '@genfeedai/types';
2
+
3
+ interface ComfyUIClientOptions {
4
+ /** Polling interval in ms when waiting for completion */
5
+ pollMs?: number;
6
+ /** Max time to wait for completion in ms */
7
+ timeoutMs?: number;
8
+ }
9
+ /**
10
+ * Lightweight HTTP client for the ComfyUI REST API.
11
+ *
12
+ * Talks to:
13
+ * POST /prompt — queue a new prompt
14
+ * GET /history/{id} — check prompt status + outputs
15
+ * GET /view — download an output file
16
+ * GET /system_stats — health check
17
+ */
18
+ declare class ComfyUIClient {
19
+ private readonly baseUrl;
20
+ constructor(baseUrl: string);
21
+ /**
22
+ * Queue a prompt for execution on ComfyUI.
23
+ */
24
+ queuePrompt(prompt: ComfyUIPrompt): Promise<ComfyUIQueuePromptResponse>;
25
+ /**
26
+ * Get history for a specific prompt execution.
27
+ */
28
+ getHistory(promptId: string): Promise<ComfyUIHistoryEntry | undefined>;
29
+ /**
30
+ * Download an output file (image/video) from ComfyUI.
31
+ */
32
+ getOutput(filename: string, subfolder: string): Promise<Buffer>;
33
+ /**
34
+ * Poll ComfyUI until the prompt completes or times out.
35
+ * Returns the history entry with outputs.
36
+ */
37
+ waitForCompletion(promptId: string, opts?: ComfyUIClientOptions): Promise<ComfyUIHistoryEntry>;
38
+ /**
39
+ * Health check — pings the ComfyUI instance.
40
+ */
41
+ ping(): Promise<boolean>;
42
+ private sleep;
43
+ }
44
+
45
+ /**
46
+ * Resolves a ComfyUI workflow template with user-provided inputs,
47
+ * then executes it on a ComfyUI instance.
48
+ */
49
+ declare class ComfyUITemplateRunner {
50
+ private readonly client;
51
+ constructor(client: ComfyUIClient);
52
+ /**
53
+ * Resolve template inputs into a concrete prompt.
54
+ * Injects user values into the template's node graph.
55
+ */
56
+ resolvePrompt(template: ComfyUIWorkflowTemplate, values: Record<string, unknown>): ComfyUIPrompt;
57
+ /**
58
+ * Run a template with the given inputs and wait for completion.
59
+ */
60
+ run(template: ComfyUIWorkflowTemplate, values: Record<string, unknown>): Promise<ComfyUIHistoryEntry>;
61
+ }
62
+
63
+ interface FluxDevParams {
64
+ prompt: string;
65
+ seed?: number;
66
+ width?: number;
67
+ height?: number;
68
+ steps?: number;
69
+ cfg?: number;
70
+ negativePrompt?: string;
71
+ }
72
+ declare function buildFluxDevPrompt(params: FluxDevParams): ComfyUIPrompt;
73
+ interface PulidFluxParams {
74
+ prompt: string;
75
+ faceImage: string;
76
+ seed?: number;
77
+ width?: number;
78
+ height?: number;
79
+ steps?: number;
80
+ cfg?: number;
81
+ pulidStrength?: number;
82
+ }
83
+ declare function buildPulidFluxPrompt(params: PulidFluxParams): ComfyUIPrompt;
84
+ interface ZImageTurboParams {
85
+ prompt: string;
86
+ seed?: number;
87
+ width?: number;
88
+ height?: number;
89
+ steps?: number;
90
+ }
91
+ declare function buildZImageTurboPrompt(params: ZImageTurboParams): ComfyUIPrompt;
92
+ interface Flux2DevParams {
93
+ prompt: string;
94
+ seed?: number;
95
+ width?: number;
96
+ height?: number;
97
+ steps?: number;
98
+ guidance?: number;
99
+ }
100
+ declare function buildFlux2DevPrompt(params: Flux2DevParams): ComfyUIPrompt;
101
+ interface Flux2PulidParams extends Flux2DevParams {
102
+ faceImage: string;
103
+ pulidStrength?: number;
104
+ }
105
+ declare function buildFlux2DevPulidPrompt(params: Flux2PulidParams): ComfyUIPrompt;
106
+ interface Flux2PulidLoraParams extends Flux2PulidParams {
107
+ loraPath: string;
108
+ loraStrength?: number;
109
+ realismLora?: string;
110
+ realismLoraStrength?: number;
111
+ }
112
+ declare function buildFlux2DevPulidLoraPrompt(params: Flux2PulidLoraParams): ComfyUIPrompt;
113
+ interface Flux2KleinParams {
114
+ prompt: string;
115
+ seed?: number;
116
+ width?: number;
117
+ height?: number;
118
+ steps?: number;
119
+ }
120
+ declare function buildFlux2KleinPrompt(params: Flux2KleinParams): ComfyUIPrompt;
121
+
122
+ /**
123
+ * Workflow Registry for @genfeedai/workflows
124
+ *
125
+ * This registry contains metadata for all official workflow templates.
126
+ * The actual workflow JSON files are stored in the `workflows/` directory.
127
+ */
128
+
129
+ interface WorkflowJson {
130
+ version: number;
131
+ name: string;
132
+ description: string;
133
+ edgeStyle: string;
134
+ createdAt: string;
135
+ updatedAt: string;
136
+ nodes: WorkflowNode[];
137
+ edges: WorkflowEdge[];
138
+ }
139
+ interface WorkflowMetadata {
140
+ slug: string;
141
+ title: string;
142
+ description: string;
143
+ category: 'image-generation' | 'video-generation' | 'full-pipeline';
144
+ tags: string[];
145
+ tier: 'free' | 'paid' | 'premium';
146
+ icon: string;
147
+ defaultModel: string;
148
+ inputTypes: string[];
149
+ outputTypes: string[];
150
+ version: number;
151
+ }
152
+ /**
153
+ * Registry of all available workflow templates
154
+ */
155
+ declare const WORKFLOW_REGISTRY: Record<string, WorkflowMetadata>;
156
+ /**
157
+ * Get all workflows
158
+ */
159
+ declare function getAllWorkflows(): WorkflowMetadata[];
160
+ /**
161
+ * Get workflow metadata by slug
162
+ */
163
+ declare function getWorkflow(slug: string): WorkflowMetadata | undefined;
164
+ /**
165
+ * Get workflow JSON by slug
166
+ */
167
+ declare function getWorkflowJson(slug: string): WorkflowJson | undefined;
168
+ /**
169
+ * Get all workflow IDs (legacy compatibility)
170
+ */
171
+ declare function getWorkflowIds(): string[];
172
+ /**
173
+ * Get workflow metadata by ID (legacy compatibility)
174
+ */
175
+ declare function getWorkflowMetadata(id: string): WorkflowMetadata | undefined;
176
+ /**
177
+ * Get workflows by category
178
+ */
179
+ declare function getWorkflowsByCategory(category: WorkflowMetadata['category']): WorkflowMetadata[];
180
+ /**
181
+ * Search workflows by tag
182
+ */
183
+ declare function searchWorkflowsByTag(tag: string): WorkflowMetadata[];
184
+
185
+ export { ComfyUIClient, type ComfyUIClientOptions, ComfyUITemplateRunner, type Flux2DevParams, type Flux2KleinParams, type Flux2PulidLoraParams, type Flux2PulidParams, type FluxDevParams, type PulidFluxParams, WORKFLOW_REGISTRY, type WorkflowJson, type WorkflowMetadata, type ZImageTurboParams, buildFlux2DevPrompt, buildFlux2DevPulidLoraPrompt, buildFlux2DevPulidPrompt, buildFlux2KleinPrompt, buildFluxDevPrompt, buildPulidFluxPrompt, buildZImageTurboPrompt, getAllWorkflows, getWorkflow, getWorkflowIds, getWorkflowJson, getWorkflowMetadata, getWorkflowsByCategory, searchWorkflowsByTag };