@comfyorg/comfyui-desktop-bridge-types 0.10.0 → 0.11.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 CHANGED
@@ -71,6 +71,15 @@ needs, and only for runs the page started; `onLocalEvent()` carries ComfyUI's
71
71
  updates for those runs. `localDownload()` saves a safetensors model from
72
72
  Hugging Face into that build's models folder.
73
73
 
74
+ `openInComfy({ prompt, where, name, build })` opens a run's API-format
75
+ workflow in a ComfyUI window in Desktop: the build the page runs on (or the
76
+ build `build` names, an id from `localBuilds()`) for `where: 'local'`, or the
77
+ person's Comfy Cloud for `where: 'cloud'`. Desktop starts the build or shows
78
+ its window if needed, and resolves `{ opened: true }` once ComfyUI has loaded
79
+ the workflow, or `{ opened: false, error }` with the reason in words. Both
80
+ members are absent on Desktop builds that predate them, so a page checks for
81
+ them and keeps its file download as the fallback.
82
+
74
83
  Both objects are absent in a browser, so a page keeps its own sign-in and its
75
84
  own way to reach a local ComfyUI as the fallback.
76
85
 
@@ -249,12 +249,41 @@ export interface ComfyDesktopLocalEvent {
249
249
  type: string
250
250
  data?: Record<string, unknown>
251
251
  }
252
+ /**
253
+ * A workflow a hosted page asks Desktop to open in a ComfyUI window.
254
+ * `prompt` is the API-format graph: an object of nodes that each have a
255
+ * `class_type` and `inputs`, at most 500 nodes and 1 MB. `where: 'local'`
256
+ * opens it in the build the page runs on, or in `build` (an id from
257
+ * `localBuilds`); `where: 'cloud'` opens it in the person's Comfy Cloud.
258
+ * `name` titles the workflow tab.
259
+ */
260
+ export interface ComfyDesktopOpenInComfyRequest {
261
+ prompt: Record<string, unknown>
262
+ where: 'local' | 'cloud'
263
+ name: string
264
+ build?: string
265
+ }
266
+ /** Whether the workflow opened, and if not, why in words for the person. */
267
+ export type ComfyDesktopOpenInComfy =
268
+ | {
269
+ opened: true
270
+ }
271
+ | {
272
+ opened: false
273
+ error: string
274
+ }
275
+ /** One of the person's ComfyUI builds on this computer. */
276
+ export interface ComfyDesktopLocalBuild {
277
+ id: string
278
+ name: string
279
+ }
252
280
  /**
253
281
  * A ComfyUI on this computer, run by Desktop, for a Comfy page hosted in
254
282
  * Desktop's Apps view. Desktop exposes it to that page as
255
283
  * `window.comfyDesktopLocal`. The page builds and follows its own runs;
256
- * Desktop finds or starts the ComfyUI, forwards the page's calls to it and
257
- * downloads a model the page asks for.
284
+ * Desktop finds or starts the ComfyUI, forwards the page's calls to it,
285
+ * downloads a model the page asks for and opens a run's workflow in a ComfyUI
286
+ * window.
258
287
  */
259
288
  export interface ComfyDesktopHostedLocalBridge {
260
289
  getLocal(want?: ComfyDesktopLocalRequirements): Promise<ComfyDesktopLocalComfy>
@@ -265,6 +294,14 @@ export interface ComfyDesktopHostedLocalBridge {
265
294
  /** Downloads into the running ComfyUI's models folder and resolves when the file is there. */
266
295
  localDownload(model: ComfyDesktopLocalModel): Promise<ComfyDesktopLocalDownload>
267
296
  onLocalEvent(callback: (event: ComfyDesktopLocalEvent) => void): () => void
297
+ /**
298
+ * Opens the workflow in a ComfyUI window in Desktop, starting the build or
299
+ * showing its window first if needed, and resolves once ComfyUI has loaded
300
+ * it. Absent on Desktop builds that predate it.
301
+ */
302
+ openInComfy?(request: ComfyDesktopOpenInComfyRequest): Promise<ComfyDesktopOpenInComfy>
303
+ /** The person's ComfyUI builds on this computer. Absent on Desktop builds that predate it. */
304
+ localBuilds?(): Promise<ComfyDesktopLocalBuild[]>
268
305
  }
269
306
  export interface ComfyDesktop2TerminalBridge {
270
307
  subscribe(installationId?: string): Promise<TerminalRestore>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-desktop-bridge-types",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "TypeScript definitions for the Comfy Desktop hosted frontend bridge",
5
5
  "type": "module",
6
6
  "main": "./index.js",