comfyui-node 1.0.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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +601 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/call-wrapper.d.ts +115 -0
  5. package/dist/call-wrapper.d.ts.map +1 -0
  6. package/dist/call-wrapper.js +432 -0
  7. package/dist/call-wrapper.js.map +1 -0
  8. package/dist/client.d.ts +233 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +719 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/constants.d.ts +4 -0
  13. package/dist/constants.d.ts.map +1 -0
  14. package/dist/constants.js +4 -0
  15. package/dist/constants.js.map +1 -0
  16. package/dist/features/abstract.d.ts +15 -0
  17. package/dist/features/abstract.d.ts.map +1 -0
  18. package/dist/features/abstract.js +19 -0
  19. package/dist/features/abstract.js.map +1 -0
  20. package/dist/features/base.d.ts +9 -0
  21. package/dist/features/base.d.ts.map +1 -0
  22. package/dist/features/base.js +15 -0
  23. package/dist/features/base.js.map +1 -0
  24. package/dist/features/feature-flags.d.ts +14 -0
  25. package/dist/features/feature-flags.d.ts.map +1 -0
  26. package/dist/features/feature-flags.js +27 -0
  27. package/dist/features/feature-flags.js.map +1 -0
  28. package/dist/features/file.d.ts +86 -0
  29. package/dist/features/file.d.ts.map +1 -0
  30. package/dist/features/file.js +160 -0
  31. package/dist/features/file.js.map +1 -0
  32. package/dist/features/history.d.ts +16 -0
  33. package/dist/features/history.d.ts.map +1 -0
  34. package/dist/features/history.js +23 -0
  35. package/dist/features/history.js.map +1 -0
  36. package/dist/features/index.d.ts +14 -0
  37. package/dist/features/index.d.ts.map +1 -0
  38. package/dist/features/index.js +14 -0
  39. package/dist/features/index.js.map +1 -0
  40. package/dist/features/manager.d.ts +154 -0
  41. package/dist/features/manager.d.ts.map +1 -0
  42. package/dist/features/manager.js +309 -0
  43. package/dist/features/manager.js.map +1 -0
  44. package/dist/features/misc.d.ts +17 -0
  45. package/dist/features/misc.d.ts.map +1 -0
  46. package/dist/features/misc.js +52 -0
  47. package/dist/features/misc.js.map +1 -0
  48. package/dist/features/model.d.ts +39 -0
  49. package/dist/features/model.d.ts.map +1 -0
  50. package/dist/features/model.js +79 -0
  51. package/dist/features/model.js.map +1 -0
  52. package/dist/features/monitoring.d.ts +90 -0
  53. package/dist/features/monitoring.d.ts.map +1 -0
  54. package/dist/features/monitoring.js +129 -0
  55. package/dist/features/monitoring.js.map +1 -0
  56. package/dist/features/node.d.ts +42 -0
  57. package/dist/features/node.d.ts.map +1 -0
  58. package/dist/features/node.js +68 -0
  59. package/dist/features/node.js.map +1 -0
  60. package/dist/features/queue.d.ts +23 -0
  61. package/dist/features/queue.d.ts.map +1 -0
  62. package/dist/features/queue.js +68 -0
  63. package/dist/features/queue.js.map +1 -0
  64. package/dist/features/system.d.ts +21 -0
  65. package/dist/features/system.d.ts.map +1 -0
  66. package/dist/features/system.js +45 -0
  67. package/dist/features/system.js.map +1 -0
  68. package/dist/features/terminal.d.ts +25 -0
  69. package/dist/features/terminal.d.ts.map +1 -0
  70. package/dist/features/terminal.js +32 -0
  71. package/dist/features/terminal.js.map +1 -0
  72. package/dist/features/user.d.ts +42 -0
  73. package/dist/features/user.d.ts.map +1 -0
  74. package/dist/features/user.js +76 -0
  75. package/dist/features/user.js.map +1 -0
  76. package/dist/index.d.ts +8 -0
  77. package/dist/index.d.ts.map +1 -0
  78. package/dist/index.js +6 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/pool.d.ts +171 -0
  81. package/dist/pool.d.ts.map +1 -0
  82. package/dist/pool.js +467 -0
  83. package/dist/pool.js.map +1 -0
  84. package/dist/prompt-builder.d.ts +131 -0
  85. package/dist/prompt-builder.d.ts.map +1 -0
  86. package/dist/prompt-builder.js +266 -0
  87. package/dist/prompt-builder.js.map +1 -0
  88. package/dist/tools.d.ts +10 -0
  89. package/dist/tools.d.ts.map +1 -0
  90. package/dist/tools.js +16 -0
  91. package/dist/tools.js.map +1 -0
  92. package/dist/typed-event-target.d.ts +7 -0
  93. package/dist/typed-event-target.d.ts.map +1 -0
  94. package/dist/typed-event-target.js +19 -0
  95. package/dist/typed-event-target.js.map +1 -0
  96. package/dist/types/api.d.ts +212 -0
  97. package/dist/types/api.d.ts.map +1 -0
  98. package/dist/types/api.js +16 -0
  99. package/dist/types/api.js.map +1 -0
  100. package/dist/types/error.d.ts +72 -0
  101. package/dist/types/error.d.ts.map +1 -0
  102. package/dist/types/error.js +75 -0
  103. package/dist/types/error.js.map +1 -0
  104. package/dist/types/event.d.ts +164 -0
  105. package/dist/types/event.d.ts.map +1 -0
  106. package/dist/types/event.js +2 -0
  107. package/dist/types/event.js.map +1 -0
  108. package/dist/types/manager.d.ts +157 -0
  109. package/dist/types/manager.d.ts.map +1 -0
  110. package/dist/types/manager.js +41 -0
  111. package/dist/types/manager.js.map +1 -0
  112. package/dist/types/sampler.d.ts +3 -0
  113. package/dist/types/sampler.d.ts.map +1 -0
  114. package/dist/types/sampler.js +2 -0
  115. package/dist/types/sampler.js.map +1 -0
  116. package/dist/types/tool.d.ts +10 -0
  117. package/dist/types/tool.d.ts.map +1 -0
  118. package/dist/types/tool.js +2 -0
  119. package/dist/types/tool.js.map +1 -0
  120. package/dist/utils/response-error.d.ts +4 -0
  121. package/dist/utils/response-error.d.ts.map +1 -0
  122. package/dist/utils/response-error.js +62 -0
  123. package/dist/utils/response-error.js.map +1 -0
  124. package/dist/utils/ws-reconnect.d.ts +29 -0
  125. package/dist/utils/ws-reconnect.d.ts.map +1 -0
  126. package/dist/utils/ws-reconnect.js +91 -0
  127. package/dist/utils/ws-reconnect.js.map +1 -0
  128. package/package.json +71 -0
@@ -0,0 +1,79 @@
1
+ import { FeatureBase } from "./base.js";
2
+ /** Experimental model browsing + preview retrieval. */
3
+ export class ModelFeature extends FeatureBase {
4
+ constructor(client) {
5
+ super(client);
6
+ }
7
+ /**
8
+ * Retrieves a list of all available model folders.
9
+ * @experimental API that may change in future versions
10
+ * @returns A promise that resolves to an array of ModelFolder objects.
11
+ */
12
+ async getModelFolders() {
13
+ try {
14
+ const response = await this.client.fetchApi("/experiment/models");
15
+ if (!response.ok) {
16
+ throw new Error(`Failed to fetch model folders: ${response.status} ${response.statusText}`);
17
+ }
18
+ return response.json();
19
+ }
20
+ catch (error) {
21
+ throw error;
22
+ }
23
+ }
24
+ /**
25
+ * Retrieves a list of all model files in a specific folder.
26
+ * @experimental API that may change in future versions
27
+ * @param folder - The name of the model folder.
28
+ * @returns A promise that resolves to an array of ModelFile objects.
29
+ */
30
+ async getModelFiles(folder) {
31
+ try {
32
+ const response = await this.client.fetchApi(`/experiment/models/${encodeURIComponent(folder)}`);
33
+ if (!response.ok) {
34
+ throw new Error(`Failed to fetch model files: ${response.status} ${response.statusText}`);
35
+ }
36
+ return response.json();
37
+ }
38
+ catch (error) {
39
+ throw error;
40
+ }
41
+ }
42
+ /**
43
+ * Retrieves a preview image for a specific model file.
44
+ * @experimental API that may change in future versions
45
+ * @param folder - The name of the model folder.
46
+ * @param pathIndex - The index of the folder path where the file is stored.
47
+ * @param filename - The name of the model file.
48
+ * @returns A promise that resolves to a ModelPreviewResponse object containing the preview image data.
49
+ */
50
+ async getModelPreview(folder, pathIndex, filename) {
51
+ try {
52
+ const response = await this.client.fetchApi(`/experiment/models/preview/${encodeURIComponent(folder)}/${pathIndex}/${encodeURIComponent(filename)}`);
53
+ if (!response.ok) {
54
+ throw new Error(`Failed to fetch model preview: ${response.status} ${response.statusText}`);
55
+ }
56
+ const contentType = response.headers.get("content-type") || "image/webp";
57
+ const body = await response.arrayBuffer();
58
+ return {
59
+ body,
60
+ contentType
61
+ };
62
+ }
63
+ catch (error) {
64
+ throw error;
65
+ }
66
+ }
67
+ /**
68
+ * Creates a URL for a model preview image.
69
+ * @experimental API that may change in future versions
70
+ * @param folder - The name of the model folder.
71
+ * @param pathIndex - The index of the folder path where the file is stored.
72
+ * @param filename - The name of the model file.
73
+ * @returns The URL string for the model preview.
74
+ */
75
+ getModelPreviewUrl(folder, pathIndex, filename) {
76
+ return this.client.apiURL(`/experiment/models/preview/${encodeURIComponent(folder)}/${pathIndex}/${encodeURIComponent(filename)}`);
77
+ }
78
+ }
79
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/features/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,uDAAuD;AACvD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,YAAY,MAAgB;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;YAClE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAC9F,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,MAAc;QAChC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAChG,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAC5F,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,CAAC,MAAc,EAAE,SAAiB,EAAE,QAAgB;QACvE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CACzC,8BAA8B,kBAAkB,CAAC,MAAM,CAAC,IAAI,SAAS,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CACxG,CAAC;YAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAC9F,CAAC;YAED,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,YAAY,CAAC;YACzE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;YAE1C,OAAO;gBACL,IAAI;gBACJ,WAAW;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,kBAAkB,CAAC,MAAc,EAAE,SAAiB,EAAE,QAAgB;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CACvB,8BAA8B,kBAAkB,CAAC,MAAM,CAAC,IAAI,SAAS,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CACxG,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,90 @@
1
+ import { AbstractFeature } from "./abstract.js";
2
+ export type TMonitorEvent = {
3
+ cpu_utilization: number;
4
+ ram_total: number;
5
+ ram_used: number;
6
+ ram_used_percent: number;
7
+ hdd_total: number;
8
+ hdd_used: number;
9
+ hdd_used_percent: number;
10
+ device_type: "cuda";
11
+ gpus: Array<{
12
+ gpu_utilization: number;
13
+ gpu_temperature: number;
14
+ vram_total: number;
15
+ vram_used: number;
16
+ vram_used_percent: number;
17
+ }>;
18
+ };
19
+ export type TMonitorEventMap = {
20
+ system_monitor: CustomEvent<TMonitorEvent>;
21
+ };
22
+ /** Crystools system monitoring (GPU/CPU/RAM/HDD + streaming events). */
23
+ export declare class MonitoringFeature extends AbstractFeature {
24
+ private resources?;
25
+ private listeners;
26
+ private bound;
27
+ checkSupported(): Promise<boolean>;
28
+ destroy(): void;
29
+ private fetchApi;
30
+ on<K extends keyof TMonitorEventMap>(type: K, callback: (event: TMonitorEventMap[K]) => void, options?: AddEventListenerOptions | boolean): () => void;
31
+ off<K extends keyof TMonitorEventMap>(type: K, callback: (event: TMonitorEventMap[K]) => void, options?: EventListenerOptions | boolean): void;
32
+ /**
33
+ * Gets the monitor data.
34
+ *
35
+ * @returns The monitor data if supported, otherwise false.
36
+ */
37
+ get monitorData(): false | TMonitorEvent | undefined;
38
+ /**
39
+ * Sets the monitor configuration.
40
+ */
41
+ setConfig(config?: Partial<{
42
+ /**
43
+ * Refresh per second (Default 0.5)
44
+ */
45
+ rate: number;
46
+ /**
47
+ * Switch to enable/disable CPU monitoring
48
+ */
49
+ switchCPU: boolean;
50
+ /**
51
+ * Switch to enable/disable GPU monitoring
52
+ */
53
+ switchHDD: boolean;
54
+ /**
55
+ * Switch to enable/disable RAM monitoring
56
+ */
57
+ switchRAM: boolean;
58
+ /**
59
+ * Path of HDD to monitor HDD usage (use getHddList to get the pick-able list)
60
+ */
61
+ whichHDD: string;
62
+ }>): Promise<false | Response>;
63
+ /**
64
+ * Switches the monitor on or off.
65
+ */
66
+ switch(active: boolean): Promise<false | Response>;
67
+ /**
68
+ * Gets the list of HDDs.
69
+ */
70
+ getHddList(): Promise<null | Array<string>>;
71
+ /**
72
+ * Gets the list of GPUs.
73
+ */
74
+ getGpuList(): Promise<null | Array<{
75
+ index: number;
76
+ name: string;
77
+ }>>;
78
+ /**
79
+ * Config gpu monitoring
80
+ * @param index Index of the GPU
81
+ * @param config Configuration of monitoring, set to `true` to enable monitoring
82
+ */
83
+ setGpuConfig(index: number, config: Partial<{
84
+ utilization: boolean;
85
+ vram: boolean;
86
+ temperature: boolean;
87
+ }>): Promise<false | Response>;
88
+ private bind;
89
+ }
90
+ //# sourceMappingURL=monitoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitoring.d.ts","sourceRoot":"","sources":["../../src/features/monitoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC;QACV,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF,wEAAwE;AACxE,qBAAa,iBAAkB,SAAQ,eAAe;IACpD,OAAO,CAAC,SAAS,CAAC,CAAgB;IAClC,OAAO,CAAC,SAAS,CAIR;IACT,OAAO,CAAC,KAAK,CAAS;IAEhB,cAAc;IAUb,OAAO,IAAI,IAAI;YAOR,QAAQ;IAOf,EAAE,CAAC,CAA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";
2
+ const SYSTEM_MONITOR_EXTENSION = encodeURIComponent("Primitive boolean [Crystools]");
3
+ /** Crystools system monitoring (GPU/CPU/RAM/HDD + streaming events). */
4
+ export class MonitoringFeature extends AbstractFeature {
5
+ resources;
6
+ listeners = [];
7
+ bound = false;
8
+ async checkSupported() {
9
+ // Use feature namespace directly to avoid triggering deprecated wrapper
10
+ const data = await this.client.ext.node.getNodeDefs(SYSTEM_MONITOR_EXTENSION);
11
+ if (data) {
12
+ this.supported = true;
13
+ this.bind();
14
+ }
15
+ return this.supported;
16
+ }
17
+ destroy() {
18
+ this.listeners.forEach((listener) => {
19
+ this.off(listener.event, listener.handler, listener.options);
20
+ });
21
+ this.listeners = [];
22
+ }
23
+ async fetchApi(path, options) {
24
+ if (!this.supported) {
25
+ return false;
26
+ }
27
+ return this.client.fetchApi(path, options);
28
+ }
29
+ on(type, callback, options) {
30
+ this.addEventListener(type, callback, options);
31
+ this.listeners.push({ event: type, options, handler: callback });
32
+ return () => this.off(type, callback);
33
+ }
34
+ off(type, callback, options) {
35
+ this.removeEventListener(type, callback, options);
36
+ this.listeners = this.listeners.filter((listener) => listener.event !== type && listener.handler !== callback);
37
+ }
38
+ /**
39
+ * Gets the monitor data.
40
+ *
41
+ * @returns The monitor data if supported, otherwise false.
42
+ */
43
+ get monitorData() {
44
+ if (!this.supported) {
45
+ return false;
46
+ }
47
+ return this.resources;
48
+ }
49
+ /**
50
+ * Sets the monitor configuration.
51
+ */
52
+ async setConfig(config) {
53
+ if (!this.supported) {
54
+ return false;
55
+ }
56
+ return this.fetchApi(`/api/crystools/monitor`, {
57
+ method: "PATCH",
58
+ body: JSON.stringify(config)
59
+ });
60
+ }
61
+ /**
62
+ * Switches the monitor on or off.
63
+ */
64
+ async switch(active) {
65
+ if (!this.supported) {
66
+ return false;
67
+ }
68
+ return this.fetchApi(`/api/crystools/monitor/switch`, {
69
+ method: "POST",
70
+ body: JSON.stringify({ monitor: active })
71
+ });
72
+ }
73
+ /**
74
+ * Gets the list of HDDs.
75
+ */
76
+ async getHddList() {
77
+ if (!this.supported) {
78
+ return null;
79
+ }
80
+ const data = await this.fetchApi(`/api/crystools/monitor/HDD`);
81
+ if (data) {
82
+ return data.json();
83
+ }
84
+ return null;
85
+ }
86
+ /**
87
+ * Gets the list of GPUs.
88
+ */
89
+ async getGpuList() {
90
+ if (!this.supported) {
91
+ return null;
92
+ }
93
+ const data = await this.fetchApi(`/api/crystools/monitor/GPU`);
94
+ if (data) {
95
+ return data.json();
96
+ }
97
+ return null;
98
+ }
99
+ /**
100
+ * Config gpu monitoring
101
+ * @param index Index of the GPU
102
+ * @param config Configuration of monitoring, set to `true` to enable monitoring
103
+ */
104
+ async setGpuConfig(index, config) {
105
+ if (!this.supported) {
106
+ return false;
107
+ }
108
+ return this.fetchApi(`/api/crystools/monitor/GPU/${index}`, {
109
+ method: "PATCH",
110
+ body: JSON.stringify(config)
111
+ });
112
+ }
113
+ bind() {
114
+ if (this.bound) {
115
+ return;
116
+ }
117
+ else {
118
+ this.bound = true;
119
+ }
120
+ this.client.on("all", (ev) => {
121
+ const msg = ev.detail;
122
+ if (msg.type === "crystools.monitor") {
123
+ this.resources = msg.data;
124
+ this.dispatchEvent(new CustomEvent("system_monitor", { detail: msg.data }));
125
+ }
126
+ });
127
+ }
128
+ }
129
+ //# sourceMappingURL=monitoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"monitoring.js","sourceRoot":"","sources":["../../src/features/monitoring.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,+BAA+B,CAAC,CAAC;AAwBrF,wEAAwE;AACxE,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAC5C,SAAS,CAAiB;IAC1B,SAAS,GAIX,EAAE,CAAC;IACD,KAAK,GAAG,KAAK,CAAC;IAEtB,KAAK,CAAC,cAAc;QAClB,wEAAwE;QACxE,MAAM,IAAI,GAA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i } from "../client.js";
2
+ import { NodeDefsResponse } from "../types/api.js";
3
+ import { FeatureBase } from "./base.js";
4
+ /** Node definition introspection + model/sampler metadata helpers. */
5
+ export declare class NodeFeature extends FeatureBase {
6
+ constructor(client: ComfyApi);
7
+ /**
8
+ * Retrieves node object definitions for the graph.
9
+ * @returns {Promise<NodeDefsResponse>} The node definitions.
10
+ */
11
+ getNodeDefs(nodeName?: string): Promise<NodeDefsResponse | null>;
12
+ /**
13
+ * Retrieves the checkpoints from the server.
14
+ * @returns A promise that resolves to an array of strings representing the checkpoints.
15
+ */
16
+ getCheckpoints(): Promise<string[]>;
17
+ /**
18
+ * Retrieves the Loras from the node definitions.
19
+ * @returns A Promise that resolves to an array of strings representing the Loras.
20
+ */
21
+ getLoras(): Promise<string[]>;
22
+ /**
23
+ * Retrieves the sampler information.
24
+ * @returns An object containing the sampler and scheduler information.
25
+ */
26
+ getSamplerInfo(): Promise<{
27
+ sampler?: undefined;
28
+ scheduler?: undefined;
29
+ } | {
30
+ sampler: [string[], {
31
+ tooltip?: string;
32
+ }] | [string, {
33
+ tooltip?: string;
34
+ }] | import("../types/api.js").TStringInput | import("../types/api.js").TBoolInput | import("../types/api.js").TNumberInput;
35
+ scheduler: [string[], {
36
+ tooltip?: string;
37
+ }] | [string, {
38
+ tooltip?: string;
39
+ }] | import("../types/api.js").TStringInput | import("../types/api.js").TBoolInput | import("../types/api.js").TNumberInput;
40
+ }>;
41
+ }
42
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/features/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,sEAAsE;AACtE,qBAAa,WAAY,SAAQ,WAAW;gBAC9B,MAAM,EAAE,QAAQ;IAI5B;;;OAGG;IACG,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAoBtE;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQzC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQnC;;;OAGG;IACG,cAAc;;;;;;;;;;;;;;;CAQrB"}
@@ -0,0 +1,68 @@
1
+ import { LOAD_CHECKPOINTS_EXTENSION, LOAD_KSAMPLER_EXTENSION, LOAD_LORAS_EXTENSION } from "../constants.js";
2
+ import { FeatureBase } from "./base.js";
3
+ /** Node definition introspection + model/sampler metadata helpers. */
4
+ export class NodeFeature extends FeatureBase {
5
+ constructor(client) {
6
+ super(client);
7
+ }
8
+ /**
9
+ * Retrieves node object definitions for the graph.
10
+ * @returns {Promise<NodeDefsResponse>} The node definitions.
11
+ */
12
+ async getNodeDefs(nodeName) {
13
+ const response = await this.client.fetchApi(`/object_info${nodeName ? `/${nodeName}` : ""}`);
14
+ if (!response.ok) {
15
+ throw new Error(`HTTP error ${response.status}: ${response.statusText}`);
16
+ }
17
+ const text = await response.text();
18
+ if (!text || text.trim().length === 0) {
19
+ return null;
20
+ }
21
+ try {
22
+ return JSON.parse(text);
23
+ }
24
+ catch (jsonError) {
25
+ throw jsonError;
26
+ }
27
+ }
28
+ /**
29
+ * Retrieves the checkpoints from the server.
30
+ * @returns A promise that resolves to an array of strings representing the checkpoints.
31
+ */
32
+ async getCheckpoints() {
33
+ const nodeInfo = await this.getNodeDefs(LOAD_CHECKPOINTS_EXTENSION);
34
+ if (!nodeInfo)
35
+ return [];
36
+ const output = nodeInfo[LOAD_CHECKPOINTS_EXTENSION].input.required?.ckpt_name?.[0];
37
+ if (!output)
38
+ return [];
39
+ return output;
40
+ }
41
+ /**
42
+ * Retrieves the Loras from the node definitions.
43
+ * @returns A Promise that resolves to an array of strings representing the Loras.
44
+ */
45
+ async getLoras() {
46
+ const nodeInfo = await this.getNodeDefs(LOAD_LORAS_EXTENSION);
47
+ if (!nodeInfo)
48
+ return [];
49
+ const output = nodeInfo[LOAD_LORAS_EXTENSION].input.required?.lora_name?.[0];
50
+ if (!output)
51
+ return [];
52
+ return output;
53
+ }
54
+ /**
55
+ * Retrieves the sampler information.
56
+ * @returns An object containing the sampler and scheduler information.
57
+ */
58
+ async getSamplerInfo() {
59
+ const nodeInfo = await this.getNodeDefs(LOAD_KSAMPLER_EXTENSION);
60
+ if (!nodeInfo)
61
+ return {};
62
+ return {
63
+ sampler: nodeInfo[LOAD_KSAMPLER_EXTENSION].input.required.sampler_name ?? [],
64
+ scheduler: nodeInfo[LOAD_KSAMPLER_EXTENSION].input.required.scheduler ?? []
65
+ };
66
+ }
67
+ }
68
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/features/node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,sEAAsE;AACtE,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C,YAAY,MAAgB;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW,CAAC,QAAiB;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAE7F,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,cAAc,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC3E,CAAC;Q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EAAE,CAAC;QACzB,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,IAAI,EAAE;YAC5E,SAAS,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE;SAC5E,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ import { ComfyApi } from "../client.js";
2
+ import { QueuePromptResponse } from "../types/api.js";
3
+ import { FeatureBase } from "./base.js";
4
+ /**
5
+ * Queue & execution control endpoints (enqueue / append / interrupt).
6
+ * Emits structured enqueue errors with detailed diagnostics.
7
+ */
8
+ export declare class QueueFeature extends FeatureBase {
9
+ constructor(client: ComfyApi);
10
+ /**
11
+ * Enqueue a workflow for execution.
12
+ * @param number Explicit queue position: `null` append (default), `-1` front, `0` auto, positive integer index.
13
+ * @param workflow Serialized workflow / graph JSON.
14
+ */
15
+ queuePrompt(number: number | null, workflow: object): Promise<QueuePromptResponse>;
16
+ /** Shorthand for append enqueue (position null). */
17
+ appendPrompt(workflow: object): Promise<QueuePromptResponse>;
18
+ /**
19
+ * Interrupt an in‑flight prompt by id (or all if omitted depending on server semantics).
20
+ */
21
+ interrupt(promptId?: string): Promise<void>;
22
+ }
23
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/features/queue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;GAGG;AACH,qBAAa,YAAa,SAAQ,WAAW;gBAC/B,MAAM,EAAE,QAAQ;IAI5B;;;;OAIG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA+BxF,oDAAoD;IAC9C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IASlE;;OAEG;IACG,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWlD"}
@@ -0,0 +1,68 @@
1
+ import { buildEnqueueFailedError } from "../utils/response-error.js";
2
+ import { FeatureBase } from "./base.js";
3
+ /**
4
+ * Queue & execution control endpoints (enqueue / append / interrupt).
5
+ * Emits structured enqueue errors with detailed diagnostics.
6
+ */
7
+ export class QueueFeature extends FeatureBase {
8
+ constructor(client) {
9
+ super(client);
10
+ }
11
+ /**
12
+ * Enqueue a workflow for execution.
13
+ * @param number Explicit queue position: `null` append (default), `-1` front, `0` auto, positive integer index.
14
+ * @param workflow Serialized workflow / graph JSON.
15
+ */
16
+ async queuePrompt(number, workflow) {
17
+ const body = {
18
+ client_id: this.client.id,
19
+ prompt: workflow
20
+ };
21
+ if (number !== null) {
22
+ if (number === -1) {
23
+ body["front"] = true;
24
+ }
25
+ else if (number !== 0) {
26
+ body["number"] = number;
27
+ }
28
+ }
29
+ const response = await this.client.fetchApi("/prompt", {
30
+ method: "POST",
31
+ headers: {
32
+ "Content-Type": "application/json"
33
+ },
34
+ body: JSON.stringify(body)
35
+ });
36
+ if (response.status !== 200) {
37
+ const err = await buildEnqueueFailedError(response);
38
+ this.client.dispatchEvent(new CustomEvent("error", { detail: err }));
39
+ throw err;
40
+ }
41
+ return response.json();
42
+ }
43
+ /** Shorthand for append enqueue (position null). */
44
+ async appendPrompt(workflow) {
45
+ try {
46
+ return await this.queuePrompt(null, workflow);
47
+ }
48
+ catch (e) {
49
+ this.client.dispatchEvent(new CustomEvent("queue_error", { detail: e }));
50
+ throw e;
51
+ }
52
+ }
53
+ /**
54
+ * Interrupt an in‑flight prompt by id (or all if omitted depending on server semantics).
55
+ */
56
+ async interrupt(promptId) {
57
+ await this.client.fetchApi("/interrupt", {
58
+ method: "POST",
59
+ headers: {
60
+ "Content-Type": "application/json"
61
+ },
62
+ body: JSON.stringify({
63
+ prompt_id: promptId
64
+ })
65
+ });
66
+ }
67
+ }
68
+ //# sourceMappingURL=queue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.js","sourceRoot":"","sources":["../../src/features/queue.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C,YAAY,MAAgB;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,MAAqB,EAAE,QAAgB;QACvD,MAAM,IAAI,GAAG;YACX,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,EAAE,QAAQ;SACV,CAAC;QAET,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;gBAClB,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;YACvB,CAAC;iBAAM,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE;YACrD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,MAAM,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;YACrE,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,oDAAoD;IACpD,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACzE,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,QAAiB;QAC/B,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE;YACvC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,SAAS,EAAE,QAAQ;aACpB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import { ComfyApi } from "../client.js";
2
+ import { SystemStatsResponse } from "../types/api.js";
3
+ import { FeatureBase } from "./base.js";
4
+ /** System stats & memory management (mirrors `/system_stats` & `/free`). */
5
+ export declare class SystemFeature extends FeatureBase {
6
+ constructor(client: ComfyApi);
7
+ /**
8
+ * Retrieves system and device stats.
9
+ * @returns {Promise<SystemStatsResponse>} The system stats.
10
+ */
11
+ getSystemStats(): Promise<SystemStatsResponse>;
12
+ /**
13
+ * Frees memory by unloading models and freeing memory.
14
+ *
15
+ * @param unloadModels - A boolean indicating whether to unload models.
16
+ * @param freeMemory - A boolean indicating whether to free memory.
17
+ * @returns A promise that resolves to a boolean indicating whether the memory was successfully freed.
18
+ */
19
+ freeMemory(unloadModels: boolean, freeMemory: boolean): Promise<boolean>;
20
+ }
21
+ //# sourceMappingURL=system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/features/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,4EAA4E;AAC5E,qBAAa,aAAc,SAAQ,WAAW;gBAChC,MAAM,EAAE,QAAQ;IAI5B;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAKpD;;;;;;OAMG;IACG,UAAU,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAwB/E"}
@@ -0,0 +1,45 @@
1
+ import { FeatureBase } from "./base.js";
2
+ /** System stats & memory management (mirrors `/system_stats` & `/free`). */
3
+ export class SystemFeature extends FeatureBase {
4
+ constructor(client) {
5
+ super(client);
6
+ }
7
+ /**
8
+ * Retrieves system and device stats.
9
+ * @returns {Promise<SystemStatsResponse>} The system stats.
10
+ */
11
+ async getSystemStats() {
12
+ const response = await this.client.fetchApi("/system_stats");
13
+ return response.json();
14
+ }
15
+ /**
16
+ * Frees memory by unloading models and freeing memory.
17
+ *
18
+ * @param unloadModels - A boolean indicating whether to unload models.
19
+ * @param freeMemory - A boolean indicating whether to free memory.
20
+ * @returns A promise that resolves to a boolean indicating whether the memory was successfully freed.
21
+ */
22
+ async freeMemory(unloadModels, freeMemory) {
23
+ const payload = {
24
+ unload_models: unloadModels,
25
+ free_memory: freeMemory
26
+ };
27
+ try {
28
+ const response = await this.client.fetchApi("/free", {
29
+ method: "POST",
30
+ headers: {
31
+ "Content-Type": "application/json"
32
+ },
33
+ body: JSON.stringify(payload)
34
+ });
35
+ if (!response.ok) {
36
+ return false;
37
+ }
38
+ return true;
39
+ }
40
+ catch (error) {
41
+ return false;
42
+ }
43
+ }
44
+ }
45
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/features/system.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,4EAA4E;AAC5E,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,MAAgB;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc;QAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,UAAU,CAAC,YAAqB,EAAE,UAAmB;QACzD,MAAM,OAAO,GAAG;YACd,aAAa,EAAE,YAAY;YAC3B,WAAW,EAAE,UAAU;SACxB,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACnD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;aAC9B,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,OAAO,KAAK,CAAC;YACf,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ import { ComfyApi } from "../client.js";
2
+ import { FeatureBase } from "./base.js";
3
+ /** Terminal log retrieval & subscription control. */
4
+ export declare class TerminalFeature extends FeatureBase {
5
+ constructor(client: ComfyApi);
6
+ /**
7
+ * Retrieves the terminal logs from the server.
8
+ */
9
+ getTerminalLogs(): Promise<{
10
+ entries: Array<{
11
+ t: string;
12
+ m: string;
13
+ }>;
14
+ size: {
15
+ cols: number;
16
+ rows: number;
17
+ };
18
+ }>;
19
+ /**
20
+ * Sets the terminal subscription status.
21
+ * Enable will subscribe to terminal logs from the websocket.
22
+ */
23
+ setTerminalSubscription(subscribe: boolean): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=terminal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/features/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qDAAqD;AACrD,qBAAa,eAAgB,SAAQ,WAAW;gBAClC,MAAM,EAAE,QAAQ;IAI5B;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC;QAC/B,OAAO,EAAE,KAAK,CAAC;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACzC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;IAKF;;;OAGG;IACG,uBAAuB,CAAC,SAAS,EAAE,OAAO;CAajD"}