comfy-ts 2.0.0 → 2.2.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 (47) hide show
  1. package/README.md +65 -225
  2. package/dist/{DefinedWorkflow-CqNE_kgR.js → DefinedWorkflow-CwHInZgn.js} +4 -3
  3. package/dist/DefinedWorkflow-CwHInZgn.js.map +1 -0
  4. package/dist/{DraftsSt-Da4DZUP7.js → DraftsSt-omWuBSej.js} +3 -4
  5. package/dist/DraftsSt-omWuBSej.js.map +1 -0
  6. package/dist/cli.js +3 -3
  7. package/dist/index.cjs +22 -5
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +12 -2
  10. package/dist/index.d.ts +12 -2
  11. package/dist/index.js +22 -5
  12. package/dist/index.js.map +1 -1
  13. package/dist/{run-serve-BqeXtf8P.js → run-serve-C1oo5ilG.js} +170 -126
  14. package/dist/run-serve-C1oo5ilG.js.map +1 -0
  15. package/dist/{run-tui-CiB7TbYv.js → run-tui-CuVst-nc.js} +298 -103
  16. package/dist/run-tui-CuVst-nc.js.map +1 -0
  17. package/dist/{state-C1g_B8zR.js → state-CvMt0W1-.js} +23 -7
  18. package/dist/state-CvMt0W1-.js.map +1 -0
  19. package/dist/web.d.ts +12 -2
  20. package/dist/web.js +22 -5
  21. package/dist/web.js.map +1 -1
  22. package/examples/README.md +6 -18
  23. package/examples/images/README.md +2 -6
  24. package/guide-for-agents.md +25 -84
  25. package/package.json +1 -1
  26. package/src/cli/serve/ServeApp.ts +17 -11
  27. package/src/cli/serve/applyVarPayload.ts +91 -71
  28. package/src/cli/serve/describeVar.ts +57 -28
  29. package/src/cli/tui/components/StatusBar.tsx +1 -0
  30. package/src/cli/tui/components/TextOverlay.tsx +7 -3
  31. package/src/cli/tui/components/TuiApp.tsx +4 -5
  32. package/src/cli/tui/components/VarsPanel.tsx +42 -4
  33. package/src/cli/tui/imageClipboard.ts +40 -0
  34. package/src/cli/tui/state/DraftsSt.ts +1 -2
  35. package/src/cli/tui/state/ExecSt.ts +146 -98
  36. package/src/cli/tui/state/PreviewSt.ts +12 -11
  37. package/src/cli/tui/state/SettingsSt.ts +13 -0
  38. package/src/cli/tui/state/TuiSt.ts +65 -11
  39. package/src/host/ComfyHost.ts +5 -1
  40. package/src/runner/ComfyExecution.ts +15 -7
  41. package/src/runner/outputPath.ts +11 -0
  42. package/src/vars/ComfyVars.ts +12 -2
  43. package/dist/DefinedWorkflow-CqNE_kgR.js.map +0 -1
  44. package/dist/DraftsSt-Da4DZUP7.js.map +0 -1
  45. package/dist/run-serve-BqeXtf8P.js.map +0 -1
  46. package/dist/run-tui-CiB7TbYv.js.map +0 -1
  47. package/dist/state-C1g_B8zR.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { _ as resolveComfyStorage, b as logInfo, g as getComfyStorage, h as extractErrorMessage, t as DefinedWorkflow, v as isQuiet, x as logSuccess, y as logError } from "./DefinedWorkflow-CqNE_kgR.js";
1
+ import { c as resolveComfyStorage, d as logInfo, f as logSuccess, l as isQuiet, o as extractErrorMessage, s as getComfyStorage, t as DefinedWorkflow, u as logError } from "./DefinedWorkflow-CwHInZgn.js";
2
2
  import { basename, join } from "pathe";
3
3
  import { scope, type } from "arktype";
4
4
  import { nanoid } from "nanoid";
@@ -884,7 +884,7 @@ var ComfySchema = class {
884
884
  };
885
885
  //#endregion
886
886
  //#region package.json
887
- var version = "2.0.0";
887
+ var version = "2.2.0";
888
888
  //#endregion
889
889
  //#region src/litegraph/LiteGraphLinkID.ts
890
890
  const asLiteGraphLinkID = (id) => id;
@@ -2232,6 +2232,15 @@ const localOutputPath = (p) => {
2232
2232
  ].filter((x) => x != null).join("_") + ext;
2233
2233
  return dir === "" ? name : `${dir}/${name}`;
2234
2234
  };
2235
+ /** REPLACE the extension (never append one): a re-encoded save owns its whole
2236
+ * name now that local naming is ours, so `save: {format:'image/webp'}` writes
2237
+ * `shot_20260731-154210_00001.webp`, not `…_00001.png.webp` — appending
2238
+ * described the bytes twice and the first description was a lie */
2239
+ const withExtension = (path, ext) => {
2240
+ const slash = path.lastIndexOf("/");
2241
+ const dot = path.lastIndexOf(".");
2242
+ return `${dot > slash ? path.slice(0, dot) : path}.${ext}`;
2243
+ };
2235
2244
  /**
2236
2245
  * never-overwrite guard: bump `-2`, `-3`, … while the path exists on disk OR
2237
2246
  * was already CLAIMED by a still-downloading retrieval (two same-second runs
@@ -2619,7 +2628,9 @@ var MediaImage = class MediaImage {
2619
2628
  //#endregion
2620
2629
  //#region src/runner/ComfyExecution.ts
2621
2630
  /** paths claimed by in-flight retrievals: two same-second runs on a
2622
- * counter-resetting cloud host compute the same name before either writes */
2631
+ * counter-resetting cloud host compute the same name before either writes.
2632
+ * A claim is released as soon as the write lands (the file itself then holds
2633
+ * the name) or fails (the name is free again) — the set never accumulates */
2623
2634
  const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
2624
2635
  var ComfyExecution = class {
2625
2636
  get host() {
@@ -2746,14 +2757,18 @@ var ComfyExecution = class {
2746
2757
  filename: p.filename,
2747
2758
  timestamp: runTimestamp(new Date(this.startedAt))
2748
2759
  }));
2749
- if (reencode) absPath += "." + bang(p.sf.format).split("/")[1];
2760
+ if (reencode) absPath = withExtension(absPath, bang(bang(p.sf.format).split("/")[1]));
2750
2761
  const storage = getComfyStorage();
2751
2762
  absPath = uniquifyOutputPath({
2752
2763
  path: absPath,
2753
2764
  exists: (x) => storage.exists(x),
2754
2765
  claimed: CLAIMED_OUTPUT_PATHS
2755
2766
  });
2756
- storage.writeBytes(asAbsolutePath(absPath), bytes);
2767
+ try {
2768
+ storage.writeBytes(asAbsolutePath(absPath), bytes);
2769
+ } finally {
2770
+ CLAIMED_OUTPUT_PATHS.delete(absPath);
2771
+ }
2757
2772
  return {
2758
2773
  path: asAbsolutePath(absPath),
2759
2774
  bytes
@@ -4172,6 +4187,7 @@ var ComfyHost = class {
4172
4187
  mime: frame.mime
4173
4188
  });
4174
4189
  }
4190
+ if (this.latentPreview != null) URL.revokeObjectURL(this.latentPreview.url);
4175
4191
  const imageBlob = new Blob([frame.bytes], { type: frame.mime });
4176
4192
  this.latentPreview = {
4177
4193
  blob: imageBlob,
@@ -4882,6 +4898,6 @@ var ComfyTS = class ComfyTS {
4882
4898
  }
4883
4899
  };
4884
4900
  //#endregion
4885
- export { ComfySchema as a, stripAnsi as i, settingsPathFor as n, sha1HexOfString as o, readableStringify as r, ComfyTS as t };
4901
+ export { importSharp as a, stripAnsi as i, settingsPathFor as n, ComfySchema as o, readableStringify as r, sha1HexOfString as s, ComfyTS as t };
4886
4902
 
4887
- //# sourceMappingURL=state-C1g_B8zR.js.map
4903
+ //# sourceMappingURL=state-CvMt0W1-.js.map