comfy-ts 2.7.0 → 2.9.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 +20 -13
- package/dist/{DefinedWorkflow-BJgt5t0x.js → DefinedWorkflow-BatWaZO1.js} +199 -16
- package/dist/DefinedWorkflow-BatWaZO1.js.map +1 -0
- package/dist/{DraftsSt-dizp3VcC.js → LogsSt-DFxzQfDc.js} +152 -4
- package/dist/LogsSt-DFxzQfDc.js.map +1 -0
- package/dist/cli.js +7 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +284 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -7
- package/dist/index.d.ts +125 -7
- package/dist/index.js +282 -37
- package/dist/index.js.map +1 -1
- package/dist/run-serve-_nrvJYyt.js +1948 -0
- package/dist/run-serve-_nrvJYyt.js.map +1 -0
- package/dist/{run-tui-JxlEbb_f.js → run-tui-BLEdTsOX.js} +106 -157
- package/dist/run-tui-BLEdTsOX.js.map +1 -0
- package/dist/serve-web.js +441 -72
- package/dist/{state-CaHeDL-0.js → state-BbgJeCe6.js} +180 -45
- package/dist/state-BbgJeCe6.js.map +1 -0
- package/dist/web.d.ts +185 -7
- package/dist/web.js +235 -36
- package/dist/web.js.map +1 -1
- package/examples/README.md +1 -0
- package/examples/comfy-cloud/sdk.d.ts +4066 -321
- package/examples/rvion/04-krea2-turbo-t2i.cflow.ts +18 -2
- package/examples/rvion/07-local-llm-text-gen.cflow.ts +220 -0
- package/examples/web/tsconfig.json +3 -0
- package/extra/README.md +32 -0
- package/extra/comfyui-textgen-stream/README.md +35 -0
- package/extra/comfyui-textgen-stream/__init__.py +166 -0
- package/extra/scripts/fetch_text_encoder.py +137 -0
- package/package.json +6 -3
- package/src/cli/comfy-ts-cli.ts +3 -1
- package/src/cli/serve/ServeApp.ts +754 -40
- package/src/cli/serve/applyVarPayload.ts +10 -3
- package/src/cli/serve/describeVar.ts +47 -7
- package/src/cli/serve/hostProtocol.ts +68 -0
- package/src/cli/serve/managerOnlyLoras.ts +27 -0
- package/src/cli/serve/run-serve.ts +35 -38
- package/src/cli/serve/serveSettings.ts +86 -0
- package/src/cli/serve/startupPrint.ts +111 -0
- package/src/cli/serve/web/api.ts +97 -1
- package/src/cli/serve/web/components/App.tsx +61 -22
- package/src/cli/serve/web/components/Gallery.tsx +306 -41
- package/src/cli/serve/web/components/Icon.tsx +160 -0
- package/src/cli/serve/web/components/PromptEnhancer.tsx +12 -9
- package/src/cli/serve/web/components/Sidebar.tsx +43 -19
- package/src/cli/serve/web/components/VarsForm.tsx +440 -91
- package/src/cli/serve/web/components/controls/BasicControls.tsx +38 -5
- package/src/cli/serve/web/components/controls/ImageControl.tsx +3 -2
- package/src/cli/serve/web/components/controls/LorasControl.tsx +498 -81
- package/src/cli/serve/web/components/controls/PresetPicker.tsx +60 -0
- package/src/cli/serve/web/components/controls/SeedControl.tsx +38 -20
- package/src/cli/serve/web/components/controls/SizeControl.tsx +3 -2
- package/src/cli/serve/web/llm.ts +1 -1
- package/src/cli/serve/web/logWeb.ts +6 -0
- package/src/cli/serve/web/state/EnhancerSt.ts +8 -15
- package/src/cli/serve/web/state/FormSt.ts +74 -18
- package/src/cli/serve/web/state/RunSt.ts +22 -1
- package/src/cli/serve/web/state/WebSt.ts +814 -22
- package/src/cli/serve/web/state/host.ts +206 -0
- package/src/cli/serve/web/state/lightbox.ts +44 -0
- package/src/cli/serve/web/state/moduleTree.ts +52 -0
- package/src/cli/serve/web/state/payload.ts +44 -2
- package/src/cli/serve/web/state/urlSelection.ts +53 -0
- package/src/cli/serve/web/styles.ts +422 -57
- package/src/cli/serve/web/tsconfig.json +4 -0
- package/src/cli/tui/components/PickerOverlays.tsx +37 -0
- package/src/cli/tui/components/StatusBar.tsx +14 -1
- package/src/cli/tui/components/TuiApp.tsx +5 -2
- package/src/cli/tui/state/HostSt.ts +3 -2
- package/src/cli/tui/state/PickerSt.ts +48 -2
- package/src/cli/tui/state/TreeSt.ts +1 -1
- package/src/cli/tui/state/TuiSt.ts +2 -1
- package/src/coreExports.ts +8 -1
- package/src/graph/ComfyNode.ts +58 -1
- package/src/host/ComfyHost.ts +13 -2
- package/src/host/ComfyManager.ts +31 -13
- package/src/host/loraInfoCache.ts +35 -1
- package/src/host/loraManagerApi.ts +94 -0
- package/src/index.ts +2 -0
- package/src/promptEnhancers.ts +102 -0
- package/src/runner/ComfyExecution.ts +61 -6
- package/src/runner/ComfyWorkflow.ts +18 -4
- package/src/runner/ComfyWsApi.ts +3 -0
- package/src/runner/describePromptRejection.ts +34 -0
- package/src/sdk-generator/ComfySchema.ts +17 -4
- package/src/sdk-generator/comfyui-sdk-codegen.ts +56 -2
- package/src/utils/ansi.ts +13 -0
- package/src/utils/matchesRegex.ts +13 -0
- package/src/utils/safeName.ts +29 -0
- package/src/utils/stringMap.ts +9 -0
- package/src/vars/ComfyVars.ts +61 -10
- package/src/vars/presets.ts +17 -0
- package/src/web.ts +12 -0
- package/dist/DefinedWorkflow-BJgt5t0x.js.map +0 -1
- package/dist/DraftsSt-dizp3VcC.js.map +0 -1
- package/dist/run-serve-D1Tsuru9.js +0 -1162
- package/dist/run-serve-D1Tsuru9.js.map +0 -1
- package/dist/run-tui-JxlEbb_f.js.map +0 -1
- package/dist/state-CaHeDL-0.js.map +0 -1
- package/src/cli/serve/promptEnhancers.ts +0 -69
- package/src/cli/serve/safeName.ts +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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-BbgJeCe6.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";
|
|
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";
|
|
@@ -398,6 +398,12 @@ const MODE_KEYS = {
|
|
|
398
398
|
["type", "filter"],
|
|
399
399
|
["esc", "cancel"]
|
|
400
400
|
],
|
|
401
|
+
"overlay-preset": [
|
|
402
|
+
["⏎", "use this text"],
|
|
403
|
+
["↑↓", "move"],
|
|
404
|
+
["type", "filter"],
|
|
405
|
+
["esc", "cancel"]
|
|
406
|
+
],
|
|
401
407
|
"overlay-size": [
|
|
402
408
|
["⏎", "pick"],
|
|
403
409
|
["↑↓", "move"],
|
|
@@ -470,7 +476,8 @@ const KeyBar = observer((p) => {
|
|
|
470
476
|
] : MODE_KEYS[s.mode] ?? [
|
|
471
477
|
["↑↓", "select"],
|
|
472
478
|
["←", "tree"],
|
|
473
|
-
...kind ? KIND_KEYS[kind] ?? [] : []
|
|
479
|
+
...kind ? KIND_KEYS[kind] ?? [] : [],
|
|
480
|
+
...s.picker.presetVar != null ? [["P", "presets"]] : []
|
|
474
481
|
];
|
|
475
482
|
const globalHints = !treeFiltering && (s.mode === "nav" || s.mode === "tree" || s.mode === "host" || s.mode === "preview") ? [
|
|
476
483
|
["r", "run"],
|
|
@@ -857,6 +864,59 @@ const ChoiceOverlay = observer((p) => {
|
|
|
857
864
|
}) : void 0
|
|
858
865
|
});
|
|
859
866
|
});
|
|
867
|
+
/** modal preset picker (`P` on a text/prompt var): the label, then a dim peek at the text it
|
|
868
|
+
* writes — two presets whose names are close are told apart by their first line, not by memory */
|
|
869
|
+
const PresetOverlay = observer((p) => {
|
|
870
|
+
const s = p.st;
|
|
871
|
+
const pk = s.picker;
|
|
872
|
+
const options = pk.presetOptions;
|
|
873
|
+
const current = pk.presetVar?.value.trim() ?? "";
|
|
874
|
+
return /* @__PURE__ */ jsx(OverlayList, {
|
|
875
|
+
title: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
876
|
+
"presets ",
|
|
877
|
+
s.selected ? s.selected[1].label ?? s.selected[0] : "",
|
|
878
|
+
" ",
|
|
879
|
+
/* @__PURE__ */ jsx(Text, {
|
|
880
|
+
color: "gray",
|
|
881
|
+
children: "· ⏎ replaces the text"
|
|
882
|
+
})
|
|
883
|
+
] }),
|
|
884
|
+
extraHeader: /* @__PURE__ */ jsxs(Text, {
|
|
885
|
+
color: "yellow",
|
|
886
|
+
children: [
|
|
887
|
+
"filter: ",
|
|
888
|
+
pk.filter,
|
|
889
|
+
"▌"
|
|
890
|
+
]
|
|
891
|
+
}),
|
|
892
|
+
selectedIx: pk.ix,
|
|
893
|
+
lines: s.overlayLines,
|
|
894
|
+
rows: options.map((opt, ix) => ({
|
|
895
|
+
key: opt.label,
|
|
896
|
+
node: /* @__PURE__ */ jsxs(Text, {
|
|
897
|
+
inverse: ix === pk.ix,
|
|
898
|
+
wrap: "truncate",
|
|
899
|
+
children: [
|
|
900
|
+
ix === pk.ix ? "▸ " : " ",
|
|
901
|
+
opt.text.trim() === current ? "• " : " ",
|
|
902
|
+
opt.label,
|
|
903
|
+
" ",
|
|
904
|
+
/* @__PURE__ */ jsx(Text, {
|
|
905
|
+
color: "gray",
|
|
906
|
+
children: firstLine(opt.text)
|
|
907
|
+
})
|
|
908
|
+
]
|
|
909
|
+
}, opt.label)
|
|
910
|
+
})),
|
|
911
|
+
footer: options.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
912
|
+
color: "red",
|
|
913
|
+
children: "no match"
|
|
914
|
+
}) : void 0
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
function firstLine(text) {
|
|
918
|
+
return text.split("\n").find((l) => l.trim() !== "") ?? "";
|
|
919
|
+
}
|
|
860
920
|
/** modal size picker: presets, or type `WxH` and ⏎ for a custom size */
|
|
861
921
|
const SizeOverlay = observer((p) => {
|
|
862
922
|
const s = p.st;
|
|
@@ -1958,7 +2018,7 @@ const TuiApp = observer((p) => {
|
|
|
1958
2018
|
if (input && !key.ctrl && !key.meta) return ed.input(input);
|
|
1959
2019
|
return;
|
|
1960
2020
|
}
|
|
1961
|
-
if (s.mode === "overlay-choice" || s.mode === "overlay-size") {
|
|
2021
|
+
if (s.mode === "overlay-choice" || s.mode === "overlay-size" || s.mode === "overlay-preset") {
|
|
1962
2022
|
const pk = s.picker;
|
|
1963
2023
|
if (key.escape) return s.editor.cancel();
|
|
1964
2024
|
if (key.return) return pk.commit();
|
|
@@ -2114,6 +2174,7 @@ const TuiApp = observer((p) => {
|
|
|
2114
2174
|
s.tree.focus();
|
|
2115
2175
|
return s.tree.beginFilter();
|
|
2116
2176
|
}
|
|
2177
|
+
if (input === "P") return s.picker.beginPresets();
|
|
2117
2178
|
if (input === "e") return s.drafts.beginRename();
|
|
2118
2179
|
if (input === "r") return void s.exec.run();
|
|
2119
2180
|
if (input === "s") return s.exec.randomizeSeedAndRun();
|
|
@@ -2143,7 +2204,7 @@ const TuiApp = observer((p) => {
|
|
|
2143
2204
|
flexDirection: "column",
|
|
2144
2205
|
flexGrow: 1,
|
|
2145
2206
|
children: [
|
|
2146
|
-
s.mode === "edit" && s.editor.isCustom ? /* @__PURE__ */ jsx(PromptOverlay, { st: s }) : s.mode === "host" ? /* @__PURE__ */ jsx(HostPanel, { st: s }) : s.mode === "overlay-text" ? /* @__PURE__ */ jsx(TextOverlay, { st: s }) : s.mode === "overlay-choice" ? /* @__PURE__ */ jsx(ChoiceOverlay, { st: s }) : s.mode === "overlay-size" ? /* @__PURE__ */ jsx(SizeOverlay, { st: s }) : s.mode === "overlay-loras" ? /* @__PURE__ */ jsx(LorasOverlay, { st: s }) : s.mode === "overlay-image" ? /* @__PURE__ */ jsx(ImagePickerOverlay, { st: s }) : s.mode === "overlay-drafts" ? /* @__PURE__ */ jsx(DraftsOverlay, { st: s }) : s.mode === "overlay-hosts" ? /* @__PURE__ */ jsx(HostsOverlay, { st: s }) : s.mode === "overlay-copy" ? /* @__PURE__ */ jsx(CopyOverlay, { st: s }) : /* @__PURE__ */ jsx(VarsPanel, { st: s }),
|
|
2207
|
+
s.mode === "edit" && s.editor.isCustom ? /* @__PURE__ */ jsx(PromptOverlay, { st: s }) : s.mode === "host" ? /* @__PURE__ */ jsx(HostPanel, { st: s }) : s.mode === "overlay-text" ? /* @__PURE__ */ jsx(TextOverlay, { st: s }) : s.mode === "overlay-choice" ? /* @__PURE__ */ jsx(ChoiceOverlay, { st: s }) : s.mode === "overlay-preset" ? /* @__PURE__ */ jsx(PresetOverlay, { st: s }) : s.mode === "overlay-size" ? /* @__PURE__ */ jsx(SizeOverlay, { st: s }) : s.mode === "overlay-loras" ? /* @__PURE__ */ jsx(LorasOverlay, { st: s }) : s.mode === "overlay-image" ? /* @__PURE__ */ jsx(ImagePickerOverlay, { st: s }) : s.mode === "overlay-drafts" ? /* @__PURE__ */ jsx(DraftsOverlay, { st: s }) : s.mode === "overlay-hosts" ? /* @__PURE__ */ jsx(HostsOverlay, { st: s }) : s.mode === "overlay-copy" ? /* @__PURE__ */ jsx(CopyOverlay, { st: s }) : /* @__PURE__ */ jsx(VarsPanel, { st: s }),
|
|
2147
2208
|
/* @__PURE__ */ jsx(Box, {
|
|
2148
2209
|
paddingX: 1,
|
|
2149
2210
|
children: /* @__PURE__ */ jsx(ProgressLine, { st: s })
|
|
@@ -3150,7 +3211,7 @@ var HostSt = class {
|
|
|
3150
3211
|
});
|
|
3151
3212
|
} catch (e) {
|
|
3152
3213
|
runInAction(() => {
|
|
3153
|
-
this.st.exec.notice =
|
|
3214
|
+
this.st.exec.notice = `🔴 reboot refused: ${extractErrorMessage(e)}`;
|
|
3154
3215
|
});
|
|
3155
3216
|
} finally {
|
|
3156
3217
|
runInAction(() => {
|
|
@@ -3160,154 +3221,6 @@ var HostSt = class {
|
|
|
3160
3221
|
}
|
|
3161
3222
|
};
|
|
3162
3223
|
//#endregion
|
|
3163
|
-
//#region src/utils/mojibake.ts
|
|
3164
|
-
const CP1252_REVERSE = {
|
|
3165
|
-
"€": 128,
|
|
3166
|
-
"‚": 130,
|
|
3167
|
-
ƒ: 131,
|
|
3168
|
-
"„": 132,
|
|
3169
|
-
"…": 133,
|
|
3170
|
-
"†": 134,
|
|
3171
|
-
"‡": 135,
|
|
3172
|
-
ˆ: 136,
|
|
3173
|
-
"‰": 137,
|
|
3174
|
-
Š: 138,
|
|
3175
|
-
"‹": 139,
|
|
3176
|
-
Œ: 140,
|
|
3177
|
-
Ž: 142,
|
|
3178
|
-
"‘": 145,
|
|
3179
|
-
"’": 146,
|
|
3180
|
-
"“": 147,
|
|
3181
|
-
"”": 148,
|
|
3182
|
-
"•": 149,
|
|
3183
|
-
"–": 150,
|
|
3184
|
-
"—": 151,
|
|
3185
|
-
"˜": 152,
|
|
3186
|
-
"™": 153,
|
|
3187
|
-
š: 154,
|
|
3188
|
-
"›": 155,
|
|
3189
|
-
œ: 156,
|
|
3190
|
-
ž: 158,
|
|
3191
|
-
Ÿ: 159
|
|
3192
|
-
};
|
|
3193
|
-
/**
|
|
3194
|
-
* repair UTF-8 that was decoded as cp1252 (a Windows server re-reading its own
|
|
3195
|
-
* output: `█` E2 96 88 arrives as `â–ˆ`). Reverses the cp1252 map back to
|
|
3196
|
-
* bytes and re-decodes as UTF-8; any unmappable char or invalid byte sequence
|
|
3197
|
-
* means the text was NOT mojibake — the original is returned untouched.
|
|
3198
|
-
*/
|
|
3199
|
-
function repairMojibake(s) {
|
|
3200
|
-
let suspicious = false;
|
|
3201
|
-
for (let i = 0; i < s.length; i++) if (s.charCodeAt(i) > 127) {
|
|
3202
|
-
suspicious = true;
|
|
3203
|
-
break;
|
|
3204
|
-
}
|
|
3205
|
-
if (!suspicious) return s;
|
|
3206
|
-
const bytes = new Uint8Array(s.length);
|
|
3207
|
-
for (let i = 0; i < s.length; i++) {
|
|
3208
|
-
const code = s.charCodeAt(i);
|
|
3209
|
-
if (code <= 255) {
|
|
3210
|
-
bytes[i] = code;
|
|
3211
|
-
continue;
|
|
3212
|
-
}
|
|
3213
|
-
const mapped = CP1252_REVERSE[s[i] ?? ""];
|
|
3214
|
-
if (mapped == null) return s;
|
|
3215
|
-
bytes[i] = mapped;
|
|
3216
|
-
}
|
|
3217
|
-
const decoded = Buffer.from(bytes).toString("utf8");
|
|
3218
|
-
return decoded.includes("�") ? s : decoded;
|
|
3219
|
-
}
|
|
3220
|
-
//#endregion
|
|
3221
|
-
//#region src/cli/tui/state/LogsSt.ts
|
|
3222
|
-
const MAX_LINES = 400;
|
|
3223
|
-
/** fold write chunks into p.lines (mutated), returns the new partial tail.
|
|
3224
|
-
* `\n` commits a line, `\r` resets the partial (tqdm redraws collapse to
|
|
3225
|
-
* their last state), ANSI stripped, blank lines dropped. */
|
|
3226
|
-
function assembleLogChunks(p) {
|
|
3227
|
-
let partial = p.partial;
|
|
3228
|
-
for (const entry of p.entries) for (const piece of stripAnsi(repairMojibake(entry.m)).split(/(\r\n|\n|\r)/)) if (piece === "\n" || piece === "\r\n") {
|
|
3229
|
-
if (partial.trim() !== "") p.lines.push(partial);
|
|
3230
|
-
partial = "";
|
|
3231
|
-
} else if (piece === "\r") partial = "";
|
|
3232
|
-
else if (piece !== "") partial += piece;
|
|
3233
|
-
return partial;
|
|
3234
|
-
}
|
|
3235
|
-
/** server console mirror: /internal/logs/raw backfill + ws 'logs' stream.
|
|
3236
|
-
* Entries are write CHUNKS, not lines — assembled here (`\n` commits,
|
|
3237
|
-
* `\r` resets the partial, so tqdm redraws collapse to their last state). */
|
|
3238
|
-
var LogsSt = class {
|
|
3239
|
-
constructor(st) {
|
|
3240
|
-
this.st = st;
|
|
3241
|
-
this.lines = [];
|
|
3242
|
-
this.partial = "";
|
|
3243
|
-
this.attached = null;
|
|
3244
|
-
makeAutoObservable(this, { st: false });
|
|
3245
|
-
this.attach(this.st.wf.host);
|
|
3246
|
-
this.st.disposers.push(() => {
|
|
3247
|
-
if (this.attached != null) {
|
|
3248
|
-
this.attached.onLogs = null;
|
|
3249
|
-
this.attached.onSession = null;
|
|
3250
|
-
}
|
|
3251
|
-
});
|
|
3252
|
-
}
|
|
3253
|
-
/** follow the CURRENT workflow's host (re-called on workflow switch) */
|
|
3254
|
-
attach(host) {
|
|
3255
|
-
if (this.attached === host) return;
|
|
3256
|
-
if (this.attached != null) {
|
|
3257
|
-
this.attached.onLogs = null;
|
|
3258
|
-
this.attached.onSession = null;
|
|
3259
|
-
if (this.attached.isConnected && this.attached.comfySessionId !== "temp") this.attached.subscribeLogs({
|
|
3260
|
-
enabled: false,
|
|
3261
|
-
clientId: this.attached.comfySessionId
|
|
3262
|
-
}).catch(() => {});
|
|
3263
|
-
}
|
|
3264
|
-
this.attached = host;
|
|
3265
|
-
this.lines = [];
|
|
3266
|
-
this.partial = "";
|
|
3267
|
-
host.onLogs = (p) => this.feed(p.entries);
|
|
3268
|
-
host.onSession = (sid) => void this.hydrate(host, sid);
|
|
3269
|
-
if (host.isConnected && host.comfySessionId !== "temp") this.hydrate(host, host.comfySessionId);
|
|
3270
|
-
}
|
|
3271
|
-
/** backfill BEFORE subscribe: entries emitted in the gap are lost, which is
|
|
3272
|
-
* the right trade — the reverse order would clobber streamed entries at the
|
|
3273
|
-
* reset, and the backfill re-covers the recent past anyway */
|
|
3274
|
-
async hydrate(host, sid) {
|
|
3275
|
-
try {
|
|
3276
|
-
const raw = await host.fetchRawLogs();
|
|
3277
|
-
if (this.attached !== host || host.comfySessionId !== sid) return;
|
|
3278
|
-
runInAction(() => {
|
|
3279
|
-
this.lines = [];
|
|
3280
|
-
this.partial = "";
|
|
3281
|
-
});
|
|
3282
|
-
this.feed(raw.entries);
|
|
3283
|
-
await host.subscribeLogs({
|
|
3284
|
-
enabled: true,
|
|
3285
|
-
clientId: sid
|
|
3286
|
-
});
|
|
3287
|
-
} catch (e) {
|
|
3288
|
-
if (this.attached !== host) return;
|
|
3289
|
-
this.feed([{
|
|
3290
|
-
t: "",
|
|
3291
|
-
m: `[comfy-ts] server log stream unavailable: ${extractErrorMessage(e)}\n`
|
|
3292
|
-
}]);
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
feed(entries) {
|
|
3296
|
-
runInAction(() => {
|
|
3297
|
-
this.partial = assembleLogChunks({
|
|
3298
|
-
lines: this.lines,
|
|
3299
|
-
partial: this.partial,
|
|
3300
|
-
entries
|
|
3301
|
-
});
|
|
3302
|
-
if (this.lines.length > MAX_LINES) this.lines.splice(0, this.lines.length - MAX_LINES);
|
|
3303
|
-
});
|
|
3304
|
-
}
|
|
3305
|
-
/** last rows to render, live partial included */
|
|
3306
|
-
tail(n) {
|
|
3307
|
-
return (this.partial.trim() !== "" ? [...this.lines, this.partial] : this.lines).slice(-n);
|
|
3308
|
-
}
|
|
3309
|
-
};
|
|
3310
|
-
//#endregion
|
|
3311
3224
|
//#region src/cli/tui/state/LorasSt.ts
|
|
3312
3225
|
/** loras overlay: filter + tick/untick + strengths + bulk ops + lora-manager metadata & preview */
|
|
3313
3226
|
var LorasSt = class {
|
|
@@ -3489,7 +3402,7 @@ var LorasSt = class {
|
|
|
3489
3402
|
//#endregion
|
|
3490
3403
|
//#region src/cli/tui/state/PickerSt.ts
|
|
3491
3404
|
/**
|
|
3492
|
-
* choice + size overlays: a windowed option list with a fuzzy type-to-filter.
|
|
3405
|
+
* choice + size + preset overlays: a windowed option list with a fuzzy type-to-filter.
|
|
3493
3406
|
* For sizes the filter doubles as free `WxH` entry.
|
|
3494
3407
|
*/
|
|
3495
3408
|
var PickerSt = class {
|
|
@@ -3509,7 +3422,23 @@ var PickerSt = class {
|
|
|
3509
3422
|
const sel = this.st.selected?.[1];
|
|
3510
3423
|
return sel?.kind === "size" ? sel : null;
|
|
3511
3424
|
}
|
|
3425
|
+
/** null when the selected var is not text/prompt, or carries no presets */
|
|
3426
|
+
get presetVar() {
|
|
3427
|
+
const sel = this.st.selected?.[1];
|
|
3428
|
+
if (sel == null || sel.kind !== "text" && sel.kind !== "prompt") return null;
|
|
3429
|
+
const withPresets = sel;
|
|
3430
|
+
return withPresets.presets.length === 0 ? null : withPresets;
|
|
3431
|
+
}
|
|
3432
|
+
/** the preset rows the filter kept — the label AND the text are searched, since what you
|
|
3433
|
+
* remember of a preset is often a phrase inside it */
|
|
3434
|
+
get presetOptions() {
|
|
3435
|
+
const pv = this.presetVar;
|
|
3436
|
+
if (pv == null) return [];
|
|
3437
|
+
if (this.filter === "") return pv.presets;
|
|
3438
|
+
return pv.presets.filter((x) => fuzzyMatch(this.filter, `${x.label} ${x.text}`));
|
|
3439
|
+
}
|
|
3512
3440
|
get options() {
|
|
3441
|
+
if (this.presetVar != null) return this.presetOptions.map((x) => x.label);
|
|
3513
3442
|
const cv = this.choiceVar;
|
|
3514
3443
|
if (cv != null) {
|
|
3515
3444
|
if (this.filter === "") return [...cv.choices];
|
|
@@ -3532,6 +3461,18 @@ var PickerSt = class {
|
|
|
3532
3461
|
this.invalid = false;
|
|
3533
3462
|
this.ix = Math.max(0, cv.choices.indexOf(cv.value));
|
|
3534
3463
|
}
|
|
3464
|
+
/** `P` on a text/prompt var that declares presets. A var without any stays on `nav`:
|
|
3465
|
+
* the keybar only advertises the key when the row has some */
|
|
3466
|
+
beginPresets() {
|
|
3467
|
+
const pv = this.presetVar;
|
|
3468
|
+
if (pv == null) return;
|
|
3469
|
+
this.st.mode = "overlay-preset";
|
|
3470
|
+
this.filter = "";
|
|
3471
|
+
this.invalid = false;
|
|
3472
|
+
const value = pv.value.trim();
|
|
3473
|
+
const ix = pv.presets.findIndex((x) => x.text.trim() === value);
|
|
3474
|
+
this.ix = ix === -1 ? 0 : ix;
|
|
3475
|
+
}
|
|
3535
3476
|
beginSize() {
|
|
3536
3477
|
const sv = this.sizeVar;
|
|
3537
3478
|
if (sv == null) return;
|
|
@@ -3565,6 +3506,14 @@ var PickerSt = class {
|
|
|
3565
3506
|
this.invalid = false;
|
|
3566
3507
|
}
|
|
3567
3508
|
commit() {
|
|
3509
|
+
const pv = this.presetVar;
|
|
3510
|
+
if (pv != null) {
|
|
3511
|
+
const hit = this.presetOptions[this.ix];
|
|
3512
|
+
if (hit == null) return;
|
|
3513
|
+
pv.set(hit.text);
|
|
3514
|
+
this.st.mode = "nav";
|
|
3515
|
+
return;
|
|
3516
|
+
}
|
|
3568
3517
|
const cv = this.choiceVar;
|
|
3569
3518
|
if (cv != null) {
|
|
3570
3519
|
const hit = this.options[this.ix];
|
|
@@ -4591,4 +4540,4 @@ async function runTui(args) {
|
|
|
4591
4540
|
//#endregion
|
|
4592
4541
|
export { runTui };
|
|
4593
4542
|
|
|
4594
|
-
//# sourceMappingURL=run-tui-
|
|
4543
|
+
//# sourceMappingURL=run-tui-BLEdTsOX.js.map
|