comfy-ts 1.2.0 → 1.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.
Files changed (42) hide show
  1. package/README.md +40 -0
  2. package/dist/DefinedWorkflow-gpknV-5f.js +686 -0
  3. package/dist/DefinedWorkflow-gpknV-5f.js.map +1 -0
  4. package/dist/DraftsSt-DmA0jWGl.js +434 -0
  5. package/dist/DraftsSt-DmA0jWGl.js.map +1 -0
  6. package/dist/cli.js +15 -5
  7. package/dist/cli.js.map +1 -1
  8. package/dist/index.cjs +132 -21
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +5 -0
  11. package/dist/index.d.ts +23 -18
  12. package/dist/index.js +132 -21
  13. package/dist/index.js.map +1 -1
  14. package/dist/run-serve-Bn6yIJB0.js +638 -0
  15. package/dist/run-serve-Bn6yIJB0.js.map +1 -0
  16. package/dist/{run-tui-BAdizWsO.js → run-tui-BtjaOXRh.js} +244 -440
  17. package/dist/run-tui-BtjaOXRh.js.map +1 -0
  18. package/dist/{state-BYbxDgfr.js → state-DKCPy105.js} +130 -698
  19. package/dist/state-DKCPy105.js.map +1 -0
  20. package/package.json +3 -2
  21. package/src/cli/comfy-ts-cli.ts +15 -5
  22. package/src/cli/serve/ServeApp.ts +378 -0
  23. package/src/cli/serve/applyVarPayload.ts +119 -0
  24. package/src/cli/serve/describeVar.ts +74 -0
  25. package/src/cli/serve/run-serve.ts +169 -0
  26. package/src/cli/tui/components/StatusBar.tsx +1 -0
  27. package/src/cli/tui/components/TreePanel.tsx +17 -3
  28. package/src/cli/tui/components/TuiApp.tsx +7 -2
  29. package/src/cli/tui/components/VarsPanel.tsx +67 -34
  30. package/src/cli/tui/imageClipboard.ts +39 -0
  31. package/src/cli/tui/listWindow.ts +36 -0
  32. package/src/cli/tui/state/ExecSt.ts +48 -0
  33. package/src/cli/tui/state/TreeSt.ts +25 -0
  34. package/src/cli/tui/state/TuiSt.ts +34 -0
  35. package/src/litegraph/convertFlowToLiteGraphJSON.ts +11 -7
  36. package/src/runner/ComfyExecution.ts +21 -4
  37. package/src/runner/outputPath.ts +75 -0
  38. package/src/sdk-generator/inputWidgetKind.ts +50 -11
  39. package/src/sdk-generator/litegraphToApiRequestPayload.ts +14 -7
  40. package/src/vars/ComfyVars.ts +8 -0
  41. package/dist/run-tui-BAdizWsO.js.map +0 -1
  42. package/dist/state-BYbxDgfr.js.map +0 -1
package/README.md CHANGED
@@ -309,11 +309,51 @@ bunx comfy-ts gen --id my-gpu --host http://127.0.0.1:8188
309
309
  bunx comfy-ts outline # what's inside that 2MB sdk.d.ts?
310
310
  bunx comfy-ts tui # your *.cflow.ts + bundled examples
311
311
  bunx comfy-ts tui [dir | module] # scan just that
312
+ bunx comfy-ts serve [dir | module] # drafts as a local HTTP API (below)
312
313
  ```
313
314
 
314
315
  Any reachable host: the box under your desk or a GPU machine across the
315
316
  network, same command, same output.
316
317
 
318
+ ## 🌐 Serve: drafts as an HTTP API
319
+
320
+ Hand-tune a draft in the TUI, then make it callable by anything that speaks
321
+ HTTP — a web frontend, curl, n8n, another service:
322
+
323
+ ```bash
324
+ bunx comfy-ts serve # every *.cflow.ts under cwd, port 8288
325
+ bunx comfy-ts serve ./flows # just that folder
326
+ bunx comfy-ts serve txt2img.cflow.ts # one workflow (routes shorten to /generate/<draft>)
327
+ bunx comfy-ts serve --port 9000 --bind 0.0.0.0 # pick port / expose beyond localhost
328
+ ```
329
+
330
+ Discover what's being served — same info the startup print shows, as JSON:
331
+
332
+ ```bash
333
+ curl http://127.0.0.1:8288/drafts # all workflows, their drafts, every var described
334
+ curl http://127.0.0.1:8288/drafts/txt2img/moody # one draft with its stored values
335
+ ```
336
+
337
+ Generate:
338
+
339
+ ```bash
340
+ curl -X POST http://127.0.0.1:8288/generate/txt2img/default \
341
+ -H 'content-type: application/json' \
342
+ -d '{"prompt": "a red cube", "steps": 8}'
343
+ # → { "ok": true, "images": [{ "url": "/outputs/…png", … }], "seeds": … }
344
+
345
+ curl -X POST http://127.0.0.1:8288/generate/txt2img/moody \
346
+ -H 'accept: image/*' -d '{"seed": 42}' -o out.png # raw image bytes
347
+ ```
348
+
349
+ Draft values are the defaults, the JSON body overrides per request, and every
350
+ value is validated before anything is queued (wrong choice? the 400 lists the
351
+ allowed ones). `GET /drafts` self-describes every workflow, draft and var —
352
+ enough for a frontend to render a form. `Accept: image/*` returns the image
353
+ bytes directly (`curl … -H 'accept: image/*' -o out.png`). Drafts are
354
+ re-read on every request: keep the TUI open, tweak, next call uses the new
355
+ values. Binds to localhost only unless you say otherwise (`--bind`, `--port`).
356
+
317
357
  ## 🌍 Hosts: local, LAN, Comfy Cloud, any provider
318
358
 
319
359
  Every Comfy is supported, through one identical API. Same mechanism, same