@workglow/tasks 0.2.17 → 0.2.19

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 (192) hide show
  1. package/dist/browser.d.ts +2 -2
  2. package/dist/browser.d.ts.map +1 -1
  3. package/dist/browser.js +1636 -1287
  4. package/dist/browser.js.map +58 -26
  5. package/dist/bun.d.ts +2 -2
  6. package/dist/bun.d.ts.map +1 -1
  7. package/dist/bun.js +1382 -1318
  8. package/dist/bun.js.map +56 -26
  9. package/dist/codec.browser.d.ts +39 -0
  10. package/dist/codec.browser.d.ts.map +1 -0
  11. package/dist/codec.node.d.ts +37 -0
  12. package/dist/codec.node.d.ts.map +1 -0
  13. package/dist/common.d.ts +39 -38
  14. package/dist/common.d.ts.map +1 -1
  15. package/dist/electron.d.ts +2 -2
  16. package/dist/electron.d.ts.map +1 -1
  17. package/dist/electron.js +1382 -1318
  18. package/dist/electron.js.map +56 -26
  19. package/dist/node.d.ts +2 -2
  20. package/dist/node.d.ts.map +1 -1
  21. package/dist/node.js +1382 -1318
  22. package/dist/node.js.map +56 -26
  23. package/dist/task/image/ImageFilterTask.d.ts +24 -0
  24. package/dist/task/image/ImageFilterTask.d.ts.map +1 -0
  25. package/dist/task/image/ImageSchemas.d.ts +15 -101
  26. package/dist/task/image/ImageSchemas.d.ts.map +1 -1
  27. package/dist/task/image/blur/ImageBlurTask.d.ts +29 -0
  28. package/dist/task/image/blur/ImageBlurTask.d.ts.map +1 -0
  29. package/dist/task/image/blur/blur.cpu.d.ts +4 -0
  30. package/dist/task/image/blur/blur.cpu.d.ts.map +1 -0
  31. package/dist/task/image/blur/blur.sharp.d.ts +2 -0
  32. package/dist/task/image/blur/blur.sharp.d.ts.map +1 -0
  33. package/dist/task/image/blur/blur.webgpu.d.ts +2 -0
  34. package/dist/task/image/blur/blur.webgpu.d.ts.map +1 -0
  35. package/dist/task/image/border/ImageBorderTask.d.ts +35 -0
  36. package/dist/task/image/border/ImageBorderTask.d.ts.map +1 -0
  37. package/dist/task/image/border/border.cpu.d.ts +10 -0
  38. package/dist/task/image/border/border.cpu.d.ts.map +1 -0
  39. package/dist/task/image/border/border.sharp.d.ts +2 -0
  40. package/dist/task/image/border/border.sharp.d.ts.map +1 -0
  41. package/dist/task/image/border/border.webgpu.d.ts +2 -0
  42. package/dist/task/image/border/border.webgpu.d.ts.map +1 -0
  43. package/dist/task/image/brightness/ImageBrightnessTask.d.ts +28 -0
  44. package/dist/task/image/brightness/ImageBrightnessTask.d.ts.map +1 -0
  45. package/dist/task/image/brightness/brightness.cpu.d.ts +4 -0
  46. package/dist/task/image/brightness/brightness.cpu.d.ts.map +1 -0
  47. package/dist/task/image/brightness/brightness.sharp.d.ts +2 -0
  48. package/dist/task/image/brightness/brightness.sharp.d.ts.map +1 -0
  49. package/dist/task/image/brightness/brightness.webgpu.d.ts +2 -0
  50. package/dist/task/image/brightness/brightness.webgpu.d.ts.map +1 -0
  51. package/dist/task/image/contrast/ImageContrastTask.d.ts +28 -0
  52. package/dist/task/image/contrast/ImageContrastTask.d.ts.map +1 -0
  53. package/dist/task/image/contrast/contrast.cpu.d.ts +4 -0
  54. package/dist/task/image/contrast/contrast.cpu.d.ts.map +1 -0
  55. package/dist/task/image/contrast/contrast.sharp.d.ts +2 -0
  56. package/dist/task/image/contrast/contrast.sharp.d.ts.map +1 -0
  57. package/dist/task/image/contrast/contrast.webgpu.d.ts +2 -0
  58. package/dist/task/image/contrast/contrast.webgpu.d.ts.map +1 -0
  59. package/dist/task/image/crop/ImageCropTask.d.ts +32 -0
  60. package/dist/task/image/crop/ImageCropTask.d.ts.map +1 -0
  61. package/dist/task/image/crop/crop.cpu.d.ts +7 -0
  62. package/dist/task/image/crop/crop.cpu.d.ts.map +1 -0
  63. package/dist/task/image/crop/crop.sharp.d.ts +2 -0
  64. package/dist/task/image/crop/crop.sharp.d.ts.map +1 -0
  65. package/dist/task/image/crop/crop.webgpu.d.ts +2 -0
  66. package/dist/task/image/crop/crop.webgpu.d.ts.map +1 -0
  67. package/dist/task/image/flip/ImageFlipTask.d.ts +28 -0
  68. package/dist/task/image/flip/ImageFlipTask.d.ts.map +1 -0
  69. package/dist/task/image/flip/flip.cpu.d.ts +4 -0
  70. package/dist/task/image/flip/flip.cpu.d.ts.map +1 -0
  71. package/dist/task/image/flip/flip.sharp.d.ts +2 -0
  72. package/dist/task/image/flip/flip.sharp.d.ts.map +1 -0
  73. package/dist/task/image/flip/flip.webgpu.d.ts +2 -0
  74. package/dist/task/image/flip/flip.webgpu.d.ts.map +1 -0
  75. package/dist/task/image/grayscale/ImageGrayscaleTask.d.ts +25 -0
  76. package/dist/task/image/grayscale/ImageGrayscaleTask.d.ts.map +1 -0
  77. package/dist/task/image/grayscale/grayscale.cpu.d.ts +2 -0
  78. package/dist/task/image/grayscale/grayscale.cpu.d.ts.map +1 -0
  79. package/dist/task/image/grayscale/grayscale.sharp.d.ts +2 -0
  80. package/dist/task/image/grayscale/grayscale.sharp.d.ts.map +1 -0
  81. package/dist/task/image/grayscale/grayscale.webgpu.d.ts +2 -0
  82. package/dist/task/image/grayscale/grayscale.webgpu.d.ts.map +1 -0
  83. package/dist/task/image/imageCodecLimits.d.ts +8 -4
  84. package/dist/task/image/imageCodecLimits.d.ts.map +1 -1
  85. package/dist/task/image/invert/ImageInvertTask.d.ts +25 -0
  86. package/dist/task/image/invert/ImageInvertTask.d.ts.map +1 -0
  87. package/dist/task/image/invert/invert.cpu.d.ts +2 -0
  88. package/dist/task/image/invert/invert.cpu.d.ts.map +1 -0
  89. package/dist/task/image/invert/invert.sharp.d.ts +2 -0
  90. package/dist/task/image/invert/invert.sharp.d.ts.map +1 -0
  91. package/dist/task/image/invert/invert.webgpu.d.ts +2 -0
  92. package/dist/task/image/invert/invert.webgpu.d.ts.map +1 -0
  93. package/dist/task/image/pixelate/ImagePixelateTask.d.ts +29 -0
  94. package/dist/task/image/pixelate/ImagePixelateTask.d.ts.map +1 -0
  95. package/dist/task/image/pixelate/pixelate.cpu.d.ts +4 -0
  96. package/dist/task/image/pixelate/pixelate.cpu.d.ts.map +1 -0
  97. package/dist/task/image/pixelate/pixelate.sharp.d.ts +2 -0
  98. package/dist/task/image/pixelate/pixelate.sharp.d.ts.map +1 -0
  99. package/dist/task/image/pixelate/pixelate.webgpu.d.ts +2 -0
  100. package/dist/task/image/pixelate/pixelate.webgpu.d.ts.map +1 -0
  101. package/dist/task/image/posterize/ImagePosterizeTask.d.ts +28 -0
  102. package/dist/task/image/posterize/ImagePosterizeTask.d.ts.map +1 -0
  103. package/dist/task/image/posterize/posterize.cpu.d.ts +4 -0
  104. package/dist/task/image/posterize/posterize.cpu.d.ts.map +1 -0
  105. package/dist/task/image/posterize/posterize.webgpu.d.ts +2 -0
  106. package/dist/task/image/posterize/posterize.webgpu.d.ts.map +1 -0
  107. package/dist/task/image/resize/ImageResizeTask.d.ts +32 -0
  108. package/dist/task/image/resize/ImageResizeTask.d.ts.map +1 -0
  109. package/dist/task/image/resize/resize.cpu.d.ts +7 -0
  110. package/dist/task/image/resize/resize.cpu.d.ts.map +1 -0
  111. package/dist/task/image/resize/resize.sharp.d.ts +2 -0
  112. package/dist/task/image/resize/resize.sharp.d.ts.map +1 -0
  113. package/dist/task/image/resize/resize.webgpu.d.ts +2 -0
  114. package/dist/task/image/resize/resize.webgpu.d.ts.map +1 -0
  115. package/dist/task/image/rotate/ImageRotateTask.d.ts +29 -0
  116. package/dist/task/image/rotate/ImageRotateTask.d.ts.map +1 -0
  117. package/dist/task/image/rotate/rotate.cpu.d.ts +5 -0
  118. package/dist/task/image/rotate/rotate.cpu.d.ts.map +1 -0
  119. package/dist/task/image/rotate/rotate.sharp.d.ts +2 -0
  120. package/dist/task/image/rotate/rotate.sharp.d.ts.map +1 -0
  121. package/dist/task/image/rotate/rotate.webgpu.d.ts +2 -0
  122. package/dist/task/image/rotate/rotate.webgpu.d.ts.map +1 -0
  123. package/dist/task/image/sepia/ImageSepiaTask.d.ts +25 -0
  124. package/dist/task/image/sepia/ImageSepiaTask.d.ts.map +1 -0
  125. package/dist/task/image/sepia/sepia.cpu.d.ts +2 -0
  126. package/dist/task/image/sepia/sepia.cpu.d.ts.map +1 -0
  127. package/dist/task/image/sepia/sepia.sharp.d.ts +2 -0
  128. package/dist/task/image/sepia/sepia.sharp.d.ts.map +1 -0
  129. package/dist/task/image/sepia/sepia.webgpu.d.ts +2 -0
  130. package/dist/task/image/sepia/sepia.webgpu.d.ts.map +1 -0
  131. package/dist/task/image/{ImageTextTask.d.ts → text/ImageTextTask.d.ts} +15 -102
  132. package/dist/task/image/text/ImageTextTask.d.ts.map +1 -0
  133. package/dist/task/image/threshold/ImageThresholdTask.d.ts +28 -0
  134. package/dist/task/image/threshold/ImageThresholdTask.d.ts.map +1 -0
  135. package/dist/task/image/threshold/threshold.cpu.d.ts +4 -0
  136. package/dist/task/image/threshold/threshold.cpu.d.ts.map +1 -0
  137. package/dist/task/image/threshold/threshold.sharp.d.ts +2 -0
  138. package/dist/task/image/threshold/threshold.sharp.d.ts.map +1 -0
  139. package/dist/task/image/threshold/threshold.webgpu.d.ts +2 -0
  140. package/dist/task/image/threshold/threshold.webgpu.d.ts.map +1 -0
  141. package/dist/task/image/tint/ImageTintTask.d.ts +30 -0
  142. package/dist/task/image/tint/ImageTintTask.d.ts.map +1 -0
  143. package/dist/task/image/tint/tint.cpu.d.ts +11 -0
  144. package/dist/task/image/tint/tint.cpu.d.ts.map +1 -0
  145. package/dist/task/image/tint/tint.sharp.d.ts +2 -0
  146. package/dist/task/image/tint/tint.sharp.d.ts.map +1 -0
  147. package/dist/task/image/tint/tint.webgpu.d.ts +2 -0
  148. package/dist/task/image/tint/tint.webgpu.d.ts.map +1 -0
  149. package/dist/task/image/transparency/ImageTransparencyTask.d.ts +28 -0
  150. package/dist/task/image/transparency/ImageTransparencyTask.d.ts.map +1 -0
  151. package/dist/task/image/transparency/transparency.cpu.d.ts +4 -0
  152. package/dist/task/image/transparency/transparency.cpu.d.ts.map +1 -0
  153. package/dist/task/image/transparency/transparency.webgpu.d.ts +2 -0
  154. package/dist/task/image/transparency/transparency.webgpu.d.ts.map +1 -0
  155. package/package.json +9 -9
  156. package/dist/task/image/ImageBlurTask.d.ts +0 -248
  157. package/dist/task/image/ImageBlurTask.d.ts.map +0 -1
  158. package/dist/task/image/ImageBorderTask.d.ts +0 -328
  159. package/dist/task/image/ImageBorderTask.d.ts.map +0 -1
  160. package/dist/task/image/ImageBrightnessTask.d.ts +0 -248
  161. package/dist/task/image/ImageBrightnessTask.d.ts.map +0 -1
  162. package/dist/task/image/ImageContrastTask.d.ts +0 -248
  163. package/dist/task/image/ImageContrastTask.d.ts.map +0 -1
  164. package/dist/task/image/ImageCropTask.d.ts +0 -280
  165. package/dist/task/image/ImageCropTask.d.ts.map +0 -1
  166. package/dist/task/image/ImageFlipTask.d.ts +0 -244
  167. package/dist/task/image/ImageFlipTask.d.ts.map +0 -1
  168. package/dist/task/image/ImageGrayscaleTask.d.ts +0 -232
  169. package/dist/task/image/ImageGrayscaleTask.d.ts.map +0 -1
  170. package/dist/task/image/ImageInvertTask.d.ts +0 -232
  171. package/dist/task/image/ImageInvertTask.d.ts.map +0 -1
  172. package/dist/task/image/ImagePixelateTask.d.ts +0 -246
  173. package/dist/task/image/ImagePixelateTask.d.ts.map +0 -1
  174. package/dist/task/image/ImagePosterizeTask.d.ts +0 -248
  175. package/dist/task/image/ImagePosterizeTask.d.ts.map +0 -1
  176. package/dist/task/image/ImageResizeTask.d.ts +0 -256
  177. package/dist/task/image/ImageResizeTask.d.ts.map +0 -1
  178. package/dist/task/image/ImageRotateTask.d.ts +0 -244
  179. package/dist/task/image/ImageRotateTask.d.ts.map +0 -1
  180. package/dist/task/image/ImageSepiaTask.d.ts +0 -232
  181. package/dist/task/image/ImageSepiaTask.d.ts.map +0 -1
  182. package/dist/task/image/ImageTextTask.d.ts.map +0 -1
  183. package/dist/task/image/ImageThresholdTask.d.ts +0 -248
  184. package/dist/task/image/ImageThresholdTask.d.ts.map +0 -1
  185. package/dist/task/image/ImageTintTask.d.ts +0 -330
  186. package/dist/task/image/ImageTintTask.d.ts.map +0 -1
  187. package/dist/task/image/ImageTransparencyTask.d.ts +0 -246
  188. package/dist/task/image/ImageTransparencyTask.d.ts.map +0 -1
  189. package/dist/task/image/ImageWatermarkTask.d.ts +0 -276
  190. package/dist/task/image/ImageWatermarkTask.d.ts.map +0 -1
  191. package/dist/task/image/imageTaskIo.d.ts +0 -20
  192. package/dist/task/image/imageTaskIo.d.ts.map +0 -1
package/dist/electron.js CHANGED
@@ -10,7 +10,7 @@ import { parseDataUri } from "@workglow/util/media";
10
10
  // src/task/image/imageCodecLimits.ts
11
11
  var MAX_DECODED_PIXELS = 1e8;
12
12
  var MAX_INPUT_BYTES_NODE = 64 * 1024 * 1024;
13
- var MAX_INPUT_BYTES_BROWSER = 8 * 1024 * 1024;
13
+ var MAX_INPUT_BYTES_BROWSER = 32 * 1024 * 1024;
14
14
  var REJECTED_DECODE_MIME_TYPES = new Set([
15
15
  "image/svg+xml",
16
16
  "image/svg",
@@ -146,6 +146,605 @@ function createNodeImageRasterCodec() {
146
146
  // src/task/image/registerImageRasterCodec.node.ts
147
147
  registerImageRasterCodec(createNodeImageRasterCodec());
148
148
 
149
+ // src/task/image/blur/blur.cpu.ts
150
+ import { CpuImage, registerFilterOp } from "@workglow/util/media";
151
+ function cpuBoxBlur(bin, radius) {
152
+ const { data: src, width, height, channels } = bin;
153
+ const kernelSize = radius * 2 + 1;
154
+ const tmp = new Uint8ClampedArray(src.length);
155
+ for (let y = 0;y < height; y++) {
156
+ for (let c = 0;c < channels; c++) {
157
+ let sum = 0;
158
+ for (let k = -radius;k <= radius; k++) {
159
+ const x = Math.max(0, Math.min(k, width - 1));
160
+ sum += src[(y * width + x) * channels + c];
161
+ }
162
+ tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
163
+ for (let x = 1;x < width; x++) {
164
+ const addX = Math.min(x + radius, width - 1);
165
+ const removeX = Math.max(x - radius - 1, 0);
166
+ sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
167
+ tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
168
+ }
169
+ }
170
+ }
171
+ const dst = new Uint8ClampedArray(src.length);
172
+ for (let x = 0;x < width; x++) {
173
+ for (let c = 0;c < channels; c++) {
174
+ let sum = 0;
175
+ for (let k = -radius;k <= radius; k++) {
176
+ const y = Math.max(0, Math.min(k, height - 1));
177
+ sum += tmp[(y * width + x) * channels + c];
178
+ }
179
+ dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
180
+ for (let y = 1;y < height; y++) {
181
+ const addY = Math.min(y + radius, height - 1);
182
+ const removeY = Math.max(y - radius - 1, 0);
183
+ sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
184
+ dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
185
+ }
186
+ }
187
+ }
188
+ return { data: dst, width, height, channels };
189
+ }
190
+ registerFilterOp("cpu", "blur", (image, { radius }) => {
191
+ return CpuImage.fromImageBinary(cpuBoxBlur(image.getBinary(), Math.max(1, radius | 0)));
192
+ });
193
+
194
+ // src/task/image/border/border.cpu.ts
195
+ import { CpuImage as CpuImage2, registerFilterOp as registerFilterOp2, resolveColor } from "@workglow/util/media";
196
+ function cpuBorder(bin, borderWidth, color) {
197
+ const { data: src, width: srcW, height: srcH, channels: srcCh } = bin;
198
+ const bw = borderWidth;
199
+ const resolved = resolveColor(color);
200
+ const outCh = 4;
201
+ const dstW = srcW + bw * 2;
202
+ const dstH = srcH + bw * 2;
203
+ const dst = new Uint8ClampedArray(dstW * dstH * outCh);
204
+ const r = resolved.r;
205
+ const g = resolved.g;
206
+ const b = resolved.b;
207
+ const a = resolved.a;
208
+ for (let i = 0;i < dst.length; i += outCh) {
209
+ dst[i] = r;
210
+ dst[i + 1] = g;
211
+ dst[i + 2] = b;
212
+ dst[i + 3] = a;
213
+ }
214
+ for (let y = 0;y < srcH; y++) {
215
+ for (let x = 0;x < srcW; x++) {
216
+ const srcIdx = (y * srcW + x) * srcCh;
217
+ const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
218
+ dst[dstIdx] = src[srcIdx];
219
+ dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
220
+ dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
221
+ dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
222
+ }
223
+ }
224
+ return { data: dst, width: dstW, height: dstH, channels: outCh };
225
+ }
226
+ registerFilterOp2("cpu", "border", (image, { borderWidth, color }) => {
227
+ return CpuImage2.fromImageBinary(cpuBorder(image.getBinary(), borderWidth, color));
228
+ });
229
+
230
+ // src/task/image/brightness/brightness.cpu.ts
231
+ import { CpuImage as CpuImage3, registerFilterOp as registerFilterOp3 } from "@workglow/util/media";
232
+ function cpuBrightness(bin, amount) {
233
+ const { data: src, width, height, channels } = bin;
234
+ const dst = new Uint8ClampedArray(src.length);
235
+ if (channels === 4) {
236
+ for (let i = 0;i < src.length; i += 4) {
237
+ dst[i] = src[i] + amount;
238
+ dst[i + 1] = src[i + 1] + amount;
239
+ dst[i + 2] = src[i + 2] + amount;
240
+ dst[i + 3] = src[i + 3];
241
+ }
242
+ } else {
243
+ for (let i = 0;i < src.length; i++) {
244
+ dst[i] = src[i] + amount;
245
+ }
246
+ }
247
+ return { data: dst, width, height, channels };
248
+ }
249
+ registerFilterOp3("cpu", "brightness", (image, { amount }) => {
250
+ return CpuImage3.fromImageBinary(cpuBrightness(image.getBinary(), amount));
251
+ });
252
+
253
+ // src/task/image/contrast/contrast.cpu.ts
254
+ import { CpuImage as CpuImage4, registerFilterOp as registerFilterOp4 } from "@workglow/util/media";
255
+ function cpuContrast(bin, amount) {
256
+ const { data: src, width, height, channels } = bin;
257
+ const factor = 259 * (amount + 255) / (255 * (259 - amount));
258
+ const lut = new Uint8ClampedArray(256);
259
+ for (let i = 0;i < 256; i++) {
260
+ lut[i] = factor * (i - 128) + 128;
261
+ }
262
+ const dst = new Uint8ClampedArray(src.length);
263
+ if (channels === 4) {
264
+ for (let i = 0;i < src.length; i += 4) {
265
+ dst[i] = lut[src[i]];
266
+ dst[i + 1] = lut[src[i + 1]];
267
+ dst[i + 2] = lut[src[i + 2]];
268
+ dst[i + 3] = src[i + 3];
269
+ }
270
+ } else {
271
+ for (let i = 0;i < src.length; i++) {
272
+ dst[i] = lut[src[i]];
273
+ }
274
+ }
275
+ return { data: dst, width, height, channels };
276
+ }
277
+ registerFilterOp4("cpu", "contrast", (image, { amount }) => {
278
+ return CpuImage4.fromImageBinary(cpuContrast(image.getBinary(), amount));
279
+ });
280
+
281
+ // src/task/image/crop/crop.cpu.ts
282
+ import { CpuImage as CpuImage5, registerFilterOp as registerFilterOp5 } from "@workglow/util/media";
283
+ function cpuCrop(bin, left, top, width, height) {
284
+ const { data: src, width: srcW, height: srcH, channels } = bin;
285
+ if (srcW < 1 || srcH < 1) {
286
+ throw new RangeError("Cannot crop an empty image");
287
+ }
288
+ if (left < 0 || left >= srcW || top < 0 || top >= srcH) {
289
+ throw new RangeError("Crop origin is outside the source image bounds");
290
+ }
291
+ const w = Math.min(width, srcW - left);
292
+ const h = Math.min(height, srcH - top);
293
+ const dst = new Uint8ClampedArray(w * h * channels);
294
+ const rowBytes = w * channels;
295
+ for (let row = 0;row < h; row++) {
296
+ const srcOffset = ((top + row) * srcW + left) * channels;
297
+ const dstOffset = row * rowBytes;
298
+ dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
299
+ }
300
+ return { data: dst, width: w, height: h, channels };
301
+ }
302
+ registerFilterOp5("cpu", "crop", (image, { left, top, width, height }) => {
303
+ return CpuImage5.fromImageBinary(cpuCrop(image.getBinary(), left, top, width, height));
304
+ });
305
+
306
+ // src/task/image/flip/flip.cpu.ts
307
+ import { CpuImage as CpuImage6, registerFilterOp as registerFilterOp6 } from "@workglow/util/media";
308
+ function cpuFlip(bin, direction) {
309
+ const { data: src, width, height, channels } = bin;
310
+ const dst = new Uint8ClampedArray(src.length);
311
+ const rowBytes = width * channels;
312
+ if (direction === "vertical") {
313
+ for (let y = 0;y < height; y++) {
314
+ const srcOffset = y * rowBytes;
315
+ const dstOffset = (height - 1 - y) * rowBytes;
316
+ dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
317
+ }
318
+ } else {
319
+ for (let y = 0;y < height; y++) {
320
+ for (let x = 0;x < width; x++) {
321
+ const srcIdx = (y * width + x) * channels;
322
+ const dstIdx = (y * width + (width - 1 - x)) * channels;
323
+ for (let c = 0;c < channels; c++) {
324
+ dst[dstIdx + c] = src[srcIdx + c];
325
+ }
326
+ }
327
+ }
328
+ }
329
+ return { data: dst, width, height, channels };
330
+ }
331
+ registerFilterOp6("cpu", "flip", (image, { direction }) => {
332
+ return CpuImage6.fromImageBinary(cpuFlip(image.getBinary(), direction));
333
+ });
334
+
335
+ // src/task/image/grayscale/grayscale.cpu.ts
336
+ import { CpuImage as CpuImage7, registerFilterOp as registerFilterOp7 } from "@workglow/util/media";
337
+ function cpuGrayscale(bin) {
338
+ const { data: src, width, height, channels } = bin;
339
+ const pixelCount = width * height;
340
+ const dst = new Uint8ClampedArray(pixelCount * 4);
341
+ for (let i = 0;i < pixelCount; i++) {
342
+ const idx = i * channels;
343
+ let g;
344
+ if (channels === 1) {
345
+ g = src[idx];
346
+ } else {
347
+ g = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
348
+ }
349
+ const a = channels === 4 ? src[idx + 3] : 255;
350
+ const dstIdx = i * 4;
351
+ dst[dstIdx] = g;
352
+ dst[dstIdx + 1] = g;
353
+ dst[dstIdx + 2] = g;
354
+ dst[dstIdx + 3] = a;
355
+ }
356
+ return { data: dst, width, height, channels: 4 };
357
+ }
358
+ registerFilterOp7("cpu", "grayscale", (image, _params) => {
359
+ return CpuImage7.fromImageBinary(cpuGrayscale(image.getBinary()));
360
+ });
361
+
362
+ // src/task/image/invert/invert.cpu.ts
363
+ import { CpuImage as CpuImage8, registerFilterOp as registerFilterOp8 } from "@workglow/util/media";
364
+ function cpuInvert(bin) {
365
+ const { data: src, width, height, channels } = bin;
366
+ const dst = new Uint8ClampedArray(src.length);
367
+ if (channels === 4) {
368
+ for (let i = 0;i < src.length; i += 4) {
369
+ dst[i] = 255 - src[i];
370
+ dst[i + 1] = 255 - src[i + 1];
371
+ dst[i + 2] = 255 - src[i + 2];
372
+ dst[i + 3] = src[i + 3];
373
+ }
374
+ } else {
375
+ for (let i = 0;i < src.length; i++) {
376
+ dst[i] = 255 - src[i];
377
+ }
378
+ }
379
+ return { data: dst, width, height, channels };
380
+ }
381
+ registerFilterOp8("cpu", "invert", (image, _params) => {
382
+ return CpuImage8.fromImageBinary(cpuInvert(image.getBinary()));
383
+ });
384
+
385
+ // src/task/image/pixelate/pixelate.cpu.ts
386
+ import { CpuImage as CpuImage9, registerFilterOp as registerFilterOp9 } from "@workglow/util/media";
387
+ function cpuPixelate(bin, blockSize) {
388
+ const { data: src, width, height, channels } = bin;
389
+ const dst = new Uint8ClampedArray(src.length);
390
+ for (let by = 0;by < height; by += blockSize) {
391
+ const blockH = Math.min(blockSize, height - by);
392
+ for (let bx = 0;bx < width; bx += blockSize) {
393
+ const blockW = Math.min(blockSize, width - bx);
394
+ const blockArea = blockW * blockH;
395
+ const sums = new Array(channels).fill(0);
396
+ for (let y = by;y < by + blockH; y++) {
397
+ for (let x = bx;x < bx + blockW; x++) {
398
+ const idx = (y * width + x) * channels;
399
+ for (let c = 0;c < channels; c++) {
400
+ sums[c] += src[idx + c];
401
+ }
402
+ }
403
+ }
404
+ const avg = sums.map((s) => s / blockArea + 0.5 | 0);
405
+ for (let y = by;y < by + blockH; y++) {
406
+ for (let x = bx;x < bx + blockW; x++) {
407
+ const idx = (y * width + x) * channels;
408
+ for (let c = 0;c < channels; c++) {
409
+ dst[idx + c] = avg[c];
410
+ }
411
+ }
412
+ }
413
+ }
414
+ }
415
+ return { data: dst, width, height, channels };
416
+ }
417
+ registerFilterOp9("cpu", "pixelate", (image, { blockSize }) => {
418
+ return CpuImage9.fromImageBinary(cpuPixelate(image.getBinary(), blockSize));
419
+ });
420
+
421
+ // src/task/image/posterize/posterize.cpu.ts
422
+ import { CpuImage as CpuImage10, registerFilterOp as registerFilterOp10 } from "@workglow/util/media";
423
+ function cpuPosterize(bin, levels) {
424
+ const { data: src, width, height, channels } = bin;
425
+ const step = 255 / (levels - 1);
426
+ const lut = new Uint8ClampedArray(256);
427
+ for (let i = 0;i < 256; i++) {
428
+ lut[i] = Math.round(Math.round(i / step) * step);
429
+ }
430
+ const dst = new Uint8ClampedArray(src.length);
431
+ if (channels === 4) {
432
+ for (let i = 0;i < src.length; i += 4) {
433
+ dst[i] = lut[src[i]];
434
+ dst[i + 1] = lut[src[i + 1]];
435
+ dst[i + 2] = lut[src[i + 2]];
436
+ dst[i + 3] = src[i + 3];
437
+ }
438
+ } else {
439
+ for (let i = 0;i < src.length; i++) {
440
+ dst[i] = lut[src[i]];
441
+ }
442
+ }
443
+ return { data: dst, width, height, channels };
444
+ }
445
+ registerFilterOp10("cpu", "posterize", (image, { levels }) => {
446
+ return CpuImage10.fromImageBinary(cpuPosterize(image.getBinary(), levels));
447
+ });
448
+
449
+ // src/task/image/resize/resize.cpu.ts
450
+ import { CpuImage as CpuImage11, registerFilterOp as registerFilterOp11 } from "@workglow/util/media";
451
+ function cpuResize(bin, dstW, dstH) {
452
+ const { data: src, width: srcW, height: srcH, channels } = bin;
453
+ const dst = new Uint8ClampedArray(dstW * dstH * channels);
454
+ for (let dy = 0;dy < dstH; dy++) {
455
+ const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
456
+ for (let dx = 0;dx < dstW; dx++) {
457
+ const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
458
+ const srcIdx = (srcY * srcW + srcX) * channels;
459
+ const dstIdx = (dy * dstW + dx) * channels;
460
+ for (let c = 0;c < channels; c++) {
461
+ dst[dstIdx + c] = src[srcIdx + c];
462
+ }
463
+ }
464
+ }
465
+ return { data: dst, width: dstW, height: dstH, channels };
466
+ }
467
+ registerFilterOp11("cpu", "resize", (image, { width, height }) => {
468
+ return CpuImage11.fromImageBinary(cpuResize(image.getBinary(), width, height));
469
+ });
470
+
471
+ // src/task/image/rotate/rotate.cpu.ts
472
+ import { CpuImage as CpuImage12, registerFilterOp as registerFilterOp12 } from "@workglow/util/media";
473
+ function cpuRotate(bin, angle) {
474
+ const { data: src, width: srcW, height: srcH, channels } = bin;
475
+ const swap = angle === 90 || angle === 270;
476
+ const dstW = swap ? srcH : srcW;
477
+ const dstH = swap ? srcW : srcH;
478
+ const dst = new Uint8ClampedArray(dstW * dstH * channels);
479
+ for (let sy = 0;sy < srcH; sy++) {
480
+ for (let sx = 0;sx < srcW; sx++) {
481
+ let dx, dy;
482
+ if (angle === 90) {
483
+ dx = srcH - 1 - sy;
484
+ dy = sx;
485
+ } else if (angle === 180) {
486
+ dx = srcW - 1 - sx;
487
+ dy = srcH - 1 - sy;
488
+ } else {
489
+ dx = sy;
490
+ dy = srcW - 1 - sx;
491
+ }
492
+ const srcIdx = (sy * srcW + sx) * channels;
493
+ const dstIdx = (dy * dstW + dx) * channels;
494
+ for (let c = 0;c < channels; c++) {
495
+ dst[dstIdx + c] = src[srcIdx + c];
496
+ }
497
+ }
498
+ }
499
+ return { data: dst, width: dstW, height: dstH, channels };
500
+ }
501
+ registerFilterOp12("cpu", "rotate", (image, { angle }) => {
502
+ return CpuImage12.fromImageBinary(cpuRotate(image.getBinary(), angle));
503
+ });
504
+
505
+ // src/task/image/sepia/sepia.cpu.ts
506
+ import { CpuImage as CpuImage13, registerFilterOp as registerFilterOp13 } from "@workglow/util/media";
507
+ function cpuSepia(bin) {
508
+ const { data: src, width, height, channels } = bin;
509
+ const dst = new Uint8ClampedArray(src.length);
510
+ const pixelCount = width * height;
511
+ for (let i = 0;i < pixelCount; i++) {
512
+ const idx = i * channels;
513
+ const r = src[idx];
514
+ const g = channels === 1 ? r : src[idx + 1];
515
+ const b = channels === 1 ? r : src[idx + 2];
516
+ const outR = r * 402 + g * 787 + b * 194 >> 10;
517
+ const outG = r * 357 + g * 702 + b * 172 >> 10;
518
+ const outB = r * 279 + g * 547 + b * 134 >> 10;
519
+ dst[idx] = outR > 255 ? 255 : outR;
520
+ if (channels >= 3) {
521
+ dst[idx + 1] = outG > 255 ? 255 : outG;
522
+ dst[idx + 2] = outB > 255 ? 255 : outB;
523
+ }
524
+ if (channels === 4) {
525
+ dst[idx + 3] = src[idx + 3];
526
+ }
527
+ }
528
+ return { data: dst, width, height, channels };
529
+ }
530
+ registerFilterOp13("cpu", "sepia", (image, _params) => {
531
+ return CpuImage13.fromImageBinary(cpuSepia(image.getBinary()));
532
+ });
533
+
534
+ // src/task/image/threshold/threshold.cpu.ts
535
+ import { CpuImage as CpuImage14, registerFilterOp as registerFilterOp14 } from "@workglow/util/media";
536
+ function cpuThreshold(bin, value) {
537
+ const { data: src, width, height, channels } = bin;
538
+ const pixelCount = width * height;
539
+ const dst = new Uint8ClampedArray(pixelCount * channels);
540
+ for (let i = 0;i < pixelCount; i++) {
541
+ const idx = i * channels;
542
+ if (channels === 1) {
543
+ dst[idx] = src[idx] >= value ? 255 : 0;
544
+ } else {
545
+ dst[idx] = src[idx] >= value ? 255 : 0;
546
+ dst[idx + 1] = src[idx + 1] >= value ? 255 : 0;
547
+ dst[idx + 2] = src[idx + 2] >= value ? 255 : 0;
548
+ if (channels === 4) {
549
+ dst[idx + 3] = src[idx + 3];
550
+ }
551
+ }
552
+ }
553
+ return { data: dst, width, height, channels };
554
+ }
555
+ registerFilterOp14("cpu", "threshold", (image, { value }) => {
556
+ return CpuImage14.fromImageBinary(cpuThreshold(image.getBinary(), value));
557
+ });
558
+
559
+ // src/task/image/tint/tint.cpu.ts
560
+ import {
561
+ CpuImage as CpuImage15,
562
+ registerFilterOp as registerFilterOp15,
563
+ resolveColor as resolveColor2
564
+ } from "@workglow/util/media";
565
+ function cpuTint(bin, tr, tg, tb, amount) {
566
+ const { data: src, width, height, channels } = bin;
567
+ const invAmount = 1 - amount;
568
+ const tintR = tr * amount;
569
+ const tintG = tg * amount;
570
+ const tintB = tb * amount;
571
+ const pixelCount = width * height;
572
+ if (channels === 1) {
573
+ const dst2 = new Uint8ClampedArray(pixelCount * 3);
574
+ for (let i = 0;i < pixelCount; i++) {
575
+ const gray = src[i];
576
+ dst2[i * 3] = gray * invAmount + tintR;
577
+ dst2[i * 3 + 1] = gray * invAmount + tintG;
578
+ dst2[i * 3 + 2] = gray * invAmount + tintB;
579
+ }
580
+ return { data: dst2, width, height, channels: 3 };
581
+ }
582
+ const dst = new Uint8ClampedArray(src.length);
583
+ for (let i = 0;i < pixelCount; i++) {
584
+ const idx = i * channels;
585
+ dst[idx] = src[idx] * invAmount + tintR;
586
+ dst[idx + 1] = src[idx + 1] * invAmount + tintG;
587
+ dst[idx + 2] = src[idx + 2] * invAmount + tintB;
588
+ if (channels === 4) {
589
+ dst[idx + 3] = src[idx + 3];
590
+ }
591
+ }
592
+ return { data: dst, width, height, channels };
593
+ }
594
+ registerFilterOp15("cpu", "tint", (image, { color, amount }) => {
595
+ const { r: tr, g: tg, b: tb } = resolveColor2(color);
596
+ return CpuImage15.fromImageBinary(cpuTint(image.getBinary(), tr, tg, tb, amount));
597
+ });
598
+
599
+ // src/task/image/transparency/transparency.cpu.ts
600
+ import { CpuImage as CpuImage16, registerFilterOp as registerFilterOp16 } from "@workglow/util/media";
601
+ function cpuTransparency(bin, amount) {
602
+ const { data: src, width, height, channels: srcCh } = bin;
603
+ const pixelCount = width * height;
604
+ const dst = new Uint8ClampedArray(pixelCount * 4);
605
+ const alphaScale = Math.round(amount * 255);
606
+ for (let i = 0;i < pixelCount; i++) {
607
+ const srcIdx = i * srcCh;
608
+ const dstIdx = i * 4;
609
+ dst[dstIdx] = src[srcIdx];
610
+ dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
611
+ dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
612
+ const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
613
+ dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
614
+ }
615
+ return { data: dst, width, height, channels: 4 };
616
+ }
617
+ registerFilterOp16("cpu", "transparency", (image, { amount }) => {
618
+ return CpuImage16.fromImageBinary(cpuTransparency(image.getBinary(), amount));
619
+ });
620
+
621
+ // src/task/image/blur/blur.sharp.ts
622
+ import { registerFilterOp as registerFilterOp17 } from "@workglow/util/media";
623
+ registerFilterOp17("sharp", "blur", (image, { radius }) => {
624
+ return image.apply((p) => p.blur(radius * 0.5));
625
+ });
626
+
627
+ // src/task/image/border/border.sharp.ts
628
+ import { registerFilterOp as registerFilterOp18, resolveColor as resolveColor3 } from "@workglow/util/media";
629
+ registerFilterOp18("sharp", "border", (image, { borderWidth: bw, color }) => {
630
+ const sharp = image;
631
+ const resolved = resolveColor3(color);
632
+ const outW = sharp.width + bw * 2;
633
+ const outH = sharp.height + bw * 2;
634
+ return sharp.apply((p) => p.extend({
635
+ top: bw,
636
+ bottom: bw,
637
+ left: bw,
638
+ right: bw,
639
+ background: { r: resolved.r, g: resolved.g, b: resolved.b, alpha: resolved.a / 255 }
640
+ }), { width: outW, height: outH });
641
+ });
642
+
643
+ // src/task/image/brightness/brightness.sharp.ts
644
+ import { registerFilterOp as registerFilterOp19 } from "@workglow/util/media";
645
+ registerFilterOp19("sharp", "brightness", (image, { amount }) => {
646
+ return image.apply((p) => p.linear(1, amount));
647
+ });
648
+
649
+ // src/task/image/contrast/contrast.sharp.ts
650
+ import { registerFilterOp as registerFilterOp20 } from "@workglow/util/media";
651
+ registerFilterOp20("sharp", "contrast", (image, { amount }) => {
652
+ const slope = 259 * (amount + 255) / (255 * (259 - amount));
653
+ const intercept = 128 - slope * 128;
654
+ return image.apply((p) => p.linear(slope, intercept));
655
+ });
656
+
657
+ // src/task/image/crop/crop.sharp.ts
658
+ import { registerFilterOp as registerFilterOp21 } from "@workglow/util/media";
659
+ registerFilterOp21("sharp", "crop", (image, { left, top, width, height }) => {
660
+ return image.apply((p) => p.extract({ left, top, width, height }), {
661
+ width,
662
+ height
663
+ });
664
+ });
665
+
666
+ // src/task/image/flip/flip.sharp.ts
667
+ import { registerFilterOp as registerFilterOp22 } from "@workglow/util/media";
668
+ registerFilterOp22("sharp", "flip", (image, { direction }) => {
669
+ const sharp = image;
670
+ return direction === "horizontal" ? sharp.apply((p) => p.flop()) : sharp.apply((p) => p.flip());
671
+ });
672
+
673
+ // src/task/image/grayscale/grayscale.sharp.ts
674
+ import { registerFilterOp as registerFilterOp23 } from "@workglow/util/media";
675
+ registerFilterOp23("sharp", "grayscale", (image, _params) => {
676
+ return image.apply((p) => p.grayscale());
677
+ });
678
+
679
+ // src/task/image/invert/invert.sharp.ts
680
+ import { registerFilterOp as registerFilterOp24 } from "@workglow/util/media";
681
+ registerFilterOp24("sharp", "invert", (image, _params) => {
682
+ return image.apply((p) => p.negate({ alpha: false }));
683
+ });
684
+
685
+ // src/task/image/pixelate/pixelate.sharp.ts
686
+ import { registerFilterOp as registerFilterOp25 } from "@workglow/util/media";
687
+ registerFilterOp25("sharp", "pixelate", (image, { blockSize }) => {
688
+ const sharp = image;
689
+ const downW = Math.max(1, Math.floor(sharp.width / blockSize));
690
+ const downH = Math.max(1, Math.floor(sharp.height / blockSize));
691
+ const outW = sharp.width;
692
+ const outH = sharp.height;
693
+ return sharp.apply((p) => {
694
+ const down = p.resize(downW, downH, { kernel: "nearest" });
695
+ return down.resize(outW, outH, { kernel: "nearest" });
696
+ });
697
+ });
698
+
699
+ // src/task/image/resize/resize.sharp.ts
700
+ import { registerFilterOp as registerFilterOp26 } from "@workglow/util/media";
701
+ registerFilterOp26("sharp", "resize", (image, { width, height, fit, kernel }) => {
702
+ return image.apply((p) => p.resize(width, height, { fit, kernel }), {
703
+ width,
704
+ height
705
+ });
706
+ });
707
+
708
+ // src/task/image/rotate/rotate.sharp.ts
709
+ import { registerFilterOp as registerFilterOp27 } from "@workglow/util/media";
710
+ registerFilterOp27("sharp", "rotate", (image, { angle, background }) => {
711
+ const sharp = image;
712
+ const swap = angle === 90 || angle === 270;
713
+ const outW = swap ? sharp.height : sharp.width;
714
+ const outH = swap ? sharp.width : sharp.height;
715
+ return sharp.apply((p) => p.rotate(angle, background ? { background } : undefined), {
716
+ width: outW,
717
+ height: outH
718
+ });
719
+ });
720
+
721
+ // src/task/image/sepia/sepia.sharp.ts
722
+ import { registerFilterOp as registerFilterOp28 } from "@workglow/util/media";
723
+ registerFilterOp28("sharp", "sepia", (image, _params) => {
724
+ return image.apply((p) => p.recomb([
725
+ [0.393, 0.769, 0.189],
726
+ [0.349, 0.686, 0.168],
727
+ [0.272, 0.534, 0.131]
728
+ ]));
729
+ });
730
+
731
+ // src/task/image/threshold/threshold.sharp.ts
732
+ import { registerFilterOp as registerFilterOp29 } from "@workglow/util/media";
733
+ registerFilterOp29("sharp", "threshold", (image, { value }) => {
734
+ return image.apply((p) => p.threshold(value));
735
+ });
736
+
737
+ // src/task/image/tint/tint.sharp.ts
738
+ import { registerFilterOp as registerFilterOp30, resolveColor as resolveColor4 } from "@workglow/util/media";
739
+ registerFilterOp30("sharp", "tint", (image, { color }) => {
740
+ const { r, g, b } = resolveColor4(color);
741
+ return image.apply((p) => p.tint({ r, g, b }));
742
+ });
743
+
744
+ // src/codec.node.ts
745
+ import { applyFilter, registerPreviewResizeFn } from "@workglow/util/media";
746
+ registerPreviewResizeFn((image, width, height) => applyFilter(image, "resize", { width, height }));
747
+
149
748
  // src/task/image/imageTextRender.ts
150
749
  import { createServiceToken, globalServiceRegistry } from "@workglow/util";
151
750
  var IMAGE_TEXT_ANCHOR_POSITIONS = [
@@ -5877,281 +6476,182 @@ ${input.prompt}` : input.prompt : this.config.message ?? "";
5877
6476
  }
5878
6477
  }
5879
6478
  Workflow16.prototype.humanInput = CreateWorkflow15(HumanInputTask);
5880
- // src/task/image/ImageBlurTask.ts
6479
+
6480
+ // src/common.ts
6481
+ import {
6482
+ registerFilterOp as registerFilterOp31,
6483
+ applyFilter as applyFilter3,
6484
+ hasFilterOp as hasFilterOp2,
6485
+ _resetFilterRegistryForTests
6486
+ } from "@workglow/util/media";
6487
+
6488
+ // src/task/image/ImageFilterTask.ts
5881
6489
  import {
5882
- CreateWorkflow as CreateWorkflow16,
5883
- Task as Task42,
5884
- Workflow as Workflow17
6490
+ Task as Task42
5885
6491
  } from "@workglow/task-graph";
6492
+ import {
6493
+ applyFilter as applyFilter2,
6494
+ CpuImage as CpuImage17,
6495
+ GpuImageFactory,
6496
+ getGpuImageFactory,
6497
+ hasFilterOp,
6498
+ previewSource
6499
+ } from "@workglow/util/media";
5886
6500
 
5887
- // src/task/image/ImageSchemas.ts
5888
- import { FromSchemaDefaultOptions } from "@workglow/util/schema";
5889
- var ImageBinaryType = null;
5890
- var ImageBinarySchemaOptions = {
5891
- ...FromSchemaDefaultOptions,
5892
- deserialize: [
5893
- {
5894
- pattern: { type: "object", format: "image:ImageBinary" },
5895
- output: ImageBinaryType
6501
+ class ImageFilterTask extends Task42 {
6502
+ scalePreviewParams(params, _scale) {
6503
+ return params;
6504
+ }
6505
+ async hydrateInput(image) {
6506
+ if (image !== null && typeof image === "object" && "backend" in image && "retain" in image && "release" in image && "materialize" in image) {
6507
+ return image;
5896
6508
  }
5897
- ]
5898
- };
5899
- var ImageBinarySchema = (annotations = {}) => ({
6509
+ if (typeof image === "string" && image.startsWith("data:")) {
6510
+ return GpuImageFactory.fromDataUri(image);
6511
+ }
6512
+ if (typeof Blob !== "undefined" && image instanceof Blob) {
6513
+ return GpuImageFactory.fromBlob(image);
6514
+ }
6515
+ if (typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap) {
6516
+ const fromImageBitmap = getGpuImageFactory("fromImageBitmap");
6517
+ if (!fromImageBitmap) {
6518
+ throw new Error("ImageFilterTask: received ImageBitmap but GpuImage.fromImageBitmap is not registered " + "in this runtime. ImageBitmap inputs require the browser entry point.");
6519
+ }
6520
+ return fromImageBitmap(image);
6521
+ }
6522
+ if (image !== null && typeof image === "object" && "data" in image && "width" in image && "height" in image && "channels" in image) {
6523
+ const bin = image;
6524
+ const asyncFactory = getGpuImageFactory("fromImageBinaryAsync");
6525
+ if (asyncFactory)
6526
+ return asyncFactory(bin);
6527
+ return GpuImageFactory.fromImageBinary(bin);
6528
+ }
6529
+ const ctor = image && typeof image === "object" && image.constructor ? image.constructor.name : typeof image;
6530
+ const keys = image && typeof image === "object" ? Object.keys(image).slice(0, 10).join(", ") : "";
6531
+ throw new Error(`ImageFilterTask: input.image is not a recognized image shape (got ${ctor}` + (keys ? ` with keys [${keys}]` : "") + `). Expected one of: GpuImage instance, raw ImageBinary, Blob, ImageBitmap, ` + `or a data: URI string.`);
6532
+ }
6533
+ async execute(input, ctx) {
6534
+ let inputImage = await this.hydrateInput(input.image);
6535
+ if (!hasFilterOp(inputImage.backend, this.filterName)) {
6536
+ const bin = await inputImage.materialize();
6537
+ const cpu = CpuImage17.fromImageBinary(bin, inputImage.previewScale);
6538
+ inputImage.release();
6539
+ inputImage = cpu;
6540
+ }
6541
+ const params = this.scalePreviewParams(this.opParams(input), inputImage.previewScale);
6542
+ const out = applyFilter2(inputImage, this.filterName, params);
6543
+ inputImage.release();
6544
+ ctx.resourceScope?.register(`gpuimage:${String(this.id)}:image`, async () => out.release());
6545
+ return { image: out };
6546
+ }
6547
+ async executePreview(input, _ctx) {
6548
+ const inputImage = await this.hydrateInput(input.image);
6549
+ let sourced = previewSource(inputImage);
6550
+ if (!hasFilterOp(sourced.backend, this.filterName)) {
6551
+ const bin = await sourced.materialize();
6552
+ const cpu = CpuImage17.fromImageBinary(bin, sourced.previewScale);
6553
+ if (sourced !== inputImage)
6554
+ sourced.release();
6555
+ sourced = cpu;
6556
+ }
6557
+ const params = this.scalePreviewParams(this.opParams(input), sourced.previewScale);
6558
+ const out = applyFilter2(sourced, this.filterName, params);
6559
+ if (sourced !== inputImage)
6560
+ sourced.release();
6561
+ return { image: out };
6562
+ }
6563
+ }
6564
+ // src/task/image/blur/ImageBlurTask.ts
6565
+ import { CreateWorkflow as CreateWorkflow16, Workflow as Workflow17 } from "@workglow/task-graph";
6566
+ import { GpuImageSchema } from "@workglow/util/media";
6567
+ var inputSchema41 = {
5900
6568
  type: "object",
5901
6569
  properties: {
5902
- data: {
5903
- type: "array",
5904
- items: { type: "number", format: "Uint8Clamped" },
5905
- format: "Uint8ClampedArray",
5906
- title: "Data",
5907
- description: "Pixel data of the image"
5908
- },
5909
- width: {
5910
- type: "integer",
6570
+ image: GpuImageSchema({ title: "Image", description: "Source image" }),
6571
+ radius: {
6572
+ type: "number",
6573
+ title: "Radius",
6574
+ description: "Blur radius (1-10)",
5911
6575
  minimum: 1,
5912
- title: "Width",
5913
- description: "Width in pixels"
5914
- },
5915
- height: {
6576
+ maximum: 10,
6577
+ default: 1
6578
+ }
6579
+ },
6580
+ required: ["image"],
6581
+ additionalProperties: false
6582
+ };
6583
+ var outputSchema40 = {
6584
+ type: "object",
6585
+ properties: { image: GpuImageSchema({ title: "Image", description: "Blurred image" }) },
6586
+ required: ["image"],
6587
+ additionalProperties: false
6588
+ };
6589
+
6590
+ class ImageBlurTask extends ImageFilterTask {
6591
+ static type = "ImageBlurTask";
6592
+ static category = "Image";
6593
+ static title = "Blur Image";
6594
+ static description = "Applies a box blur to an image";
6595
+ static inputSchema() {
6596
+ return inputSchema41;
6597
+ }
6598
+ static outputSchema() {
6599
+ return outputSchema40;
6600
+ }
6601
+ filterName = "blur";
6602
+ opParams(input) {
6603
+ return { radius: input.radius ?? 1 };
6604
+ }
6605
+ scalePreviewParams({ radius }, s) {
6606
+ return { radius: Math.max(1, Math.round(radius * s)) };
6607
+ }
6608
+ }
6609
+ Workflow17.prototype.imageBlur = CreateWorkflow16(ImageBlurTask);
6610
+ // src/task/image/border/ImageBorderTask.ts
6611
+ import { CreateWorkflow as CreateWorkflow17, Workflow as Workflow18 } from "@workglow/task-graph";
6612
+ import { GpuImageSchema as GpuImageSchema2 } from "@workglow/util/media";
6613
+ var inputSchema42 = {
6614
+ type: "object",
6615
+ properties: {
6616
+ image: GpuImageSchema2({ title: "Image", description: "Source image" }),
6617
+ borderWidth: {
5916
6618
  type: "integer",
6619
+ title: "Border Width",
6620
+ description: "Border width in pixels",
5917
6621
  minimum: 1,
5918
- title: "Height",
5919
- description: "Height in pixels"
6622
+ default: 10
5920
6623
  },
5921
- channels: {
5922
- type: "integer",
5923
- enum: [1, 3, 4],
5924
- title: "Channels",
5925
- description: "1 (gray), 3 (RGB), or 4 (RGBA)"
6624
+ color: {
6625
+ oneOf: [
6626
+ { type: "string", pattern: "^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$" },
6627
+ {
6628
+ type: "object",
6629
+ properties: {
6630
+ r: { type: "integer", minimum: 0, maximum: 255 },
6631
+ g: { type: "integer", minimum: 0, maximum: 255 },
6632
+ b: { type: "integer", minimum: 0, maximum: 255 },
6633
+ a: { type: "integer", minimum: 0, maximum: 255 }
6634
+ },
6635
+ required: ["r", "g", "b"],
6636
+ additionalProperties: false
6637
+ }
6638
+ ],
6639
+ title: "Color",
6640
+ description: "Border color",
6641
+ default: "#000000"
5926
6642
  }
5927
6643
  },
5928
- additionalProperties: false,
5929
- required: ["data", "width", "height", "channels"],
5930
- format: "image:ImageBinary",
5931
- title: "Image",
5932
- description: "Raw pixel image data",
5933
- ...annotations
5934
- });
5935
- var ImageBinaryOrDataUriSchema = (annotations = {}) => ({
5936
- oneOf: [
5937
- ImageBinarySchema(annotations),
5938
- {
5939
- type: "string",
5940
- format: "image:data-uri",
5941
- title: annotations.title ?? "Image",
5942
- description: annotations.description ?? "Image as ImageBinary or data URI (data:image/png;base64,...)"
5943
- }
5944
- ]
5945
- });
5946
- var ColorSchema = (annotations = {}) => ({
6644
+ required: ["image", "color"],
6645
+ additionalProperties: false
6646
+ };
6647
+ var outputSchema41 = {
5947
6648
  type: "object",
5948
- properties: {
5949
- r: { type: "integer", minimum: 0, maximum: 255, title: "Red" },
5950
- g: { type: "integer", minimum: 0, maximum: 255, title: "Green" },
5951
- b: { type: "integer", minimum: 0, maximum: 255, title: "Blue" },
5952
- a: { type: "integer", minimum: 0, maximum: 255, title: "Alpha", default: 255 }
5953
- },
5954
- required: ["r", "g", "b"],
5955
- format: "color",
5956
- additionalProperties: false,
5957
- ...annotations
5958
- });
5959
- var HexColorSchema = (annotations = {}) => ({
5960
- type: "string",
5961
- format: "color",
5962
- pattern: "^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
5963
- title: "Color (hex)",
5964
- description: "Color as a `#RRGGBB[AA]` or `#RGB[A]` hex string",
5965
- ...annotations
5966
- });
5967
- var ColorValueSchema = (annotations = {}) => ({
5968
- oneOf: [
5969
- ColorSchema(),
5970
- HexColorSchema({
5971
- title: annotations.title ?? "Color",
5972
- description: annotations.description ?? "Color as {r,g,b,a} object or `#RRGGBB[AA]` / `#RGB[A]` hex string"
5973
- })
5974
- ],
5975
- ...annotations
5976
- });
5977
- var ColorObjectType = null;
5978
- var ColorFromSchemaOptions = {
5979
- ...FromSchemaDefaultOptions,
5980
- deserialize: [
5981
- {
5982
- pattern: { type: "object", format: "color" },
5983
- output: ColorObjectType
5984
- }
5985
- ]
5986
- };
5987
-
5988
- // src/task/image/imageTaskIo.ts
5989
- import { Image, getImageRasterCodec } from "@workglow/util/media";
5990
- async function produceImageOutput(inputImage, run) {
5991
- const image = Image.is(inputImage) ? inputImage : Image.from(inputImage);
5992
- const pixels = await image.getPixels();
5993
- const out = await run(pixels);
5994
- if (image.kind === "dataUri") {
5995
- const mime = image.mimeType ?? "image/png";
5996
- return getImageRasterCodec().encodeDataUri(out, mime);
5997
- }
5998
- return out;
5999
- }
6000
-
6001
- // src/task/image/ImageBlurTask.ts
6002
- async function applyBlur(input) {
6003
- const { radius = 1 } = input;
6004
- const image = await produceImageOutput(input.image, (img) => {
6005
- const { data: src, width, height, channels } = img;
6006
- const kernelSize = radius * 2 + 1;
6007
- const tmp = new Uint8ClampedArray(src.length);
6008
- for (let y = 0;y < height; y++) {
6009
- for (let c = 0;c < channels; c++) {
6010
- let sum = 0;
6011
- for (let k = -radius;k <= radius; k++) {
6012
- const x = Math.max(0, Math.min(k, width - 1));
6013
- sum += src[(y * width + x) * channels + c];
6014
- }
6015
- tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
6016
- for (let x = 1;x < width; x++) {
6017
- const addX = Math.min(x + radius, width - 1);
6018
- const removeX = Math.max(x - radius - 1, 0);
6019
- sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
6020
- tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6021
- }
6022
- }
6023
- }
6024
- const dst = new Uint8ClampedArray(src.length);
6025
- for (let x = 0;x < width; x++) {
6026
- for (let c = 0;c < channels; c++) {
6027
- let sum = 0;
6028
- for (let k = -radius;k <= radius; k++) {
6029
- const y = Math.max(0, Math.min(k, height - 1));
6030
- sum += tmp[(y * width + x) * channels + c];
6031
- }
6032
- dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
6033
- for (let y = 1;y < height; y++) {
6034
- const addY = Math.min(y + radius, height - 1);
6035
- const removeY = Math.max(y - radius - 1, 0);
6036
- sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
6037
- dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6038
- }
6039
- }
6040
- }
6041
- return { data: dst, width, height, channels };
6042
- });
6043
- return { image };
6044
- }
6045
- var inputSchema41 = {
6046
- type: "object",
6047
- properties: {
6048
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6049
- radius: {
6050
- type: "integer",
6051
- title: "Radius",
6052
- description: "Blur radius (1-10)",
6053
- minimum: 1,
6054
- maximum: 10,
6055
- default: 1
6056
- }
6057
- },
6058
- required: ["image"],
6059
- additionalProperties: false
6060
- };
6061
- var outputSchema40 = {
6062
- type: "object",
6063
- properties: {
6064
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Blurred image" })
6065
- },
6649
+ properties: { image: GpuImageSchema2({ title: "Image", description: "Image with border" }) },
6066
6650
  required: ["image"],
6067
6651
  additionalProperties: false
6068
6652
  };
6069
6653
 
6070
- class ImageBlurTask extends Task42 {
6071
- static type = "ImageBlurTask";
6072
- static category = "Image";
6073
- static title = "Blur Image";
6074
- static description = "Applies a box blur to an image";
6075
- static inputSchema() {
6076
- return inputSchema41;
6077
- }
6078
- static outputSchema() {
6079
- return outputSchema40;
6080
- }
6081
- async execute(input, _context) {
6082
- return await applyBlur(input);
6083
- }
6084
- async executePreview(input, _context) {
6085
- return await applyBlur(input);
6086
- }
6087
- }
6088
- Workflow17.prototype.imageBlur = CreateWorkflow16(ImageBlurTask);
6089
- // src/task/image/ImageBorderTask.ts
6090
- import {
6091
- CreateWorkflow as CreateWorkflow17,
6092
- Task as Task43,
6093
- Workflow as Workflow18
6094
- } from "@workglow/task-graph";
6095
- import { resolveColor } from "@workglow/util/media";
6096
- async function applyBorder(input) {
6097
- const { borderWidth: bw = 1 } = input;
6098
- const color = resolveColor(input.color);
6099
- const image = await produceImageOutput(input.image, (img) => {
6100
- const { data: src, width: srcW, height: srcH, channels: srcCh } = img;
6101
- const outCh = 4;
6102
- const dstW = srcW + bw * 2;
6103
- const dstH = srcH + bw * 2;
6104
- const dst = new Uint8ClampedArray(dstW * dstH * outCh);
6105
- const r = color.r;
6106
- const g = color.g;
6107
- const b = color.b;
6108
- const a = color.a;
6109
- for (let i = 0;i < dst.length; i += outCh) {
6110
- dst[i] = r;
6111
- dst[i + 1] = g;
6112
- dst[i + 2] = b;
6113
- dst[i + 3] = a;
6114
- }
6115
- for (let y = 0;y < srcH; y++) {
6116
- for (let x = 0;x < srcW; x++) {
6117
- const srcIdx = (y * srcW + x) * srcCh;
6118
- const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
6119
- dst[dstIdx] = src[srcIdx];
6120
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
6121
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
6122
- dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
6123
- }
6124
- }
6125
- return { data: dst, width: dstW, height: dstH, channels: outCh };
6126
- });
6127
- return { image };
6128
- }
6129
- var inputSchema42 = {
6130
- type: "object",
6131
- properties: {
6132
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6133
- borderWidth: {
6134
- type: "integer",
6135
- title: "Border Width",
6136
- description: "Border width in pixels",
6137
- minimum: 1,
6138
- default: 1
6139
- },
6140
- color: ColorValueSchema({ title: "Color", description: "Border color" })
6141
- },
6142
- required: ["image", "color"],
6143
- additionalProperties: false
6144
- };
6145
- var outputSchema41 = {
6146
- type: "object",
6147
- properties: {
6148
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Image with border" })
6149
- },
6150
- required: ["image"],
6151
- additionalProperties: false
6152
- };
6153
-
6154
- class ImageBorderTask extends Task43 {
6654
+ class ImageBorderTask extends ImageFilterTask {
6155
6655
  static type = "ImageBorderTask";
6156
6656
  static category = "Image";
6157
6657
  static title = "Add Border";
@@ -6162,45 +6662,25 @@ class ImageBorderTask extends Task43 {
6162
6662
  static outputSchema() {
6163
6663
  return outputSchema41;
6164
6664
  }
6165
- async execute(input, _context) {
6166
- return await applyBorder(input);
6665
+ filterName = "border";
6666
+ opParams(input) {
6667
+ return {
6668
+ borderWidth: input.borderWidth ?? 10,
6669
+ color: input.color
6670
+ };
6167
6671
  }
6168
- async executePreview(input, _context) {
6169
- return await applyBorder(input);
6672
+ scalePreviewParams({ borderWidth, color }, s) {
6673
+ return { borderWidth: Math.max(1, Math.round(borderWidth * s)), color };
6170
6674
  }
6171
6675
  }
6172
6676
  Workflow18.prototype.imageBorder = CreateWorkflow17(ImageBorderTask);
6173
- // src/task/image/ImageBrightnessTask.ts
6174
- import {
6175
- CreateWorkflow as CreateWorkflow18,
6176
- Task as Task44,
6177
- Workflow as Workflow19
6178
- } from "@workglow/task-graph";
6179
- async function applyBrightness(input) {
6180
- const amount = input.amount ?? 0;
6181
- const image = await produceImageOutput(input.image, (img) => {
6182
- const { data: src, width, height, channels } = img;
6183
- const dst = new Uint8ClampedArray(src.length);
6184
- if (channels === 4) {
6185
- for (let i = 0;i < src.length; i += 4) {
6186
- dst[i] = src[i] + amount;
6187
- dst[i + 1] = src[i + 1] + amount;
6188
- dst[i + 2] = src[i + 2] + amount;
6189
- dst[i + 3] = src[i + 3];
6190
- }
6191
- } else {
6192
- for (let i = 0;i < src.length; i++) {
6193
- dst[i] = src[i] + amount;
6194
- }
6195
- }
6196
- return { data: dst, width, height, channels };
6197
- });
6198
- return { image };
6199
- }
6677
+ // src/task/image/brightness/ImageBrightnessTask.ts
6678
+ import { CreateWorkflow as CreateWorkflow18, Workflow as Workflow19 } from "@workglow/task-graph";
6679
+ import { GpuImageSchema as GpuImageSchema3 } from "@workglow/util/media";
6200
6680
  var inputSchema43 = {
6201
6681
  type: "object",
6202
6682
  properties: {
6203
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6683
+ image: GpuImageSchema3({ title: "Image", description: "Source image" }),
6204
6684
  amount: {
6205
6685
  type: "number",
6206
6686
  title: "Amount",
@@ -6215,14 +6695,12 @@ var inputSchema43 = {
6215
6695
  };
6216
6696
  var outputSchema42 = {
6217
6697
  type: "object",
6218
- properties: {
6219
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Brightness-adjusted image" })
6220
- },
6698
+ properties: { image: GpuImageSchema3({ title: "Image", description: "Brightness-adjusted image" }) },
6221
6699
  required: ["image"],
6222
6700
  additionalProperties: false
6223
6701
  };
6224
6702
 
6225
- class ImageBrightnessTask extends Task44 {
6703
+ class ImageBrightnessTask extends ImageFilterTask {
6226
6704
  static type = "ImageBrightnessTask";
6227
6705
  static category = "Image";
6228
6706
  static title = "Adjust Brightness";
@@ -6233,50 +6711,19 @@ class ImageBrightnessTask extends Task44 {
6233
6711
  static outputSchema() {
6234
6712
  return outputSchema42;
6235
6713
  }
6236
- async execute(input, _context) {
6237
- return await applyBrightness(input);
6238
- }
6239
- async executePreview(input, _context) {
6240
- return await applyBrightness(input);
6714
+ filterName = "brightness";
6715
+ opParams(input) {
6716
+ return { amount: input.amount ?? 0 };
6241
6717
  }
6242
6718
  }
6243
6719
  Workflow19.prototype.imageBrightness = CreateWorkflow18(ImageBrightnessTask);
6244
- // src/task/image/ImageContrastTask.ts
6245
- import {
6246
- CreateWorkflow as CreateWorkflow19,
6247
- Task as Task45,
6248
- Workflow as Workflow20
6249
- } from "@workglow/task-graph";
6250
- async function applyContrast(input) {
6251
- const amount = input.amount ?? 0;
6252
- const image = await produceImageOutput(input.image, (img) => {
6253
- const { data: src, width, height, channels } = img;
6254
- const factor = 259 * (amount + 255) / (255 * (259 - amount));
6255
- const lut = new Uint8ClampedArray(256);
6256
- for (let i = 0;i < 256; i++) {
6257
- lut[i] = factor * (i - 128) + 128;
6258
- }
6259
- const dst = new Uint8ClampedArray(src.length);
6260
- if (channels === 4) {
6261
- for (let i = 0;i < src.length; i += 4) {
6262
- dst[i] = lut[src[i]];
6263
- dst[i + 1] = lut[src[i + 1]];
6264
- dst[i + 2] = lut[src[i + 2]];
6265
- dst[i + 3] = src[i + 3];
6266
- }
6267
- } else {
6268
- for (let i = 0;i < src.length; i++) {
6269
- dst[i] = lut[src[i]];
6270
- }
6271
- }
6272
- return { data: dst, width, height, channels };
6273
- });
6274
- return { image };
6275
- }
6720
+ // src/task/image/contrast/ImageContrastTask.ts
6721
+ import { CreateWorkflow as CreateWorkflow19, Workflow as Workflow20 } from "@workglow/task-graph";
6722
+ import { GpuImageSchema as GpuImageSchema4 } from "@workglow/util/media";
6276
6723
  var inputSchema44 = {
6277
6724
  type: "object",
6278
6725
  properties: {
6279
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6726
+ image: GpuImageSchema4({ title: "Image", description: "Source image" }),
6280
6727
  amount: {
6281
6728
  type: "number",
6282
6729
  title: "Amount",
@@ -6291,14 +6738,12 @@ var inputSchema44 = {
6291
6738
  };
6292
6739
  var outputSchema43 = {
6293
6740
  type: "object",
6294
- properties: {
6295
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Contrast-adjusted image" })
6296
- },
6741
+ properties: { image: GpuImageSchema4({ title: "Image", description: "Contrast-adjusted image" }) },
6297
6742
  required: ["image"],
6298
6743
  additionalProperties: false
6299
6744
  };
6300
6745
 
6301
- class ImageContrastTask extends Task45 {
6746
+ class ImageContrastTask extends ImageFilterTask {
6302
6747
  static type = "ImageContrastTask";
6303
6748
  static category = "Image";
6304
6749
  static title = "Adjust Contrast";
@@ -6309,67 +6754,35 @@ class ImageContrastTask extends Task45 {
6309
6754
  static outputSchema() {
6310
6755
  return outputSchema43;
6311
6756
  }
6312
- async execute(input, _context) {
6313
- return await applyContrast(input);
6314
- }
6315
- async executePreview(input, _context) {
6316
- return await applyContrast(input);
6757
+ filterName = "contrast";
6758
+ opParams(input) {
6759
+ return { amount: input.amount ?? 0 };
6317
6760
  }
6318
6761
  }
6319
6762
  Workflow20.prototype.imageContrast = CreateWorkflow19(ImageContrastTask);
6320
- // src/task/image/ImageCropTask.ts
6321
- import {
6322
- CreateWorkflow as CreateWorkflow20,
6323
- Task as Task46,
6324
- Workflow as Workflow21
6325
- } from "@workglow/task-graph";
6326
- async function cropImage(input) {
6327
- const { x: rawX, y: rawY, width: rawW, height: rawH } = input;
6328
- const image = await produceImageOutput(input.image, (img) => {
6329
- const { data: src, width: srcW, height: srcH, channels } = img;
6330
- if (srcW < 1 || srcH < 1) {
6331
- throw new RangeError("Cannot crop an empty image");
6332
- }
6333
- if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
6334
- throw new RangeError("Crop origin is outside the source image bounds");
6335
- }
6336
- const x = rawX;
6337
- const y = rawY;
6338
- const w = Math.min(rawW, srcW - x);
6339
- const h = Math.min(rawH, srcH - y);
6340
- const dst = new Uint8ClampedArray(w * h * channels);
6341
- const rowBytes = w * channels;
6342
- for (let row = 0;row < h; row++) {
6343
- const srcOffset = ((y + row) * srcW + x) * channels;
6344
- const dstOffset = row * rowBytes;
6345
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6346
- }
6347
- return { data: dst, width: w, height: h, channels };
6348
- });
6349
- return { image };
6350
- }
6763
+ // src/task/image/crop/ImageCropTask.ts
6764
+ import { CreateWorkflow as CreateWorkflow20, Workflow as Workflow21 } from "@workglow/task-graph";
6765
+ import { GpuImageSchema as GpuImageSchema5 } from "@workglow/util/media";
6351
6766
  var inputSchema45 = {
6352
6767
  type: "object",
6353
6768
  properties: {
6354
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6355
- x: { type: "integer", title: "X", description: "Left offset", minimum: 0 },
6356
- y: { type: "integer", title: "Y", description: "Top offset", minimum: 0 },
6769
+ image: GpuImageSchema5({ title: "Image", description: "Source image" }),
6770
+ left: { type: "integer", title: "Left", description: "Left offset", minimum: 0, default: 0 },
6771
+ top: { type: "integer", title: "Top", description: "Top offset", minimum: 0, default: 0 },
6357
6772
  width: { type: "integer", title: "Width", description: "Crop width", minimum: 1 },
6358
6773
  height: { type: "integer", title: "Height", description: "Crop height", minimum: 1 }
6359
6774
  },
6360
- required: ["image", "x", "y", "width", "height"],
6775
+ required: ["image", "left", "top", "width", "height"],
6361
6776
  additionalProperties: false
6362
6777
  };
6363
6778
  var outputSchema44 = {
6364
6779
  type: "object",
6365
- properties: {
6366
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Cropped image" })
6367
- },
6780
+ properties: { image: GpuImageSchema5({ title: "Image", description: "Cropped image" }) },
6368
6781
  required: ["image"],
6369
6782
  additionalProperties: false
6370
6783
  };
6371
6784
 
6372
- class ImageCropTask extends Task46 {
6785
+ class ImageCropTask extends ImageFilterTask {
6373
6786
  static type = "ImageCropTask";
6374
6787
  static category = "Image";
6375
6788
  static title = "Crop Image";
@@ -6380,56 +6793,38 @@ class ImageCropTask extends Task46 {
6380
6793
  static outputSchema() {
6381
6794
  return outputSchema44;
6382
6795
  }
6383
- async execute(input, _context) {
6384
- return await cropImage(input);
6796
+ filterName = "crop";
6797
+ opParams(input) {
6798
+ return {
6799
+ left: input.left,
6800
+ top: input.top,
6801
+ width: input.width,
6802
+ height: input.height
6803
+ };
6385
6804
  }
6386
- async executePreview(input, _context) {
6387
- return await cropImage(input);
6805
+ scalePreviewParams({ left, top, width, height }, s) {
6806
+ return {
6807
+ left: Math.round(left * s),
6808
+ top: Math.round(top * s),
6809
+ width: Math.max(1, Math.round(width * s)),
6810
+ height: Math.max(1, Math.round(height * s))
6811
+ };
6388
6812
  }
6389
6813
  }
6390
6814
  Workflow21.prototype.imageCrop = CreateWorkflow20(ImageCropTask);
6391
- // src/task/image/ImageFlipTask.ts
6392
- import {
6393
- CreateWorkflow as CreateWorkflow21,
6394
- Task as Task47,
6395
- Workflow as Workflow22
6396
- } from "@workglow/task-graph";
6397
- async function flipImage(input) {
6398
- const { direction } = input;
6399
- const image = await produceImageOutput(input.image, (img) => {
6400
- const { data: src, width, height, channels } = img;
6401
- const dst = new Uint8ClampedArray(src.length);
6402
- const rowBytes = width * channels;
6403
- if (direction === "vertical") {
6404
- for (let y = 0;y < height; y++) {
6405
- const srcOffset = y * rowBytes;
6406
- const dstOffset = (height - 1 - y) * rowBytes;
6407
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6408
- }
6409
- } else {
6410
- for (let y = 0;y < height; y++) {
6411
- for (let x = 0;x < width; x++) {
6412
- const srcIdx = (y * width + x) * channels;
6413
- const dstIdx = (y * width + (width - 1 - x)) * channels;
6414
- for (let c = 0;c < channels; c++) {
6415
- dst[dstIdx + c] = src[srcIdx + c];
6416
- }
6417
- }
6418
- }
6419
- }
6420
- return { data: dst, width, height, channels };
6421
- });
6422
- return { image };
6423
- }
6815
+ // src/task/image/flip/ImageFlipTask.ts
6816
+ import { CreateWorkflow as CreateWorkflow21, Workflow as Workflow22 } from "@workglow/task-graph";
6817
+ import { GpuImageSchema as GpuImageSchema6 } from "@workglow/util/media";
6424
6818
  var inputSchema46 = {
6425
6819
  type: "object",
6426
6820
  properties: {
6427
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6821
+ image: GpuImageSchema6({ title: "Image", description: "Source image" }),
6428
6822
  direction: {
6429
6823
  type: "string",
6430
6824
  enum: ["horizontal", "vertical"],
6431
6825
  title: "Direction",
6432
- description: "Flip direction"
6826
+ description: "Flip direction",
6827
+ default: "horizontal"
6433
6828
  }
6434
6829
  },
6435
6830
  required: ["image", "direction"],
@@ -6437,14 +6832,12 @@ var inputSchema46 = {
6437
6832
  };
6438
6833
  var outputSchema45 = {
6439
6834
  type: "object",
6440
- properties: {
6441
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Flipped image" })
6442
- },
6835
+ properties: { image: GpuImageSchema6({ title: "Image", description: "Flipped image" }) },
6443
6836
  required: ["image"],
6444
6837
  additionalProperties: false
6445
6838
  };
6446
6839
 
6447
- class ImageFlipTask extends Task47 {
6840
+ class ImageFlipTask extends ImageFilterTask {
6448
6841
  static type = "ImageFlipTask";
6449
6842
  static category = "Image";
6450
6843
  static title = "Flip Image";
@@ -6455,54 +6848,29 @@ class ImageFlipTask extends Task47 {
6455
6848
  static outputSchema() {
6456
6849
  return outputSchema45;
6457
6850
  }
6458
- async execute(input, _context) {
6459
- return await flipImage(input);
6460
- }
6461
- async executePreview(input, _context) {
6462
- return await flipImage(input);
6851
+ filterName = "flip";
6852
+ opParams(input) {
6853
+ return { direction: input.direction ?? "horizontal" };
6463
6854
  }
6464
6855
  }
6465
6856
  Workflow22.prototype.imageFlip = CreateWorkflow21(ImageFlipTask);
6466
- // src/task/image/ImageGrayscaleTask.ts
6467
- import {
6468
- CreateWorkflow as CreateWorkflow22,
6469
- Task as Task48,
6470
- Workflow as Workflow23
6471
- } from "@workglow/task-graph";
6472
- async function applyGrayscale(input) {
6473
- const image = await produceImageOutput(input.image, (img) => {
6474
- const { data: src, width, height, channels } = img;
6475
- if (channels === 1) {
6476
- return { data: new Uint8ClampedArray(src), width, height, channels: 1 };
6477
- }
6478
- const pixelCount = width * height;
6479
- const dst = new Uint8ClampedArray(pixelCount);
6480
- for (let i = 0;i < pixelCount; i++) {
6481
- const idx = i * channels;
6482
- dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
6483
- }
6484
- return { data: dst, width, height, channels: 1 };
6485
- });
6486
- return { image };
6487
- }
6857
+ // src/task/image/grayscale/ImageGrayscaleTask.ts
6858
+ import { CreateWorkflow as CreateWorkflow22, Workflow as Workflow23 } from "@workglow/task-graph";
6859
+ import { GpuImageSchema as GpuImageSchema7 } from "@workglow/util/media";
6488
6860
  var inputSchema47 = {
6489
6861
  type: "object",
6490
- properties: {
6491
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" })
6492
- },
6862
+ properties: { image: GpuImageSchema7({ title: "Image", description: "Source image" }) },
6493
6863
  required: ["image"],
6494
6864
  additionalProperties: false
6495
6865
  };
6496
6866
  var outputSchema46 = {
6497
6867
  type: "object",
6498
- properties: {
6499
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Grayscale image" })
6500
- },
6868
+ properties: { image: GpuImageSchema7({ title: "Image", description: "Grayscale image" }) },
6501
6869
  required: ["image"],
6502
6870
  additionalProperties: false
6503
6871
  };
6504
6872
 
6505
- class ImageGrayscaleTask extends Task48 {
6873
+ class ImageGrayscaleTask extends ImageFilterTask {
6506
6874
  static type = "ImageGrayscaleTask";
6507
6875
  static category = "Image";
6508
6876
  static title = "Grayscale";
@@ -6513,58 +6881,29 @@ class ImageGrayscaleTask extends Task48 {
6513
6881
  static outputSchema() {
6514
6882
  return outputSchema46;
6515
6883
  }
6516
- async execute(input, _context) {
6517
- return await applyGrayscale(input);
6518
- }
6519
- async executePreview(input, _context) {
6520
- return await applyGrayscale(input);
6884
+ filterName = "grayscale";
6885
+ opParams(_input) {
6886
+ return;
6521
6887
  }
6522
6888
  }
6523
6889
  Workflow23.prototype.imageGrayscale = CreateWorkflow22(ImageGrayscaleTask);
6524
- // src/task/image/ImageInvertTask.ts
6525
- import {
6526
- CreateWorkflow as CreateWorkflow23,
6527
- Task as Task49,
6528
- Workflow as Workflow24
6529
- } from "@workglow/task-graph";
6530
- async function invertImage(input) {
6531
- const image = await produceImageOutput(input.image, (img) => {
6532
- const { data: src, width, height, channels } = img;
6533
- const dst = new Uint8ClampedArray(src.length);
6534
- if (channels === 4) {
6535
- for (let i = 0;i < src.length; i += 4) {
6536
- dst[i] = 255 - src[i];
6537
- dst[i + 1] = 255 - src[i + 1];
6538
- dst[i + 2] = 255 - src[i + 2];
6539
- dst[i + 3] = src[i + 3];
6540
- }
6541
- } else {
6542
- for (let i = 0;i < src.length; i++) {
6543
- dst[i] = 255 - src[i];
6544
- }
6545
- }
6546
- return { data: dst, width, height, channels };
6547
- });
6548
- return { image };
6549
- }
6890
+ // src/task/image/invert/ImageInvertTask.ts
6891
+ import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow24 } from "@workglow/task-graph";
6892
+ import { GpuImageSchema as GpuImageSchema8 } from "@workglow/util/media";
6550
6893
  var inputSchema48 = {
6551
6894
  type: "object",
6552
- properties: {
6553
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" })
6554
- },
6895
+ properties: { image: GpuImageSchema8({ title: "Image", description: "Source image" }) },
6555
6896
  required: ["image"],
6556
6897
  additionalProperties: false
6557
6898
  };
6558
6899
  var outputSchema47 = {
6559
6900
  type: "object",
6560
- properties: {
6561
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Inverted image" })
6562
- },
6901
+ properties: { image: GpuImageSchema8({ title: "Image", description: "Inverted image" }) },
6563
6902
  required: ["image"],
6564
6903
  additionalProperties: false
6565
6904
  };
6566
6905
 
6567
- class ImageInvertTask extends Task49 {
6906
+ class ImageInvertTask extends ImageFilterTask {
6568
6907
  static type = "ImageInvertTask";
6569
6908
  static category = "Image";
6570
6909
  static title = "Invert Colors";
@@ -6575,64 +6914,26 @@ class ImageInvertTask extends Task49 {
6575
6914
  static outputSchema() {
6576
6915
  return outputSchema47;
6577
6916
  }
6578
- async execute(input, _context) {
6579
- return await invertImage(input);
6580
- }
6581
- async executePreview(input, _context) {
6582
- return await invertImage(input);
6917
+ filterName = "invert";
6918
+ opParams(_input) {
6919
+ return;
6583
6920
  }
6584
6921
  }
6585
6922
  Workflow24.prototype.imageInvert = CreateWorkflow23(ImageInvertTask);
6586
- // src/task/image/ImagePixelateTask.ts
6587
- import {
6588
- CreateWorkflow as CreateWorkflow24,
6589
- Task as Task50,
6590
- Workflow as Workflow25
6591
- } from "@workglow/task-graph";
6592
- async function pixelateImage(input) {
6593
- const { blockSize = 8 } = input;
6594
- const image = await produceImageOutput(input.image, (img) => {
6595
- const { data: src, width, height, channels } = img;
6596
- const dst = new Uint8ClampedArray(src.length);
6597
- for (let by = 0;by < height; by += blockSize) {
6598
- const blockH = Math.min(blockSize, height - by);
6599
- for (let bx = 0;bx < width; bx += blockSize) {
6600
- const blockW = Math.min(blockSize, width - bx);
6601
- const blockArea = blockW * blockH;
6602
- const sums = new Array(channels).fill(0);
6603
- for (let y = by;y < by + blockH; y++) {
6604
- for (let x = bx;x < bx + blockW; x++) {
6605
- const idx = (y * width + x) * channels;
6606
- for (let c = 0;c < channels; c++) {
6607
- sums[c] += src[idx + c];
6608
- }
6609
- }
6610
- }
6611
- const avg = sums.map((s) => s / blockArea + 0.5 | 0);
6612
- for (let y = by;y < by + blockH; y++) {
6613
- for (let x = bx;x < bx + blockW; x++) {
6614
- const idx = (y * width + x) * channels;
6615
- for (let c = 0;c < channels; c++) {
6616
- dst[idx + c] = avg[c];
6617
- }
6618
- }
6619
- }
6620
- }
6621
- }
6622
- return { data: dst, width, height, channels };
6623
- });
6624
- return { image };
6625
- }
6923
+ // src/task/image/pixelate/ImagePixelateTask.ts
6924
+ import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow25 } from "@workglow/task-graph";
6925
+ import { GpuImageSchema as GpuImageSchema9 } from "@workglow/util/media";
6626
6926
  var inputSchema49 = {
6627
6927
  type: "object",
6628
6928
  properties: {
6629
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6929
+ image: GpuImageSchema9({ title: "Image", description: "Source image" }),
6630
6930
  blockSize: {
6631
6931
  type: "integer",
6632
6932
  title: "Block Size",
6633
6933
  description: "Size of each pixelation block",
6634
6934
  minimum: 2,
6635
- default: 8
6935
+ maximum: 64,
6936
+ default: 4
6636
6937
  }
6637
6938
  },
6638
6939
  required: ["image"],
@@ -6640,14 +6941,12 @@ var inputSchema49 = {
6640
6941
  };
6641
6942
  var outputSchema48 = {
6642
6943
  type: "object",
6643
- properties: {
6644
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Pixelated image" })
6645
- },
6944
+ properties: { image: GpuImageSchema9({ title: "Image", description: "Pixelated image" }) },
6646
6945
  required: ["image"],
6647
6946
  additionalProperties: false
6648
6947
  };
6649
6948
 
6650
- class ImagePixelateTask extends Task50 {
6949
+ class ImagePixelateTask extends ImageFilterTask {
6651
6950
  static type = "ImagePixelateTask";
6652
6951
  static category = "Image";
6653
6952
  static title = "Pixelate Image";
@@ -6658,56 +6957,28 @@ class ImagePixelateTask extends Task50 {
6658
6957
  static outputSchema() {
6659
6958
  return outputSchema48;
6660
6959
  }
6661
- async execute(input, _context) {
6662
- return await pixelateImage(input);
6960
+ filterName = "pixelate";
6961
+ opParams(input) {
6962
+ return { blockSize: input.blockSize ?? 4 };
6663
6963
  }
6664
- async executePreview(input, _context) {
6665
- return await pixelateImage(input);
6964
+ scalePreviewParams({ blockSize }, s) {
6965
+ return { blockSize: Math.max(1, Math.round(blockSize * s)) };
6666
6966
  }
6667
6967
  }
6668
6968
  Workflow25.prototype.imagePixelate = CreateWorkflow24(ImagePixelateTask);
6669
- // src/task/image/ImagePosterizeTask.ts
6670
- import {
6671
- CreateWorkflow as CreateWorkflow25,
6672
- Task as Task51,
6673
- Workflow as Workflow26
6674
- } from "@workglow/task-graph";
6675
- async function posterizeImage(input) {
6676
- const levels = input.levels ?? 4;
6677
- const image = await produceImageOutput(input.image, (img) => {
6678
- const { data: src, width, height, channels } = img;
6679
- const step = 255 / (levels - 1);
6680
- const lut = new Uint8ClampedArray(256);
6681
- for (let i = 0;i < 256; i++) {
6682
- lut[i] = Math.round(Math.round(i / step) * step);
6683
- }
6684
- const dst = new Uint8ClampedArray(src.length);
6685
- if (channels === 4) {
6686
- for (let i = 0;i < src.length; i += 4) {
6687
- dst[i] = lut[src[i]];
6688
- dst[i + 1] = lut[src[i + 1]];
6689
- dst[i + 2] = lut[src[i + 2]];
6690
- dst[i + 3] = src[i + 3];
6691
- }
6692
- } else {
6693
- for (let i = 0;i < src.length; i++) {
6694
- dst[i] = lut[src[i]];
6695
- }
6696
- }
6697
- return { data: dst, width, height, channels };
6698
- });
6699
- return { image };
6700
- }
6969
+ // src/task/image/posterize/ImagePosterizeTask.ts
6970
+ import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow26 } from "@workglow/task-graph";
6971
+ import { GpuImageSchema as GpuImageSchema10 } from "@workglow/util/media";
6701
6972
  var inputSchema50 = {
6702
6973
  type: "object",
6703
6974
  properties: {
6704
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6975
+ image: GpuImageSchema10({ title: "Image", description: "Source image" }),
6705
6976
  levels: {
6706
6977
  type: "integer",
6707
6978
  title: "Levels",
6708
- description: "Number of color levels per channel (2-32)",
6979
+ description: "Number of color levels per channel (2-16)",
6709
6980
  minimum: 2,
6710
- maximum: 32,
6981
+ maximum: 16,
6711
6982
  default: 4
6712
6983
  }
6713
6984
  },
@@ -6716,14 +6987,12 @@ var inputSchema50 = {
6716
6987
  };
6717
6988
  var outputSchema49 = {
6718
6989
  type: "object",
6719
- properties: {
6720
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Posterized image" })
6721
- },
6990
+ properties: { image: GpuImageSchema10({ title: "Image", description: "Posterized image" }) },
6722
6991
  required: ["image"],
6723
6992
  additionalProperties: false
6724
6993
  };
6725
6994
 
6726
- class ImagePosterizeTask extends Task51 {
6995
+ class ImagePosterizeTask extends ImageFilterTask {
6727
6996
  static type = "ImagePosterizeTask";
6728
6997
  static category = "Image";
6729
6998
  static title = "Posterize";
@@ -6734,52 +7003,34 @@ class ImagePosterizeTask extends Task51 {
6734
7003
  static outputSchema() {
6735
7004
  return outputSchema49;
6736
7005
  }
6737
- async execute(input, _context) {
6738
- return await posterizeImage(input);
6739
- }
6740
- async executePreview(input, _context) {
6741
- return await posterizeImage(input);
7006
+ filterName = "posterize";
7007
+ opParams(input) {
7008
+ return { levels: input.levels ?? 4 };
6742
7009
  }
6743
7010
  }
6744
7011
  Workflow26.prototype.imagePosterize = CreateWorkflow25(ImagePosterizeTask);
6745
7012
  // src/task/image/imageRasterCodecRegistry.ts
6746
- import { getImageRasterCodec as getImageRasterCodec2, registerImageRasterCodec as registerImageRasterCodec2 } from "@workglow/util/media";
6747
- // src/task/image/ImageResizeTask.ts
6748
- import {
6749
- CreateWorkflow as CreateWorkflow26,
6750
- Task as Task52,
6751
- Workflow as Workflow27
6752
- } from "@workglow/task-graph";
6753
- async function resizeImage(input) {
6754
- const { width: dstW, height: dstH } = input;
6755
- const image = await produceImageOutput(input.image, (img) => {
6756
- const { data: src, width: srcW, height: srcH, channels } = img;
6757
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6758
- for (let dy = 0;dy < dstH; dy++) {
6759
- const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
6760
- for (let dx = 0;dx < dstW; dx++) {
6761
- const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
6762
- const srcIdx = (srcY * srcW + srcX) * channels;
6763
- const dstIdx = (dy * dstW + dx) * channels;
6764
- for (let c = 0;c < channels; c++) {
6765
- dst[dstIdx + c] = src[srcIdx + c];
6766
- }
6767
- }
6768
- }
6769
- return { data: dst, width: dstW, height: dstH, channels };
6770
- });
6771
- return { image };
6772
- }
7013
+ import { getImageRasterCodec, registerImageRasterCodec as registerImageRasterCodec2 } from "@workglow/util/media";
7014
+ // src/task/image/resize/ImageResizeTask.ts
7015
+ import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow27 } from "@workglow/task-graph";
7016
+ import { GpuImageSchema as GpuImageSchema11 } from "@workglow/util/media";
6773
7017
  var inputSchema51 = {
6774
7018
  type: "object",
6775
7019
  properties: {
6776
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7020
+ image: GpuImageSchema11({ title: "Image", description: "Source image" }),
6777
7021
  width: { type: "integer", title: "Width", description: "Target width in pixels", minimum: 1 },
6778
- height: {
6779
- type: "integer",
6780
- title: "Height",
6781
- description: "Target height in pixels",
6782
- minimum: 1
7022
+ height: { type: "integer", title: "Height", description: "Target height in pixels", minimum: 1 },
7023
+ fit: {
7024
+ type: "string",
7025
+ enum: ["cover", "contain", "fill", "inside", "outside"],
7026
+ title: "Fit",
7027
+ description: "How the image should be resized to fit"
7028
+ },
7029
+ kernel: {
7030
+ type: "string",
7031
+ enum: ["nearest", "cubic", "mitchell", "lanczos2", "lanczos3"],
7032
+ title: "Kernel",
7033
+ description: "Resampling kernel"
6783
7034
  }
6784
7035
  },
6785
7036
  required: ["image", "width", "height"],
@@ -6787,14 +7038,12 @@ var inputSchema51 = {
6787
7038
  };
6788
7039
  var outputSchema50 = {
6789
7040
  type: "object",
6790
- properties: {
6791
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Resized image" })
6792
- },
7041
+ properties: { image: GpuImageSchema11({ title: "Image", description: "Resized image" }) },
6793
7042
  required: ["image"],
6794
7043
  additionalProperties: false
6795
7044
  };
6796
7045
 
6797
- class ImageResizeTask extends Task52 {
7046
+ class ImageResizeTask extends ImageFilterTask {
6798
7047
  static type = "ImageResizeTask";
6799
7048
  static category = "Image";
6800
7049
  static title = "Resize Image";
@@ -6805,61 +7054,42 @@ class ImageResizeTask extends Task52 {
6805
7054
  static outputSchema() {
6806
7055
  return outputSchema50;
6807
7056
  }
6808
- async execute(input, _context) {
6809
- return await resizeImage(input);
7057
+ filterName = "resize";
7058
+ opParams(input) {
7059
+ return {
7060
+ width: input.width,
7061
+ height: input.height,
7062
+ fit: input.fit,
7063
+ kernel: input.kernel
7064
+ };
6810
7065
  }
6811
- async executePreview(input, _context) {
6812
- return await resizeImage(input);
7066
+ scalePreviewParams({ width, height, fit, kernel }, s) {
7067
+ return {
7068
+ width: Math.max(1, Math.round(width * s)),
7069
+ height: Math.max(1, Math.round(height * s)),
7070
+ fit,
7071
+ kernel
7072
+ };
6813
7073
  }
6814
7074
  }
6815
7075
  Workflow27.prototype.imageResize = CreateWorkflow26(ImageResizeTask);
6816
- // src/task/image/ImageRotateTask.ts
6817
- import {
6818
- CreateWorkflow as CreateWorkflow27,
6819
- Task as Task53,
6820
- Workflow as Workflow28
6821
- } from "@workglow/task-graph";
6822
- async function rotateImage(input) {
6823
- const { angle } = input;
6824
- const image = await produceImageOutput(input.image, (img) => {
6825
- const { data: src, width: srcW, height: srcH, channels } = img;
6826
- const swap = angle === 90 || angle === 270;
6827
- const dstW = swap ? srcH : srcW;
6828
- const dstH = swap ? srcW : srcH;
6829
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6830
- for (let sy = 0;sy < srcH; sy++) {
6831
- for (let sx = 0;sx < srcW; sx++) {
6832
- let dx, dy;
6833
- if (angle === 90) {
6834
- dx = srcH - 1 - sy;
6835
- dy = sx;
6836
- } else if (angle === 180) {
6837
- dx = srcW - 1 - sx;
6838
- dy = srcH - 1 - sy;
6839
- } else {
6840
- dx = sy;
6841
- dy = srcW - 1 - sx;
6842
- }
6843
- const srcIdx = (sy * srcW + sx) * channels;
6844
- const dstIdx = (dy * dstW + dx) * channels;
6845
- for (let c = 0;c < channels; c++) {
6846
- dst[dstIdx + c] = src[srcIdx + c];
6847
- }
6848
- }
6849
- }
6850
- return { data: dst, width: dstW, height: dstH, channels };
6851
- });
6852
- return { image };
6853
- }
7076
+ // src/task/image/rotate/ImageRotateTask.ts
7077
+ import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow28 } from "@workglow/task-graph";
7078
+ import { GpuImageSchema as GpuImageSchema12 } from "@workglow/util/media";
6854
7079
  var inputSchema52 = {
6855
7080
  type: "object",
6856
7081
  properties: {
6857
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7082
+ image: GpuImageSchema12({ title: "Image", description: "Source image" }),
6858
7083
  angle: {
6859
7084
  type: "integer",
6860
7085
  enum: [90, 180, 270],
6861
7086
  title: "Angle",
6862
7087
  description: "Rotation angle in degrees (clockwise)"
7088
+ },
7089
+ background: {
7090
+ type: "string",
7091
+ title: "Background",
7092
+ description: "Background color for rotation (hex string)"
6863
7093
  }
6864
7094
  },
6865
7095
  required: ["image", "angle"],
@@ -6867,14 +7097,12 @@ var inputSchema52 = {
6867
7097
  };
6868
7098
  var outputSchema51 = {
6869
7099
  type: "object",
6870
- properties: {
6871
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Rotated image" })
6872
- },
7100
+ properties: { image: GpuImageSchema12({ title: "Image", description: "Rotated image" }) },
6873
7101
  required: ["image"],
6874
7102
  additionalProperties: false
6875
7103
  };
6876
7104
 
6877
- class ImageRotateTask extends Task53 {
7105
+ class ImageRotateTask extends ImageFilterTask {
6878
7106
  static type = "ImageRotateTask";
6879
7107
  static category = "Image";
6880
7108
  static title = "Rotate Image";
@@ -6885,64 +7113,87 @@ class ImageRotateTask extends Task53 {
6885
7113
  static outputSchema() {
6886
7114
  return outputSchema51;
6887
7115
  }
6888
- async execute(input, _context) {
6889
- return await rotateImage(input);
6890
- }
6891
- async executePreview(input, _context) {
6892
- return await rotateImage(input);
7116
+ filterName = "rotate";
7117
+ opParams(input) {
7118
+ return {
7119
+ angle: input.angle,
7120
+ background: input.background
7121
+ };
6893
7122
  }
6894
7123
  }
6895
7124
  Workflow28.prototype.imageRotate = CreateWorkflow27(ImageRotateTask);
6896
- // src/task/image/ImageSepiaTask.ts
6897
- import {
6898
- CreateWorkflow as CreateWorkflow28,
6899
- Task as Task54,
6900
- Workflow as Workflow29
6901
- } from "@workglow/task-graph";
6902
- async function applySepia(input) {
6903
- const image = await produceImageOutput(input.image, (img) => {
6904
- const { data: src, width, height, channels } = img;
6905
- const dst = new Uint8ClampedArray(src.length);
6906
- const pixelCount = width * height;
6907
- for (let i = 0;i < pixelCount; i++) {
6908
- const idx = i * channels;
6909
- const r = channels === 1 ? src[idx] : src[idx];
6910
- const g = channels === 1 ? src[idx] : src[idx + 1];
6911
- const b = channels === 1 ? src[idx] : src[idx + 2];
6912
- const outR = r * 402 + g * 787 + b * 194 >> 10;
6913
- const outG = r * 357 + g * 702 + b * 172 >> 10;
6914
- const outB = r * 279 + g * 547 + b * 134 >> 10;
6915
- dst[idx] = outR > 255 ? 255 : outR;
6916
- if (channels >= 3) {
6917
- dst[idx + 1] = outG > 255 ? 255 : outG;
6918
- dst[idx + 2] = outB > 255 ? 255 : outB;
6919
- }
6920
- if (channels === 4) {
6921
- dst[idx + 3] = src[idx + 3];
6922
- }
7125
+ // src/task/image/ImageSchemas.ts
7126
+ import { FromSchemaDefaultOptions } from "@workglow/util/schema";
7127
+ var cssRgbChannelPattern = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)";
7128
+ var cssRgbAlphaPattern = "(?:0(?:\\.\\d+)?|1(?:\\.0+)?)";
7129
+ var cssRgbColorPattern = `^rgba?\\(\\s*${cssRgbChannelPattern}\\s*,\\s*${cssRgbChannelPattern}\\s*,\\s*` + `${cssRgbChannelPattern}\\s*(?:,\\s*${cssRgbAlphaPattern})?\\s*\\)$`;
7130
+ var ColorSchema = (annotations = {}) => ({
7131
+ type: "object",
7132
+ properties: {
7133
+ r: { type: "integer", minimum: 0, maximum: 255, title: "Red" },
7134
+ g: { type: "integer", minimum: 0, maximum: 255, title: "Green" },
7135
+ b: { type: "integer", minimum: 0, maximum: 255, title: "Blue" },
7136
+ a: { type: "integer", minimum: 0, maximum: 255, title: "Alpha", default: 255 }
7137
+ },
7138
+ required: ["r", "g", "b"],
7139
+ format: "color",
7140
+ additionalProperties: false,
7141
+ ...annotations
7142
+ });
7143
+ var HexColorSchema = (annotations = {}) => ({
7144
+ type: "string",
7145
+ format: "color",
7146
+ pattern: "^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
7147
+ title: "Color (hex)",
7148
+ description: "Color as a `#RRGGBB[AA]` or `#RGB[A]` hex string",
7149
+ ...annotations
7150
+ });
7151
+ var CssRgbColorSchema = (annotations = {}) => ({
7152
+ type: "string",
7153
+ format: "color",
7154
+ pattern: cssRgbColorPattern,
7155
+ title: "Color (RGB)",
7156
+ description: "Color as a CSS `rgb(r,g,b)` or `rgba(r,g,b,a)` string",
7157
+ ...annotations
7158
+ });
7159
+ var ColorValueSchema = (annotations = {}) => ({
7160
+ oneOf: [
7161
+ ColorSchema(),
7162
+ HexColorSchema({
7163
+ title: annotations.title ?? "Color",
7164
+ description: annotations.description ?? "Color as {r,g,b,a} object, `#RRGGBB[AA]` / `#RGB[A]` hex string, or CSS `rgb(...)` / `rgba(...)` string"
7165
+ }),
7166
+ CssRgbColorSchema()
7167
+ ],
7168
+ ...annotations
7169
+ });
7170
+ var ColorObjectType = null;
7171
+ var ColorFromSchemaOptions = {
7172
+ ...FromSchemaDefaultOptions,
7173
+ deserialize: [
7174
+ {
7175
+ pattern: { type: "object", format: "color" },
7176
+ output: ColorObjectType
6923
7177
  }
6924
- return { data: dst, width, height, channels };
6925
- });
6926
- return { image };
6927
- }
7178
+ ]
7179
+ };
7180
+ // src/task/image/sepia/ImageSepiaTask.ts
7181
+ import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow29 } from "@workglow/task-graph";
7182
+ import { GpuImageSchema as GpuImageSchema13 } from "@workglow/util/media";
6928
7183
  var inputSchema53 = {
6929
7184
  type: "object",
6930
- properties: {
6931
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" })
6932
- },
7185
+ properties: { image: GpuImageSchema13({ title: "Image", description: "Source image" }) },
6933
7186
  required: ["image"],
6934
7187
  additionalProperties: false
6935
7188
  };
6936
7189
  var outputSchema52 = {
6937
7190
  type: "object",
6938
- properties: {
6939
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Sepia-toned image" })
6940
- },
7191
+ properties: { image: GpuImageSchema13({ title: "Image", description: "Sepia-toned image" }) },
6941
7192
  required: ["image"],
6942
7193
  additionalProperties: false
6943
7194
  };
6944
7195
 
6945
- class ImageSepiaTask extends Task54 {
7196
+ class ImageSepiaTask extends ImageFilterTask {
6946
7197
  static type = "ImageSepiaTask";
6947
7198
  static category = "Image";
6948
7199
  static title = "Sepia Tone";
@@ -6953,21 +7204,24 @@ class ImageSepiaTask extends Task54 {
6953
7204
  static outputSchema() {
6954
7205
  return outputSchema52;
6955
7206
  }
6956
- async execute(input, _context) {
6957
- return await applySepia(input);
6958
- }
6959
- async executePreview(input, _context) {
6960
- return await applySepia(input);
7207
+ filterName = "sepia";
7208
+ opParams(_input) {
7209
+ return;
6961
7210
  }
6962
7211
  }
6963
7212
  Workflow29.prototype.imageSepia = CreateWorkflow28(ImageSepiaTask);
6964
- // src/task/image/ImageTextTask.ts
7213
+ // src/task/image/text/ImageTextTask.ts
6965
7214
  import {
6966
7215
  CreateWorkflow as CreateWorkflow29,
6967
- Task as Task55,
7216
+ Task as Task43,
6968
7217
  Workflow as Workflow30
6969
7218
  } from "@workglow/task-graph";
6970
- import { resolveColor as resolveColor2 } from "@workglow/util/media";
7219
+ import {
7220
+ CpuImage as CpuImage18,
7221
+ getPreviewBudget,
7222
+ GpuImageSchema as GpuImageSchema14,
7223
+ resolveColor as resolveColor5
7224
+ } from "@workglow/util/media";
6971
7225
  function toRgbaImage(image) {
6972
7226
  const { data, width, height, channels } = image;
6973
7227
  const rgba = new Uint8ClampedArray(width * height * 4);
@@ -7042,7 +7296,7 @@ var IMAGE_TEXT_POSITION_LABELS = {
7042
7296
  "bottom-center": "Bottom center",
7043
7297
  "bottom-right": "Bottom right"
7044
7298
  };
7045
- var backgroundImageProperty = ImageBinaryOrDataUriSchema({
7299
+ var backgroundImageProperty = GpuImageSchema14({
7046
7300
  title: "Image",
7047
7301
  description: "Background image to render the text onto"
7048
7302
  });
@@ -7107,65 +7361,73 @@ var inputSchema54 = {
7107
7361
  var outputSchema53 = {
7108
7362
  type: "object",
7109
7363
  properties: {
7110
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Raster image with text" })
7364
+ image: GpuImageSchema14({ title: "Image", description: "Raster image with text" })
7111
7365
  },
7112
7366
  required: ["image"],
7113
7367
  additionalProperties: false
7114
7368
  };
7115
- function hasUsableBackgroundImage(value) {
7116
- if (typeof value === "string") {
7117
- return value.length > 0;
7118
- }
7119
- if (typeof value !== "object" || value === null) {
7120
- return false;
7121
- }
7122
- const candidate = value;
7123
- return typeof candidate.width === "number" && typeof candidate.height === "number" && typeof candidate.channels === "number" && candidate.data !== undefined;
7369
+ function resolveTextParams(input) {
7370
+ return {
7371
+ text: input.text,
7372
+ font: input.font ?? "sans-serif",
7373
+ fontSize: input.fontSize ?? 24,
7374
+ bold: input.bold ?? false,
7375
+ italic: input.italic ?? false,
7376
+ color: resolveColor5(input.color),
7377
+ position: input.position ?? "middle-center"
7378
+ };
7379
+ }
7380
+ function requireStandaloneDims(input) {
7381
+ if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
7382
+ throw new Error("ImageTextTask: width and height are required when no background image is provided");
7383
+ }
7384
+ return { width: input.width, height: input.height };
7385
+ }
7386
+ async function renderTextOverBackground(params, backgroundImage, previewScale) {
7387
+ const background = await backgroundImage.materialize();
7388
+ const overlay = await renderImageTextToRgba({
7389
+ text: params.text,
7390
+ font: params.font,
7391
+ fontSize: Math.max(1, Math.round(params.fontSize * previewScale)),
7392
+ bold: params.bold,
7393
+ italic: params.italic,
7394
+ color: params.color,
7395
+ width: background.width,
7396
+ height: background.height,
7397
+ position: params.position
7398
+ });
7399
+ const composited = compositeTextOverBackground(background, overlay);
7400
+ return {
7401
+ image: CpuImage18.fromImageBinary(composited, previewScale)
7402
+ };
7124
7403
  }
7125
- async function renderImageText(input) {
7126
- const color = resolveColor2(input.color);
7127
- const fontSize = input.fontSize ?? 24;
7128
- const font = input.font ?? "sans-serif";
7129
- const bold = input.bold ?? false;
7130
- const italic = input.italic ?? false;
7131
- const position = input.position ?? "middle-center";
7404
+ async function renderTextStandalone(params, width, height, previewScale) {
7405
+ const textBinary = await renderImageTextToRgba({
7406
+ text: params.text,
7407
+ font: params.font,
7408
+ fontSize: Math.max(1, Math.round(params.fontSize * previewScale)),
7409
+ bold: params.bold,
7410
+ italic: params.italic,
7411
+ color: params.color,
7412
+ width: Math.max(1, Math.round(width * previewScale)),
7413
+ height: Math.max(1, Math.round(height * previewScale)),
7414
+ position: params.position
7415
+ });
7416
+ return {
7417
+ image: CpuImage18.fromImageBinary(textBinary, previewScale)
7418
+ };
7419
+ }
7420
+ async function runText(input) {
7421
+ const params = resolveTextParams(input);
7132
7422
  const backgroundImage = "image" in input ? input.image : undefined;
7133
- let image;
7134
- if (hasUsableBackgroundImage(backgroundImage)) {
7135
- image = await produceImageOutput(backgroundImage, async (background) => {
7136
- const overlay = await renderImageTextToRgba({
7137
- text: input.text,
7138
- font,
7139
- fontSize,
7140
- bold,
7141
- italic,
7142
- color,
7143
- width: background.width,
7144
- height: background.height,
7145
- position
7146
- });
7147
- return compositeTextOverBackground(background, overlay);
7148
- });
7149
- } else {
7150
- if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
7151
- throw new Error("ImageTextTask: width and height are required when no background image is provided");
7152
- }
7153
- image = await renderImageTextToRgba({
7154
- text: input.text,
7155
- font,
7156
- fontSize,
7157
- bold,
7158
- italic,
7159
- color,
7160
- width: input.width,
7161
- height: input.height,
7162
- position
7163
- });
7423
+ if (backgroundImage != null) {
7424
+ return renderTextOverBackground(params, backgroundImage, 1);
7164
7425
  }
7165
- return { image };
7426
+ const { width, height } = requireStandaloneDims(input);
7427
+ return renderTextStandalone(params, width, height, 1);
7166
7428
  }
7167
7429
 
7168
- class ImageTextTask extends Task55 {
7430
+ class ImageTextTask extends Task43 {
7169
7431
  static type = "ImageTextTask";
7170
7432
  static category = "Image";
7171
7433
  static title = "Render Text to Image";
@@ -7184,46 +7446,32 @@ class ImageTextTask extends Task55 {
7184
7446
  return defaults;
7185
7447
  }
7186
7448
  async execute(input, _context) {
7187
- return await renderImageText(input);
7449
+ return await runText(input);
7188
7450
  }
7189
7451
  async executePreview(input, _context) {
7190
- return await renderImageText(input);
7452
+ const params = resolveTextParams(input);
7453
+ const backgroundImage = "image" in input ? input.image : undefined;
7454
+ if (backgroundImage != null) {
7455
+ return await renderTextOverBackground(params, backgroundImage, backgroundImage.previewScale);
7456
+ }
7457
+ const { width, height } = requireStandaloneDims(input);
7458
+ const longEdge = Math.max(width, height);
7459
+ const budget = getPreviewBudget();
7460
+ const s = longEdge > budget ? budget / longEdge : 1;
7461
+ return await renderTextStandalone(params, width, height, s);
7191
7462
  }
7192
7463
  }
7193
7464
  Workflow30.prototype.imageText = CreateWorkflow29(ImageTextTask);
7194
- // src/task/image/ImageThresholdTask.ts
7195
- import {
7196
- CreateWorkflow as CreateWorkflow30,
7197
- Task as Task56,
7198
- Workflow as Workflow31
7199
- } from "@workglow/task-graph";
7200
- async function applyThreshold(input) {
7201
- const threshold = input.threshold ?? 128;
7202
- const image = await produceImageOutput(input.image, (img) => {
7203
- const { data: src, width, height, channels } = img;
7204
- const pixelCount = width * height;
7205
- const dst = new Uint8ClampedArray(pixelCount);
7206
- for (let i = 0;i < pixelCount; i++) {
7207
- const idx = i * channels;
7208
- let gray;
7209
- if (channels === 1) {
7210
- gray = src[idx];
7211
- } else {
7212
- gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
7213
- }
7214
- dst[i] = gray >= threshold ? 255 : 0;
7215
- }
7216
- return { data: dst, width, height, channels: 1 };
7217
- });
7218
- return { image };
7219
- }
7465
+ // src/task/image/threshold/ImageThresholdTask.ts
7466
+ import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow31 } from "@workglow/task-graph";
7467
+ import { GpuImageSchema as GpuImageSchema15 } from "@workglow/util/media";
7220
7468
  var inputSchema55 = {
7221
7469
  type: "object",
7222
7470
  properties: {
7223
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7224
- threshold: {
7225
- type: "integer",
7226
- title: "Threshold",
7471
+ image: GpuImageSchema15({ title: "Image", description: "Source image" }),
7472
+ value: {
7473
+ type: "number",
7474
+ title: "Value",
7227
7475
  description: "Threshold value (0-255)",
7228
7476
  minimum: 0,
7229
7477
  maximum: 255,
@@ -7235,77 +7483,35 @@ var inputSchema55 = {
7235
7483
  };
7236
7484
  var outputSchema54 = {
7237
7485
  type: "object",
7238
- properties: {
7239
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Thresholded binary image" })
7240
- },
7486
+ properties: { image: GpuImageSchema15({ title: "Image", description: "Thresholded image" }) },
7241
7487
  required: ["image"],
7242
7488
  additionalProperties: false
7243
7489
  };
7244
7490
 
7245
- class ImageThresholdTask extends Task56 {
7491
+ class ImageThresholdTask extends ImageFilterTask {
7246
7492
  static type = "ImageThresholdTask";
7247
7493
  static category = "Image";
7248
7494
  static title = "Threshold";
7249
- static description = "Converts an image to binary black and white";
7495
+ static description = "Applies a binary threshold per channel";
7250
7496
  static inputSchema() {
7251
7497
  return inputSchema55;
7252
7498
  }
7253
7499
  static outputSchema() {
7254
7500
  return outputSchema54;
7255
7501
  }
7256
- async execute(input, _context) {
7257
- return await applyThreshold(input);
7258
- }
7259
- async executePreview(input, _context) {
7260
- return await applyThreshold(input);
7502
+ filterName = "threshold";
7503
+ opParams(input) {
7504
+ return { value: input.value ?? 128 };
7261
7505
  }
7262
7506
  }
7263
7507
  Workflow31.prototype.imageThreshold = CreateWorkflow30(ImageThresholdTask);
7264
- // src/task/image/ImageTintTask.ts
7265
- import {
7266
- CreateWorkflow as CreateWorkflow31,
7267
- Task as Task57,
7268
- Workflow as Workflow32
7269
- } from "@workglow/task-graph";
7270
- import { resolveColor as resolveColor3 } from "@workglow/util/media";
7271
- async function applyTint(input) {
7272
- const { r: tr, g: tg, b: tb } = resolveColor3(input.color);
7273
- const amount = input.amount ?? 0.5;
7274
- const invAmount = 1 - amount;
7275
- const tintR = tr * amount;
7276
- const tintG = tg * amount;
7277
- const tintB = tb * amount;
7278
- const image = await produceImageOutput(input.image, (img) => {
7279
- const { data: src, width, height, channels } = img;
7280
- const pixelCount = width * height;
7281
- if (channels === 1) {
7282
- const dst2 = new Uint8ClampedArray(pixelCount * 3);
7283
- for (let i = 0;i < pixelCount; i++) {
7284
- const gray = src[i];
7285
- dst2[i * 3] = gray * invAmount + tintR;
7286
- dst2[i * 3 + 1] = gray * invAmount + tintG;
7287
- dst2[i * 3 + 2] = gray * invAmount + tintB;
7288
- }
7289
- return { data: dst2, width, height, channels: 3 };
7290
- }
7291
- const dst = new Uint8ClampedArray(src.length);
7292
- for (let i = 0;i < pixelCount; i++) {
7293
- const idx = i * channels;
7294
- dst[idx] = src[idx] * invAmount + tintR;
7295
- dst[idx + 1] = src[idx + 1] * invAmount + tintG;
7296
- dst[idx + 2] = src[idx + 2] * invAmount + tintB;
7297
- if (channels === 4) {
7298
- dst[idx + 3] = src[idx + 3];
7299
- }
7300
- }
7301
- return { data: dst, width, height, channels };
7302
- });
7303
- return { image };
7304
- }
7508
+ // src/task/image/tint/ImageTintTask.ts
7509
+ import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow32 } from "@workglow/task-graph";
7510
+ import { GpuImageSchema as GpuImageSchema16 } from "@workglow/util/media";
7305
7511
  var inputSchema56 = {
7306
7512
  type: "object",
7307
7513
  properties: {
7308
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7514
+ image: GpuImageSchema16({ title: "Image", description: "Source image" }),
7309
7515
  color: ColorValueSchema({ title: "Color", description: "Tint color" }),
7310
7516
  amount: {
7311
7517
  type: "number",
@@ -7321,14 +7527,12 @@ var inputSchema56 = {
7321
7527
  };
7322
7528
  var outputSchema55 = {
7323
7529
  type: "object",
7324
- properties: {
7325
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Tinted image" })
7326
- },
7530
+ properties: { image: GpuImageSchema16({ title: "Image", description: "Tinted image" }) },
7327
7531
  required: ["image"],
7328
7532
  additionalProperties: false
7329
7533
  };
7330
7534
 
7331
- class ImageTintTask extends Task57 {
7535
+ class ImageTintTask extends ImageFilterTask {
7332
7536
  static type = "ImageTintTask";
7333
7537
  static category = "Image";
7334
7538
  static title = "Tint Image";
@@ -7339,68 +7543,42 @@ class ImageTintTask extends Task57 {
7339
7543
  static outputSchema() {
7340
7544
  return outputSchema55;
7341
7545
  }
7342
- async execute(input, _context) {
7343
- return await applyTint(input);
7344
- }
7345
- async executePreview(input, _context) {
7346
- return await applyTint(input);
7546
+ filterName = "tint";
7547
+ opParams(input) {
7548
+ return {
7549
+ color: input.color,
7550
+ amount: input.amount ?? 0.5
7551
+ };
7347
7552
  }
7348
7553
  }
7349
7554
  Workflow32.prototype.imageTint = CreateWorkflow31(ImageTintTask);
7350
- // src/task/image/ImageTransparencyTask.ts
7351
- import {
7352
- CreateWorkflow as CreateWorkflow32,
7353
- Task as Task58,
7354
- Workflow as Workflow33
7355
- } from "@workglow/task-graph";
7356
- async function applyTransparency(input) {
7357
- const { opacity } = input;
7358
- const image = await produceImageOutput(input.image, (img) => {
7359
- const { data: src, width, height, channels: srcCh } = img;
7360
- const pixelCount = width * height;
7361
- const dst = new Uint8ClampedArray(pixelCount * 4);
7362
- const alphaScale = Math.round(opacity * 255);
7363
- for (let i = 0;i < pixelCount; i++) {
7364
- const srcIdx = i * srcCh;
7365
- const dstIdx = i * 4;
7366
- dst[dstIdx] = src[srcIdx];
7367
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
7368
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
7369
- const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
7370
- dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
7371
- }
7372
- return { data: dst, width, height, channels: 4 };
7373
- });
7374
- return { image };
7375
- }
7555
+ // src/task/image/transparency/ImageTransparencyTask.ts
7556
+ import { CreateWorkflow as CreateWorkflow32, Workflow as Workflow33 } from "@workglow/task-graph";
7557
+ import { GpuImageSchema as GpuImageSchema17 } from "@workglow/util/media";
7376
7558
  var inputSchema57 = {
7377
7559
  type: "object",
7378
7560
  properties: {
7379
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7380
- opacity: {
7561
+ image: GpuImageSchema17({ title: "Image", description: "Source image" }),
7562
+ amount: {
7381
7563
  type: "number",
7382
- title: "Opacity",
7564
+ title: "Amount",
7383
7565
  description: "Opacity level (0.0 = fully transparent, 1.0 = fully opaque)",
7384
7566
  minimum: 0,
7385
- maximum: 1
7567
+ maximum: 1,
7568
+ default: 1
7386
7569
  }
7387
7570
  },
7388
- required: ["image", "opacity"],
7571
+ required: ["image"],
7389
7572
  additionalProperties: false
7390
7573
  };
7391
7574
  var outputSchema56 = {
7392
7575
  type: "object",
7393
- properties: {
7394
- image: ImageBinaryOrDataUriSchema({
7395
- title: "Image",
7396
- description: "Image with adjusted transparency"
7397
- })
7398
- },
7576
+ properties: { image: GpuImageSchema17({ title: "Image", description: "Image with adjusted transparency" }) },
7399
7577
  required: ["image"],
7400
7578
  additionalProperties: false
7401
7579
  };
7402
7580
 
7403
- class ImageTransparencyTask extends Task58 {
7581
+ class ImageTransparencyTask extends ImageFilterTask {
7404
7582
  static type = "ImageTransparencyTask";
7405
7583
  static category = "Image";
7406
7584
  static title = "Set Transparency";
@@ -7411,133 +7589,19 @@ class ImageTransparencyTask extends Task58 {
7411
7589
  static outputSchema() {
7412
7590
  return outputSchema56;
7413
7591
  }
7414
- async execute(input, _context) {
7415
- return await applyTransparency(input);
7416
- }
7417
- async executePreview(input, _context) {
7418
- return await applyTransparency(input);
7592
+ filterName = "transparency";
7593
+ opParams(input) {
7594
+ return { amount: input.amount ?? 1 };
7419
7595
  }
7420
7596
  }
7421
7597
  Workflow33.prototype.imageTransparency = CreateWorkflow32(ImageTransparencyTask);
7422
- // src/task/image/ImageWatermarkTask.ts
7423
- import {
7424
- CreateWorkflow as CreateWorkflow33,
7425
- Task as Task59,
7426
- Workflow as Workflow34
7427
- } from "@workglow/task-graph";
7428
- async function applyWatermark(input) {
7429
- const { spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input;
7430
- const image = await produceImageOutput(input.image, (img) => {
7431
- const { data: src, width, height, channels: srcCh } = img;
7432
- const outCh = 4;
7433
- const dst = new Uint8ClampedArray(width * height * outCh);
7434
- const lineWidth = 2;
7435
- const dotRadius = Math.max(2, spacing >> 3);
7436
- const dotRadiusSq = dotRadius * dotRadius;
7437
- const half = spacing >> 1;
7438
- const alpha = Math.round(opacity * 255);
7439
- for (let y = 0;y < height; y++) {
7440
- for (let x = 0;x < width; x++) {
7441
- const srcIdx = (y * width + x) * srcCh;
7442
- const dstIdx = (y * width + x) * outCh;
7443
- const sr = src[srcIdx];
7444
- const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
7445
- const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
7446
- const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
7447
- let isPattern = false;
7448
- if (pattern === "diagonal-lines") {
7449
- isPattern = (x + y) % spacing < lineWidth;
7450
- } else if (pattern === "grid") {
7451
- isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
7452
- } else {
7453
- const dx = x % spacing - half;
7454
- const dy = y % spacing - half;
7455
- isPattern = dx * dx + dy * dy < dotRadiusSq;
7456
- }
7457
- if (isPattern) {
7458
- const blend = alpha;
7459
- const invBlend = 255 - blend;
7460
- dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
7461
- dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
7462
- dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
7463
- dst[dstIdx + 3] = sa;
7464
- } else {
7465
- dst[dstIdx] = sr;
7466
- dst[dstIdx + 1] = sg;
7467
- dst[dstIdx + 2] = sb;
7468
- dst[dstIdx + 3] = sa;
7469
- }
7470
- }
7471
- }
7472
- return { data: dst, width, height, channels: outCh };
7473
- });
7474
- return { image };
7475
- }
7476
- var inputSchema58 = {
7477
- type: "object",
7478
- properties: {
7479
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7480
- spacing: {
7481
- type: "integer",
7482
- title: "Spacing",
7483
- description: "Pattern spacing in pixels",
7484
- minimum: 8,
7485
- default: 64
7486
- },
7487
- opacity: {
7488
- type: "number",
7489
- title: "Opacity",
7490
- description: "Watermark opacity (0.0-1.0)",
7491
- minimum: 0,
7492
- maximum: 1,
7493
- default: 0.3
7494
- },
7495
- pattern: {
7496
- type: "string",
7497
- enum: ["diagonal-lines", "grid", "dots"],
7498
- title: "Pattern",
7499
- description: "Watermark pattern type",
7500
- default: "diagonal-lines"
7501
- }
7502
- },
7503
- required: ["image"],
7504
- additionalProperties: false
7505
- };
7506
- var outputSchema57 = {
7507
- type: "object",
7508
- properties: {
7509
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Watermarked image" })
7510
- },
7511
- required: ["image"],
7512
- additionalProperties: false
7513
- };
7514
-
7515
- class ImageWatermarkTask extends Task59 {
7516
- static type = "ImageWatermarkTask";
7517
- static category = "Image";
7518
- static title = "Add Watermark";
7519
- static description = "Adds a repeating pattern watermark to an image";
7520
- static inputSchema() {
7521
- return inputSchema58;
7522
- }
7523
- static outputSchema() {
7524
- return outputSchema57;
7525
- }
7526
- async execute(input, _context) {
7527
- return await applyWatermark(input);
7528
- }
7529
- async executePreview(input, _context) {
7530
- return await applyWatermark(input);
7531
- }
7532
- }
7533
- Workflow34.prototype.imageWatermark = CreateWorkflow33(ImageWatermarkTask);
7534
7598
  // src/task/InputTask.ts
7535
- import { CreateWorkflow as CreateWorkflow34, Task as Task60, Workflow as Workflow35 } from "@workglow/task-graph";
7599
+ import { CreateWorkflow as CreateWorkflow33, Task as Task44, Workflow as Workflow34 } from "@workglow/task-graph";
7536
7600
  function passthroughInput(input) {
7537
7601
  return input;
7538
7602
  }
7539
7603
 
7540
- class InputTask extends Task60 {
7604
+ class InputTask extends Task44 {
7541
7605
  static type = "InputTask";
7542
7606
  static category = "Flow Control";
7543
7607
  static title = "Input";
@@ -7592,15 +7656,15 @@ class InputTask extends Task60 {
7592
7656
  yield { type: "finish", data: input };
7593
7657
  }
7594
7658
  }
7595
- Workflow35.prototype.input = CreateWorkflow34(InputTask);
7659
+ Workflow34.prototype.input = CreateWorkflow33(InputTask);
7596
7660
  // src/task/JavaScriptTask.ts
7597
7661
  import {
7598
- CreateWorkflow as CreateWorkflow35,
7662
+ CreateWorkflow as CreateWorkflow34,
7599
7663
  Entitlements as Entitlements7,
7600
- Task as Task61,
7664
+ Task as Task45,
7601
7665
  TaskConfigSchema as TaskConfigSchema32,
7602
7666
  TaskInvalidInputError as TaskInvalidInputError3,
7603
- Workflow as Workflow36
7667
+ Workflow as Workflow35
7604
7668
  } from "@workglow/task-graph";
7605
7669
 
7606
7670
  // src/util/acorn.js
@@ -12096,7 +12160,7 @@ var configSchema = {
12096
12160
  },
12097
12161
  additionalProperties: false
12098
12162
  };
12099
- var inputSchema59 = {
12163
+ var inputSchema58 = {
12100
12164
  type: "object",
12101
12165
  properties: {
12102
12166
  javascript_code: {
@@ -12110,7 +12174,7 @@ var inputSchema59 = {
12110
12174
  required: ["javascript_code"],
12111
12175
  additionalProperties: true
12112
12176
  };
12113
- var outputSchema58 = {
12177
+ var outputSchema57 = {
12114
12178
  type: "object",
12115
12179
  properties: {
12116
12180
  output: {
@@ -12122,7 +12186,7 @@ var outputSchema58 = {
12122
12186
  additionalProperties: false
12123
12187
  };
12124
12188
 
12125
- class JavaScriptTask extends Task61 {
12189
+ class JavaScriptTask extends Task45 {
12126
12190
  static type = "JavaScriptTask";
12127
12191
  static category = "Utility";
12128
12192
  static title = "JavaScript Interpreter";
@@ -12143,10 +12207,10 @@ class JavaScriptTask extends Task61 {
12143
12207
  return configSchema;
12144
12208
  }
12145
12209
  static inputSchema() {
12146
- return inputSchema59;
12210
+ return inputSchema58;
12147
12211
  }
12148
12212
  static outputSchema() {
12149
- return outputSchema58;
12213
+ return outputSchema57;
12150
12214
  }
12151
12215
  inputSchema() {
12152
12216
  if (this.config?.javascript_code) {
@@ -12159,7 +12223,7 @@ class JavaScriptTask extends Task61 {
12159
12223
  additionalProperties: true
12160
12224
  };
12161
12225
  }
12162
- return inputSchema59;
12226
+ return inputSchema58;
12163
12227
  }
12164
12228
  async execute(input2) {
12165
12229
  return runJavaScript(input2, this.config.javascript_code);
@@ -12171,14 +12235,14 @@ class JavaScriptTask extends Task61 {
12171
12235
  var javaScript = (input2, config = {}) => {
12172
12236
  return new JavaScriptTask(config).run(input2);
12173
12237
  };
12174
- Workflow36.prototype.javaScript = CreateWorkflow35(JavaScriptTask);
12238
+ Workflow35.prototype.javaScript = CreateWorkflow34(JavaScriptTask);
12175
12239
  // src/task/JsonPathTask.ts
12176
12240
  import {
12177
- CreateWorkflow as CreateWorkflow36,
12178
- Task as Task62,
12179
- Workflow as Workflow37
12241
+ CreateWorkflow as CreateWorkflow35,
12242
+ Task as Task46,
12243
+ Workflow as Workflow36
12180
12244
  } from "@workglow/task-graph";
12181
- var inputSchema60 = {
12245
+ var inputSchema59 = {
12182
12246
  type: "object",
12183
12247
  properties: {
12184
12248
  value: {
@@ -12194,7 +12258,7 @@ var inputSchema60 = {
12194
12258
  required: ["value", "path"],
12195
12259
  additionalProperties: false
12196
12260
  };
12197
- var outputSchema59 = {
12261
+ var outputSchema58 = {
12198
12262
  type: "object",
12199
12263
  properties: {
12200
12264
  result: {
@@ -12231,16 +12295,16 @@ function extractJsonPath(value, path) {
12231
12295
  return resolvePath(value, segments);
12232
12296
  }
12233
12297
 
12234
- class JsonPathTask extends Task62 {
12298
+ class JsonPathTask extends Task46 {
12235
12299
  static type = "JsonPathTask";
12236
12300
  static category = "Utility";
12237
12301
  static title = "JSON Path";
12238
12302
  static description = "Extracts a value from an object using a dot-notation path";
12239
12303
  static inputSchema() {
12240
- return inputSchema60;
12304
+ return inputSchema59;
12241
12305
  }
12242
12306
  static outputSchema() {
12243
- return outputSchema59;
12307
+ return outputSchema58;
12244
12308
  }
12245
12309
  async execute(input2, _context) {
12246
12310
  return { result: extractJsonPath(input2.value, input2.path) };
@@ -12249,18 +12313,18 @@ class JsonPathTask extends Task62 {
12249
12313
  return { result: extractJsonPath(input2.value, input2.path) };
12250
12314
  }
12251
12315
  }
12252
- Workflow37.prototype.jsonPath = CreateWorkflow36(JsonPathTask);
12316
+ Workflow36.prototype.jsonPath = CreateWorkflow35(JsonPathTask);
12253
12317
  // src/task/JsonTask.ts
12254
12318
  import {
12255
12319
  createGraphFromDependencyJSON,
12256
12320
  createGraphFromGraphJSON,
12257
- CreateWorkflow as CreateWorkflow37,
12321
+ CreateWorkflow as CreateWorkflow36,
12258
12322
  Dataflow,
12259
12323
  GraphAsTask as GraphAsTask2,
12260
12324
  TaskConfigurationError as TaskConfigurationError3,
12261
- Workflow as Workflow38
12325
+ Workflow as Workflow37
12262
12326
  } from "@workglow/task-graph";
12263
- var inputSchema61 = {
12327
+ var inputSchema60 = {
12264
12328
  type: "object",
12265
12329
  properties: {
12266
12330
  json: {
@@ -12271,7 +12335,7 @@ var inputSchema61 = {
12271
12335
  },
12272
12336
  additionalProperties: false
12273
12337
  };
12274
- var outputSchema60 = {
12338
+ var outputSchema59 = {
12275
12339
  type: "object",
12276
12340
  properties: {
12277
12341
  output: {
@@ -12288,10 +12352,10 @@ class JsonTask extends GraphAsTask2 {
12288
12352
  static title = "JSON Task";
12289
12353
  static description = "A task that creates and manages task graphs from JSON configurations";
12290
12354
  static inputSchema() {
12291
- return inputSchema61;
12355
+ return inputSchema60;
12292
12356
  }
12293
12357
  static outputSchema() {
12294
- return outputSchema60;
12358
+ return outputSchema59;
12295
12359
  }
12296
12360
  regenerateGraph() {
12297
12361
  if (!this.runInputData.json)
@@ -12325,15 +12389,15 @@ class JsonTask extends GraphAsTask2 {
12325
12389
  var json = (input2, config = {}) => {
12326
12390
  return new JsonTask(config).run(input2);
12327
12391
  };
12328
- Workflow38.prototype.json = CreateWorkflow37(JsonTask);
12392
+ Workflow37.prototype.json = CreateWorkflow36(JsonTask);
12329
12393
  // src/task/LambdaTask.ts
12330
12394
  import {
12331
- CreateWorkflow as CreateWorkflow38,
12395
+ CreateWorkflow as CreateWorkflow37,
12332
12396
  DATAFLOW_ALL_PORTS,
12333
- Task as Task63,
12397
+ Task as Task47,
12334
12398
  TaskConfigSchema as TaskConfigSchema33,
12335
12399
  TaskConfigurationError as TaskConfigurationError4,
12336
- Workflow as Workflow39
12400
+ Workflow as Workflow38
12337
12401
  } from "@workglow/task-graph";
12338
12402
  var lambdaTaskConfigSchema = {
12339
12403
  type: "object",
@@ -12344,7 +12408,7 @@ var lambdaTaskConfigSchema = {
12344
12408
  },
12345
12409
  additionalProperties: false
12346
12410
  };
12347
- var inputSchema62 = {
12411
+ var inputSchema61 = {
12348
12412
  type: "object",
12349
12413
  properties: {
12350
12414
  [DATAFLOW_ALL_PORTS]: {
@@ -12354,7 +12418,7 @@ var inputSchema62 = {
12354
12418
  },
12355
12419
  additionalProperties: true
12356
12420
  };
12357
- var outputSchema61 = {
12421
+ var outputSchema60 = {
12358
12422
  type: "object",
12359
12423
  properties: {
12360
12424
  [DATAFLOW_ALL_PORTS]: {
@@ -12365,7 +12429,7 @@ var outputSchema61 = {
12365
12429
  additionalProperties: true
12366
12430
  };
12367
12431
 
12368
- class LambdaTask extends Task63 {
12432
+ class LambdaTask extends Task47 {
12369
12433
  static type = "LambdaTask";
12370
12434
  static title = "Lambda Task";
12371
12435
  static description = "A task that wraps a provided function and its input";
@@ -12375,10 +12439,10 @@ class LambdaTask extends Task63 {
12375
12439
  return lambdaTaskConfigSchema;
12376
12440
  }
12377
12441
  static inputSchema() {
12378
- return inputSchema62;
12442
+ return inputSchema61;
12379
12443
  }
12380
12444
  static outputSchema() {
12381
- return outputSchema61;
12445
+ return outputSchema60;
12382
12446
  }
12383
12447
  canSerializeConfig() {
12384
12448
  return false;
@@ -12412,14 +12476,14 @@ function lambda(input2, config) {
12412
12476
  const task = new LambdaTask({ ...config, defaults: input2 });
12413
12477
  return task.run();
12414
12478
  }
12415
- Workflow39.prototype.lambda = CreateWorkflow38(LambdaTask);
12479
+ Workflow38.prototype.lambda = CreateWorkflow37(LambdaTask);
12416
12480
  // src/task/mcp/McpListTask.ts
12417
12481
  import {
12418
- CreateWorkflow as CreateWorkflow39,
12482
+ CreateWorkflow as CreateWorkflow38,
12419
12483
  Entitlements as Entitlements8,
12420
12484
  mergeEntitlements as mergeEntitlements4,
12421
- Task as Task64,
12422
- Workflow as Workflow40
12485
+ Task as Task48,
12486
+ Workflow as Workflow39
12423
12487
  } from "@workglow/task-graph";
12424
12488
 
12425
12489
  // src/util/getMcpServerTransport.ts
@@ -12593,7 +12657,7 @@ var outputSchemaAll = {
12593
12657
  additionalProperties: false
12594
12658
  };
12595
12659
 
12596
- class McpListTask extends Task64 {
12660
+ class McpListTask extends Task48 {
12597
12661
  static type = "McpListTask";
12598
12662
  static category = "MCP";
12599
12663
  static title = "MCP List";
@@ -12700,15 +12764,15 @@ class McpListTask extends Task64 {
12700
12764
  var mcpList = async (input2, config = {}) => {
12701
12765
  return new McpListTask(config).run(input2);
12702
12766
  };
12703
- Workflow40.prototype.mcpList = CreateWorkflow39(McpListTask);
12767
+ Workflow39.prototype.mcpList = CreateWorkflow38(McpListTask);
12704
12768
  // src/task/mcp/McpPromptGetTask.ts
12705
12769
  import {
12706
- CreateWorkflow as CreateWorkflow40,
12770
+ CreateWorkflow as CreateWorkflow39,
12707
12771
  Entitlements as Entitlements9,
12708
12772
  mergeEntitlements as mergeEntitlements5,
12709
- Task as Task65,
12773
+ Task as Task49,
12710
12774
  TaskConfigSchema as TaskConfigSchema34,
12711
- Workflow as Workflow41
12775
+ Workflow as Workflow40
12712
12776
  } from "@workglow/task-graph";
12713
12777
  var annotationsSchema = {
12714
12778
  type: "object",
@@ -12843,7 +12907,7 @@ var fallbackInputSchema = {
12843
12907
  additionalProperties: false
12844
12908
  };
12845
12909
 
12846
- class McpPromptGetTask extends Task65 {
12910
+ class McpPromptGetTask extends Task49 {
12847
12911
  static type = "McpPromptGetTask";
12848
12912
  static category = "MCP";
12849
12913
  static title = "MCP Get Prompt";
@@ -12966,15 +13030,15 @@ class McpPromptGetTask extends Task65 {
12966
13030
  var mcpPromptGet = async (input2, config) => {
12967
13031
  return new McpPromptGetTask(config).run(input2);
12968
13032
  };
12969
- Workflow41.prototype.mcpPromptGet = CreateWorkflow40(McpPromptGetTask);
13033
+ Workflow40.prototype.mcpPromptGet = CreateWorkflow39(McpPromptGetTask);
12970
13034
  // src/task/mcp/McpResourceReadTask.ts
12971
13035
  import {
12972
- CreateWorkflow as CreateWorkflow41,
13036
+ CreateWorkflow as CreateWorkflow40,
12973
13037
  Entitlements as Entitlements10,
12974
13038
  mergeEntitlements as mergeEntitlements6,
12975
- Task as Task66,
13039
+ Task as Task50,
12976
13040
  TaskConfigSchema as TaskConfigSchema35,
12977
- Workflow as Workflow42
13041
+ Workflow as Workflow41
12978
13042
  } from "@workglow/task-graph";
12979
13043
  var contentItemSchema = {
12980
13044
  anyOf: [
@@ -13002,12 +13066,12 @@ var contentItemSchema = {
13002
13066
  }
13003
13067
  ]
13004
13068
  };
13005
- var inputSchema63 = {
13069
+ var inputSchema62 = {
13006
13070
  type: "object",
13007
13071
  properties: {},
13008
13072
  additionalProperties: false
13009
13073
  };
13010
- var outputSchema62 = {
13074
+ var outputSchema61 = {
13011
13075
  type: "object",
13012
13076
  properties: {
13013
13077
  contents: {
@@ -13021,7 +13085,7 @@ var outputSchema62 = {
13021
13085
  additionalProperties: false
13022
13086
  };
13023
13087
 
13024
- class McpResourceReadTask extends Task66 {
13088
+ class McpResourceReadTask extends Task50 {
13025
13089
  static type = "McpResourceReadTask";
13026
13090
  static category = "MCP";
13027
13091
  static title = "MCP Read Resource";
@@ -13054,10 +13118,10 @@ class McpResourceReadTask extends Task66 {
13054
13118
  });
13055
13119
  }
13056
13120
  static inputSchema() {
13057
- return inputSchema63;
13121
+ return inputSchema62;
13058
13122
  }
13059
13123
  static outputSchema() {
13060
- return outputSchema62;
13124
+ return outputSchema61;
13061
13125
  }
13062
13126
  static configSchema() {
13063
13127
  const { mcpServerConfigSchema: mcpServerConfigSchema2 } = getMcpTaskDeps();
@@ -13094,13 +13158,13 @@ class McpResourceReadTask extends Task66 {
13094
13158
  var mcpResourceRead = async (config) => {
13095
13159
  return new McpResourceReadTask(config).run({});
13096
13160
  };
13097
- Workflow42.prototype.mcpResourceRead = CreateWorkflow41(McpResourceReadTask);
13161
+ Workflow41.prototype.mcpResourceRead = CreateWorkflow40(McpResourceReadTask);
13098
13162
  // src/task/mcp/McpSearchTask.ts
13099
13163
  import {
13100
- CreateWorkflow as CreateWorkflow42,
13164
+ CreateWorkflow as CreateWorkflow41,
13101
13165
  Entitlements as Entitlements11,
13102
- Task as Task67,
13103
- Workflow as Workflow43
13166
+ Task as Task51,
13167
+ Workflow as Workflow42
13104
13168
  } from "@workglow/task-graph";
13105
13169
  var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
13106
13170
  var McpSearchInputSchema = {
@@ -13240,7 +13304,7 @@ async function searchMcpRegistry(query, signal) {
13240
13304
  return page.results;
13241
13305
  }
13242
13306
 
13243
- class McpSearchTask extends Task67 {
13307
+ class McpSearchTask extends Task51 {
13244
13308
  static type = "McpSearchTask";
13245
13309
  static category = "MCP";
13246
13310
  static title = "MCP Search";
@@ -13267,15 +13331,15 @@ class McpSearchTask extends Task67 {
13267
13331
  var mcpSearch = (input2, config) => {
13268
13332
  return new McpSearchTask(config).run(input2);
13269
13333
  };
13270
- Workflow43.prototype.mcpSearch = CreateWorkflow42(McpSearchTask);
13334
+ Workflow42.prototype.mcpSearch = CreateWorkflow41(McpSearchTask);
13271
13335
  // src/task/mcp/McpToolCallTask.ts
13272
13336
  import {
13273
- CreateWorkflow as CreateWorkflow43,
13337
+ CreateWorkflow as CreateWorkflow42,
13274
13338
  Entitlements as Entitlements12,
13275
13339
  mergeEntitlements as mergeEntitlements7,
13276
- Task as Task68,
13340
+ Task as Task52,
13277
13341
  TaskConfigSchema as TaskConfigSchema36,
13278
- Workflow as Workflow44
13342
+ Workflow as Workflow43
13279
13343
  } from "@workglow/task-graph";
13280
13344
  var annotationsSchema2 = {
13281
13345
  type: "object",
@@ -13402,7 +13466,7 @@ var fallbackInputSchema2 = {
13402
13466
  additionalProperties: true
13403
13467
  };
13404
13468
 
13405
- class McpToolCallTask extends Task68 {
13469
+ class McpToolCallTask extends Task52 {
13406
13470
  static type = "McpToolCallTask";
13407
13471
  static category = "MCP";
13408
13472
  static title = "MCP Call Tool";
@@ -13540,7 +13604,7 @@ class McpToolCallTask extends Task68 {
13540
13604
  var mcpToolCall = async (input2, config) => {
13541
13605
  return new McpToolCallTask(config).run(input2);
13542
13606
  };
13543
- Workflow44.prototype.mcpToolCall = CreateWorkflow43(McpToolCallTask);
13607
+ Workflow43.prototype.mcpToolCall = CreateWorkflow42(McpToolCallTask);
13544
13608
  // src/task/McpElicitationConnector.ts
13545
13609
  function defaultAbortError() {
13546
13610
  const err = new Error("The operation was aborted");
@@ -13634,13 +13698,13 @@ class McpElicitationConnector {
13634
13698
  }
13635
13699
  }
13636
13700
  // src/task/MergeTask.ts
13637
- import { CreateWorkflow as CreateWorkflow44, Task as Task69, Workflow as Workflow45 } from "@workglow/task-graph";
13638
- var inputSchema64 = {
13701
+ import { CreateWorkflow as CreateWorkflow43, Task as Task53, Workflow as Workflow44 } from "@workglow/task-graph";
13702
+ var inputSchema63 = {
13639
13703
  type: "object",
13640
13704
  properties: {},
13641
13705
  additionalProperties: true
13642
13706
  };
13643
- var outputSchema63 = {
13707
+ var outputSchema62 = {
13644
13708
  type: "object",
13645
13709
  properties: {
13646
13710
  output: {
@@ -13652,17 +13716,17 @@ var outputSchema63 = {
13652
13716
  additionalProperties: false
13653
13717
  };
13654
13718
 
13655
- class MergeTask extends Task69 {
13719
+ class MergeTask extends Task53 {
13656
13720
  static type = "MergeTask";
13657
13721
  static category = "Utility";
13658
13722
  static title = "Merge";
13659
13723
  static description = "Merges multiple inputs into a single array output";
13660
13724
  static cacheable = true;
13661
13725
  static inputSchema() {
13662
- return inputSchema64;
13726
+ return inputSchema63;
13663
13727
  }
13664
13728
  static outputSchema() {
13665
- return outputSchema63;
13729
+ return outputSchema62;
13666
13730
  }
13667
13731
  async execute(input2, _context) {
13668
13732
  const keys = Object.keys(input2).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
@@ -13676,14 +13740,14 @@ var merge = (input2, config = {}) => {
13676
13740
  const task = new MergeTask(config);
13677
13741
  return task.run(input2);
13678
13742
  };
13679
- Workflow45.prototype.merge = CreateWorkflow44(MergeTask);
13743
+ Workflow44.prototype.merge = CreateWorkflow43(MergeTask);
13680
13744
  // src/task/OutputTask.ts
13681
- import { CreateWorkflow as CreateWorkflow45, Task as Task70, Workflow as Workflow46 } from "@workglow/task-graph";
13745
+ import { CreateWorkflow as CreateWorkflow44, Task as Task54, Workflow as Workflow45 } from "@workglow/task-graph";
13682
13746
  function passthroughInput2(input2) {
13683
13747
  return input2;
13684
13748
  }
13685
13749
 
13686
- class OutputTask extends Task70 {
13750
+ class OutputTask extends Task54 {
13687
13751
  static type = "OutputTask";
13688
13752
  static category = "Flow Control";
13689
13753
  static title = "Output";
@@ -13739,13 +13803,13 @@ class OutputTask extends Task70 {
13739
13803
  yield { type: "finish", data: input2 };
13740
13804
  }
13741
13805
  }
13742
- Workflow46.prototype.output = CreateWorkflow45(OutputTask);
13806
+ Workflow45.prototype.output = CreateWorkflow44(OutputTask);
13743
13807
  // src/task/RegexTask.ts
13744
13808
  import {
13745
- CreateWorkflow as CreateWorkflow46,
13746
- Task as Task71,
13809
+ CreateWorkflow as CreateWorkflow45,
13810
+ Task as Task55,
13747
13811
  TaskInvalidInputError as TaskInvalidInputError4,
13748
- Workflow as Workflow47
13812
+ Workflow as Workflow46
13749
13813
  } from "@workglow/task-graph";
13750
13814
  var MAX_BRACKET_COUNT = 100;
13751
13815
  function hasNestedQuantifiers(pattern) {
@@ -13778,7 +13842,7 @@ function executeRegex(input2) {
13778
13842
  matches: result.slice(0)
13779
13843
  };
13780
13844
  }
13781
- var inputSchema65 = {
13845
+ var inputSchema64 = {
13782
13846
  type: "object",
13783
13847
  properties: {
13784
13848
  value: {
@@ -13801,7 +13865,7 @@ var inputSchema65 = {
13801
13865
  required: ["value", "pattern"],
13802
13866
  additionalProperties: false
13803
13867
  };
13804
- var outputSchema64 = {
13868
+ var outputSchema63 = {
13805
13869
  type: "object",
13806
13870
  properties: {
13807
13871
  match: {
@@ -13820,16 +13884,16 @@ var outputSchema64 = {
13820
13884
  additionalProperties: false
13821
13885
  };
13822
13886
 
13823
- class RegexTask extends Task71 {
13887
+ class RegexTask extends Task55 {
13824
13888
  static type = "RegexTask";
13825
13889
  static category = "String";
13826
13890
  static title = "Regex";
13827
13891
  static description = "Matches a string against a regular expression pattern";
13828
13892
  static inputSchema() {
13829
- return inputSchema65;
13893
+ return inputSchema64;
13830
13894
  }
13831
13895
  static outputSchema() {
13832
- return outputSchema64;
13896
+ return outputSchema63;
13833
13897
  }
13834
13898
  async execute(input2, _context) {
13835
13899
  return executeRegex(input2);
@@ -13838,10 +13902,10 @@ class RegexTask extends Task71 {
13838
13902
  return executeRegex(input2);
13839
13903
  }
13840
13904
  }
13841
- Workflow47.prototype.regex = CreateWorkflow46(RegexTask);
13905
+ Workflow46.prototype.regex = CreateWorkflow45(RegexTask);
13842
13906
  // src/task/scalar/ScalarAbsTask.ts
13843
- import { CreateWorkflow as CreateWorkflow47, Task as Task72, Workflow as Workflow48 } from "@workglow/task-graph";
13844
- var inputSchema66 = {
13907
+ import { CreateWorkflow as CreateWorkflow46, Task as Task56, Workflow as Workflow47 } from "@workglow/task-graph";
13908
+ var inputSchema65 = {
13845
13909
  type: "object",
13846
13910
  properties: {
13847
13911
  value: {
@@ -13853,7 +13917,7 @@ var inputSchema66 = {
13853
13917
  required: ["value"],
13854
13918
  additionalProperties: false
13855
13919
  };
13856
- var outputSchema65 = {
13920
+ var outputSchema64 = {
13857
13921
  type: "object",
13858
13922
  properties: {
13859
13923
  result: {
@@ -13866,25 +13930,25 @@ var outputSchema65 = {
13866
13930
  additionalProperties: false
13867
13931
  };
13868
13932
 
13869
- class ScalarAbsTask extends Task72 {
13933
+ class ScalarAbsTask extends Task56 {
13870
13934
  static type = "ScalarAbsTask";
13871
13935
  static category = "Math";
13872
13936
  static title = "Abs";
13873
13937
  static description = "Returns the absolute value of a number";
13874
13938
  static inputSchema() {
13875
- return inputSchema66;
13939
+ return inputSchema65;
13876
13940
  }
13877
13941
  static outputSchema() {
13878
- return outputSchema65;
13942
+ return outputSchema64;
13879
13943
  }
13880
13944
  async execute(input2, _context) {
13881
13945
  return { result: Math.abs(input2.value) };
13882
13946
  }
13883
13947
  }
13884
- Workflow48.prototype.scalarAbs = CreateWorkflow47(ScalarAbsTask);
13948
+ Workflow47.prototype.scalarAbs = CreateWorkflow46(ScalarAbsTask);
13885
13949
  // src/task/scalar/ScalarCeilTask.ts
13886
- import { CreateWorkflow as CreateWorkflow48, Task as Task73, Workflow as Workflow49 } from "@workglow/task-graph";
13887
- var inputSchema67 = {
13950
+ import { CreateWorkflow as CreateWorkflow47, Task as Task57, Workflow as Workflow48 } from "@workglow/task-graph";
13951
+ var inputSchema66 = {
13888
13952
  type: "object",
13889
13953
  properties: {
13890
13954
  value: {
@@ -13896,7 +13960,7 @@ var inputSchema67 = {
13896
13960
  required: ["value"],
13897
13961
  additionalProperties: false
13898
13962
  };
13899
- var outputSchema66 = {
13963
+ var outputSchema65 = {
13900
13964
  type: "object",
13901
13965
  properties: {
13902
13966
  result: {
@@ -13909,25 +13973,25 @@ var outputSchema66 = {
13909
13973
  additionalProperties: false
13910
13974
  };
13911
13975
 
13912
- class ScalarCeilTask extends Task73 {
13976
+ class ScalarCeilTask extends Task57 {
13913
13977
  static type = "ScalarCeilTask";
13914
13978
  static category = "Math";
13915
13979
  static title = "Ceil";
13916
13980
  static description = "Returns the smallest integer greater than or equal to a number";
13917
13981
  static inputSchema() {
13918
- return inputSchema67;
13982
+ return inputSchema66;
13919
13983
  }
13920
13984
  static outputSchema() {
13921
- return outputSchema66;
13985
+ return outputSchema65;
13922
13986
  }
13923
13987
  async execute(input2, _context) {
13924
13988
  return { result: Math.ceil(input2.value) };
13925
13989
  }
13926
13990
  }
13927
- Workflow49.prototype.scalarCeil = CreateWorkflow48(ScalarCeilTask);
13991
+ Workflow48.prototype.scalarCeil = CreateWorkflow47(ScalarCeilTask);
13928
13992
  // src/task/scalar/ScalarFloorTask.ts
13929
- import { CreateWorkflow as CreateWorkflow49, Task as Task74, Workflow as Workflow50 } from "@workglow/task-graph";
13930
- var inputSchema68 = {
13993
+ import { CreateWorkflow as CreateWorkflow48, Task as Task58, Workflow as Workflow49 } from "@workglow/task-graph";
13994
+ var inputSchema67 = {
13931
13995
  type: "object",
13932
13996
  properties: {
13933
13997
  value: {
@@ -13939,7 +14003,7 @@ var inputSchema68 = {
13939
14003
  required: ["value"],
13940
14004
  additionalProperties: false
13941
14005
  };
13942
- var outputSchema67 = {
14006
+ var outputSchema66 = {
13943
14007
  type: "object",
13944
14008
  properties: {
13945
14009
  result: {
@@ -13952,25 +14016,25 @@ var outputSchema67 = {
13952
14016
  additionalProperties: false
13953
14017
  };
13954
14018
 
13955
- class ScalarFloorTask extends Task74 {
14019
+ class ScalarFloorTask extends Task58 {
13956
14020
  static type = "ScalarFloorTask";
13957
14021
  static category = "Math";
13958
14022
  static title = "Floor";
13959
14023
  static description = "Returns the largest integer less than or equal to a number";
13960
14024
  static inputSchema() {
13961
- return inputSchema68;
14025
+ return inputSchema67;
13962
14026
  }
13963
14027
  static outputSchema() {
13964
- return outputSchema67;
14028
+ return outputSchema66;
13965
14029
  }
13966
14030
  async execute(input2, _context) {
13967
14031
  return { result: Math.floor(input2.value) };
13968
14032
  }
13969
14033
  }
13970
- Workflow50.prototype.scalarFloor = CreateWorkflow49(ScalarFloorTask);
14034
+ Workflow49.prototype.scalarFloor = CreateWorkflow48(ScalarFloorTask);
13971
14035
  // src/task/scalar/ScalarMaxTask.ts
13972
- import { CreateWorkflow as CreateWorkflow50, Task as Task75, Workflow as Workflow51 } from "@workglow/task-graph";
13973
- var inputSchema69 = {
14036
+ import { CreateWorkflow as CreateWorkflow49, Task as Task59, Workflow as Workflow50 } from "@workglow/task-graph";
14037
+ var inputSchema68 = {
13974
14038
  type: "object",
13975
14039
  properties: {
13976
14040
  values: {
@@ -13983,7 +14047,7 @@ var inputSchema69 = {
13983
14047
  required: ["values"],
13984
14048
  additionalProperties: false
13985
14049
  };
13986
- var outputSchema68 = {
14050
+ var outputSchema67 = {
13987
14051
  type: "object",
13988
14052
  properties: {
13989
14053
  result: {
@@ -13996,25 +14060,25 @@ var outputSchema68 = {
13996
14060
  additionalProperties: false
13997
14061
  };
13998
14062
 
13999
- class ScalarMaxTask extends Task75 {
14063
+ class ScalarMaxTask extends Task59 {
14000
14064
  static type = "ScalarMaxTask";
14001
14065
  static category = "Math";
14002
14066
  static title = "Max";
14003
14067
  static description = "Returns the largest of the given numbers";
14004
14068
  static inputSchema() {
14005
- return inputSchema69;
14069
+ return inputSchema68;
14006
14070
  }
14007
14071
  static outputSchema() {
14008
- return outputSchema68;
14072
+ return outputSchema67;
14009
14073
  }
14010
14074
  async execute(input2, _context) {
14011
14075
  return { result: Math.max(...input2.values) };
14012
14076
  }
14013
14077
  }
14014
- Workflow51.prototype.scalarMax = CreateWorkflow50(ScalarMaxTask);
14078
+ Workflow50.prototype.scalarMax = CreateWorkflow49(ScalarMaxTask);
14015
14079
  // src/task/scalar/ScalarMinTask.ts
14016
- import { CreateWorkflow as CreateWorkflow51, Task as Task76, Workflow as Workflow52 } from "@workglow/task-graph";
14017
- var inputSchema70 = {
14080
+ import { CreateWorkflow as CreateWorkflow50, Task as Task60, Workflow as Workflow51 } from "@workglow/task-graph";
14081
+ var inputSchema69 = {
14018
14082
  type: "object",
14019
14083
  properties: {
14020
14084
  values: {
@@ -14027,7 +14091,7 @@ var inputSchema70 = {
14027
14091
  required: ["values"],
14028
14092
  additionalProperties: false
14029
14093
  };
14030
- var outputSchema69 = {
14094
+ var outputSchema68 = {
14031
14095
  type: "object",
14032
14096
  properties: {
14033
14097
  result: {
@@ -14040,25 +14104,25 @@ var outputSchema69 = {
14040
14104
  additionalProperties: false
14041
14105
  };
14042
14106
 
14043
- class ScalarMinTask extends Task76 {
14107
+ class ScalarMinTask extends Task60 {
14044
14108
  static type = "ScalarMinTask";
14045
14109
  static category = "Math";
14046
14110
  static title = "Min";
14047
14111
  static description = "Returns the smallest of the given numbers";
14048
14112
  static inputSchema() {
14049
- return inputSchema70;
14113
+ return inputSchema69;
14050
14114
  }
14051
14115
  static outputSchema() {
14052
- return outputSchema69;
14116
+ return outputSchema68;
14053
14117
  }
14054
14118
  async execute(input2, _context) {
14055
14119
  return { result: Math.min(...input2.values) };
14056
14120
  }
14057
14121
  }
14058
- Workflow52.prototype.scalarMin = CreateWorkflow51(ScalarMinTask);
14122
+ Workflow51.prototype.scalarMin = CreateWorkflow50(ScalarMinTask);
14059
14123
  // src/task/scalar/ScalarRoundTask.ts
14060
- import { CreateWorkflow as CreateWorkflow52, Task as Task77, Workflow as Workflow53 } from "@workglow/task-graph";
14061
- var inputSchema71 = {
14124
+ import { CreateWorkflow as CreateWorkflow51, Task as Task61, Workflow as Workflow52 } from "@workglow/task-graph";
14125
+ var inputSchema70 = {
14062
14126
  type: "object",
14063
14127
  properties: {
14064
14128
  value: {
@@ -14070,7 +14134,7 @@ var inputSchema71 = {
14070
14134
  required: ["value"],
14071
14135
  additionalProperties: false
14072
14136
  };
14073
- var outputSchema70 = {
14137
+ var outputSchema69 = {
14074
14138
  type: "object",
14075
14139
  properties: {
14076
14140
  result: {
@@ -14083,25 +14147,25 @@ var outputSchema70 = {
14083
14147
  additionalProperties: false
14084
14148
  };
14085
14149
 
14086
- class ScalarRoundTask extends Task77 {
14150
+ class ScalarRoundTask extends Task61 {
14087
14151
  static type = "ScalarRoundTask";
14088
14152
  static category = "Math";
14089
14153
  static title = "Round";
14090
14154
  static description = "Returns the value of a number rounded to the nearest integer";
14091
14155
  static inputSchema() {
14092
- return inputSchema71;
14156
+ return inputSchema70;
14093
14157
  }
14094
14158
  static outputSchema() {
14095
- return outputSchema70;
14159
+ return outputSchema69;
14096
14160
  }
14097
14161
  async execute(input2, _context) {
14098
14162
  return { result: Math.round(input2.value) };
14099
14163
  }
14100
14164
  }
14101
- Workflow53.prototype.scalarRound = CreateWorkflow52(ScalarRoundTask);
14165
+ Workflow52.prototype.scalarRound = CreateWorkflow51(ScalarRoundTask);
14102
14166
  // src/task/scalar/ScalarTruncTask.ts
14103
- import { CreateWorkflow as CreateWorkflow53, Task as Task78, Workflow as Workflow54 } from "@workglow/task-graph";
14104
- var inputSchema72 = {
14167
+ import { CreateWorkflow as CreateWorkflow52, Task as Task62, Workflow as Workflow53 } from "@workglow/task-graph";
14168
+ var inputSchema71 = {
14105
14169
  type: "object",
14106
14170
  properties: {
14107
14171
  value: {
@@ -14113,7 +14177,7 @@ var inputSchema72 = {
14113
14177
  required: ["value"],
14114
14178
  additionalProperties: false
14115
14179
  };
14116
- var outputSchema71 = {
14180
+ var outputSchema70 = {
14117
14181
  type: "object",
14118
14182
  properties: {
14119
14183
  result: {
@@ -14126,25 +14190,25 @@ var outputSchema71 = {
14126
14190
  additionalProperties: false
14127
14191
  };
14128
14192
 
14129
- class ScalarTruncTask extends Task78 {
14193
+ class ScalarTruncTask extends Task62 {
14130
14194
  static type = "ScalarTruncTask";
14131
14195
  static category = "Math";
14132
14196
  static title = "Truncate";
14133
14197
  static description = "Returns the integer part of a number by removing fractional digits";
14134
14198
  static inputSchema() {
14135
- return inputSchema72;
14199
+ return inputSchema71;
14136
14200
  }
14137
14201
  static outputSchema() {
14138
- return outputSchema71;
14202
+ return outputSchema70;
14139
14203
  }
14140
14204
  async execute(input2, _context) {
14141
14205
  return { result: Math.trunc(input2.value) };
14142
14206
  }
14143
14207
  }
14144
- Workflow54.prototype.scalarTrunc = CreateWorkflow53(ScalarTruncTask);
14208
+ Workflow53.prototype.scalarTrunc = CreateWorkflow52(ScalarTruncTask);
14145
14209
  // src/task/SplitTask.ts
14146
- import { CreateWorkflow as CreateWorkflow54, Task as Task79, Workflow as Workflow55 } from "@workglow/task-graph";
14147
- var inputSchema73 = {
14210
+ import { CreateWorkflow as CreateWorkflow53, Task as Task63, Workflow as Workflow54 } from "@workglow/task-graph";
14211
+ var inputSchema72 = {
14148
14212
  type: "object",
14149
14213
  properties: {
14150
14214
  input: {
@@ -14154,7 +14218,7 @@ var inputSchema73 = {
14154
14218
  },
14155
14219
  additionalProperties: false
14156
14220
  };
14157
- var outputSchema72 = {
14221
+ var outputSchema71 = {
14158
14222
  type: "object",
14159
14223
  properties: {},
14160
14224
  additionalProperties: true
@@ -14171,17 +14235,17 @@ function fanoutToIndexedOutputs(inputValue) {
14171
14235
  return output;
14172
14236
  }
14173
14237
 
14174
- class SplitTask extends Task79 {
14238
+ class SplitTask extends Task63 {
14175
14239
  static type = "SplitTask";
14176
14240
  static category = "Utility";
14177
14241
  static title = "Split";
14178
14242
  static description = "Splits an array into individual outputs, creating one output per element";
14179
14243
  static cacheable = false;
14180
14244
  static inputSchema() {
14181
- return inputSchema73;
14245
+ return inputSchema72;
14182
14246
  }
14183
14247
  static outputSchema() {
14184
- return outputSchema72;
14248
+ return outputSchema71;
14185
14249
  }
14186
14250
  async execute(input2, _context) {
14187
14251
  return fanoutToIndexedOutputs(input2.input);
@@ -14194,22 +14258,22 @@ var split = (input2, config = {}) => {
14194
14258
  const task = new SplitTask(config);
14195
14259
  return task.run(input2);
14196
14260
  };
14197
- Workflow55.prototype.split = CreateWorkflow54(SplitTask);
14261
+ Workflow54.prototype.split = CreateWorkflow53(SplitTask);
14198
14262
  // src/task/string/StringConcatTask.ts
14199
14263
  import {
14200
- CreateWorkflow as CreateWorkflow55,
14201
- Task as Task80,
14202
- Workflow as Workflow56
14264
+ CreateWorkflow as CreateWorkflow54,
14265
+ Task as Task64,
14266
+ Workflow as Workflow55
14203
14267
  } from "@workglow/task-graph";
14204
14268
  function concatStrings(input2) {
14205
14269
  return Object.values(input2).join("");
14206
14270
  }
14207
- var inputSchema74 = {
14271
+ var inputSchema73 = {
14208
14272
  type: "object",
14209
14273
  properties: {},
14210
14274
  additionalProperties: { type: "string" }
14211
14275
  };
14212
- var outputSchema73 = {
14276
+ var outputSchema72 = {
14213
14277
  type: "object",
14214
14278
  properties: {
14215
14279
  text: {
@@ -14222,16 +14286,16 @@ var outputSchema73 = {
14222
14286
  additionalProperties: false
14223
14287
  };
14224
14288
 
14225
- class StringConcatTask extends Task80 {
14289
+ class StringConcatTask extends Task64 {
14226
14290
  static type = "StringConcatTask";
14227
14291
  static category = "String";
14228
14292
  static title = "Concat";
14229
14293
  static description = "Concatenates all input strings";
14230
14294
  static inputSchema() {
14231
- return inputSchema74;
14295
+ return inputSchema73;
14232
14296
  }
14233
14297
  static outputSchema() {
14234
- return outputSchema73;
14298
+ return outputSchema72;
14235
14299
  }
14236
14300
  async execute(input2, _context) {
14237
14301
  return { text: concatStrings(input2) };
@@ -14240,17 +14304,17 @@ class StringConcatTask extends Task80 {
14240
14304
  return { text: concatStrings(input2) };
14241
14305
  }
14242
14306
  }
14243
- Workflow56.prototype.stringConcat = CreateWorkflow55(StringConcatTask);
14307
+ Workflow55.prototype.stringConcat = CreateWorkflow54(StringConcatTask);
14244
14308
  // src/task/string/StringIncludesTask.ts
14245
14309
  import {
14246
- CreateWorkflow as CreateWorkflow56,
14247
- Task as Task81,
14248
- Workflow as Workflow57
14310
+ CreateWorkflow as CreateWorkflow55,
14311
+ Task as Task65,
14312
+ Workflow as Workflow56
14249
14313
  } from "@workglow/task-graph";
14250
14314
  function stringIncludes(text, search) {
14251
14315
  return text.includes(search);
14252
14316
  }
14253
- var inputSchema75 = {
14317
+ var inputSchema74 = {
14254
14318
  type: "object",
14255
14319
  properties: {
14256
14320
  text: {
@@ -14267,7 +14331,7 @@ var inputSchema75 = {
14267
14331
  required: ["text", "search"],
14268
14332
  additionalProperties: false
14269
14333
  };
14270
- var outputSchema74 = {
14334
+ var outputSchema73 = {
14271
14335
  type: "object",
14272
14336
  properties: {
14273
14337
  included: {
@@ -14280,16 +14344,16 @@ var outputSchema74 = {
14280
14344
  additionalProperties: false
14281
14345
  };
14282
14346
 
14283
- class StringIncludesTask extends Task81 {
14347
+ class StringIncludesTask extends Task65 {
14284
14348
  static type = "StringIncludesTask";
14285
14349
  static category = "String";
14286
14350
  static title = "Includes";
14287
14351
  static description = "Checks if a string contains a substring";
14288
14352
  static inputSchema() {
14289
- return inputSchema75;
14353
+ return inputSchema74;
14290
14354
  }
14291
14355
  static outputSchema() {
14292
- return outputSchema74;
14356
+ return outputSchema73;
14293
14357
  }
14294
14358
  async execute(input2, _context) {
14295
14359
  return { included: stringIncludes(input2.text, input2.search) };
@@ -14298,17 +14362,17 @@ class StringIncludesTask extends Task81 {
14298
14362
  return { included: stringIncludes(input2.text, input2.search) };
14299
14363
  }
14300
14364
  }
14301
- Workflow57.prototype.stringIncludes = CreateWorkflow56(StringIncludesTask);
14365
+ Workflow56.prototype.stringIncludes = CreateWorkflow55(StringIncludesTask);
14302
14366
  // src/task/string/StringJoinTask.ts
14303
14367
  import {
14304
- CreateWorkflow as CreateWorkflow57,
14305
- Task as Task82,
14306
- Workflow as Workflow58
14368
+ CreateWorkflow as CreateWorkflow56,
14369
+ Task as Task66,
14370
+ Workflow as Workflow57
14307
14371
  } from "@workglow/task-graph";
14308
14372
  function joinStrings(texts, separator) {
14309
14373
  return texts.join(separator ?? "");
14310
14374
  }
14311
- var inputSchema76 = {
14375
+ var inputSchema75 = {
14312
14376
  type: "object",
14313
14377
  properties: {
14314
14378
  texts: {
@@ -14327,7 +14391,7 @@ var inputSchema76 = {
14327
14391
  required: ["texts"],
14328
14392
  additionalProperties: false
14329
14393
  };
14330
- var outputSchema75 = {
14394
+ var outputSchema74 = {
14331
14395
  type: "object",
14332
14396
  properties: {
14333
14397
  text: {
@@ -14340,16 +14404,16 @@ var outputSchema75 = {
14340
14404
  additionalProperties: false
14341
14405
  };
14342
14406
 
14343
- class StringJoinTask extends Task82 {
14407
+ class StringJoinTask extends Task66 {
14344
14408
  static type = "StringJoinTask";
14345
14409
  static category = "String";
14346
14410
  static title = "Join";
14347
14411
  static description = "Joins an array of strings with a separator";
14348
14412
  static inputSchema() {
14349
- return inputSchema76;
14413
+ return inputSchema75;
14350
14414
  }
14351
14415
  static outputSchema() {
14352
- return outputSchema75;
14416
+ return outputSchema74;
14353
14417
  }
14354
14418
  async execute(input2, _context) {
14355
14419
  return { text: joinStrings(input2.texts, input2.separator) };
@@ -14358,17 +14422,17 @@ class StringJoinTask extends Task82 {
14358
14422
  return { text: joinStrings(input2.texts, input2.separator) };
14359
14423
  }
14360
14424
  }
14361
- Workflow58.prototype.stringJoin = CreateWorkflow57(StringJoinTask);
14425
+ Workflow57.prototype.stringJoin = CreateWorkflow56(StringJoinTask);
14362
14426
  // src/task/string/StringLengthTask.ts
14363
14427
  import {
14364
- CreateWorkflow as CreateWorkflow58,
14365
- Task as Task83,
14366
- Workflow as Workflow59
14428
+ CreateWorkflow as CreateWorkflow57,
14429
+ Task as Task67,
14430
+ Workflow as Workflow58
14367
14431
  } from "@workglow/task-graph";
14368
14432
  function stringLength(text) {
14369
14433
  return text.length;
14370
14434
  }
14371
- var inputSchema77 = {
14435
+ var inputSchema76 = {
14372
14436
  type: "object",
14373
14437
  properties: {
14374
14438
  text: {
@@ -14380,7 +14444,7 @@ var inputSchema77 = {
14380
14444
  required: ["text"],
14381
14445
  additionalProperties: false
14382
14446
  };
14383
- var outputSchema76 = {
14447
+ var outputSchema75 = {
14384
14448
  type: "object",
14385
14449
  properties: {
14386
14450
  length: {
@@ -14393,16 +14457,16 @@ var outputSchema76 = {
14393
14457
  additionalProperties: false
14394
14458
  };
14395
14459
 
14396
- class StringLengthTask extends Task83 {
14460
+ class StringLengthTask extends Task67 {
14397
14461
  static type = "StringLengthTask";
14398
14462
  static category = "String";
14399
14463
  static title = "Length";
14400
14464
  static description = "Returns the length of a string";
14401
14465
  static inputSchema() {
14402
- return inputSchema77;
14466
+ return inputSchema76;
14403
14467
  }
14404
14468
  static outputSchema() {
14405
- return outputSchema76;
14469
+ return outputSchema75;
14406
14470
  }
14407
14471
  async execute(input2, _context) {
14408
14472
  return { length: stringLength(input2.text) };
@@ -14411,17 +14475,17 @@ class StringLengthTask extends Task83 {
14411
14475
  return { length: stringLength(input2.text) };
14412
14476
  }
14413
14477
  }
14414
- Workflow59.prototype.stringLength = CreateWorkflow58(StringLengthTask);
14478
+ Workflow58.prototype.stringLength = CreateWorkflow57(StringLengthTask);
14415
14479
  // src/task/string/StringLowerCaseTask.ts
14416
14480
  import {
14417
- CreateWorkflow as CreateWorkflow59,
14418
- Task as Task84,
14419
- Workflow as Workflow60
14481
+ CreateWorkflow as CreateWorkflow58,
14482
+ Task as Task68,
14483
+ Workflow as Workflow59
14420
14484
  } from "@workglow/task-graph";
14421
14485
  function toLowerCase(text) {
14422
14486
  return text.toLowerCase();
14423
14487
  }
14424
- var inputSchema78 = {
14488
+ var inputSchema77 = {
14425
14489
  type: "object",
14426
14490
  properties: {
14427
14491
  text: {
@@ -14433,7 +14497,7 @@ var inputSchema78 = {
14433
14497
  required: ["text"],
14434
14498
  additionalProperties: false
14435
14499
  };
14436
- var outputSchema77 = {
14500
+ var outputSchema76 = {
14437
14501
  type: "object",
14438
14502
  properties: {
14439
14503
  text: {
@@ -14446,16 +14510,16 @@ var outputSchema77 = {
14446
14510
  additionalProperties: false
14447
14511
  };
14448
14512
 
14449
- class StringLowerCaseTask extends Task84 {
14513
+ class StringLowerCaseTask extends Task68 {
14450
14514
  static type = "StringLowerCaseTask";
14451
14515
  static category = "String";
14452
14516
  static title = "Lower Case";
14453
14517
  static description = "Converts a string to lower case";
14454
14518
  static inputSchema() {
14455
- return inputSchema78;
14519
+ return inputSchema77;
14456
14520
  }
14457
14521
  static outputSchema() {
14458
- return outputSchema77;
14522
+ return outputSchema76;
14459
14523
  }
14460
14524
  async execute(input2, _context) {
14461
14525
  return { text: toLowerCase(input2.text) };
@@ -14464,17 +14528,17 @@ class StringLowerCaseTask extends Task84 {
14464
14528
  return { text: toLowerCase(input2.text) };
14465
14529
  }
14466
14530
  }
14467
- Workflow60.prototype.stringLowerCase = CreateWorkflow59(StringLowerCaseTask);
14531
+ Workflow59.prototype.stringLowerCase = CreateWorkflow58(StringLowerCaseTask);
14468
14532
  // src/task/string/StringReplaceTask.ts
14469
14533
  import {
14470
- CreateWorkflow as CreateWorkflow60,
14471
- Task as Task85,
14472
- Workflow as Workflow61
14534
+ CreateWorkflow as CreateWorkflow59,
14535
+ Task as Task69,
14536
+ Workflow as Workflow60
14473
14537
  } from "@workglow/task-graph";
14474
14538
  function replaceString(text, search, replace) {
14475
14539
  return text.replaceAll(search, replace);
14476
14540
  }
14477
- var inputSchema79 = {
14541
+ var inputSchema78 = {
14478
14542
  type: "object",
14479
14543
  properties: {
14480
14544
  text: {
@@ -14496,7 +14560,7 @@ var inputSchema79 = {
14496
14560
  required: ["text", "search", "replace"],
14497
14561
  additionalProperties: false
14498
14562
  };
14499
- var outputSchema78 = {
14563
+ var outputSchema77 = {
14500
14564
  type: "object",
14501
14565
  properties: {
14502
14566
  text: {
@@ -14509,16 +14573,16 @@ var outputSchema78 = {
14509
14573
  additionalProperties: false
14510
14574
  };
14511
14575
 
14512
- class StringReplaceTask extends Task85 {
14576
+ class StringReplaceTask extends Task69 {
14513
14577
  static type = "StringReplaceTask";
14514
14578
  static category = "String";
14515
14579
  static title = "Replace";
14516
14580
  static description = "Replaces all occurrences of a substring";
14517
14581
  static inputSchema() {
14518
- return inputSchema79;
14582
+ return inputSchema78;
14519
14583
  }
14520
14584
  static outputSchema() {
14521
- return outputSchema78;
14585
+ return outputSchema77;
14522
14586
  }
14523
14587
  async execute(input2, _context) {
14524
14588
  return { text: replaceString(input2.text, input2.search, input2.replace) };
@@ -14527,17 +14591,17 @@ class StringReplaceTask extends Task85 {
14527
14591
  return { text: replaceString(input2.text, input2.search, input2.replace) };
14528
14592
  }
14529
14593
  }
14530
- Workflow61.prototype.stringReplace = CreateWorkflow60(StringReplaceTask);
14594
+ Workflow60.prototype.stringReplace = CreateWorkflow59(StringReplaceTask);
14531
14595
  // src/task/string/StringSliceTask.ts
14532
14596
  import {
14533
- CreateWorkflow as CreateWorkflow61,
14534
- Task as Task86,
14535
- Workflow as Workflow62
14597
+ CreateWorkflow as CreateWorkflow60,
14598
+ Task as Task70,
14599
+ Workflow as Workflow61
14536
14600
  } from "@workglow/task-graph";
14537
14601
  function sliceString(text, start, end) {
14538
14602
  return text.slice(start, end);
14539
14603
  }
14540
- var inputSchema80 = {
14604
+ var inputSchema79 = {
14541
14605
  type: "object",
14542
14606
  properties: {
14543
14607
  text: {
@@ -14559,7 +14623,7 @@ var inputSchema80 = {
14559
14623
  required: ["text", "start"],
14560
14624
  additionalProperties: false
14561
14625
  };
14562
- var outputSchema79 = {
14626
+ var outputSchema78 = {
14563
14627
  type: "object",
14564
14628
  properties: {
14565
14629
  text: {
@@ -14572,16 +14636,16 @@ var outputSchema79 = {
14572
14636
  additionalProperties: false
14573
14637
  };
14574
14638
 
14575
- class StringSliceTask extends Task86 {
14639
+ class StringSliceTask extends Task70 {
14576
14640
  static type = "StringSliceTask";
14577
14641
  static category = "String";
14578
14642
  static title = "Slice";
14579
14643
  static description = "Extracts a substring by start and optional end index";
14580
14644
  static inputSchema() {
14581
- return inputSchema80;
14645
+ return inputSchema79;
14582
14646
  }
14583
14647
  static outputSchema() {
14584
- return outputSchema79;
14648
+ return outputSchema78;
14585
14649
  }
14586
14650
  async execute(input2, _context) {
14587
14651
  return { text: sliceString(input2.text, input2.start, input2.end) };
@@ -14590,12 +14654,12 @@ class StringSliceTask extends Task86 {
14590
14654
  return { text: sliceString(input2.text, input2.start, input2.end) };
14591
14655
  }
14592
14656
  }
14593
- Workflow62.prototype.stringSlice = CreateWorkflow61(StringSliceTask);
14657
+ Workflow61.prototype.stringSlice = CreateWorkflow60(StringSliceTask);
14594
14658
  // src/task/string/StringTemplateTask.ts
14595
14659
  import {
14596
- CreateWorkflow as CreateWorkflow62,
14597
- Task as Task87,
14598
- Workflow as Workflow63
14660
+ CreateWorkflow as CreateWorkflow61,
14661
+ Task as Task71,
14662
+ Workflow as Workflow62
14599
14663
  } from "@workglow/task-graph";
14600
14664
  function renderStringTemplate(template, values) {
14601
14665
  let text = template;
@@ -14604,7 +14668,7 @@ function renderStringTemplate(template, values) {
14604
14668
  }
14605
14669
  return text;
14606
14670
  }
14607
- var inputSchema81 = {
14671
+ var inputSchema80 = {
14608
14672
  type: "object",
14609
14673
  properties: {
14610
14674
  template: {
@@ -14622,7 +14686,7 @@ var inputSchema81 = {
14622
14686
  required: ["template", "values"],
14623
14687
  additionalProperties: false
14624
14688
  };
14625
- var outputSchema80 = {
14689
+ var outputSchema79 = {
14626
14690
  type: "object",
14627
14691
  properties: {
14628
14692
  text: {
@@ -14635,16 +14699,16 @@ var outputSchema80 = {
14635
14699
  additionalProperties: false
14636
14700
  };
14637
14701
 
14638
- class StringTemplateTask extends Task87 {
14702
+ class StringTemplateTask extends Task71 {
14639
14703
  static type = "StringTemplateTask";
14640
14704
  static category = "String";
14641
14705
  static title = "Template";
14642
14706
  static description = "Replaces {{key}} placeholders in a template string with values";
14643
14707
  static inputSchema() {
14644
- return inputSchema81;
14708
+ return inputSchema80;
14645
14709
  }
14646
14710
  static outputSchema() {
14647
- return outputSchema80;
14711
+ return outputSchema79;
14648
14712
  }
14649
14713
  async execute(input2, _context) {
14650
14714
  return { text: renderStringTemplate(input2.template, input2.values) };
@@ -14653,17 +14717,17 @@ class StringTemplateTask extends Task87 {
14653
14717
  return { text: renderStringTemplate(input2.template, input2.values) };
14654
14718
  }
14655
14719
  }
14656
- Workflow63.prototype.stringTemplate = CreateWorkflow62(StringTemplateTask);
14720
+ Workflow62.prototype.stringTemplate = CreateWorkflow61(StringTemplateTask);
14657
14721
  // src/task/string/StringTrimTask.ts
14658
14722
  import {
14659
- CreateWorkflow as CreateWorkflow63,
14660
- Task as Task88,
14661
- Workflow as Workflow64
14723
+ CreateWorkflow as CreateWorkflow62,
14724
+ Task as Task72,
14725
+ Workflow as Workflow63
14662
14726
  } from "@workglow/task-graph";
14663
14727
  function trimString(text) {
14664
14728
  return text.trim();
14665
14729
  }
14666
- var inputSchema82 = {
14730
+ var inputSchema81 = {
14667
14731
  type: "object",
14668
14732
  properties: {
14669
14733
  text: {
@@ -14675,7 +14739,7 @@ var inputSchema82 = {
14675
14739
  required: ["text"],
14676
14740
  additionalProperties: false
14677
14741
  };
14678
- var outputSchema81 = {
14742
+ var outputSchema80 = {
14679
14743
  type: "object",
14680
14744
  properties: {
14681
14745
  text: {
@@ -14688,16 +14752,16 @@ var outputSchema81 = {
14688
14752
  additionalProperties: false
14689
14753
  };
14690
14754
 
14691
- class StringTrimTask extends Task88 {
14755
+ class StringTrimTask extends Task72 {
14692
14756
  static type = "StringTrimTask";
14693
14757
  static category = "String";
14694
14758
  static title = "Trim";
14695
14759
  static description = "Removes leading and trailing whitespace from a string";
14696
14760
  static inputSchema() {
14697
- return inputSchema82;
14761
+ return inputSchema81;
14698
14762
  }
14699
14763
  static outputSchema() {
14700
- return outputSchema81;
14764
+ return outputSchema80;
14701
14765
  }
14702
14766
  async execute(input2, _context) {
14703
14767
  return { text: trimString(input2.text) };
@@ -14706,17 +14770,17 @@ class StringTrimTask extends Task88 {
14706
14770
  return { text: trimString(input2.text) };
14707
14771
  }
14708
14772
  }
14709
- Workflow64.prototype.stringTrim = CreateWorkflow63(StringTrimTask);
14773
+ Workflow63.prototype.stringTrim = CreateWorkflow62(StringTrimTask);
14710
14774
  // src/task/string/StringUpperCaseTask.ts
14711
14775
  import {
14712
- CreateWorkflow as CreateWorkflow64,
14713
- Task as Task89,
14714
- Workflow as Workflow65
14776
+ CreateWorkflow as CreateWorkflow63,
14777
+ Task as Task73,
14778
+ Workflow as Workflow64
14715
14779
  } from "@workglow/task-graph";
14716
14780
  function toUpperCase(text) {
14717
14781
  return text.toUpperCase();
14718
14782
  }
14719
- var inputSchema83 = {
14783
+ var inputSchema82 = {
14720
14784
  type: "object",
14721
14785
  properties: {
14722
14786
  text: {
@@ -14728,7 +14792,7 @@ var inputSchema83 = {
14728
14792
  required: ["text"],
14729
14793
  additionalProperties: false
14730
14794
  };
14731
- var outputSchema82 = {
14795
+ var outputSchema81 = {
14732
14796
  type: "object",
14733
14797
  properties: {
14734
14798
  text: {
@@ -14741,16 +14805,16 @@ var outputSchema82 = {
14741
14805
  additionalProperties: false
14742
14806
  };
14743
14807
 
14744
- class StringUpperCaseTask extends Task89 {
14808
+ class StringUpperCaseTask extends Task73 {
14745
14809
  static type = "StringUpperCaseTask";
14746
14810
  static category = "String";
14747
14811
  static title = "Upper Case";
14748
14812
  static description = "Converts a string to upper case";
14749
14813
  static inputSchema() {
14750
- return inputSchema83;
14814
+ return inputSchema82;
14751
14815
  }
14752
14816
  static outputSchema() {
14753
- return outputSchema82;
14817
+ return outputSchema81;
14754
14818
  }
14755
14819
  async execute(input2, _context) {
14756
14820
  return { text: toUpperCase(input2.text) };
@@ -14759,12 +14823,12 @@ class StringUpperCaseTask extends Task89 {
14759
14823
  return { text: toUpperCase(input2.text) };
14760
14824
  }
14761
14825
  }
14762
- Workflow65.prototype.stringUpperCase = CreateWorkflow64(StringUpperCaseTask);
14826
+ Workflow64.prototype.stringUpperCase = CreateWorkflow63(StringUpperCaseTask);
14763
14827
  // src/task/TemplateTask.ts
14764
14828
  import {
14765
- CreateWorkflow as CreateWorkflow65,
14766
- Task as Task90,
14767
- Workflow as Workflow66
14829
+ CreateWorkflow as CreateWorkflow64,
14830
+ Task as Task74,
14831
+ Workflow as Workflow65
14768
14832
  } from "@workglow/task-graph";
14769
14833
  function renderTemplate(template, values) {
14770
14834
  return template.replace(/\{\{([^{}]+)\}\}/g, (_match, expr) => {
@@ -14784,7 +14848,7 @@ function renderTemplate(template, values) {
14784
14848
  return defaultValue !== undefined ? defaultValue : "";
14785
14849
  });
14786
14850
  }
14787
- var inputSchema84 = {
14851
+ var inputSchema83 = {
14788
14852
  type: "object",
14789
14853
  properties: {
14790
14854
  template: {
@@ -14802,7 +14866,7 @@ var inputSchema84 = {
14802
14866
  required: ["template", "values"],
14803
14867
  additionalProperties: false
14804
14868
  };
14805
- var outputSchema83 = {
14869
+ var outputSchema82 = {
14806
14870
  type: "object",
14807
14871
  properties: {
14808
14872
  result: {
@@ -14815,16 +14879,16 @@ var outputSchema83 = {
14815
14879
  additionalProperties: false
14816
14880
  };
14817
14881
 
14818
- class TemplateTask extends Task90 {
14882
+ class TemplateTask extends Task74 {
14819
14883
  static type = "TemplateTask";
14820
14884
  static category = "Utility";
14821
14885
  static title = "Template";
14822
14886
  static description = "Renders a template string with {{key}} placeholders and optional defaults";
14823
14887
  static inputSchema() {
14824
- return inputSchema84;
14888
+ return inputSchema83;
14825
14889
  }
14826
14890
  static outputSchema() {
14827
- return outputSchema83;
14891
+ return outputSchema82;
14828
14892
  }
14829
14893
  async execute(input2, _context) {
14830
14894
  return { result: renderTemplate(input2.template, input2.values) };
@@ -14833,13 +14897,13 @@ class TemplateTask extends Task90 {
14833
14897
  return { result: renderTemplate(input2.template, input2.values) };
14834
14898
  }
14835
14899
  }
14836
- Workflow66.prototype.template = CreateWorkflow65(TemplateTask);
14900
+ Workflow65.prototype.template = CreateWorkflow64(TemplateTask);
14837
14901
  // src/task/vector/VectorDistanceTask.ts
14838
- import { CreateWorkflow as CreateWorkflow66, Task as Task91, Workflow as Workflow67 } from "@workglow/task-graph";
14902
+ import { CreateWorkflow as CreateWorkflow65, Task as Task75, Workflow as Workflow66 } from "@workglow/task-graph";
14839
14903
  import {
14840
14904
  TypedArraySchema as TypedArraySchema5
14841
14905
  } from "@workglow/util/schema";
14842
- var inputSchema85 = {
14906
+ var inputSchema84 = {
14843
14907
  type: "object",
14844
14908
  properties: {
14845
14909
  vectors: {
@@ -14855,7 +14919,7 @@ var inputSchema85 = {
14855
14919
  required: ["vectors"],
14856
14920
  additionalProperties: false
14857
14921
  };
14858
- var outputSchema84 = {
14922
+ var outputSchema83 = {
14859
14923
  type: "object",
14860
14924
  properties: {
14861
14925
  result: {
@@ -14868,16 +14932,16 @@ var outputSchema84 = {
14868
14932
  additionalProperties: false
14869
14933
  };
14870
14934
 
14871
- class VectorDistanceTask extends Task91 {
14935
+ class VectorDistanceTask extends Task75 {
14872
14936
  static type = "VectorDistanceTask";
14873
14937
  static category = "Vector";
14874
14938
  static title = "Distance";
14875
14939
  static description = "Returns the Euclidean distance between the first two vectors";
14876
14940
  static inputSchema() {
14877
- return inputSchema85;
14941
+ return inputSchema84;
14878
14942
  }
14879
14943
  static outputSchema() {
14880
- return outputSchema84;
14944
+ return outputSchema83;
14881
14945
  }
14882
14946
  async execute(input2, _context) {
14883
14947
  const { vectors } = input2;
@@ -14895,13 +14959,13 @@ class VectorDistanceTask extends Task91 {
14895
14959
  return { result: Math.sqrt(sumPrecise(diffs)) };
14896
14960
  }
14897
14961
  }
14898
- Workflow67.prototype.vectorDistance = CreateWorkflow66(VectorDistanceTask);
14962
+ Workflow66.prototype.vectorDistance = CreateWorkflow65(VectorDistanceTask);
14899
14963
  // src/task/vector/VectorDotProductTask.ts
14900
- import { CreateWorkflow as CreateWorkflow67, Task as Task92, Workflow as Workflow68 } from "@workglow/task-graph";
14964
+ import { CreateWorkflow as CreateWorkflow66, Task as Task76, Workflow as Workflow67 } from "@workglow/task-graph";
14901
14965
  import {
14902
14966
  TypedArraySchema as TypedArraySchema6
14903
14967
  } from "@workglow/util/schema";
14904
- var inputSchema86 = {
14968
+ var inputSchema85 = {
14905
14969
  type: "object",
14906
14970
  properties: {
14907
14971
  vectors: {
@@ -14917,7 +14981,7 @@ var inputSchema86 = {
14917
14981
  required: ["vectors"],
14918
14982
  additionalProperties: false
14919
14983
  };
14920
- var outputSchema85 = {
14984
+ var outputSchema84 = {
14921
14985
  type: "object",
14922
14986
  properties: {
14923
14987
  result: {
@@ -14930,16 +14994,16 @@ var outputSchema85 = {
14930
14994
  additionalProperties: false
14931
14995
  };
14932
14996
 
14933
- class VectorDotProductTask extends Task92 {
14997
+ class VectorDotProductTask extends Task76 {
14934
14998
  static type = "VectorDotProductTask";
14935
14999
  static category = "Vector";
14936
15000
  static title = "Dot Product";
14937
15001
  static description = "Returns the dot (inner) product of the first two vectors";
14938
15002
  static inputSchema() {
14939
- return inputSchema86;
15003
+ return inputSchema85;
14940
15004
  }
14941
15005
  static outputSchema() {
14942
- return outputSchema85;
15006
+ return outputSchema84;
14943
15007
  }
14944
15008
  async execute(input2, _context) {
14945
15009
  const { vectors } = input2;
@@ -14954,14 +15018,14 @@ class VectorDotProductTask extends Task92 {
14954
15018
  return { result: sumPrecise(products) };
14955
15019
  }
14956
15020
  }
14957
- Workflow68.prototype.vectorDotProduct = CreateWorkflow67(VectorDotProductTask);
15021
+ Workflow67.prototype.vectorDotProduct = CreateWorkflow66(VectorDotProductTask);
14958
15022
  // src/task/vector/VectorNormalizeTask.ts
14959
- import { CreateWorkflow as CreateWorkflow68, Task as Task93, Workflow as Workflow69 } from "@workglow/task-graph";
15023
+ import { CreateWorkflow as CreateWorkflow67, Task as Task77, Workflow as Workflow68 } from "@workglow/task-graph";
14960
15024
  import {
14961
15025
  TypedArraySchema as TypedArraySchema7,
14962
15026
  normalize
14963
15027
  } from "@workglow/util/schema";
14964
- var inputSchema87 = {
15028
+ var inputSchema86 = {
14965
15029
  type: "object",
14966
15030
  properties: {
14967
15031
  vector: TypedArraySchema7({
@@ -14972,7 +15036,7 @@ var inputSchema87 = {
14972
15036
  required: ["vector"],
14973
15037
  additionalProperties: false
14974
15038
  };
14975
- var outputSchema86 = {
15039
+ var outputSchema85 = {
14976
15040
  type: "object",
14977
15041
  properties: {
14978
15042
  result: TypedArraySchema7({
@@ -14984,29 +15048,29 @@ var outputSchema86 = {
14984
15048
  additionalProperties: false
14985
15049
  };
14986
15050
 
14987
- class VectorNormalizeTask extends Task93 {
15051
+ class VectorNormalizeTask extends Task77 {
14988
15052
  static type = "VectorNormalizeTask";
14989
15053
  static category = "Vector";
14990
15054
  static title = "Normalize";
14991
15055
  static description = "Returns the L2-normalized (unit length) vector";
14992
15056
  static inputSchema() {
14993
- return inputSchema87;
15057
+ return inputSchema86;
14994
15058
  }
14995
15059
  static outputSchema() {
14996
- return outputSchema86;
15060
+ return outputSchema85;
14997
15061
  }
14998
15062
  async execute(input2, _context) {
14999
15063
  return { result: normalize(input2.vector) };
15000
15064
  }
15001
15065
  }
15002
- Workflow69.prototype.vectorNormalize = CreateWorkflow68(VectorNormalizeTask);
15066
+ Workflow68.prototype.vectorNormalize = CreateWorkflow67(VectorNormalizeTask);
15003
15067
  // src/task/vector/VectorScaleTask.ts
15004
- import { CreateWorkflow as CreateWorkflow69, Task as Task94, Workflow as Workflow70 } from "@workglow/task-graph";
15068
+ import { CreateWorkflow as CreateWorkflow68, Task as Task78, Workflow as Workflow69 } from "@workglow/task-graph";
15005
15069
  import {
15006
15070
  createTypedArrayFrom as createTypedArrayFrom5,
15007
15071
  TypedArraySchema as TypedArraySchema8
15008
15072
  } from "@workglow/util/schema";
15009
- var inputSchema88 = {
15073
+ var inputSchema87 = {
15010
15074
  type: "object",
15011
15075
  properties: {
15012
15076
  vector: TypedArraySchema8({
@@ -15022,7 +15086,7 @@ var inputSchema88 = {
15022
15086
  required: ["vector", "scalar"],
15023
15087
  additionalProperties: false
15024
15088
  };
15025
- var outputSchema87 = {
15089
+ var outputSchema86 = {
15026
15090
  type: "object",
15027
15091
  properties: {
15028
15092
  result: TypedArraySchema8({
@@ -15034,16 +15098,16 @@ var outputSchema87 = {
15034
15098
  additionalProperties: false
15035
15099
  };
15036
15100
 
15037
- class VectorScaleTask extends Task94 {
15101
+ class VectorScaleTask extends Task78 {
15038
15102
  static type = "VectorScaleTask";
15039
15103
  static category = "Vector";
15040
15104
  static title = "Scale";
15041
15105
  static description = "Multiplies each element of a vector by a scalar";
15042
15106
  static inputSchema() {
15043
- return inputSchema88;
15107
+ return inputSchema87;
15044
15108
  }
15045
15109
  static outputSchema() {
15046
- return outputSchema87;
15110
+ return outputSchema86;
15047
15111
  }
15048
15112
  async execute(input2, _context) {
15049
15113
  const { vector, scalar } = input2;
@@ -15051,7 +15115,7 @@ class VectorScaleTask extends Task94 {
15051
15115
  return { result: createTypedArrayFrom5([vector], values) };
15052
15116
  }
15053
15117
  }
15054
- Workflow70.prototype.vectorScale = CreateWorkflow69(VectorScaleTask);
15118
+ Workflow69.prototype.vectorScale = CreateWorkflow68(VectorScaleTask);
15055
15119
 
15056
15120
  // src/common.ts
15057
15121
  import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
@@ -15152,7 +15216,6 @@ var registerCommonTasks = () => {
15152
15216
  ImageBorderTask,
15153
15217
  ImageTransparencyTask,
15154
15218
  ImageBlurTask,
15155
- ImageWatermarkTask,
15156
15219
  ImagePixelateTask,
15157
15220
  ImageInvertTask,
15158
15221
  ImageBrightnessTask,
@@ -15169,18 +15232,18 @@ var registerCommonTasks = () => {
15169
15232
  };
15170
15233
  // src/task/FileLoaderTask.server.ts
15171
15234
  import {
15172
- CreateWorkflow as CreateWorkflow71,
15235
+ CreateWorkflow as CreateWorkflow70,
15173
15236
  TaskAbortedError as TaskAbortedError5,
15174
- Workflow as Workflow72
15237
+ Workflow as Workflow71
15175
15238
  } from "@workglow/task-graph";
15176
15239
  import { readFile } from "node:fs/promises";
15177
15240
 
15178
15241
  // src/task/FileLoaderTask.ts
15179
15242
  import {
15180
- CreateWorkflow as CreateWorkflow70,
15181
- Task as Task95,
15243
+ CreateWorkflow as CreateWorkflow69,
15244
+ Task as Task79,
15182
15245
  TaskAbortedError as TaskAbortedError4,
15183
- Workflow as Workflow71
15246
+ Workflow as Workflow70
15184
15247
  } from "@workglow/task-graph";
15185
15248
  var _papaParse;
15186
15249
  async function getPapaParse() {
@@ -15194,7 +15257,7 @@ async function getPapaParse() {
15194
15257
  }
15195
15258
  return _papaParse;
15196
15259
  }
15197
- var inputSchema89 = {
15260
+ var inputSchema88 = {
15198
15261
  type: "object",
15199
15262
  properties: {
15200
15263
  url: {
@@ -15214,7 +15277,7 @@ var inputSchema89 = {
15214
15277
  required: ["url"],
15215
15278
  additionalProperties: false
15216
15279
  };
15217
- var outputSchema88 = {
15280
+ var outputSchema87 = {
15218
15281
  type: "object",
15219
15282
  properties: {
15220
15283
  text: {
@@ -15265,17 +15328,17 @@ var outputSchema88 = {
15265
15328
  additionalProperties: false
15266
15329
  };
15267
15330
 
15268
- class FileLoaderTask extends Task95 {
15331
+ class FileLoaderTask extends Task79 {
15269
15332
  static type = "FileLoaderTask";
15270
15333
  static category = "Document";
15271
15334
  static title = "File Loader";
15272
15335
  static description = "Load documents from URLs (http://, https://)";
15273
15336
  static cacheable = true;
15274
15337
  static inputSchema() {
15275
- return inputSchema89;
15338
+ return inputSchema88;
15276
15339
  }
15277
15340
  static outputSchema() {
15278
- return outputSchema88;
15341
+ return outputSchema87;
15279
15342
  }
15280
15343
  async execute(input2, context) {
15281
15344
  const { url, format = "auto" } = input2;
@@ -15628,7 +15691,7 @@ class FileLoaderTask extends Task95 {
15628
15691
  });
15629
15692
  }
15630
15693
  }
15631
- Workflow71.prototype.fileLoader = CreateWorkflow70(FileLoaderTask);
15694
+ Workflow70.prototype.fileLoader = CreateWorkflow69(FileLoaderTask);
15632
15695
 
15633
15696
  // src/task/FileLoaderTask.server.ts
15634
15697
  class FileLoaderTask2 extends FileLoaderTask {
@@ -15817,7 +15880,7 @@ class FileLoaderTask2 extends FileLoaderTask {
15817
15880
  var fileLoader = (input2, config) => {
15818
15881
  return new FileLoaderTask2(config).run(input2);
15819
15882
  };
15820
- Workflow72.prototype.fileLoader = CreateWorkflow71(FileLoaderTask2);
15883
+ Workflow71.prototype.fileLoader = CreateWorkflow70(FileLoaderTask2);
15821
15884
  // src/task/browser-control/ElectronBackend.ts
15822
15885
  import { sleep as sleep3 } from "@workglow/util";
15823
15886
  var electronModule = null;
@@ -16587,9 +16650,9 @@ export {
16587
16650
  registerMcpTaskDeps,
16588
16651
  registerMcpServer,
16589
16652
  registerImageRasterCodec2 as registerImageRasterCodec,
16653
+ registerFilterOp31 as registerFilterOp,
16590
16654
  registerCommonTasks2 as registerCommonTasks,
16591
16655
  registerBrowserDeps,
16592
- produceImageOutput,
16593
16656
  normalizeOutputMimeType,
16594
16657
  merge,
16595
16658
  mcpTransportTypes,
@@ -16607,11 +16670,12 @@ export {
16607
16670
  lambda,
16608
16671
  json,
16609
16672
  javaScript,
16673
+ hasFilterOp2 as hasFilterOp,
16610
16674
  getSafeFetchImpl,
16611
16675
  getMcpTaskDeps,
16612
16676
  getMcpServerConfig,
16613
16677
  getMcpServer,
16614
- getImageRasterCodec2 as getImageRasterCodec,
16678
+ getImageRasterCodec,
16615
16679
  getGlobalMcpServers,
16616
16680
  getGlobalMcpServerRepository,
16617
16681
  getBrowserDeps,
@@ -16628,6 +16692,8 @@ export {
16628
16692
  assertWithinPixelBudget,
16629
16693
  assertWithinByteBudget,
16630
16694
  assertIsDataUri,
16695
+ applyFilter3 as applyFilter,
16696
+ _resetFilterRegistryForTests,
16631
16697
  VectorSumTask,
16632
16698
  VectorSubtractTask,
16633
16699
  VectorScaleTask,
@@ -16689,7 +16755,6 @@ export {
16689
16755
  JavaScriptTask,
16690
16756
  InputTask,
16691
16757
  InMemoryMcpServerRepository,
16692
- ImageWatermarkTask,
16693
16758
  ImageTransparencyTask,
16694
16759
  ImageTintTask,
16695
16760
  ImageThresholdTask,
@@ -16702,14 +16767,12 @@ export {
16702
16767
  ImageInvertTask,
16703
16768
  ImageGrayscaleTask,
16704
16769
  ImageFlipTask,
16770
+ ImageFilterTask,
16705
16771
  ImageCropTask,
16706
16772
  ImageContrastTask,
16707
16773
  ImageBrightnessTask,
16708
16774
  ImageBorderTask,
16709
16775
  ImageBlurTask,
16710
- ImageBinarySchemaOptions,
16711
- ImageBinarySchema,
16712
- ImageBinaryOrDataUriSchema,
16713
16776
  HumanInputTask,
16714
16777
  HumanApprovalTask,
16715
16778
  HexColorSchema,
@@ -16720,6 +16783,7 @@ export {
16720
16783
  DelayTask,
16721
16784
  DebugLogTask,
16722
16785
  DateFormatTask,
16786
+ CssRgbColorSchema,
16723
16787
  CredentialStoreOAuthProvider,
16724
16788
  ColorValueSchema,
16725
16789
  ColorSchema,
@@ -16757,4 +16821,4 @@ export {
16757
16821
  ArrayTask
16758
16822
  };
16759
16823
 
16760
- //# debugId=A0F5730670C6AF6364756E2164756E21
16824
+ //# debugId=71F58D454DFC36C464756E2164756E21