@reaatech/media-pipeline-mcp-comfyui 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/LICENSE +21 -0
- package/README.md +240 -0
- package/dist/index.cjs +662 -0
- package/dist/index.d.cts +76 -0
- package/dist/index.d.ts +76 -0
- package/dist/index.js +628 -0
- package/package.json +49 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { MediaProvider, ProviderCacheConfig, ProviderHealth, ProviderInput, CostEstimate, ProviderOutput } from '@reaatech/media-pipeline-mcp-provider-core';
|
|
2
|
+
|
|
3
|
+
interface ComfyUIConfig {
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
workflowsDir?: string;
|
|
6
|
+
downloadOutputs?: boolean;
|
|
7
|
+
pollIntervalMs?: number;
|
|
8
|
+
retentionMs?: number;
|
|
9
|
+
}
|
|
10
|
+
interface ComfyParamSpec {
|
|
11
|
+
path: string;
|
|
12
|
+
type: 'string' | 'number' | 'boolean' | 'enum';
|
|
13
|
+
enum?: string[];
|
|
14
|
+
default?: unknown;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface ComfyUIWorkflow {
|
|
18
|
+
name: string;
|
|
19
|
+
apiFormat: object;
|
|
20
|
+
inputs: Record<string, ComfyParamSpec>;
|
|
21
|
+
outputs: Record<string, 'image' | 'video' | 'mask' | 'latent'>;
|
|
22
|
+
}
|
|
23
|
+
declare class ComfyUIProvider extends MediaProvider {
|
|
24
|
+
static readonly id = "comfyui";
|
|
25
|
+
readonly name = "comfyui";
|
|
26
|
+
readonly supportedOperations: string[];
|
|
27
|
+
/**
|
|
28
|
+
* §0.6 capability declarations. ComfyUI exposes per-node progress as it executes a
|
|
29
|
+
* workflow (we surface it via the F6 progress bridge during pollForCompletion), but
|
|
30
|
+
* does not push outbound webhooks.
|
|
31
|
+
*/
|
|
32
|
+
readonly supportsStreaming: Set<string>;
|
|
33
|
+
readonly supportsWebhooks = false;
|
|
34
|
+
/**
|
|
35
|
+
* F2 cacheConfig per plan §F10 "Per-implementation features":
|
|
36
|
+
* "det per fixed `seed`; cache enabled when seed is provided and non-negative"
|
|
37
|
+
*
|
|
38
|
+
* All workflow inputs are deterministic given a fixed seed. The non-det list is
|
|
39
|
+
* empty because there is no provider-side request id (ComfyUI's `prompt_id` is
|
|
40
|
+
* generated post-submit and is not user-supplied). Normalize trims string params.
|
|
41
|
+
*/
|
|
42
|
+
static cacheConfig: ProviderCacheConfig;
|
|
43
|
+
private baseUrl;
|
|
44
|
+
private pollIntervalMs;
|
|
45
|
+
private retentionMs;
|
|
46
|
+
private downloadOutputs;
|
|
47
|
+
private workflows;
|
|
48
|
+
private workflowsDir?;
|
|
49
|
+
private workflowsDirLoaded;
|
|
50
|
+
constructor(config?: ComfyUIConfig);
|
|
51
|
+
/**
|
|
52
|
+
* Plan §F10 "Mechanism (ComfyUI) #1": load user workflows from `workflowsDir/*.json`
|
|
53
|
+
* at construction time. We do it lazily (first execute / explicit call) so that the
|
|
54
|
+
* constructor stays sync and tests can mock fs.
|
|
55
|
+
*
|
|
56
|
+
* Each file becomes `custom/<basename>` workflow. The JSON must declare `apiFormat`,
|
|
57
|
+
* `inputs`, and `outputs` keys (the ComfyUIWorkflow shape). Files that don't match
|
|
58
|
+
* the shape are skipped with a warning.
|
|
59
|
+
*/
|
|
60
|
+
loadWorkflowsFromDir(): Promise<void>;
|
|
61
|
+
healthCheck(): Promise<ProviderHealth>;
|
|
62
|
+
estimateCost(_input: ProviderInput): Promise<CostEstimate>;
|
|
63
|
+
registerWorkflow(name: string, workflow: ComfyUIWorkflow): void;
|
|
64
|
+
getWorkflow(name: string): ComfyUIWorkflow | undefined;
|
|
65
|
+
listWorkflows(): string[];
|
|
66
|
+
execute(input: ProviderInput): Promise<ProviderOutput>;
|
|
67
|
+
private resolveWorkflowName;
|
|
68
|
+
private runWorkflow;
|
|
69
|
+
private pollForCompletion;
|
|
70
|
+
private setNestedValue;
|
|
71
|
+
private mimeTypeFromFilename;
|
|
72
|
+
private sleep;
|
|
73
|
+
}
|
|
74
|
+
declare function createComfyUIProvider(config?: ComfyUIConfig): ComfyUIProvider;
|
|
75
|
+
|
|
76
|
+
export { type ComfyParamSpec, type ComfyUIConfig, ComfyUIProvider, type ComfyUIWorkflow, createComfyUIProvider };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { MediaProvider, ProviderCacheConfig, ProviderHealth, ProviderInput, CostEstimate, ProviderOutput } from '@reaatech/media-pipeline-mcp-provider-core';
|
|
2
|
+
|
|
3
|
+
interface ComfyUIConfig {
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
workflowsDir?: string;
|
|
6
|
+
downloadOutputs?: boolean;
|
|
7
|
+
pollIntervalMs?: number;
|
|
8
|
+
retentionMs?: number;
|
|
9
|
+
}
|
|
10
|
+
interface ComfyParamSpec {
|
|
11
|
+
path: string;
|
|
12
|
+
type: 'string' | 'number' | 'boolean' | 'enum';
|
|
13
|
+
enum?: string[];
|
|
14
|
+
default?: unknown;
|
|
15
|
+
required?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface ComfyUIWorkflow {
|
|
18
|
+
name: string;
|
|
19
|
+
apiFormat: object;
|
|
20
|
+
inputs: Record<string, ComfyParamSpec>;
|
|
21
|
+
outputs: Record<string, 'image' | 'video' | 'mask' | 'latent'>;
|
|
22
|
+
}
|
|
23
|
+
declare class ComfyUIProvider extends MediaProvider {
|
|
24
|
+
static readonly id = "comfyui";
|
|
25
|
+
readonly name = "comfyui";
|
|
26
|
+
readonly supportedOperations: string[];
|
|
27
|
+
/**
|
|
28
|
+
* §0.6 capability declarations. ComfyUI exposes per-node progress as it executes a
|
|
29
|
+
* workflow (we surface it via the F6 progress bridge during pollForCompletion), but
|
|
30
|
+
* does not push outbound webhooks.
|
|
31
|
+
*/
|
|
32
|
+
readonly supportsStreaming: Set<string>;
|
|
33
|
+
readonly supportsWebhooks = false;
|
|
34
|
+
/**
|
|
35
|
+
* F2 cacheConfig per plan §F10 "Per-implementation features":
|
|
36
|
+
* "det per fixed `seed`; cache enabled when seed is provided and non-negative"
|
|
37
|
+
*
|
|
38
|
+
* All workflow inputs are deterministic given a fixed seed. The non-det list is
|
|
39
|
+
* empty because there is no provider-side request id (ComfyUI's `prompt_id` is
|
|
40
|
+
* generated post-submit and is not user-supplied). Normalize trims string params.
|
|
41
|
+
*/
|
|
42
|
+
static cacheConfig: ProviderCacheConfig;
|
|
43
|
+
private baseUrl;
|
|
44
|
+
private pollIntervalMs;
|
|
45
|
+
private retentionMs;
|
|
46
|
+
private downloadOutputs;
|
|
47
|
+
private workflows;
|
|
48
|
+
private workflowsDir?;
|
|
49
|
+
private workflowsDirLoaded;
|
|
50
|
+
constructor(config?: ComfyUIConfig);
|
|
51
|
+
/**
|
|
52
|
+
* Plan §F10 "Mechanism (ComfyUI) #1": load user workflows from `workflowsDir/*.json`
|
|
53
|
+
* at construction time. We do it lazily (first execute / explicit call) so that the
|
|
54
|
+
* constructor stays sync and tests can mock fs.
|
|
55
|
+
*
|
|
56
|
+
* Each file becomes `custom/<basename>` workflow. The JSON must declare `apiFormat`,
|
|
57
|
+
* `inputs`, and `outputs` keys (the ComfyUIWorkflow shape). Files that don't match
|
|
58
|
+
* the shape are skipped with a warning.
|
|
59
|
+
*/
|
|
60
|
+
loadWorkflowsFromDir(): Promise<void>;
|
|
61
|
+
healthCheck(): Promise<ProviderHealth>;
|
|
62
|
+
estimateCost(_input: ProviderInput): Promise<CostEstimate>;
|
|
63
|
+
registerWorkflow(name: string, workflow: ComfyUIWorkflow): void;
|
|
64
|
+
getWorkflow(name: string): ComfyUIWorkflow | undefined;
|
|
65
|
+
listWorkflows(): string[];
|
|
66
|
+
execute(input: ProviderInput): Promise<ProviderOutput>;
|
|
67
|
+
private resolveWorkflowName;
|
|
68
|
+
private runWorkflow;
|
|
69
|
+
private pollForCompletion;
|
|
70
|
+
private setNestedValue;
|
|
71
|
+
private mimeTypeFromFilename;
|
|
72
|
+
private sleep;
|
|
73
|
+
}
|
|
74
|
+
declare function createComfyUIProvider(config?: ComfyUIConfig): ComfyUIProvider;
|
|
75
|
+
|
|
76
|
+
export { type ComfyParamSpec, type ComfyUIConfig, ComfyUIProvider, type ComfyUIWorkflow, createComfyUIProvider };
|