comfyui-node 1.4.2 → 1.4.4

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 (42) hide show
  1. package/README.md +16 -3
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/call-wrapper.js +567 -567
  4. package/dist/call-wrapper.js.map +1 -1
  5. package/dist/client.d.ts +290 -290
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +2 -0
  8. package/dist/client.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/pool/WorkflowPool.d.ts +80 -0
  13. package/dist/pool/WorkflowPool.d.ts.map +1 -1
  14. package/dist/pool/WorkflowPool.js +608 -455
  15. package/dist/pool/WorkflowPool.js.map +1 -1
  16. package/dist/pool/client/ClientManager.d.ts +15 -1
  17. package/dist/pool/client/ClientManager.d.ts.map +1 -1
  18. package/dist/pool/client/ClientManager.js +35 -6
  19. package/dist/pool/client/ClientManager.js.map +1 -1
  20. package/dist/pool/failover/SmartFailoverStrategy.js +1 -1
  21. package/dist/pool/failover/SmartFailoverStrategy.js.map +1 -1
  22. package/dist/pool/index.d.ts +1 -0
  23. package/dist/pool/index.d.ts.map +1 -1
  24. package/dist/pool/profiling/JobProfiler.d.ts +130 -0
  25. package/dist/pool/profiling/JobProfiler.d.ts.map +1 -0
  26. package/dist/pool/profiling/JobProfiler.js +225 -0
  27. package/dist/pool/profiling/JobProfiler.js.map +1 -0
  28. package/dist/pool/queue/QueueAdapter.d.ts +30 -30
  29. package/dist/pool/queue/adapters/memory.d.ts +20 -20
  30. package/dist/pool/types/job.d.ts +3 -0
  31. package/dist/pool/types/job.d.ts.map +1 -1
  32. package/dist/pool/utils/hash.d.ts +13 -1
  33. package/dist/pool/utils/hash.d.ts.map +1 -1
  34. package/dist/pool/utils/hash.js +14 -1
  35. package/dist/pool/utils/hash.js.map +1 -1
  36. package/dist/pool.d.ts +180 -180
  37. package/dist/workflow.d.ts +27 -4
  38. package/dist/workflow.d.ts.map +1 -1
  39. package/dist/workflow.js +30 -7
  40. package/dist/workflow.js.map +1 -1
  41. package/package.json +2 -2
  42. package/README.OLD.md +0 -1395
package/README.md CHANGED
@@ -63,6 +63,8 @@ for (const img of (result.images?.images || [])) {
63
63
 
64
64
  - **[WorkflowPool Documentation](./docs/workflow-pool.md)** – Production-ready pooling with health checks (v1.4.1+)
65
65
  - **[Connection Stability Guide](./docs/websocket-idle-issue.md)** – WebSocket health check implementation details
66
+ - **[Hash-Based Routing Guide](./docs/hash-routing-guide.md)** – Workflow-level failure tracking and intelligent failover (v1.4.2+)
67
+ - **[Hash-Routing Quick Start](./docs/hash-routing-quickstart.sh)** – Running the demos
66
68
 
67
69
  ### Advanced Features
68
70
 
@@ -99,24 +101,35 @@ See [comparison guide](./docs/workflow-guide.md#choosing-workflow-vs-promptbuild
99
101
 
100
102
  ### WorkflowPool (v1.4.1+)
101
103
 
102
- Production-ready multi-instance scheduling with automatic health checks:
104
+ Production-ready multi-instance scheduling with automatic health checks and intelligent hash-based routing:
103
105
 
104
106
  ```ts
105
- import { WorkflowPool, MemoryQueueAdapter } from "comfyui-node";
107
+ import { WorkflowPool, MemoryQueueAdapter, SmartFailoverStrategy } from "comfyui-node";
106
108
 
107
109
  const pool = new WorkflowPool([
108
110
  new ComfyApi("http://localhost:8188"),
109
111
  new ComfyApi("http://localhost:8189")
110
112
  ], {
113
+ failoverStrategy: new SmartFailoverStrategy({
114
+ cooldownMs: 60_000, // Block workflow for 60s after failure
115
+ maxFailuresBeforeBlock: 1 // Block on first failure
116
+ }),
111
117
  healthCheckIntervalMs: 30000 // keeps connections alive
112
118
  });
113
119
 
120
+ // Monitor workflow blocking
121
+ pool.on("client:blocked_workflow", ev => {
122
+ console.log(`${ev.detail.clientId} blocked for workflow ${ev.detail.workflowHash.slice(0, 8)}`);
123
+ });
124
+
114
125
  pool.on("job:progress", ev => console.log(ev.detail.jobId, ev.detail.progress));
115
126
 
116
127
  const jobId = await pool.enqueue(workflow, { priority: 10 });
117
128
  ```
118
129
 
119
- **New in v1.4.1:** Automatic health checks prevent idle connection timeouts. See [WorkflowPool docs](./docs/workflow-pool.md).
130
+ **New in v1.4.2:** Hash-based routing intelligently handles failures at the workflow level (not client level). When a workflow fails on one client, the pool routes it to others while keeping that client available for different workflows.
131
+
132
+ See [Hash-Based Routing Guide](./docs/hash-routing-guide.md) for details and demos.
120
133
 
121
134
  ## What's New in v1.4.1
122
135