comfy-ts 0.3.0 → 0.4.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 +3 -3
- package/dist/cli.js +1 -1
- package/dist/index.cjs +45 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +45 -2
- package/dist/index.js.map +1 -1
- package/dist/{run-tui-Io8Xea0L.js → run-tui-SDSJo1Qf.js} +638 -82
- package/dist/run-tui-SDSJo1Qf.js.map +1 -0
- package/package.json +2 -3
- package/src/cli/tui/components/Header.tsx +5 -0
- package/src/cli/tui/components/LogsPanel.tsx +23 -0
- package/src/cli/tui/components/PreviewPanel.tsx +52 -7
- package/src/cli/tui/components/StatusBar.tsx +10 -4
- package/src/cli/tui/components/TuiApp.tsx +26 -3
- package/src/cli/tui/protocolImagePainter.ts +54 -18
- package/src/cli/tui/run-tui.tsx +4 -1
- package/src/cli/tui/state/ExecSt.ts +4 -1
- package/src/cli/tui/state/HostSt.ts +124 -1
- package/src/cli/tui/state/LogsSt.ts +107 -0
- package/src/cli/tui/state/PreviewSt.ts +173 -23
- package/src/cli/tui/state/SettingsSt.ts +48 -21
- package/src/cli/tui/state/TuiSt.ts +6 -0
- package/src/cli/tui/state/WorkflowsSt.ts +1 -0
- package/src/host/ComfyHost.ts +44 -0
- package/src/runner/ComfyWsApi.ts +12 -1
- package/src/ssh-host-manager/ssh-manager.ts +0 -15
- package/src/utils/ansi.ts +7 -0
- package/src/utils/mojibake.ts +60 -0
- package/dist/run-tui-Io8Xea0L.js.map +0 -1
package/README.md
CHANGED
|
@@ -216,9 +216,9 @@ bunx comfy-ts tui # no arg: scans cwd
|
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
```
|
|
219
|
-
┌ comfy-ts ┐┌ (w)orkflow ─┐┌ (d)raft ─┐┌ (h)ost
|
|
220
|
-
│ comfy-ts ││ 01-txt2img ││ default ││ windows-1 (127.0.0.1:8085)│
|
|
221
|
-
|
|
219
|
+
┌ comfy-ts ┐┌ (w)orkflow ─┐┌ (d)raft ─┐┌ (h)ost ────────────────────┐
|
|
220
|
+
│ comfy-ts ││ 01-txt2img ││ default ││ ● windows-1 (127.0.0.1:8085)│
|
|
221
|
+
└──────────┘└─────────────┘└──────────┘└────────────────────────────┘
|
|
222
222
|
┌ (t)ree ────────────┐┌ (v)ars ─────────────────────────────┐┌ (p)review ─────┐
|
|
223
223
|
│ ▾ 01-txt2img ││ ▸ prompt [text] a cozy house in a… ││ │
|
|
224
224
|
│ default ││ seed [seed] ? 42 ││ ▄▓▓▒▒░▄▄▓▒░░ │
|
package/dist/cli.js
CHANGED
|
@@ -751,7 +751,7 @@ async function main() {
|
|
|
751
751
|
if (cmd === "gen") return runGen(rest);
|
|
752
752
|
if (cmd === "outline") return runOutline(rest);
|
|
753
753
|
if (cmd === "tui") {
|
|
754
|
-
const { runTui } = await import("./run-tui-
|
|
754
|
+
const { runTui } = await import("./run-tui-SDSJo1Qf.js");
|
|
755
755
|
return runTui(rest);
|
|
756
756
|
}
|
|
757
757
|
console.log(HELP);
|
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ node_https = __toESM(node_https, 1);
|
|
|
39
39
|
let node_process = require("node:process");
|
|
40
40
|
let fs = require("fs");
|
|
41
41
|
//#region package.json
|
|
42
|
-
var version = "0.
|
|
42
|
+
var version = "0.4.0";
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/sdk-generator/Primitives.ts
|
|
45
45
|
const ComfyPrimitiveMapping = {
|
|
@@ -803,6 +803,18 @@ const types$1 = (0, arktype.scope)({
|
|
|
803
803
|
type: "'manager-terminal-feedback'",
|
|
804
804
|
data: "WSMsgManagerFeedbackData"
|
|
805
805
|
},
|
|
806
|
+
LogEntry: {
|
|
807
|
+
t: "string",
|
|
808
|
+
m: "string"
|
|
809
|
+
},
|
|
810
|
+
_WsMsgLogsData: {
|
|
811
|
+
entries: "LogEntry[]",
|
|
812
|
+
"size?": "unknown"
|
|
813
|
+
},
|
|
814
|
+
WsMsgLogs: {
|
|
815
|
+
type: "'logs'",
|
|
816
|
+
data: "_WsMsgLogsData"
|
|
817
|
+
},
|
|
806
818
|
WsMsgProgress: {
|
|
807
819
|
type: "'progress'",
|
|
808
820
|
data: "NodeProgress"
|
|
@@ -816,11 +828,12 @@ const types$1 = (0, arktype.scope)({
|
|
|
816
828
|
data: "_WsMsgProgressStateData"
|
|
817
829
|
},
|
|
818
830
|
PromptRelated_WsMsg: "WsMsgExecutionStart | WsMsgExecutionCached | WsMsgExecuting | WsMsgProgress | WsMsgProgressState | WsMsgExecuted | WsMsgExecutionError | WsMsgExecutionSuccess",
|
|
819
|
-
WsMsg: "WsMsgStatus | WSMsgManagerFeedback | PromptRelated_WsMsg"
|
|
831
|
+
WsMsg: "WsMsgStatus | WSMsgManagerFeedback | WsMsgLogs | PromptRelated_WsMsg"
|
|
820
832
|
}).export();
|
|
821
833
|
const PromptInfo_ark = (0, arktype.type)({ prompt_id: types$1.PromptID }).as();
|
|
822
834
|
const WsMsg_ark = types$1.WsMsg;
|
|
823
835
|
const ComfyImageInfo_ark = types$1.ComfyImageInfo;
|
|
836
|
+
const WsMsgLogsData_ark = types$1._WsMsgLogsData;
|
|
824
837
|
(0, arktype.type)({
|
|
825
838
|
comfyHostHttpURL: "string",
|
|
826
839
|
comfyImageInfo: ComfyImageInfo_ark
|
|
@@ -3201,6 +3214,28 @@ var ComfyHost = class {
|
|
|
3201
3214
|
this.interrupt = () => {
|
|
3202
3215
|
return this.postJSON_("/interrupt", {});
|
|
3203
3216
|
};
|
|
3217
|
+
this.fetchRawLogs = async () => {
|
|
3218
|
+
const res = await fetch(`${this.getServerHostHTTP()}/internal/logs/raw`);
|
|
3219
|
+
if (!res.ok) throw new Error(`GET /internal/logs/raw failed: ${res.status}`);
|
|
3220
|
+
const json = await res.json();
|
|
3221
|
+
const checked = WsMsgLogsData_ark(json);
|
|
3222
|
+
if (checked instanceof arktype.type.errors) {
|
|
3223
|
+
console.log(`[🔴] /!\\ /internal/logs/raw payload does not match schema.`);
|
|
3224
|
+
printArkResultInConsole(checked);
|
|
3225
|
+
}
|
|
3226
|
+
return json;
|
|
3227
|
+
};
|
|
3228
|
+
this.subscribeLogs = async (p) => {
|
|
3229
|
+
const res = await fetch(`${this.getServerHostHTTP()}/internal/logs/subscribe`, {
|
|
3230
|
+
method: "PATCH",
|
|
3231
|
+
headers: { "Content-Type": "application/json" },
|
|
3232
|
+
body: JSON.stringify({
|
|
3233
|
+
enabled: p.enabled,
|
|
3234
|
+
clientId: p.clientId
|
|
3235
|
+
})
|
|
3236
|
+
});
|
|
3237
|
+
if (!res.ok) throw new Error(`PATCH /internal/logs/subscribe failed: ${res.status}`);
|
|
3238
|
+
};
|
|
3204
3239
|
this.fetchJSON_ = async (route) => {
|
|
3205
3240
|
const base = this.getServerHostHTTP();
|
|
3206
3241
|
for (const url of [`${base}/api${route}`, `${base}${route}`]) {
|
|
@@ -3249,6 +3284,8 @@ var ComfyHost = class {
|
|
|
3249
3284
|
this.latentPreview = null;
|
|
3250
3285
|
this.onLatentPreview = null;
|
|
3251
3286
|
this.onStatus = null;
|
|
3287
|
+
this.onSession = null;
|
|
3288
|
+
this.onLogs = null;
|
|
3252
3289
|
this.comfySessionId = "temp";
|
|
3253
3290
|
this.status = null;
|
|
3254
3291
|
/** folder where file related to the host config will be cached */
|
|
@@ -3432,9 +3469,11 @@ var ComfyHost = class {
|
|
|
3432
3469
|
const msg = msg_;
|
|
3433
3470
|
if (msg.type === "status") {
|
|
3434
3471
|
if (msg.data.sid) {
|
|
3472
|
+
const sidChanged = msg.data.sid !== this.comfySessionId;
|
|
3435
3473
|
this.comfySessionId = msg.data.sid;
|
|
3436
3474
|
this._sessionResolve?.();
|
|
3437
3475
|
this._sessionResolve = null;
|
|
3476
|
+
if (sidChanged) this.onSession?.(msg.data.sid);
|
|
3438
3477
|
}
|
|
3439
3478
|
this.status = msg.data.status;
|
|
3440
3479
|
this.onStatus?.({ queueRemaining: msg.data.status?.exec_info?.queue_remaining ?? 0 });
|
|
@@ -3457,6 +3496,10 @@ var ComfyHost = class {
|
|
|
3457
3496
|
this.addLog(msg.data.data);
|
|
3458
3497
|
return;
|
|
3459
3498
|
}
|
|
3499
|
+
if (msg.type === "logs") {
|
|
3500
|
+
this.onLogs?.(msg.data);
|
|
3501
|
+
return;
|
|
3502
|
+
}
|
|
3460
3503
|
console.log("❌", "Unknown message:", msg);
|
|
3461
3504
|
logError("Unknown message type: " + JSON.stringify(msg.type));
|
|
3462
3505
|
}
|