@genfeedai/workflows 0.1.1 → 0.3.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 +16 -0
- package/dist/chunk-CTZNKWZB.mjs +39 -0
- package/dist/contracts/index.d.mts +127 -0
- package/dist/contracts/index.d.ts +127 -0
- package/dist/contracts/index.js +66 -0
- package/dist/contracts/index.mjs +8 -0
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +149 -0
- package/dist/index.mjs +116 -0
- package/metadata/catalog.json +12 -0
- package/package.json +18 -11
- package/workflows/lora-dataset-generator.json +754 -0
package/README.md
CHANGED
|
@@ -94,3 +94,19 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on submitting new workfl
|
|
|
94
94
|
## License
|
|
95
95
|
|
|
96
96
|
AGPL-3.0
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
## Extension & Engine Contracts
|
|
100
|
+
|
|
101
|
+
Use shared contracts for workflow engines and cloud extension packs:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import type {
|
|
105
|
+
ExecutableWorkflow,
|
|
106
|
+
NodeDefinition,
|
|
107
|
+
ExtensionPack,
|
|
108
|
+
NodeRegistry,
|
|
109
|
+
} from '@genfeedai/workflows/contracts';
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
These contracts are designed so private/cloud node packs can extend public core workflows without forking type definitions.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/contracts/execution.ts
|
|
2
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
3
|
+
backoffMultiplier: 2,
|
|
4
|
+
baseDelayMs: 1e3,
|
|
5
|
+
maxDelayMs: 3e4,
|
|
6
|
+
maxRetries: 3
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// src/extensions/registry.ts
|
|
10
|
+
var InMemoryNodeRegistry = class {
|
|
11
|
+
nodes = /* @__PURE__ */ new Map();
|
|
12
|
+
register(node) {
|
|
13
|
+
this.nodes.set(this.key(node.type, node.version), node);
|
|
14
|
+
}
|
|
15
|
+
registerMany(nodes) {
|
|
16
|
+
for (const node of nodes) this.register(node);
|
|
17
|
+
}
|
|
18
|
+
registerPack(pack) {
|
|
19
|
+
this.registerMany(pack.nodes);
|
|
20
|
+
}
|
|
21
|
+
get(type, version) {
|
|
22
|
+
if (version !== void 0) {
|
|
23
|
+
return this.nodes.get(this.key(type, version));
|
|
24
|
+
}
|
|
25
|
+
const candidates = [...this.nodes.values()].filter((node) => node.type === type).sort((a, b) => b.version - a.version);
|
|
26
|
+
return candidates[0];
|
|
27
|
+
}
|
|
28
|
+
list() {
|
|
29
|
+
return [...this.nodes.values()];
|
|
30
|
+
}
|
|
31
|
+
key(type, version) {
|
|
32
|
+
return `${type}@${version}`;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
DEFAULT_RETRY_CONFIG,
|
|
38
|
+
InMemoryNodeRegistry
|
|
39
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
2
|
+
type NodeExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
3
|
+
type WorkflowLifecycle = 'draft' | 'published' | 'archived';
|
|
4
|
+
interface ExecutionProgressEvent {
|
|
5
|
+
runId: string;
|
|
6
|
+
workflowId: string;
|
|
7
|
+
progress: number;
|
|
8
|
+
currentNodeId?: string;
|
|
9
|
+
currentNodeLabel?: string;
|
|
10
|
+
completedNodes: string[];
|
|
11
|
+
failedNodes: string[];
|
|
12
|
+
timestamp: Date;
|
|
13
|
+
}
|
|
14
|
+
interface NodeStatusChangeEvent {
|
|
15
|
+
runId: string;
|
|
16
|
+
workflowId: string;
|
|
17
|
+
nodeId: string;
|
|
18
|
+
previousStatus: NodeExecutionStatus;
|
|
19
|
+
newStatus: NodeExecutionStatus;
|
|
20
|
+
error?: string;
|
|
21
|
+
output?: unknown;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
}
|
|
24
|
+
interface ExecutionOptions {
|
|
25
|
+
nodeIds?: string[];
|
|
26
|
+
resumeFromNodeId?: string;
|
|
27
|
+
respectLocks?: boolean;
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
onProgress?: (event: ExecutionProgressEvent) => void;
|
|
30
|
+
onNodeStatusChange?: (event: NodeStatusChangeEvent) => void;
|
|
31
|
+
availableCredits?: number;
|
|
32
|
+
dryRun?: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface ExecutableNode {
|
|
35
|
+
id: string;
|
|
36
|
+
type: string;
|
|
37
|
+
label: string;
|
|
38
|
+
config: Record<string, unknown>;
|
|
39
|
+
inputs: string[];
|
|
40
|
+
isLocked?: boolean;
|
|
41
|
+
cachedOutput?: unknown;
|
|
42
|
+
}
|
|
43
|
+
interface ExecutableEdge {
|
|
44
|
+
id: string;
|
|
45
|
+
source: string;
|
|
46
|
+
target: string;
|
|
47
|
+
sourceHandle?: string;
|
|
48
|
+
targetHandle?: string;
|
|
49
|
+
}
|
|
50
|
+
interface ExecutableWorkflow {
|
|
51
|
+
id: string;
|
|
52
|
+
organizationId: string;
|
|
53
|
+
userId: string;
|
|
54
|
+
nodes: ExecutableNode[];
|
|
55
|
+
edges: ExecutableEdge[];
|
|
56
|
+
lockedNodeIds: string[];
|
|
57
|
+
}
|
|
58
|
+
interface ValidationResult {
|
|
59
|
+
isValid: boolean;
|
|
60
|
+
errors: ValidationError[];
|
|
61
|
+
warnings: ValidationWarning[];
|
|
62
|
+
}
|
|
63
|
+
interface ValidationError {
|
|
64
|
+
code: string;
|
|
65
|
+
message: string;
|
|
66
|
+
nodeId?: string;
|
|
67
|
+
field?: string;
|
|
68
|
+
}
|
|
69
|
+
interface ValidationWarning {
|
|
70
|
+
code: string;
|
|
71
|
+
message: string;
|
|
72
|
+
nodeId?: string;
|
|
73
|
+
}
|
|
74
|
+
interface RetryConfig {
|
|
75
|
+
maxRetries: number;
|
|
76
|
+
baseDelayMs: number;
|
|
77
|
+
maxDelayMs: number;
|
|
78
|
+
backoffMultiplier: number;
|
|
79
|
+
}
|
|
80
|
+
declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Stable extension contracts for workflow engines.
|
|
84
|
+
* Cloud/private packages should implement these interfaces without forking them.
|
|
85
|
+
*/
|
|
86
|
+
type NodeSchema = Record<string, unknown>;
|
|
87
|
+
interface NodeDefinition {
|
|
88
|
+
type: string;
|
|
89
|
+
version: number;
|
|
90
|
+
label: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
inputs: NodeSchema;
|
|
93
|
+
outputs: NodeSchema;
|
|
94
|
+
configSchema?: NodeSchema;
|
|
95
|
+
}
|
|
96
|
+
interface NodeExecutionContext {
|
|
97
|
+
environment?: 'local' | 'cloud';
|
|
98
|
+
metadata?: Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
interface ExtensionPack {
|
|
101
|
+
id: string;
|
|
102
|
+
version: string;
|
|
103
|
+
nodes: NodeDefinition[];
|
|
104
|
+
capabilities?: string[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Minimal registry interface for composing core and private workflow node packs.
|
|
109
|
+
*/
|
|
110
|
+
interface NodeRegistry {
|
|
111
|
+
register(node: NodeDefinition): void;
|
|
112
|
+
registerMany(nodes: NodeDefinition[]): void;
|
|
113
|
+
registerPack(pack: ExtensionPack): void;
|
|
114
|
+
get(type: string, version?: number): NodeDefinition | undefined;
|
|
115
|
+
list(): NodeDefinition[];
|
|
116
|
+
}
|
|
117
|
+
declare class InMemoryNodeRegistry implements NodeRegistry {
|
|
118
|
+
private readonly nodes;
|
|
119
|
+
register(node: NodeDefinition): void;
|
|
120
|
+
registerMany(nodes: NodeDefinition[]): void;
|
|
121
|
+
registerPack(pack: ExtensionPack): void;
|
|
122
|
+
get(type: string, version?: number): NodeDefinition | undefined;
|
|
123
|
+
list(): NodeDefinition[];
|
|
124
|
+
private key;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { DEFAULT_RETRY_CONFIG, type ExecutableEdge, type ExecutableNode, type ExecutableWorkflow, type ExecutionOptions, type ExecutionProgressEvent, type ExecutionStatus, type ExtensionPack, InMemoryNodeRegistry, type NodeDefinition, type NodeExecutionContext, type NodeExecutionStatus, type NodeRegistry, type NodeSchema, type NodeStatusChangeEvent, type RetryConfig, type ValidationError, type ValidationResult, type ValidationWarning, type WorkflowLifecycle };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
2
|
+
type NodeExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
3
|
+
type WorkflowLifecycle = 'draft' | 'published' | 'archived';
|
|
4
|
+
interface ExecutionProgressEvent {
|
|
5
|
+
runId: string;
|
|
6
|
+
workflowId: string;
|
|
7
|
+
progress: number;
|
|
8
|
+
currentNodeId?: string;
|
|
9
|
+
currentNodeLabel?: string;
|
|
10
|
+
completedNodes: string[];
|
|
11
|
+
failedNodes: string[];
|
|
12
|
+
timestamp: Date;
|
|
13
|
+
}
|
|
14
|
+
interface NodeStatusChangeEvent {
|
|
15
|
+
runId: string;
|
|
16
|
+
workflowId: string;
|
|
17
|
+
nodeId: string;
|
|
18
|
+
previousStatus: NodeExecutionStatus;
|
|
19
|
+
newStatus: NodeExecutionStatus;
|
|
20
|
+
error?: string;
|
|
21
|
+
output?: unknown;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
}
|
|
24
|
+
interface ExecutionOptions {
|
|
25
|
+
nodeIds?: string[];
|
|
26
|
+
resumeFromNodeId?: string;
|
|
27
|
+
respectLocks?: boolean;
|
|
28
|
+
maxRetries?: number;
|
|
29
|
+
onProgress?: (event: ExecutionProgressEvent) => void;
|
|
30
|
+
onNodeStatusChange?: (event: NodeStatusChangeEvent) => void;
|
|
31
|
+
availableCredits?: number;
|
|
32
|
+
dryRun?: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface ExecutableNode {
|
|
35
|
+
id: string;
|
|
36
|
+
type: string;
|
|
37
|
+
label: string;
|
|
38
|
+
config: Record<string, unknown>;
|
|
39
|
+
inputs: string[];
|
|
40
|
+
isLocked?: boolean;
|
|
41
|
+
cachedOutput?: unknown;
|
|
42
|
+
}
|
|
43
|
+
interface ExecutableEdge {
|
|
44
|
+
id: string;
|
|
45
|
+
source: string;
|
|
46
|
+
target: string;
|
|
47
|
+
sourceHandle?: string;
|
|
48
|
+
targetHandle?: string;
|
|
49
|
+
}
|
|
50
|
+
interface ExecutableWorkflow {
|
|
51
|
+
id: string;
|
|
52
|
+
organizationId: string;
|
|
53
|
+
userId: string;
|
|
54
|
+
nodes: ExecutableNode[];
|
|
55
|
+
edges: ExecutableEdge[];
|
|
56
|
+
lockedNodeIds: string[];
|
|
57
|
+
}
|
|
58
|
+
interface ValidationResult {
|
|
59
|
+
isValid: boolean;
|
|
60
|
+
errors: ValidationError[];
|
|
61
|
+
warnings: ValidationWarning[];
|
|
62
|
+
}
|
|
63
|
+
interface ValidationError {
|
|
64
|
+
code: string;
|
|
65
|
+
message: string;
|
|
66
|
+
nodeId?: string;
|
|
67
|
+
field?: string;
|
|
68
|
+
}
|
|
69
|
+
interface ValidationWarning {
|
|
70
|
+
code: string;
|
|
71
|
+
message: string;
|
|
72
|
+
nodeId?: string;
|
|
73
|
+
}
|
|
74
|
+
interface RetryConfig {
|
|
75
|
+
maxRetries: number;
|
|
76
|
+
baseDelayMs: number;
|
|
77
|
+
maxDelayMs: number;
|
|
78
|
+
backoffMultiplier: number;
|
|
79
|
+
}
|
|
80
|
+
declare const DEFAULT_RETRY_CONFIG: RetryConfig;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Stable extension contracts for workflow engines.
|
|
84
|
+
* Cloud/private packages should implement these interfaces without forking them.
|
|
85
|
+
*/
|
|
86
|
+
type NodeSchema = Record<string, unknown>;
|
|
87
|
+
interface NodeDefinition {
|
|
88
|
+
type: string;
|
|
89
|
+
version: number;
|
|
90
|
+
label: string;
|
|
91
|
+
description?: string;
|
|
92
|
+
inputs: NodeSchema;
|
|
93
|
+
outputs: NodeSchema;
|
|
94
|
+
configSchema?: NodeSchema;
|
|
95
|
+
}
|
|
96
|
+
interface NodeExecutionContext {
|
|
97
|
+
environment?: 'local' | 'cloud';
|
|
98
|
+
metadata?: Record<string, unknown>;
|
|
99
|
+
}
|
|
100
|
+
interface ExtensionPack {
|
|
101
|
+
id: string;
|
|
102
|
+
version: string;
|
|
103
|
+
nodes: NodeDefinition[];
|
|
104
|
+
capabilities?: string[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Minimal registry interface for composing core and private workflow node packs.
|
|
109
|
+
*/
|
|
110
|
+
interface NodeRegistry {
|
|
111
|
+
register(node: NodeDefinition): void;
|
|
112
|
+
registerMany(nodes: NodeDefinition[]): void;
|
|
113
|
+
registerPack(pack: ExtensionPack): void;
|
|
114
|
+
get(type: string, version?: number): NodeDefinition | undefined;
|
|
115
|
+
list(): NodeDefinition[];
|
|
116
|
+
}
|
|
117
|
+
declare class InMemoryNodeRegistry implements NodeRegistry {
|
|
118
|
+
private readonly nodes;
|
|
119
|
+
register(node: NodeDefinition): void;
|
|
120
|
+
registerMany(nodes: NodeDefinition[]): void;
|
|
121
|
+
registerPack(pack: ExtensionPack): void;
|
|
122
|
+
get(type: string, version?: number): NodeDefinition | undefined;
|
|
123
|
+
list(): NodeDefinition[];
|
|
124
|
+
private key;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { DEFAULT_RETRY_CONFIG, type ExecutableEdge, type ExecutableNode, type ExecutableWorkflow, type ExecutionOptions, type ExecutionProgressEvent, type ExecutionStatus, type ExtensionPack, InMemoryNodeRegistry, type NodeDefinition, type NodeExecutionContext, type NodeExecutionStatus, type NodeRegistry, type NodeSchema, type NodeStatusChangeEvent, type RetryConfig, type ValidationError, type ValidationResult, type ValidationWarning, type WorkflowLifecycle };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/contracts/index.ts
|
|
21
|
+
var contracts_exports = {};
|
|
22
|
+
__export(contracts_exports, {
|
|
23
|
+
DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
|
|
24
|
+
InMemoryNodeRegistry: () => InMemoryNodeRegistry
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(contracts_exports);
|
|
27
|
+
|
|
28
|
+
// src/contracts/execution.ts
|
|
29
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
30
|
+
backoffMultiplier: 2,
|
|
31
|
+
baseDelayMs: 1e3,
|
|
32
|
+
maxDelayMs: 3e4,
|
|
33
|
+
maxRetries: 3
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/extensions/registry.ts
|
|
37
|
+
var InMemoryNodeRegistry = class {
|
|
38
|
+
nodes = /* @__PURE__ */ new Map();
|
|
39
|
+
register(node) {
|
|
40
|
+
this.nodes.set(this.key(node.type, node.version), node);
|
|
41
|
+
}
|
|
42
|
+
registerMany(nodes) {
|
|
43
|
+
for (const node of nodes) this.register(node);
|
|
44
|
+
}
|
|
45
|
+
registerPack(pack) {
|
|
46
|
+
this.registerMany(pack.nodes);
|
|
47
|
+
}
|
|
48
|
+
get(type, version) {
|
|
49
|
+
if (version !== void 0) {
|
|
50
|
+
return this.nodes.get(this.key(type, version));
|
|
51
|
+
}
|
|
52
|
+
const candidates = [...this.nodes.values()].filter((node) => node.type === type).sort((a, b) => b.version - a.version);
|
|
53
|
+
return candidates[0];
|
|
54
|
+
}
|
|
55
|
+
list() {
|
|
56
|
+
return [...this.nodes.values()];
|
|
57
|
+
}
|
|
58
|
+
key(type, version) {
|
|
59
|
+
return `${type}@${version}`;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
DEFAULT_RETRY_CONFIG,
|
|
65
|
+
InMemoryNodeRegistry
|
|
66
|
+
});
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { DEFAULT_RETRY_CONFIG, ExecutableEdge, ExecutableNode, ExecutableWorkflow, ExecutionOptions, ExecutionProgressEvent, ExecutionStatus, ExtensionPack, InMemoryNodeRegistry, NodeDefinition, NodeExecutionContext, NodeExecutionStatus, NodeRegistry, NodeSchema, NodeStatusChangeEvent, RetryConfig, ValidationError, ValidationResult, ValidationWarning, WorkflowLifecycle } from './contracts/index.mjs';
|
|
1
2
|
import { ComfyUIPrompt, ComfyUIQueuePromptResponse, ComfyUIHistoryEntry, ComfyUIWorkflowTemplate, WorkflowNode, WorkflowEdge } from '@genfeedai/types';
|
|
2
3
|
|
|
3
4
|
interface ComfyUIClientOptions {
|
|
@@ -125,13 +126,12 @@ interface Flux2KleinParams {
|
|
|
125
126
|
steps?: number;
|
|
126
127
|
}
|
|
127
128
|
declare function buildFlux2KleinPrompt(params: Flux2KleinParams): ComfyUIPrompt;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*/
|
|
129
|
+
interface ZImageTurboLoraParams extends ZImageTurboParams {
|
|
130
|
+
loraPath: string;
|
|
131
|
+
loraStrength?: number;
|
|
132
|
+
upscaleModel?: string;
|
|
133
|
+
}
|
|
134
|
+
declare function buildZImageTurboLoraPrompt(params: ZImageTurboLoraParams): ComfyUIPrompt;
|
|
135
135
|
|
|
136
136
|
interface WorkflowJson {
|
|
137
137
|
version: number;
|
|
@@ -189,4 +189,4 @@ declare function getWorkflowsByCategory(category: WorkflowMetadata['category']):
|
|
|
189
189
|
*/
|
|
190
190
|
declare function searchWorkflowsByTag(tag: string): WorkflowMetadata[];
|
|
191
191
|
|
|
192
|
-
export { ComfyUIClient, type ComfyUIClientOptions, ComfyUITemplateRunner, type Flux2DevParams, type Flux2KleinParams, type Flux2PulidLoraParams, type Flux2PulidParams, type Flux2PulidUpscaleParams, type FluxDevParams, type PulidFluxParams, WORKFLOW_REGISTRY, type WorkflowJson, type WorkflowMetadata, type ZImageTurboParams, buildFlux2DevPrompt, buildFlux2DevPulidLoraPrompt, buildFlux2DevPulidPrompt, buildFlux2DevPulidUpscalePrompt, buildFlux2KleinPrompt, buildFluxDevPrompt, buildPulidFluxPrompt, buildZImageTurboPrompt, getAllWorkflows, getWorkflow, getWorkflowIds, getWorkflowJson, getWorkflowMetadata, getWorkflowsByCategory, searchWorkflowsByTag };
|
|
192
|
+
export { ComfyUIClient, type ComfyUIClientOptions, ComfyUITemplateRunner, type Flux2DevParams, type Flux2KleinParams, type Flux2PulidLoraParams, type Flux2PulidParams, type Flux2PulidUpscaleParams, type FluxDevParams, type PulidFluxParams, WORKFLOW_REGISTRY, type WorkflowJson, type WorkflowMetadata, type ZImageTurboLoraParams, type ZImageTurboParams, buildFlux2DevPrompt, buildFlux2DevPulidLoraPrompt, buildFlux2DevPulidPrompt, buildFlux2DevPulidUpscalePrompt, buildFlux2KleinPrompt, buildFluxDevPrompt, buildPulidFluxPrompt, buildZImageTurboLoraPrompt, buildZImageTurboPrompt, getAllWorkflows, getWorkflow, getWorkflowIds, getWorkflowJson, getWorkflowMetadata, getWorkflowsByCategory, searchWorkflowsByTag };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { DEFAULT_RETRY_CONFIG, ExecutableEdge, ExecutableNode, ExecutableWorkflow, ExecutionOptions, ExecutionProgressEvent, ExecutionStatus, ExtensionPack, InMemoryNodeRegistry, NodeDefinition, NodeExecutionContext, NodeExecutionStatus, NodeRegistry, NodeSchema, NodeStatusChangeEvent, RetryConfig, ValidationError, ValidationResult, ValidationWarning, WorkflowLifecycle } from './contracts/index.js';
|
|
1
2
|
import { ComfyUIPrompt, ComfyUIQueuePromptResponse, ComfyUIHistoryEntry, ComfyUIWorkflowTemplate, WorkflowNode, WorkflowEdge } from '@genfeedai/types';
|
|
2
3
|
|
|
3
4
|
interface ComfyUIClientOptions {
|
|
@@ -125,13 +126,12 @@ interface Flux2KleinParams {
|
|
|
125
126
|
steps?: number;
|
|
126
127
|
}
|
|
127
128
|
declare function buildFlux2KleinPrompt(params: Flux2KleinParams): ComfyUIPrompt;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*/
|
|
129
|
+
interface ZImageTurboLoraParams extends ZImageTurboParams {
|
|
130
|
+
loraPath: string;
|
|
131
|
+
loraStrength?: number;
|
|
132
|
+
upscaleModel?: string;
|
|
133
|
+
}
|
|
134
|
+
declare function buildZImageTurboLoraPrompt(params: ZImageTurboLoraParams): ComfyUIPrompt;
|
|
135
135
|
|
|
136
136
|
interface WorkflowJson {
|
|
137
137
|
version: number;
|
|
@@ -189,4 +189,4 @@ declare function getWorkflowsByCategory(category: WorkflowMetadata['category']):
|
|
|
189
189
|
*/
|
|
190
190
|
declare function searchWorkflowsByTag(tag: string): WorkflowMetadata[];
|
|
191
191
|
|
|
192
|
-
export { ComfyUIClient, type ComfyUIClientOptions, ComfyUITemplateRunner, type Flux2DevParams, type Flux2KleinParams, type Flux2PulidLoraParams, type Flux2PulidParams, type Flux2PulidUpscaleParams, type FluxDevParams, type PulidFluxParams, WORKFLOW_REGISTRY, type WorkflowJson, type WorkflowMetadata, type ZImageTurboParams, buildFlux2DevPrompt, buildFlux2DevPulidLoraPrompt, buildFlux2DevPulidPrompt, buildFlux2DevPulidUpscalePrompt, buildFlux2KleinPrompt, buildFluxDevPrompt, buildPulidFluxPrompt, buildZImageTurboPrompt, getAllWorkflows, getWorkflow, getWorkflowIds, getWorkflowJson, getWorkflowMetadata, getWorkflowsByCategory, searchWorkflowsByTag };
|
|
192
|
+
export { ComfyUIClient, type ComfyUIClientOptions, ComfyUITemplateRunner, type Flux2DevParams, type Flux2KleinParams, type Flux2PulidLoraParams, type Flux2PulidParams, type Flux2PulidUpscaleParams, type FluxDevParams, type PulidFluxParams, WORKFLOW_REGISTRY, type WorkflowJson, type WorkflowMetadata, type ZImageTurboLoraParams, type ZImageTurboParams, buildFlux2DevPrompt, buildFlux2DevPulidLoraPrompt, buildFlux2DevPulidPrompt, buildFlux2DevPulidUpscalePrompt, buildFlux2KleinPrompt, buildFluxDevPrompt, buildPulidFluxPrompt, buildZImageTurboLoraPrompt, buildZImageTurboPrompt, getAllWorkflows, getWorkflow, getWorkflowIds, getWorkflowJson, getWorkflowMetadata, getWorkflowsByCategory, searchWorkflowsByTag };
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,8 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ComfyUIClient: () => ComfyUIClient,
|
|
34
34
|
ComfyUITemplateRunner: () => ComfyUITemplateRunner,
|
|
35
|
+
DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
|
|
36
|
+
InMemoryNodeRegistry: () => InMemoryNodeRegistry,
|
|
35
37
|
WORKFLOW_REGISTRY: () => WORKFLOW_REGISTRY,
|
|
36
38
|
buildFlux2DevPrompt: () => buildFlux2DevPrompt,
|
|
37
39
|
buildFlux2DevPulidLoraPrompt: () => buildFlux2DevPulidLoraPrompt,
|
|
@@ -40,6 +42,7 @@ __export(index_exports, {
|
|
|
40
42
|
buildFlux2KleinPrompt: () => buildFlux2KleinPrompt,
|
|
41
43
|
buildFluxDevPrompt: () => buildFluxDevPrompt,
|
|
42
44
|
buildPulidFluxPrompt: () => buildPulidFluxPrompt,
|
|
45
|
+
buildZImageTurboLoraPrompt: () => buildZImageTurboLoraPrompt,
|
|
43
46
|
buildZImageTurboPrompt: () => buildZImageTurboPrompt,
|
|
44
47
|
getAllWorkflows: () => getAllWorkflows,
|
|
45
48
|
getWorkflow: () => getWorkflow,
|
|
@@ -51,6 +54,41 @@ __export(index_exports, {
|
|
|
51
54
|
});
|
|
52
55
|
module.exports = __toCommonJS(index_exports);
|
|
53
56
|
|
|
57
|
+
// src/contracts/execution.ts
|
|
58
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
59
|
+
backoffMultiplier: 2,
|
|
60
|
+
baseDelayMs: 1e3,
|
|
61
|
+
maxDelayMs: 3e4,
|
|
62
|
+
maxRetries: 3
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// src/extensions/registry.ts
|
|
66
|
+
var InMemoryNodeRegistry = class {
|
|
67
|
+
nodes = /* @__PURE__ */ new Map();
|
|
68
|
+
register(node) {
|
|
69
|
+
this.nodes.set(this.key(node.type, node.version), node);
|
|
70
|
+
}
|
|
71
|
+
registerMany(nodes) {
|
|
72
|
+
for (const node of nodes) this.register(node);
|
|
73
|
+
}
|
|
74
|
+
registerPack(pack) {
|
|
75
|
+
this.registerMany(pack.nodes);
|
|
76
|
+
}
|
|
77
|
+
get(type, version) {
|
|
78
|
+
if (version !== void 0) {
|
|
79
|
+
return this.nodes.get(this.key(type, version));
|
|
80
|
+
}
|
|
81
|
+
const candidates = [...this.nodes.values()].filter((node) => node.type === type).sort((a, b) => b.version - a.version);
|
|
82
|
+
return candidates[0];
|
|
83
|
+
}
|
|
84
|
+
list() {
|
|
85
|
+
return [...this.nodes.values()];
|
|
86
|
+
}
|
|
87
|
+
key(type, version) {
|
|
88
|
+
return `${type}@${version}`;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
54
92
|
// src/comfyui/client.ts
|
|
55
93
|
var DEFAULT_POLL_MS = 2e3;
|
|
56
94
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
@@ -1015,6 +1053,114 @@ function buildFlux2KleinPrompt(params) {
|
|
|
1015
1053
|
}
|
|
1016
1054
|
};
|
|
1017
1055
|
}
|
|
1056
|
+
function buildZImageTurboLoraPrompt(params) {
|
|
1057
|
+
const {
|
|
1058
|
+
prompt,
|
|
1059
|
+
loraPath,
|
|
1060
|
+
seed = Math.floor(Math.random() * 2 ** 32),
|
|
1061
|
+
width = 832,
|
|
1062
|
+
height = 1216,
|
|
1063
|
+
steps = 8,
|
|
1064
|
+
loraStrength = 0.8,
|
|
1065
|
+
upscaleModel = "4x-UltraSharp.pth"
|
|
1066
|
+
} = params;
|
|
1067
|
+
return {
|
|
1068
|
+
"1": {
|
|
1069
|
+
class_type: "UNETLoader",
|
|
1070
|
+
inputs: {
|
|
1071
|
+
unet_name: "z_image_turbo_bf16.safetensors",
|
|
1072
|
+
weight_dtype: "default"
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
"2": {
|
|
1076
|
+
class_type: "CLIPLoader",
|
|
1077
|
+
inputs: {
|
|
1078
|
+
clip_name: "qwen_3_4b.safetensors",
|
|
1079
|
+
type: "lumina2"
|
|
1080
|
+
}
|
|
1081
|
+
},
|
|
1082
|
+
"3": {
|
|
1083
|
+
class_type: "LoraLoader",
|
|
1084
|
+
inputs: {
|
|
1085
|
+
model: ["1", 0],
|
|
1086
|
+
clip: ["2", 0],
|
|
1087
|
+
lora_name: loraPath,
|
|
1088
|
+
strength_model: loraStrength,
|
|
1089
|
+
strength_clip: loraStrength
|
|
1090
|
+
}
|
|
1091
|
+
},
|
|
1092
|
+
"4": {
|
|
1093
|
+
class_type: "CLIPTextEncode",
|
|
1094
|
+
inputs: {
|
|
1095
|
+
text: prompt,
|
|
1096
|
+
clip: ["3", 1]
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
"5": {
|
|
1100
|
+
class_type: "CLIPTextEncode",
|
|
1101
|
+
inputs: {
|
|
1102
|
+
text: "",
|
|
1103
|
+
clip: ["3", 1]
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
"6": {
|
|
1107
|
+
class_type: "EmptyLatentImage",
|
|
1108
|
+
inputs: {
|
|
1109
|
+
width,
|
|
1110
|
+
height,
|
|
1111
|
+
batch_size: 1
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
"7": {
|
|
1115
|
+
class_type: "KSampler",
|
|
1116
|
+
inputs: {
|
|
1117
|
+
model: ["3", 0],
|
|
1118
|
+
positive: ["4", 0],
|
|
1119
|
+
negative: ["5", 0],
|
|
1120
|
+
latent_image: ["6", 0],
|
|
1121
|
+
seed,
|
|
1122
|
+
steps,
|
|
1123
|
+
cfg: 1,
|
|
1124
|
+
sampler_name: "euler_ancestral",
|
|
1125
|
+
scheduler: "normal",
|
|
1126
|
+
denoise: 1
|
|
1127
|
+
}
|
|
1128
|
+
},
|
|
1129
|
+
"8": {
|
|
1130
|
+
class_type: "VAELoader",
|
|
1131
|
+
inputs: {
|
|
1132
|
+
vae_name: "ae.safetensors"
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
"9": {
|
|
1136
|
+
class_type: "VAEDecode",
|
|
1137
|
+
inputs: {
|
|
1138
|
+
samples: ["7", 0],
|
|
1139
|
+
vae: ["8", 0]
|
|
1140
|
+
}
|
|
1141
|
+
},
|
|
1142
|
+
"10": {
|
|
1143
|
+
class_type: "UpscaleModelLoader",
|
|
1144
|
+
inputs: {
|
|
1145
|
+
model_name: upscaleModel
|
|
1146
|
+
}
|
|
1147
|
+
},
|
|
1148
|
+
"11": {
|
|
1149
|
+
class_type: "ImageUpscaleWithModel",
|
|
1150
|
+
inputs: {
|
|
1151
|
+
upscale_model: ["10", 0],
|
|
1152
|
+
image: ["9", 0]
|
|
1153
|
+
}
|
|
1154
|
+
},
|
|
1155
|
+
"12": {
|
|
1156
|
+
class_type: "SaveImage",
|
|
1157
|
+
inputs: {
|
|
1158
|
+
images: ["11", 0],
|
|
1159
|
+
filename_prefix: "genfeed-z-turbo-lora"
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1018
1164
|
|
|
1019
1165
|
// src/index.ts
|
|
1020
1166
|
var fs = __toESM(require("fs"));
|
|
@@ -1132,6 +1278,8 @@ function searchWorkflowsByTag(tag) {
|
|
|
1132
1278
|
0 && (module.exports = {
|
|
1133
1279
|
ComfyUIClient,
|
|
1134
1280
|
ComfyUITemplateRunner,
|
|
1281
|
+
DEFAULT_RETRY_CONFIG,
|
|
1282
|
+
InMemoryNodeRegistry,
|
|
1135
1283
|
WORKFLOW_REGISTRY,
|
|
1136
1284
|
buildFlux2DevPrompt,
|
|
1137
1285
|
buildFlux2DevPulidLoraPrompt,
|
|
@@ -1140,6 +1288,7 @@ function searchWorkflowsByTag(tag) {
|
|
|
1140
1288
|
buildFlux2KleinPrompt,
|
|
1141
1289
|
buildFluxDevPrompt,
|
|
1142
1290
|
buildPulidFluxPrompt,
|
|
1291
|
+
buildZImageTurboLoraPrompt,
|
|
1143
1292
|
buildZImageTurboPrompt,
|
|
1144
1293
|
getAllWorkflows,
|
|
1145
1294
|
getWorkflow,
|