comfy-ts 2.10.0 → 2.12.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 (110) hide show
  1. package/README.md +1 -0
  2. package/dist/{LogsSt-DFxzQfDc.js → LogsSt-U1H0mP1m.js} +35 -5
  3. package/dist/LogsSt-U1H0mP1m.js.map +1 -0
  4. package/dist/cli.js +4 -4
  5. package/dist/index.cjs +565 -62
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +210 -31
  8. package/dist/index.d.ts +210 -31
  9. package/dist/index.js +561 -63
  10. package/dist/index.js.map +1 -1
  11. package/dist/{run-serve-_nrvJYyt.js → run-serve-BeAznay5.js} +549 -43
  12. package/dist/run-serve-BeAznay5.js.map +1 -0
  13. package/dist/{run-tui-Atvf9vb3.js → run-tui-BTGjvnKk.js} +75 -18
  14. package/dist/run-tui-BTGjvnKk.js.map +1 -0
  15. package/dist/{DefinedWorkflow-BatWaZO1.js → schemaDrift-Cg39vs53.js} +644 -60
  16. package/dist/schemaDrift-Cg39vs53.js.map +1 -0
  17. package/dist/serve-web.js +523 -133
  18. package/dist/{state-6RFDIQwJ.js → state-C7REnHan.js} +18 -3
  19. package/dist/{state-6RFDIQwJ.js.map → state-C7REnHan.js.map} +1 -1
  20. package/dist/web.d.ts +210 -31
  21. package/dist/web.js +561 -63
  22. package/dist/web.js.map +1 -1
  23. package/examples/comfy-cloud/capybara-i2v.cflow.ts +2 -0
  24. package/examples/comfy-cloud/wan22-5b-t2v.cflow.ts +2 -0
  25. package/examples/comfy-cloud/wan22-i2v.cflow.ts +2 -0
  26. package/examples/comfy-cloud/wan22-t2v.cflow.ts +2 -0
  27. package/examples/rvion/06-qwen-image-edit.cflow.ts +3 -2
  28. package/examples/rvion/07-local-llm-text-gen.cflow.ts +2 -2
  29. package/examples/rvion/10-anima-t2i.cflow.ts +229 -0
  30. package/extra/README.md +4 -0
  31. package/extra/comfyui-fresh-model-lists/README.md +25 -0
  32. package/extra/comfyui-fresh-model-lists/__init__.py +36 -0
  33. package/extra/comfyui-fresh-model-lists/test_fresh_model_lists.py +97 -0
  34. package/package.json +17 -7
  35. package/src/cli/draftMeta.ts +39 -0
  36. package/src/cli/serve/ServeApp.ts +242 -12
  37. package/src/cli/serve/applyVarPayload.ts +50 -22
  38. package/src/cli/serve/describeVar.ts +49 -6
  39. package/src/cli/serve/favicon.ts +3 -0
  40. package/src/cli/serve/llmConfigShape.ts +51 -0
  41. package/src/cli/serve/llmConfigs.ts +52 -0
  42. package/src/cli/serve/tagList.ts +92 -0
  43. package/src/cli/serve/tagSource.ts +69 -0
  44. package/src/cli/serve/web/api.ts +60 -0
  45. package/src/cli/serve/web/components/App.tsx +336 -44
  46. package/src/cli/serve/web/components/Gallery.tsx +105 -28
  47. package/src/cli/serve/web/components/HistoryPicker.tsx +149 -0
  48. package/src/cli/serve/web/components/Icon.tsx +18 -2
  49. package/src/cli/serve/web/components/MenuButton.tsx +53 -0
  50. package/src/cli/serve/web/components/Omnibox.tsx +85 -0
  51. package/src/cli/serve/web/components/PromptEnhancer.tsx +476 -180
  52. package/src/cli/serve/web/components/TooltipLayer.tsx +45 -0
  53. package/src/cli/serve/web/components/VarIcon.tsx +24 -0
  54. package/src/cli/serve/web/components/VarsForm.tsx +341 -177
  55. package/src/cli/serve/web/components/controls/BasicControls.tsx +57 -32
  56. package/src/cli/serve/web/components/controls/LorasControl.tsx +708 -285
  57. package/src/cli/serve/web/components/controls/PresetPicker.tsx +1 -1
  58. package/src/cli/serve/web/components/controls/PromptControl.tsx +279 -0
  59. package/src/cli/serve/web/components/controls/PromptEditor.tsx +113 -0
  60. package/src/cli/serve/web/components/controls/SeedControl.tsx +17 -10
  61. package/src/cli/serve/web/components/controls/SizeControl.tsx +111 -18
  62. package/src/cli/serve/web/components/modKey.ts +2 -0
  63. package/src/cli/serve/web/llm.ts +23 -12
  64. package/src/cli/serve/web/promptEditor/promptExtensions.ts +281 -0
  65. package/src/cli/serve/web/state/EnhancerSt.ts +415 -100
  66. package/src/cli/serve/web/state/FormSt.ts +193 -29
  67. package/src/cli/serve/web/state/OmniboxSt.ts +57 -0
  68. package/src/cli/serve/web/state/WebSt.ts +281 -57
  69. package/src/cli/serve/web/state/choiceButtons.ts +61 -0
  70. package/src/cli/serve/web/state/generateButton.ts +16 -0
  71. package/src/cli/serve/web/state/history.ts +54 -0
  72. package/src/cli/serve/web/state/host.ts +5 -2
  73. package/src/cli/serve/web/state/keptLines.ts +53 -0
  74. package/src/cli/serve/web/state/latentMode.ts +20 -0
  75. package/src/cli/serve/web/state/loraSort.ts +57 -0
  76. package/src/cli/serve/web/state/moduleTree.ts +2 -2
  77. package/src/cli/serve/web/state/omnibox.ts +69 -0
  78. package/src/cli/serve/web/state/payload.ts +38 -58
  79. package/src/cli/serve/web/state/shortcuts.ts +54 -0
  80. package/src/cli/serve/web/state/sizeStars.ts +31 -0
  81. package/src/cli/serve/web/state/stableSlots.ts +21 -0
  82. package/src/cli/serve/web/state/varGroups.ts +24 -0
  83. package/src/cli/serve/web/styles.ts +472 -118
  84. package/src/cli/serve/webBundle.ts +54 -10
  85. package/src/cli/tui/components/Header.tsx +2 -0
  86. package/src/cli/tui/components/PickerOverlays.tsx +9 -2
  87. package/src/cli/tui/imagePicker/ImagePickerSt.ts +1 -1
  88. package/src/cli/tui/state/DraftsSt.ts +18 -2
  89. package/src/cli/tui/state/EditorSt.ts +1 -1
  90. package/src/cli/tui/state/HostSt.ts +34 -0
  91. package/src/cli/tui/state/LorasSt.ts +1 -1
  92. package/src/cli/tui/state/PickerSt.ts +25 -7
  93. package/src/cli/tui/state/SettingsSt.ts +1 -1
  94. package/src/cli/tui/state/TuiSt.ts +10 -0
  95. package/src/coreExports.ts +20 -0
  96. package/src/host/ComfyHost.ts +15 -0
  97. package/src/host/loraInfoCache.ts +70 -0
  98. package/src/host/loraManagerApi.ts +27 -0
  99. package/src/host/schemaDrift.ts +87 -0
  100. package/src/state.ts +5 -0
  101. package/src/vars/ComfyVars.ts +337 -67
  102. package/src/vars/DefinedWorkflow.ts +40 -19
  103. package/src/vars/lanes.ts +238 -0
  104. package/src/vars/loraEntry.ts +101 -0
  105. package/src/vars/promptSyntax.ts +382 -0
  106. package/dist/DefinedWorkflow-BatWaZO1.js.map +0 -1
  107. package/dist/LogsSt-DFxzQfDc.js.map +0 -1
  108. package/dist/run-serve-_nrvJYyt.js.map +0 -1
  109. package/dist/run-tui-Atvf9vb3.js.map +0 -1
  110. package/src/cli/serve/web/components/Sidebar.tsx +0 -66
@@ -1,6 +1,6 @@
1
- import { C as fetchLoraList, F as loraBasename, I as loraKey, L as loraPreviewMapFrom, V as extractErrorMessage, a as clearLoraKeywordOverride, c as loraKeywordFromMirror, d as getLoraDisplayName, h as loraMatchesFilter, i as PromptVar, l as setLoraKeyword, o as getLoraKeyword, p as getLoraPreviewUrl, q as logError, r as LorasVar, s as isLoraKeywordFromMirror, v as refreshLoraInfoCacheIfChanged, w as fetchLoraPreviewBytes } from "./DefinedWorkflow-BatWaZO1.js";
2
- import { i as importSharp, n as settingsPathFor } from "./state-6RFDIQwJ.js";
3
- import { c as buildFileRows, d as mergeWorkflowSources, f as scanCflowFiles, i as draftKeyForFile, l as familyOf, o as listDraftsForFile, r as DraftsSt, s as assignFamilyColors, t as LogsSt, u as findDefinedWorkflow } from "./LogsSt-DFxzQfDc.js";
1
+ import { A as refreshLoraInfoCacheIfChanged, I as fetchLoraList, J as loraBasename, L as fetchLoraPreviewBytes, S as getLoraPreviewUrl, T as loraMatchesFilter, X as loraPreviewMapFrom, Y as loraKey, _ as setLoraKeyword, b as getLoraDisplayName, c as PromptVar, et as extractErrorMessage, g as loraKeywordFromMirror, h as isLoraKeywordFromMirror, i as summarizeDrift, m as getLoraKeyword, ot as logError, p as clearLoraKeywordOverride, s as LorasVar } from "./schemaDrift-Cg39vs53.js";
2
+ import { i as importSharp, n as settingsPathFor } from "./state-C7REnHan.js";
3
+ import { d as familyOf, f as findDefinedWorkflow, i as draftKeyForFile, l as assignFamilyColors, m as scanCflowFiles, o as listDraftsForFile, p as mergeWorkflowSources, r as DraftsSt, t as LogsSt, u as buildFileRows } from "./LogsSt-U1H0mP1m.js";
4
4
  import { spawn } from "node:child_process";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
@@ -656,6 +656,14 @@ const Header = observer((p) => {
656
656
  color: "yellow",
657
657
  children: [" ⇄ overrides ", s.wf.host.data.id]
658
658
  }),
659
+ s.host.drift !== "" && /* @__PURE__ */ jsxs(Text, {
660
+ color: "yellow",
661
+ children: [
662
+ " ⚠ changed: ",
663
+ s.host.drift,
664
+ " · a → re-codegen"
665
+ ]
666
+ }),
659
667
  s.host.status === "down" && /* @__PURE__ */ jsxs(Text, {
660
668
  color: "red",
661
669
  children: [" ", s.host.probing ? s.host.spinner : `↻ ${s.host.retryInS}s`]
@@ -855,12 +863,19 @@ const ChoiceOverlay = observer((p) => {
855
863
  key: opt,
856
864
  node: /* @__PURE__ */ jsxs(Text, {
857
865
  inverse: ix === pk.ix,
858
- children: [ix === pk.ix ? "▸ " : " ", opt]
866
+ children: [
867
+ ix === pk.ix ? "▸ " : " ",
868
+ pk.isPicked(opt) ? "● " : "○ ",
869
+ opt
870
+ ]
859
871
  }, opt)
860
872
  })),
861
873
  footer: options.length === 0 ? /* @__PURE__ */ jsx(Text, {
862
874
  color: "red",
863
875
  children: "no match"
876
+ }) : pk.choiceIsMany ? /* @__PURE__ */ jsx(Text, {
877
+ color: "gray",
878
+ children: "⏎ toggles · esc done"
864
879
  }) : void 0
865
880
  });
866
881
  });
@@ -870,7 +885,7 @@ const PresetOverlay = observer((p) => {
870
885
  const s = p.st;
871
886
  const pk = s.picker;
872
887
  const options = pk.presetOptions;
873
- const current = pk.presetVar?.value.trim() ?? "";
888
+ const current = pk.presetVar?.toEditBuffer().trim() ?? "";
874
889
  return /* @__PURE__ */ jsx(OverlayList, {
875
890
  title: /* @__PURE__ */ jsxs(Fragment, { children: [
876
891
  "presets ",
@@ -1263,7 +1278,7 @@ var ImagePickerSt = class {
1263
1278
  this.filter = "";
1264
1279
  this._busy = false;
1265
1280
  makeAutoObservable(this, { st: false });
1266
- this.st.disposers.push(reaction(() => this.st.mode === "overlay-image" ? this.highlightedImage : null, () => void this.refreshPreview(), { delay: 120 }));
1281
+ this.st.disposers.push(reaction(() => this.st.mode === "overlay-image" ? this.highlightedImage : null, () => void this.refreshPreview(), { delay: this.st.timing.previewMs }));
1267
1282
  }
1268
1283
  /** kind-narrowing cast sanctioned (agent/coding.md), `kind` is the tag */
1269
1284
  get selectedVar() {
@@ -2346,7 +2361,7 @@ var EditorSt = class EditorSt {
2346
2361
  const sel = this.st.selected?.[1];
2347
2362
  if (sel == null) return;
2348
2363
  this.st.mode = "overlay-text";
2349
- this.buffer = String(sel.value);
2364
+ this.buffer = sel.toEditBuffer();
2350
2365
  this.cursor = [...this.buffer].length;
2351
2366
  this.invalid = false;
2352
2367
  }
@@ -2926,6 +2941,8 @@ var ExecSt = class {
2926
2941
  //#endregion
2927
2942
  //#region src/cli/tui/state/HostSt.ts
2928
2943
  const PROBE_EVERY_MS = 5e3;
2944
+ /** a light drift check (the loaders only) at most this often while the host is up */
2945
+ const DRIFT_EVERY_MS = 6e4;
2929
2946
  const PROBE_TIMEOUT_MS = 3e3;
2930
2947
  const SPIN_FRAMES = [
2931
2948
  "⠋",
@@ -2976,6 +2993,8 @@ var HostSt = class {
2976
2993
  this.loopTimer = null;
2977
2994
  this.spinTimer = null;
2978
2995
  this.countdownTimer = null;
2996
+ this.drift = "";
2997
+ this.driftAt = 0;
2979
2998
  this.ix = 0;
2980
2999
  this.running = null;
2981
3000
  this.actions = [
@@ -3010,6 +3029,7 @@ var HostSt = class {
3010
3029
  this.status = "unknown";
3011
3030
  this.statusVia = null;
3012
3031
  this.lastProbeError = null;
3032
+ this.drift = "";
3013
3033
  });
3014
3034
  this.probeGen++;
3015
3035
  if (this.loopTimer != null) clearTimeout(this.loopTimer);
@@ -3077,6 +3097,7 @@ var HostSt = class {
3077
3097
  }
3078
3098
  }
3079
3099
  if (this.host !== host) return;
3100
+ const before = this.status;
3080
3101
  const verdict = probeVerdict({
3081
3102
  httpOk: ok,
3082
3103
  wsOpen: host.isConnected,
@@ -3088,6 +3109,23 @@ var HostSt = class {
3088
3109
  this.statusVia = verdict.via;
3089
3110
  this.lastProbeError = probeError;
3090
3111
  });
3112
+ if (verdict.status === "up") {
3113
+ if (before !== "up") this.checkDrift(true);
3114
+ else if (Date.now() - this.driftAt > DRIFT_EVERY_MS) this.checkDrift(false);
3115
+ }
3116
+ }
3117
+ async checkDrift(full) {
3118
+ const host = this.host;
3119
+ if (host.data.sdkAutoWrite === false) return;
3120
+ this.driftAt = Date.now();
3121
+ try {
3122
+ const summary = summarizeDrift(await host.checkSchemaDrift({ full }));
3123
+ if (this.host !== host) return;
3124
+ runInAction(() => {
3125
+ if (summary !== "") this.drift = summary;
3126
+ else if (full) this.drift = "";
3127
+ });
3128
+ } catch {}
3091
3129
  }
3092
3130
  get host() {
3093
3131
  return this.st.runHost;
@@ -3189,6 +3227,7 @@ var HostSt = class {
3189
3227
  runInAction(() => {
3190
3228
  const schema = this.host.schema;
3191
3229
  this.st.exec.notice = `SDK regenerated: ${schema.nodes.length} node types, ${schema.getLoras().length} loras`;
3230
+ this.drift = "";
3192
3231
  });
3193
3232
  } catch (e) {
3194
3233
  runInAction(() => {
@@ -3233,7 +3272,7 @@ var LorasSt = class {
3233
3272
  this.previewSweepStatus = null;
3234
3273
  this._busy = false;
3235
3274
  makeAutoObservable(this, { st: false });
3236
- this.st.disposers.push(reaction(() => this.st.mode === "overlay-loras" ? this.selectedName : null, () => void this.refreshPreview(), { delay: 120 }));
3275
+ this.st.disposers.push(reaction(() => this.st.mode === "overlay-loras" ? this.selectedName : null, () => void this.refreshPreview(), { delay: this.st.timing.previewMs }));
3237
3276
  }
3238
3277
  /** kind-narrowing cast sanctioned (agent/coding.md), `kind` is the tag */
3239
3278
  get selectedVar() {
@@ -3418,6 +3457,16 @@ var PickerSt = class {
3418
3457
  const sel = this.st.selected?.[1];
3419
3458
  return sel?.kind === "choice" ? sel : null;
3420
3459
  }
3460
+ /** is this option currently picked (one, one or none, or one of many) */
3461
+ isPicked(option) {
3462
+ const cv = this.choiceVar;
3463
+ if (cv == null) return false;
3464
+ return cv.select === "many" ? cv.value.includes(option) : cv.value === option;
3465
+ }
3466
+ /** a many-choice stays open after ⏎: you toggle several, esc leaves */
3467
+ get choiceIsMany() {
3468
+ return this.choiceVar?.select === "many";
3469
+ }
3421
3470
  get sizeVar() {
3422
3471
  const sel = this.st.selected?.[1];
3423
3472
  return sel?.kind === "size" ? sel : null;
@@ -3459,7 +3508,8 @@ var PickerSt = class {
3459
3508
  this.st.mode = "overlay-choice";
3460
3509
  this.filter = "";
3461
3510
  this.invalid = false;
3462
- this.ix = Math.max(0, cv.choices.indexOf(cv.value));
3511
+ const first = cv.select === "many" ? cv.value[0] : cv.value;
3512
+ this.ix = Math.max(0, first == null ? 0 : cv.choices.indexOf(first));
3463
3513
  }
3464
3514
  /** `P` on a text/prompt var that declares presets. A var without any stays on `nav`:
3465
3515
  * the keybar only advertises the key when the row has some */
@@ -3469,7 +3519,7 @@ var PickerSt = class {
3469
3519
  this.st.mode = "overlay-preset";
3470
3520
  this.filter = "";
3471
3521
  this.invalid = false;
3472
- const value = pv.value.trim();
3522
+ const value = pv.toEditBuffer().trim();
3473
3523
  const ix = pv.presets.findIndex((x) => x.text.trim() === value);
3474
3524
  this.ix = ix === -1 ? 0 : ix;
3475
3525
  }
@@ -3516,9 +3566,14 @@ var PickerSt = class {
3516
3566
  }
3517
3567
  const cv = this.choiceVar;
3518
3568
  if (cv != null) {
3519
- const hit = this.options[this.ix];
3569
+ const hit = cv.choices.find((c) => c === this.options[this.ix]);
3520
3570
  if (hit == null) return;
3521
- cv.set(hit);
3571
+ if (cv.select === "many") {
3572
+ cv.toggle(hit);
3573
+ return;
3574
+ }
3575
+ if (cv.select === "zero-or-one") cv.toggle(hit);
3576
+ else cv.set(hit);
3522
3577
  this.st.mode = "nav";
3523
3578
  return;
3524
3579
  }
@@ -3896,7 +3951,7 @@ var SettingsSt = class {
3896
3951
  this.load();
3897
3952
  if (this.previewRenderer === "native" && !protocolCapable()) this.previewRenderer = "pixel";
3898
3953
  makeAutoObservable(this, { st: false });
3899
- this.st.disposers.push(reaction(() => this.snapshotJson(), (json) => this.write(json), { delay: 300 }));
3954
+ this.st.disposers.push(reaction(() => this.snapshotJson(), (json) => this.write(json), { delay: this.st.timing.autosaveMs }));
3900
3955
  this.st.disposers.push(() => this.write(this.snapshotJson()));
3901
3956
  }
3902
3957
  snapshotJson() {
@@ -4255,10 +4310,10 @@ var WorkflowsSt = class {
4255
4310
  };
4256
4311
  //#endregion
4257
4312
  //#region src/cli/tui/state/TuiSt.ts
4258
- /**
4259
- * ROOT of the TUI state tree (one instance per run). Children are service
4260
- * classes with an `st` backref; components are stateless views over this.
4261
- */
4313
+ const TUI_TIMING = {
4314
+ previewMs: 120,
4315
+ autosaveMs: 300
4316
+ };
4262
4317
  var TuiSt = class {
4263
4318
  /** the host runs actually target right now */
4264
4319
  get runHost() {
@@ -4288,10 +4343,12 @@ var TuiSt = class {
4288
4343
  this.termRows = (process.stdout.rows ?? 24) - 1;
4289
4344
  this.varsViewH = 0;
4290
4345
  this.wf = wf;
4346
+ this.timing = opts.timing ?? TUI_TIMING;
4291
4347
  makeAutoObservable(this, {
4292
4348
  wf: observableRef,
4293
4349
  hostOverride: observableRef,
4294
4350
  onExit: false,
4351
+ timing: false,
4295
4352
  editor: false,
4296
4353
  picker: false,
4297
4354
  loras: false,
@@ -4540,4 +4597,4 @@ async function runTui(args) {
4540
4597
  //#endregion
4541
4598
  export { runTui };
4542
4599
 
4543
- //# sourceMappingURL=run-tui-Atvf9vb3.js.map
4600
+ //# sourceMappingURL=run-tui-BTGjvnKk.js.map