comfy-ts 2.1.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.
- package/README.md +65 -225
- package/dist/{DefinedWorkflow-CqNE_kgR.js → DefinedWorkflow-CwHInZgn.js} +4 -3
- package/dist/DefinedWorkflow-CwHInZgn.js.map +1 -0
- package/dist/{DraftsSt-C-gBk9v7.js → DraftsSt-omWuBSej.js} +2 -2
- package/dist/{DraftsSt-C-gBk9v7.js.map → DraftsSt-omWuBSej.js.map} +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-CnlN_RFH.js → run-serve-C1oo5ilG.js} +170 -126
- package/dist/run-serve-C1oo5ilG.js.map +1 -0
- package/dist/{run-tui-DXI_Jufu.js → run-tui-CuVst-nc.js} +49 -50
- package/dist/run-tui-CuVst-nc.js.map +1 -0
- package/dist/{state-DC5BcG6d.js → state-CvMt0W1-.js} +23 -7
- package/dist/state-CvMt0W1-.js.map +1 -0
- package/dist/web.d.ts +12 -2
- package/dist/web.js +22 -5
- package/dist/web.js.map +1 -1
- package/examples/README.md +6 -18
- package/examples/images/README.md +2 -6
- package/guide-for-agents.md +25 -84
- package/package.json +1 -1
- package/src/cli/serve/ServeApp.ts +17 -11
- package/src/cli/serve/applyVarPayload.ts +91 -71
- package/src/cli/serve/describeVar.ts +57 -28
- package/src/cli/tui/components/StatusBar.tsx +1 -0
- package/src/cli/tui/components/TextOverlay.tsx +7 -3
- package/src/cli/tui/components/VarsPanel.tsx +2 -2
- package/src/cli/tui/state/ExecSt.ts +47 -52
- package/src/cli/tui/state/TuiSt.ts +11 -6
- package/src/host/ComfyHost.ts +5 -1
- package/src/runner/ComfyExecution.ts +15 -7
- package/src/runner/outputPath.ts +11 -0
- package/src/vars/ComfyVars.ts +12 -2
- package/dist/DefinedWorkflow-CqNE_kgR.js.map +0 -1
- package/dist/run-serve-CnlN_RFH.js.map +0 -1
- package/dist/run-tui-DXI_Jufu.js.map +0 -1
- package/dist/state-DC5BcG6d.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as stripAnsi, n as settingsPathFor,
|
|
2
|
-
import {
|
|
3
|
-
import { a as assignFamilyColors, c as findDefinedWorkflow, i as listDraftsForFile, l as mergeWorkflowSources, n as draftKeyForFile, o as buildFileRows, s as familyOf, t as DraftsSt, u as scanCflowFiles } from "./DraftsSt-
|
|
1
|
+
import { a as importSharp, i as stripAnsi, n as settingsPathFor, s as sha1HexOfString } from "./state-CvMt0W1-.js";
|
|
2
|
+
import { a as setLoraKeyword, i as getLoraKeyword, n as LorasVar, o as extractErrorMessage, r as PromptVar, s as getComfyStorage, u as logError } from "./DefinedWorkflow-CwHInZgn.js";
|
|
3
|
+
import { a as assignFamilyColors, c as findDefinedWorkflow, i as listDraftsForFile, l as mergeWorkflowSources, n as draftKeyForFile, o as buildFileRows, s as familyOf, t as DraftsSt, u as scanCflowFiles } from "./DraftsSt-omWuBSej.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";
|
|
@@ -477,6 +477,7 @@ const ProgressLine = observer((p) => {
|
|
|
477
477
|
});
|
|
478
478
|
const KIND_KEYS = {
|
|
479
479
|
text: [["⏎/→", "edit"]],
|
|
480
|
+
prompt: [["⏎/→", "edit"]],
|
|
480
481
|
int: [["⏎/→", "edit"]],
|
|
481
482
|
float: [["⏎/→", "edit"]],
|
|
482
483
|
seed: [
|
|
@@ -1607,9 +1608,10 @@ const TextOverlay = observer((p) => {
|
|
|
1607
1608
|
const s = p.st;
|
|
1608
1609
|
const ed = s.editor;
|
|
1609
1610
|
const winLines = s.overlayLines;
|
|
1610
|
-
const
|
|
1611
|
-
const
|
|
1612
|
-
const
|
|
1611
|
+
const selectedVar = s.selected?.[1];
|
|
1612
|
+
const promptVar = selectedVar?.kind === "prompt" ? selectedVar : null;
|
|
1613
|
+
const isPrompt = promptVar != null;
|
|
1614
|
+
const injected = promptVar?.injectedKeywords() ?? [];
|
|
1613
1615
|
const lines = [];
|
|
1614
1616
|
let start = 0;
|
|
1615
1617
|
for (const text of ed.buffer.split("\n")) {
|
|
@@ -1858,7 +1860,7 @@ const VarRow = observer((p) => {
|
|
|
1858
1860
|
color: "cyan",
|
|
1859
1861
|
wrap: "truncate",
|
|
1860
1862
|
children: value.replaceAll("\n", " ")
|
|
1861
|
-
}) : p.varDef
|
|
1863
|
+
}) : p.varDef.kind === "prompt" ? /* @__PURE__ */ jsx(PromptCell, {
|
|
1862
1864
|
varDef: p.varDef,
|
|
1863
1865
|
value
|
|
1864
1866
|
}) : /* @__PURE__ */ jsx(Text, {
|
|
@@ -2789,6 +2791,10 @@ var ExecSt = class {
|
|
|
2789
2791
|
this.copyPopup = null;
|
|
2790
2792
|
this.st.mode = "nav";
|
|
2791
2793
|
}
|
|
2794
|
+
/** makeAutoObservable already annotates this method as an action, so the
|
|
2795
|
+
* post-await callers below need no runInAction of their own (verified
|
|
2796
|
+
* against mobx: a TS-private prototype method called after an `await`
|
|
2797
|
+
* opens its own action context; only a CONSTRUCTOR body does not) */
|
|
2792
2798
|
showCopyPopup(title, ok, lines) {
|
|
2793
2799
|
const m = this.st.mode;
|
|
2794
2800
|
if (m === "edit" || m.startsWith("overlay-")) {
|
|
@@ -2841,16 +2847,14 @@ var ExecSt = class {
|
|
|
2841
2847
|
proc.on("error", () => resolve(false));
|
|
2842
2848
|
proc.on("close", (code) => resolve(code === 0));
|
|
2843
2849
|
});
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
] : [`COPY FAILED for ${lastImg.filename}`, `could not run ${piped.cmd} — is it installed and allowed ?`]);
|
|
2850
|
-
});
|
|
2850
|
+
this.showCopyPopup("image → clipboard", ok, ok ? [
|
|
2851
|
+
`${basename(file)} — paste the pixels anywhere`,
|
|
2852
|
+
"",
|
|
2853
|
+
`via fallback file ${file}`
|
|
2854
|
+
] : [`COPY FAILED for ${lastImg.filename}`, `could not run ${piped.cmd} — is it installed and allowed ?`]);
|
|
2851
2855
|
}
|
|
2852
2856
|
async toPngBytes(bytes) {
|
|
2853
|
-
const
|
|
2857
|
+
const sharp = await importSharp("the clipboard png normalize");
|
|
2854
2858
|
return new Uint8Array(await sharp(bytes).png().toBuffer());
|
|
2855
2859
|
}
|
|
2856
2860
|
runWithStdin(p) {
|
|
@@ -2896,22 +2900,18 @@ var ExecSt = class {
|
|
|
2896
2900
|
const json = await (await this.st.wf.build({ host: this.st.hostOverride ?? void 0 })).toWorkflowJson();
|
|
2897
2901
|
const text = JSON.stringify(json, null, 2);
|
|
2898
2902
|
const ok = await this.toClipboard(text);
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
] : ["CLIPBOARD COPY FAILED — is a clipboard tool available (pbcopy/clip/xclip) ?"]);
|
|
2905
|
-
});
|
|
2903
|
+
this.showCopyPopup("workflow.json → clipboard", ok, ok ? [
|
|
2904
|
+
`${json.nodes.length} nodes · ${text.length} chars — paste into the ComfyUI editor`,
|
|
2905
|
+
"",
|
|
2906
|
+
...jsonHead(text, 10)
|
|
2907
|
+
] : ["CLIPBOARD COPY FAILED — is a clipboard tool available (pbcopy/clip/xclip) ?"]);
|
|
2906
2908
|
} catch (e) {
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
]);
|
|
2914
|
-
});
|
|
2909
|
+
this.showCopyPopup("workflow.json copy FAILED", false, [
|
|
2910
|
+
extractErrorMessage(e),
|
|
2911
|
+
"",
|
|
2912
|
+
"nothing was copied. i2i/i2v builds upload their input image first —",
|
|
2913
|
+
"an unreachable host fails the build itself, not just the run."
|
|
2914
|
+
]);
|
|
2915
2915
|
} finally {
|
|
2916
2916
|
runInAction(() => {
|
|
2917
2917
|
this.copying = false;
|
|
@@ -2929,22 +2929,18 @@ var ExecSt = class {
|
|
|
2929
2929
|
const json = (await this.st.wf.build({ host: this.st.hostOverride ?? void 0 })).toApiJson("use_stringified_numbers_only");
|
|
2930
2930
|
const text = JSON.stringify(json, null, 2);
|
|
2931
2931
|
const ok = await this.toClipboard(text);
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
] : ["CLIPBOARD COPY FAILED — is a clipboard tool available (pbcopy/clip/xclip) ?"]);
|
|
2938
|
-
});
|
|
2932
|
+
this.showCopyPopup("api.json → clipboard", ok, ok ? [
|
|
2933
|
+
`${Object.keys(json).length} nodes · ${text.length} chars — the POST /prompt payload`,
|
|
2934
|
+
"",
|
|
2935
|
+
...jsonHead(text, 10)
|
|
2936
|
+
] : ["CLIPBOARD COPY FAILED — is a clipboard tool available (pbcopy/clip/xclip) ?"]);
|
|
2939
2937
|
} catch (e) {
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
]);
|
|
2947
|
-
});
|
|
2938
|
+
this.showCopyPopup("api.json copy FAILED", false, [
|
|
2939
|
+
extractErrorMessage(e),
|
|
2940
|
+
"",
|
|
2941
|
+
"nothing was copied. i2i/i2v builds upload their input image first —",
|
|
2942
|
+
"an unreachable host fails the build itself, not just the run."
|
|
2943
|
+
]);
|
|
2948
2944
|
} finally {
|
|
2949
2945
|
runInAction(() => {
|
|
2950
2946
|
this.copying = false;
|
|
@@ -4249,9 +4245,12 @@ var TuiSt = class {
|
|
|
4249
4245
|
this.applyPersistedHostOverride();
|
|
4250
4246
|
this.drafts.activateRemembered();
|
|
4251
4247
|
if (opts.currentFile != null) {
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4248
|
+
const currentFile = opts.currentFile;
|
|
4249
|
+
runInAction(() => {
|
|
4250
|
+
this.tree.expandedFiles.add(currentFile);
|
|
4251
|
+
this.workflows.recordSpecColor(currentFile, wf);
|
|
4252
|
+
this.settings.lastWorkflow = currentFile;
|
|
4253
|
+
});
|
|
4255
4254
|
}
|
|
4256
4255
|
const onResize = () => {
|
|
4257
4256
|
runInAction(() => {
|
|
@@ -4361,7 +4360,7 @@ var TuiSt = class {
|
|
|
4361
4360
|
const sel = this.selected?.[1];
|
|
4362
4361
|
if (sel == null) return;
|
|
4363
4362
|
if (sel.kind === "toggle") sel.toggle();
|
|
4364
|
-
else if (sel.kind === "text") this.editor.beginMultiline();
|
|
4363
|
+
else if (sel.kind === "text" || sel.kind === "prompt") this.editor.beginMultiline();
|
|
4365
4364
|
else if (sel.kind === "choice") this.picker.beginChoice();
|
|
4366
4365
|
else if (sel.kind === "size") this.picker.beginSize();
|
|
4367
4366
|
else if (sel.kind === "loras") this.loras.begin();
|
|
@@ -4464,4 +4463,4 @@ async function runTui(args) {
|
|
|
4464
4463
|
//#endregion
|
|
4465
4464
|
export { runTui };
|
|
4466
4465
|
|
|
4467
|
-
//# sourceMappingURL=run-tui-
|
|
4466
|
+
//# sourceMappingURL=run-tui-CuVst-nc.js.map
|