@genfeedai/workflows 0.2.0 → 0.3.1
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 +14 -78
- 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 +1 -7
- package/dist/index.d.ts +1 -7
- package/dist/index.js +39 -0
- package/dist/index.mjs +7 -0
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -1,96 +1,32 @@
|
|
|
1
1
|
# @genfeedai/workflows
|
|
2
2
|
|
|
3
|
-
Official workflow templates
|
|
3
|
+
Official Genfeed workflow templates and registry helpers.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
# or
|
|
10
|
-
bun add @genfeedai/workflows
|
|
8
|
+
npm i @genfeedai/workflows
|
|
11
9
|
```
|
|
12
10
|
|
|
13
11
|
## Usage
|
|
14
12
|
|
|
15
|
-
|
|
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
|
|
13
|
+
```ts
|
|
14
|
+
import { WORKFLOW_REGISTRY, getWorkflowMetadata } from '@genfeedai/workflows';
|
|
46
15
|
import singleImage from '@genfeedai/workflows/workflows/single-image.json';
|
|
47
|
-
import singleVideo from '@genfeedai/workflows/workflows/single-video.json';
|
|
48
|
-
```
|
|
49
16
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
17
|
+
const meta = getWorkflowMetadata('single-image');
|
|
18
|
+
console.log(meta?.title, singleImage.nodes.length);
|
|
19
|
+
```
|
|
73
20
|
|
|
74
|
-
|
|
21
|
+
## Related Packages
|
|
75
22
|
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
```
|
|
23
|
+
- `@genfeedai/types`
|
|
24
|
+
- `@genfeedai/prompts`
|
|
89
25
|
|
|
90
|
-
##
|
|
26
|
+
## Build Faster with Genfeed
|
|
91
27
|
|
|
92
|
-
|
|
28
|
+
Use production-ready templates in code, or run them in Genfeed at [https://genfeed.ai](https://genfeed.ai).
|
|
93
29
|
|
|
94
30
|
## License
|
|
95
31
|
|
|
96
|
-
|
|
32
|
+
MIT
|
|
@@ -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 {
|
|
@@ -132,13 +133,6 @@ interface ZImageTurboLoraParams extends ZImageTurboParams {
|
|
|
132
133
|
}
|
|
133
134
|
declare function buildZImageTurboLoraPrompt(params: ZImageTurboLoraParams): ComfyUIPrompt;
|
|
134
135
|
|
|
135
|
-
/**
|
|
136
|
-
* Workflow Registry for @genfeedai/workflows
|
|
137
|
-
*
|
|
138
|
-
* This registry contains metadata for all official workflow templates.
|
|
139
|
-
* The actual workflow JSON files are stored in the `workflows/` directory.
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
136
|
interface WorkflowJson {
|
|
143
137
|
version: number;
|
|
144
138
|
name: string;
|
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 {
|
|
@@ -132,13 +133,6 @@ interface ZImageTurboLoraParams extends ZImageTurboParams {
|
|
|
132
133
|
}
|
|
133
134
|
declare function buildZImageTurboLoraPrompt(params: ZImageTurboLoraParams): ComfyUIPrompt;
|
|
134
135
|
|
|
135
|
-
/**
|
|
136
|
-
* Workflow Registry for @genfeedai/workflows
|
|
137
|
-
*
|
|
138
|
-
* This registry contains metadata for all official workflow templates.
|
|
139
|
-
* The actual workflow JSON files are stored in the `workflows/` directory.
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
136
|
interface WorkflowJson {
|
|
143
137
|
version: number;
|
|
144
138
|
name: string;
|
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,
|
|
@@ -52,6 +54,41 @@ __export(index_exports, {
|
|
|
52
54
|
});
|
|
53
55
|
module.exports = __toCommonJS(index_exports);
|
|
54
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
|
+
|
|
55
92
|
// src/comfyui/client.ts
|
|
56
93
|
var DEFAULT_POLL_MS = 2e3;
|
|
57
94
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
@@ -1241,6 +1278,8 @@ function searchWorkflowsByTag(tag) {
|
|
|
1241
1278
|
0 && (module.exports = {
|
|
1242
1279
|
ComfyUIClient,
|
|
1243
1280
|
ComfyUITemplateRunner,
|
|
1281
|
+
DEFAULT_RETRY_CONFIG,
|
|
1282
|
+
InMemoryNodeRegistry,
|
|
1244
1283
|
WORKFLOW_REGISTRY,
|
|
1245
1284
|
buildFlux2DevPrompt,
|
|
1246
1285
|
buildFlux2DevPulidLoraPrompt,
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_RETRY_CONFIG,
|
|
3
|
+
InMemoryNodeRegistry
|
|
4
|
+
} from "./chunk-CTZNKWZB.mjs";
|
|
5
|
+
|
|
1
6
|
// src/comfyui/client.ts
|
|
2
7
|
var DEFAULT_POLL_MS = 2e3;
|
|
3
8
|
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
@@ -1186,6 +1191,8 @@ function searchWorkflowsByTag(tag) {
|
|
|
1186
1191
|
export {
|
|
1187
1192
|
ComfyUIClient,
|
|
1188
1193
|
ComfyUITemplateRunner,
|
|
1194
|
+
DEFAULT_RETRY_CONFIG,
|
|
1195
|
+
InMemoryNodeRegistry,
|
|
1189
1196
|
WORKFLOW_REGISTRY,
|
|
1190
1197
|
buildFlux2DevPrompt,
|
|
1191
1198
|
buildFlux2DevPulidLoraPrompt,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genfeedai/workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -25,20 +25,27 @@
|
|
|
25
25
|
"import": "./dist/comfyui/index.mjs",
|
|
26
26
|
"require": "./dist/comfyui/index.js"
|
|
27
27
|
},
|
|
28
|
-
"./workflows/*": "./workflows/*"
|
|
28
|
+
"./workflows/*": "./workflows/*",
|
|
29
|
+
"./contracts": {
|
|
30
|
+
"types": "./dist/contracts/index.d.ts",
|
|
31
|
+
"import": "./dist/contracts/index.mjs",
|
|
32
|
+
"require": "./dist/contracts/index.js"
|
|
33
|
+
}
|
|
29
34
|
},
|
|
30
35
|
"files": [
|
|
31
36
|
"dist",
|
|
32
37
|
"workflows",
|
|
33
38
|
"metadata"
|
|
34
39
|
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@genfeedai/types": "^0.2.2"
|
|
42
|
+
},
|
|
35
43
|
"scripts": {
|
|
36
|
-
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
37
|
-
"dev": "tsup src/index.ts --format esm,cjs --dts --watch",
|
|
44
|
+
"build": "tsup src/index.ts src/contracts/index.ts --format esm,cjs --dts --clean",
|
|
45
|
+
"dev": "tsup src/index.ts src/contracts/index.ts --format esm,cjs --dts --watch",
|
|
38
46
|
"prepublishOnly": "bun run build"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
|
-
"@genfeedai/types": "^0.2.0",
|
|
42
49
|
"@types/node": "^25.2.3",
|
|
43
50
|
"tsup": "8.4.0",
|
|
44
51
|
"typescript": "5.9.3"
|