@comfyorg/comfyui-desktop-bridge-types 0.2.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/comfyDesktopBridge.d.ts +67 -0
- package/package.json +1 -1
package/comfyDesktopBridge.d.ts
CHANGED
|
@@ -14,7 +14,61 @@ export interface ComfyDownloadProgress {
|
|
|
14
14
|
status: 'pending' | 'downloading' | 'paused' | 'completed' | 'error' | 'cancelled'
|
|
15
15
|
error?: string
|
|
16
16
|
isImage?: boolean
|
|
17
|
+
/**
|
|
18
|
+
* The template inputs this transfer serves, named by the host on every
|
|
19
|
+
* event. A retry mints a new job id, and a renderer that dropped the old
|
|
20
|
+
* mapping has no way back to it; naming the inputs here removes the need
|
|
21
|
+
* to correlate by id at all.
|
|
22
|
+
*/
|
|
23
|
+
templateInputs?: ComfyTemplateInputReference[]
|
|
17
24
|
}
|
|
25
|
+
export interface ComfyTemplateInputReference {
|
|
26
|
+
templateId: string
|
|
27
|
+
assetId: string
|
|
28
|
+
}
|
|
29
|
+
export interface ComfyTemplateInputAssetDownload {
|
|
30
|
+
downloadId: string
|
|
31
|
+
filename: string
|
|
32
|
+
progress: number
|
|
33
|
+
receivedBytes?: number
|
|
34
|
+
totalBytes?: number
|
|
35
|
+
status: ComfyDownloadProgress['status']
|
|
36
|
+
error?: string
|
|
37
|
+
}
|
|
38
|
+
export interface ComfyTemplateInputDownloadProgress extends ComfyTemplateInputAssetDownload {
|
|
39
|
+
/** Every template asset currently sharing this managed download job. */
|
|
40
|
+
templateInputs: ComfyTemplateInputReference[]
|
|
41
|
+
}
|
|
42
|
+
export interface ComfyTemplateInputAsset {
|
|
43
|
+
/** Opaque, template-scoped identifier accepted by `downloadTemplateInputAsset`. */
|
|
44
|
+
assetId: string
|
|
45
|
+
filename: string
|
|
46
|
+
mediaType: 'image' | 'video' | 'audio'
|
|
47
|
+
/** Desktop-resolved public URL for previewing this declared template asset. */
|
|
48
|
+
previewUrl: string
|
|
49
|
+
availability: 'present' | 'missing' | 'unknown'
|
|
50
|
+
/** Present when this exact asset destination already has a managed job. */
|
|
51
|
+
activeDownload?: ComfyTemplateInputAssetDownload
|
|
52
|
+
}
|
|
53
|
+
export type ComfyTemplateInputAssetDownloadResult =
|
|
54
|
+
| {
|
|
55
|
+
status: 'already-present'
|
|
56
|
+
/**
|
|
57
|
+
* No job exists for a file that is already on disk, so nothing would
|
|
58
|
+
* report it. Naming it lets the host emit one terminal progress event,
|
|
59
|
+
* which is the only channel a renderer watches.
|
|
60
|
+
*/
|
|
61
|
+
filename: string
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
status: 'accepted' | 'joined'
|
|
65
|
+
/** Admission snapshot seeds UI state even if the first IPC event raced ahead. */
|
|
66
|
+
download: ComfyTemplateInputAssetDownload
|
|
67
|
+
}
|
|
68
|
+
| {
|
|
69
|
+
status: 'not-started'
|
|
70
|
+
reason: 'invalid-request' | 'not-declared' | 'unavailable'
|
|
71
|
+
}
|
|
18
72
|
export interface TerminalRestore {
|
|
19
73
|
buffer: string[]
|
|
20
74
|
size: {
|
|
@@ -86,6 +140,19 @@ export interface ComfyDesktop2Bridge {
|
|
|
86
140
|
openModelAccessPage?: (url: string) => Promise<boolean>
|
|
87
141
|
downloadModel?: (url: string, filename: string, directory: string) => Promise<boolean>
|
|
88
142
|
downloadAsset?: (url: string, filename: string, authToken?: string) => Promise<boolean>
|
|
143
|
+
/** Resolve only assets declared by this template. `null` means Desktop cannot
|
|
144
|
+
* authorize the caller or resolve the metadata; `[]` means the resolved
|
|
145
|
+
* template declares none. */
|
|
146
|
+
getTemplateInputAssets?: (templateId: string) => Promise<ComfyTemplateInputAsset[] | null>
|
|
147
|
+
/** Start or join the managed download for one declared template asset. */
|
|
148
|
+
downloadTemplateInputAsset?: (
|
|
149
|
+
templateId: string,
|
|
150
|
+
assetId: string
|
|
151
|
+
) => Promise<ComfyTemplateInputAssetDownloadResult>
|
|
152
|
+
/** Download events decorated with the template asset identities that own the job. */
|
|
153
|
+
onTemplateInputDownloadProgress?: (
|
|
154
|
+
callback: (data: ComfyTemplateInputDownloadProgress) => void
|
|
155
|
+
) => () => void
|
|
89
156
|
pauseDownload?: (url: string) => Promise<boolean>
|
|
90
157
|
resumeDownload?: (url: string) => Promise<boolean>
|
|
91
158
|
cancelDownload?: (url: string) => Promise<boolean>
|