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.
- 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-Da4DZUP7.js → DraftsSt-omWuBSej.js} +3 -4
- package/dist/DraftsSt-omWuBSej.js.map +1 -0
- 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-BqeXtf8P.js → run-serve-C1oo5ilG.js} +170 -126
- package/dist/run-serve-C1oo5ilG.js.map +1 -0
- package/dist/{run-tui-CiB7TbYv.js → run-tui-CuVst-nc.js} +298 -103
- package/dist/run-tui-CuVst-nc.js.map +1 -0
- package/dist/{state-C1g_B8zR.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/TuiApp.tsx +4 -5
- package/src/cli/tui/components/VarsPanel.tsx +42 -4
- package/src/cli/tui/imageClipboard.ts +40 -0
- package/src/cli/tui/state/DraftsSt.ts +1 -2
- package/src/cli/tui/state/ExecSt.ts +146 -98
- package/src/cli/tui/state/PreviewSt.ts +12 -11
- package/src/cli/tui/state/SettingsSt.ts +13 -0
- package/src/cli/tui/state/TuiSt.ts +65 -11
- 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/DraftsSt-Da4DZUP7.js.map +0 -1
- package/dist/run-serve-BqeXtf8P.js.map +0 -1
- package/dist/run-tui-CiB7TbYv.js.map +0 -1
- package/dist/state-C1g_B8zR.js.map +0 -1
package/dist/web.d.ts
CHANGED
|
@@ -15906,7 +15906,15 @@ declare class ResilientWebSocketClient {
|
|
|
15906
15906
|
}
|
|
15907
15907
|
//#endregion
|
|
15908
15908
|
//#region src/vars/ComfyVars.d.ts
|
|
15909
|
-
|
|
15909
|
+
/**
|
|
15910
|
+
* the var's CLASS, and the only safe way to discriminate one: `instanceof` compares class
|
|
15911
|
+
* OBJECTS, and the published package hands the same class out twice — a consumer's
|
|
15912
|
+
* `.cflow.ts` imports `comfy-ts` (dist/index.js) while `comfy-ts serve`/`tui` run from the
|
|
15913
|
+
* cli bundle, so every `instanceof XVar` across that boundary is false (his repro
|
|
15914
|
+
* 2026-07-31: "var 'prompt' has unsupported kind 'text'" for EVERY kind). A string tag
|
|
15915
|
+
* crosses bundles; a class identity does not.
|
|
15916
|
+
*/
|
|
15917
|
+
type VarKind = 'text' | 'prompt' | 'int' | 'float' | 'seed' | 'toggle' | 'choice' | 'loras' | 'size' | 'image';
|
|
15910
15918
|
/**
|
|
15911
15919
|
* full base: T is what's STORED/edited, Out what the GRAPH consumes at build
|
|
15912
15920
|
* time. They usually coincide — extend `ComfyVar<T>` for that. PromptVar is
|
|
@@ -15973,7 +15981,7 @@ declare class PromptVar extends ComfyVarBase<string, PromptValue> {
|
|
|
15973
15981
|
label?: string;
|
|
15974
15982
|
loraKeywordsFrom?: ActiveLoraSource;
|
|
15975
15983
|
};
|
|
15976
|
-
readonly kind: '
|
|
15984
|
+
readonly kind: 'prompt';
|
|
15977
15985
|
constructor(defaultValue: string, promptOpts?: {
|
|
15978
15986
|
label?: string;
|
|
15979
15987
|
loraKeywordsFrom?: ActiveLoraSource;
|
|
@@ -16151,6 +16159,8 @@ declare const DEFAULT_IMAGE_EXTENSIONS: readonly string[];
|
|
|
16151
16159
|
/** empty image var consumed at build time — typed so drivers surface it apart from real crashes */
|
|
16152
16160
|
declare class ImageVarEmptyError extends Error {
|
|
16153
16161
|
readonly varName: string;
|
|
16162
|
+
/** name, not instanceof: the cli bundle and dist/index.js each define this class */
|
|
16163
|
+
readonly name = "ImageVarEmptyError";
|
|
16154
16164
|
constructor(varName: string);
|
|
16155
16165
|
}
|
|
16156
16166
|
/**
|
package/dist/web.js
CHANGED
|
@@ -101,7 +101,7 @@ function getComfyStorage() {
|
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region package.json
|
|
104
|
-
var version = "2.
|
|
104
|
+
var version = "2.2.0";
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/litegraph/LiteGraphLinkID.ts
|
|
107
107
|
const asLiteGraphLinkID = (id) => id;
|
|
@@ -1682,6 +1682,15 @@ const localOutputPath = (p) => {
|
|
|
1682
1682
|
].filter((x) => x != null).join("_") + ext;
|
|
1683
1683
|
return dir === "" ? name : `${dir}/${name}`;
|
|
1684
1684
|
};
|
|
1685
|
+
/** REPLACE the extension (never append one): a re-encoded save owns its whole
|
|
1686
|
+
* name now that local naming is ours, so `save: {format:'image/webp'}` writes
|
|
1687
|
+
* `shot_20260731-154210_00001.webp`, not `…_00001.png.webp` — appending
|
|
1688
|
+
* described the bytes twice and the first description was a lie */
|
|
1689
|
+
const withExtension = (path, ext) => {
|
|
1690
|
+
const slash = path.lastIndexOf("/");
|
|
1691
|
+
const dot = path.lastIndexOf(".");
|
|
1692
|
+
return `${dot > slash ? path.slice(0, dot) : path}.${ext}`;
|
|
1693
|
+
};
|
|
1685
1694
|
/**
|
|
1686
1695
|
* never-overwrite guard: bump `-2`, `-3`, … while the path exists on disk OR
|
|
1687
1696
|
* was already CLAIMED by a still-downloading retrieval (two same-second runs
|
|
@@ -2164,7 +2173,9 @@ var MediaImage = class MediaImage {
|
|
|
2164
2173
|
//#endregion
|
|
2165
2174
|
//#region src/runner/ComfyExecution.ts
|
|
2166
2175
|
/** paths claimed by in-flight retrievals: two same-second runs on a
|
|
2167
|
-
* counter-resetting cloud host compute the same name before either writes
|
|
2176
|
+
* counter-resetting cloud host compute the same name before either writes.
|
|
2177
|
+
* A claim is released as soon as the write lands (the file itself then holds
|
|
2178
|
+
* the name) or fails (the name is free again) — the set never accumulates */
|
|
2168
2179
|
const CLAIMED_OUTPUT_PATHS = /* @__PURE__ */ new Set();
|
|
2169
2180
|
var ComfyExecution = class {
|
|
2170
2181
|
get host() {
|
|
@@ -2291,14 +2302,18 @@ var ComfyExecution = class {
|
|
|
2291
2302
|
filename: p.filename,
|
|
2292
2303
|
timestamp: runTimestamp(new Date(this.startedAt))
|
|
2293
2304
|
}));
|
|
2294
|
-
if (reencode) absPath
|
|
2305
|
+
if (reencode) absPath = withExtension(absPath, bang(bang(p.sf.format).split("/")[1]));
|
|
2295
2306
|
const storage = getComfyStorage();
|
|
2296
2307
|
absPath = uniquifyOutputPath({
|
|
2297
2308
|
path: absPath,
|
|
2298
2309
|
exists: (x) => storage.exists(x),
|
|
2299
2310
|
claimed: CLAIMED_OUTPUT_PATHS
|
|
2300
2311
|
});
|
|
2301
|
-
|
|
2312
|
+
try {
|
|
2313
|
+
storage.writeBytes(asAbsolutePath(absPath), bytes);
|
|
2314
|
+
} finally {
|
|
2315
|
+
CLAIMED_OUTPUT_PATHS.delete(absPath);
|
|
2316
|
+
}
|
|
2302
2317
|
return {
|
|
2303
2318
|
path: asAbsolutePath(absPath),
|
|
2304
2319
|
bytes
|
|
@@ -4000,7 +4015,7 @@ var PromptVar = class extends ComfyVarBase {
|
|
|
4000
4015
|
constructor(defaultValue, promptOpts = {}) {
|
|
4001
4016
|
super(defaultValue, promptOpts.label);
|
|
4002
4017
|
this.promptOpts = promptOpts;
|
|
4003
|
-
this.kind = "
|
|
4018
|
+
this.kind = "prompt";
|
|
4004
4019
|
}
|
|
4005
4020
|
parse(raw) {
|
|
4006
4021
|
this.set(raw);
|
|
@@ -4405,6 +4420,7 @@ var ImageVarEmptyError = class extends Error {
|
|
|
4405
4420
|
constructor(varName) {
|
|
4406
4421
|
super(`image var '${varName}' is empty — pick a file (TUI: activate the var; script: .set('/path/to/image.png'))`);
|
|
4407
4422
|
this.varName = varName;
|
|
4423
|
+
this.name = "ImageVarEmptyError";
|
|
4408
4424
|
}
|
|
4409
4425
|
};
|
|
4410
4426
|
/** trim + expand a leading `~/` — every ImageVar write funnels through this */
|
|
@@ -4977,6 +4993,7 @@ var ComfyHost = class {
|
|
|
4977
4993
|
mime: frame.mime
|
|
4978
4994
|
});
|
|
4979
4995
|
}
|
|
4996
|
+
if (this.latentPreview != null) URL.revokeObjectURL(this.latentPreview.url);
|
|
4980
4997
|
const imageBlob = new Blob([frame.bytes], { type: frame.mime });
|
|
4981
4998
|
this.latentPreview = {
|
|
4982
4999
|
blob: imageBlob,
|