@workglow/tasks 0.2.16 → 0.2.18

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 (235) hide show
  1. package/README.md +10 -9
  2. package/dist/browser.d.ts +2 -2
  3. package/dist/browser.d.ts.map +1 -1
  4. package/dist/browser.js +1924 -1363
  5. package/dist/browser.js.map +79 -47
  6. package/dist/bun.d.ts +2 -2
  7. package/dist/bun.d.ts.map +1 -1
  8. package/dist/bun.js +1604 -1328
  9. package/dist/bun.js.map +77 -47
  10. package/dist/codec.browser.d.ts +39 -0
  11. package/dist/codec.browser.d.ts.map +1 -0
  12. package/dist/codec.node.d.ts +37 -0
  13. package/dist/codec.node.d.ts.map +1 -0
  14. package/dist/common.d.ts +39 -38
  15. package/dist/common.d.ts.map +1 -1
  16. package/dist/electron.d.ts +2 -2
  17. package/dist/electron.d.ts.map +1 -1
  18. package/dist/electron.js +1604 -1328
  19. package/dist/electron.js.map +77 -47
  20. package/dist/node.d.ts +2 -2
  21. package/dist/node.d.ts.map +1 -1
  22. package/dist/node.js +1604 -1328
  23. package/dist/node.js.map +77 -47
  24. package/dist/task/ArrayTask.d.ts +4 -5
  25. package/dist/task/ArrayTask.d.ts.map +1 -1
  26. package/dist/task/DateFormatTask.d.ts +3 -2
  27. package/dist/task/DateFormatTask.d.ts.map +1 -1
  28. package/dist/task/DebugLogTask.d.ts +2 -1
  29. package/dist/task/DebugLogTask.d.ts.map +1 -1
  30. package/dist/task/InputTask.d.ts +2 -1
  31. package/dist/task/InputTask.d.ts.map +1 -1
  32. package/dist/task/JavaScriptTask.d.ts +4 -1
  33. package/dist/task/JavaScriptTask.d.ts.map +1 -1
  34. package/dist/task/JsonPathTask.d.ts +3 -2
  35. package/dist/task/JsonPathTask.d.ts.map +1 -1
  36. package/dist/task/LambdaTask.d.ts +7 -6
  37. package/dist/task/LambdaTask.d.ts.map +1 -1
  38. package/dist/task/OutputTask.d.ts +2 -1
  39. package/dist/task/OutputTask.d.ts.map +1 -1
  40. package/dist/task/RegexTask.d.ts +3 -2
  41. package/dist/task/RegexTask.d.ts.map +1 -1
  42. package/dist/task/SplitTask.d.ts +3 -2
  43. package/dist/task/SplitTask.d.ts.map +1 -1
  44. package/dist/task/TemplateTask.d.ts +3 -2
  45. package/dist/task/TemplateTask.d.ts.map +1 -1
  46. package/dist/task/image/ImageFilterTask.d.ts +24 -0
  47. package/dist/task/image/ImageFilterTask.d.ts.map +1 -0
  48. package/dist/task/image/ImageSchemas.d.ts +15 -101
  49. package/dist/task/image/ImageSchemas.d.ts.map +1 -1
  50. package/dist/task/image/blur/ImageBlurTask.d.ts +29 -0
  51. package/dist/task/image/blur/ImageBlurTask.d.ts.map +1 -0
  52. package/dist/task/image/blur/blur.cpu.d.ts +4 -0
  53. package/dist/task/image/blur/blur.cpu.d.ts.map +1 -0
  54. package/dist/task/image/blur/blur.sharp.d.ts +2 -0
  55. package/dist/task/image/blur/blur.sharp.d.ts.map +1 -0
  56. package/dist/task/image/blur/blur.webgpu.d.ts +2 -0
  57. package/dist/task/image/blur/blur.webgpu.d.ts.map +1 -0
  58. package/dist/task/image/border/ImageBorderTask.d.ts +35 -0
  59. package/dist/task/image/border/ImageBorderTask.d.ts.map +1 -0
  60. package/dist/task/image/border/border.cpu.d.ts +10 -0
  61. package/dist/task/image/border/border.cpu.d.ts.map +1 -0
  62. package/dist/task/image/border/border.sharp.d.ts +2 -0
  63. package/dist/task/image/border/border.sharp.d.ts.map +1 -0
  64. package/dist/task/image/border/border.webgpu.d.ts +2 -0
  65. package/dist/task/image/border/border.webgpu.d.ts.map +1 -0
  66. package/dist/task/image/brightness/ImageBrightnessTask.d.ts +28 -0
  67. package/dist/task/image/brightness/ImageBrightnessTask.d.ts.map +1 -0
  68. package/dist/task/image/brightness/brightness.cpu.d.ts +4 -0
  69. package/dist/task/image/brightness/brightness.cpu.d.ts.map +1 -0
  70. package/dist/task/image/brightness/brightness.sharp.d.ts +2 -0
  71. package/dist/task/image/brightness/brightness.sharp.d.ts.map +1 -0
  72. package/dist/task/image/brightness/brightness.webgpu.d.ts +2 -0
  73. package/dist/task/image/brightness/brightness.webgpu.d.ts.map +1 -0
  74. package/dist/task/image/contrast/ImageContrastTask.d.ts +28 -0
  75. package/dist/task/image/contrast/ImageContrastTask.d.ts.map +1 -0
  76. package/dist/task/image/contrast/contrast.cpu.d.ts +4 -0
  77. package/dist/task/image/contrast/contrast.cpu.d.ts.map +1 -0
  78. package/dist/task/image/contrast/contrast.sharp.d.ts +2 -0
  79. package/dist/task/image/contrast/contrast.sharp.d.ts.map +1 -0
  80. package/dist/task/image/contrast/contrast.webgpu.d.ts +2 -0
  81. package/dist/task/image/contrast/contrast.webgpu.d.ts.map +1 -0
  82. package/dist/task/image/crop/ImageCropTask.d.ts +32 -0
  83. package/dist/task/image/crop/ImageCropTask.d.ts.map +1 -0
  84. package/dist/task/image/crop/crop.cpu.d.ts +7 -0
  85. package/dist/task/image/crop/crop.cpu.d.ts.map +1 -0
  86. package/dist/task/image/crop/crop.sharp.d.ts +2 -0
  87. package/dist/task/image/crop/crop.sharp.d.ts.map +1 -0
  88. package/dist/task/image/crop/crop.webgpu.d.ts +2 -0
  89. package/dist/task/image/crop/crop.webgpu.d.ts.map +1 -0
  90. package/dist/task/image/flip/ImageFlipTask.d.ts +28 -0
  91. package/dist/task/image/flip/ImageFlipTask.d.ts.map +1 -0
  92. package/dist/task/image/flip/flip.cpu.d.ts +4 -0
  93. package/dist/task/image/flip/flip.cpu.d.ts.map +1 -0
  94. package/dist/task/image/flip/flip.sharp.d.ts +2 -0
  95. package/dist/task/image/flip/flip.sharp.d.ts.map +1 -0
  96. package/dist/task/image/flip/flip.webgpu.d.ts +2 -0
  97. package/dist/task/image/flip/flip.webgpu.d.ts.map +1 -0
  98. package/dist/task/image/grayscale/ImageGrayscaleTask.d.ts +25 -0
  99. package/dist/task/image/grayscale/ImageGrayscaleTask.d.ts.map +1 -0
  100. package/dist/task/image/grayscale/grayscale.cpu.d.ts +2 -0
  101. package/dist/task/image/grayscale/grayscale.cpu.d.ts.map +1 -0
  102. package/dist/task/image/grayscale/grayscale.sharp.d.ts +2 -0
  103. package/dist/task/image/grayscale/grayscale.sharp.d.ts.map +1 -0
  104. package/dist/task/image/grayscale/grayscale.webgpu.d.ts +2 -0
  105. package/dist/task/image/grayscale/grayscale.webgpu.d.ts.map +1 -0
  106. package/dist/task/image/imageCodecLimits.d.ts +8 -4
  107. package/dist/task/image/imageCodecLimits.d.ts.map +1 -1
  108. package/dist/task/image/invert/ImageInvertTask.d.ts +25 -0
  109. package/dist/task/image/invert/ImageInvertTask.d.ts.map +1 -0
  110. package/dist/task/image/invert/invert.cpu.d.ts +2 -0
  111. package/dist/task/image/invert/invert.cpu.d.ts.map +1 -0
  112. package/dist/task/image/invert/invert.sharp.d.ts +2 -0
  113. package/dist/task/image/invert/invert.sharp.d.ts.map +1 -0
  114. package/dist/task/image/invert/invert.webgpu.d.ts +2 -0
  115. package/dist/task/image/invert/invert.webgpu.d.ts.map +1 -0
  116. package/dist/task/image/pixelate/ImagePixelateTask.d.ts +29 -0
  117. package/dist/task/image/pixelate/ImagePixelateTask.d.ts.map +1 -0
  118. package/dist/task/image/pixelate/pixelate.cpu.d.ts +4 -0
  119. package/dist/task/image/pixelate/pixelate.cpu.d.ts.map +1 -0
  120. package/dist/task/image/pixelate/pixelate.sharp.d.ts +2 -0
  121. package/dist/task/image/pixelate/pixelate.sharp.d.ts.map +1 -0
  122. package/dist/task/image/pixelate/pixelate.webgpu.d.ts +2 -0
  123. package/dist/task/image/pixelate/pixelate.webgpu.d.ts.map +1 -0
  124. package/dist/task/image/posterize/ImagePosterizeTask.d.ts +28 -0
  125. package/dist/task/image/posterize/ImagePosterizeTask.d.ts.map +1 -0
  126. package/dist/task/image/posterize/posterize.cpu.d.ts +4 -0
  127. package/dist/task/image/posterize/posterize.cpu.d.ts.map +1 -0
  128. package/dist/task/image/posterize/posterize.webgpu.d.ts +2 -0
  129. package/dist/task/image/posterize/posterize.webgpu.d.ts.map +1 -0
  130. package/dist/task/image/resize/ImageResizeTask.d.ts +32 -0
  131. package/dist/task/image/resize/ImageResizeTask.d.ts.map +1 -0
  132. package/dist/task/image/resize/resize.cpu.d.ts +7 -0
  133. package/dist/task/image/resize/resize.cpu.d.ts.map +1 -0
  134. package/dist/task/image/resize/resize.sharp.d.ts +2 -0
  135. package/dist/task/image/resize/resize.sharp.d.ts.map +1 -0
  136. package/dist/task/image/resize/resize.webgpu.d.ts +2 -0
  137. package/dist/task/image/resize/resize.webgpu.d.ts.map +1 -0
  138. package/dist/task/image/rotate/ImageRotateTask.d.ts +29 -0
  139. package/dist/task/image/rotate/ImageRotateTask.d.ts.map +1 -0
  140. package/dist/task/image/rotate/rotate.cpu.d.ts +5 -0
  141. package/dist/task/image/rotate/rotate.cpu.d.ts.map +1 -0
  142. package/dist/task/image/rotate/rotate.sharp.d.ts +2 -0
  143. package/dist/task/image/rotate/rotate.sharp.d.ts.map +1 -0
  144. package/dist/task/image/rotate/rotate.webgpu.d.ts +2 -0
  145. package/dist/task/image/rotate/rotate.webgpu.d.ts.map +1 -0
  146. package/dist/task/image/sepia/ImageSepiaTask.d.ts +25 -0
  147. package/dist/task/image/sepia/ImageSepiaTask.d.ts.map +1 -0
  148. package/dist/task/image/sepia/sepia.cpu.d.ts +2 -0
  149. package/dist/task/image/sepia/sepia.cpu.d.ts.map +1 -0
  150. package/dist/task/image/sepia/sepia.sharp.d.ts +2 -0
  151. package/dist/task/image/sepia/sepia.sharp.d.ts.map +1 -0
  152. package/dist/task/image/sepia/sepia.webgpu.d.ts +2 -0
  153. package/dist/task/image/sepia/sepia.webgpu.d.ts.map +1 -0
  154. package/dist/task/image/{ImageTextTask.d.ts → text/ImageTextTask.d.ts} +18 -104
  155. package/dist/task/image/text/ImageTextTask.d.ts.map +1 -0
  156. package/dist/task/image/threshold/ImageThresholdTask.d.ts +28 -0
  157. package/dist/task/image/threshold/ImageThresholdTask.d.ts.map +1 -0
  158. package/dist/task/image/threshold/threshold.cpu.d.ts +4 -0
  159. package/dist/task/image/threshold/threshold.cpu.d.ts.map +1 -0
  160. package/dist/task/image/threshold/threshold.sharp.d.ts +2 -0
  161. package/dist/task/image/threshold/threshold.sharp.d.ts.map +1 -0
  162. package/dist/task/image/threshold/threshold.webgpu.d.ts +2 -0
  163. package/dist/task/image/threshold/threshold.webgpu.d.ts.map +1 -0
  164. package/dist/task/image/tint/ImageTintTask.d.ts +30 -0
  165. package/dist/task/image/tint/ImageTintTask.d.ts.map +1 -0
  166. package/dist/task/image/tint/tint.cpu.d.ts +11 -0
  167. package/dist/task/image/tint/tint.cpu.d.ts.map +1 -0
  168. package/dist/task/image/tint/tint.sharp.d.ts +2 -0
  169. package/dist/task/image/tint/tint.sharp.d.ts.map +1 -0
  170. package/dist/task/image/tint/tint.webgpu.d.ts +2 -0
  171. package/dist/task/image/tint/tint.webgpu.d.ts.map +1 -0
  172. package/dist/task/image/transparency/ImageTransparencyTask.d.ts +28 -0
  173. package/dist/task/image/transparency/ImageTransparencyTask.d.ts.map +1 -0
  174. package/dist/task/image/transparency/transparency.cpu.d.ts +4 -0
  175. package/dist/task/image/transparency/transparency.cpu.d.ts.map +1 -0
  176. package/dist/task/image/transparency/transparency.webgpu.d.ts +2 -0
  177. package/dist/task/image/transparency/transparency.webgpu.d.ts.map +1 -0
  178. package/dist/task/string/StringConcatTask.d.ts +3 -2
  179. package/dist/task/string/StringConcatTask.d.ts.map +1 -1
  180. package/dist/task/string/StringIncludesTask.d.ts +3 -2
  181. package/dist/task/string/StringIncludesTask.d.ts.map +1 -1
  182. package/dist/task/string/StringJoinTask.d.ts +3 -2
  183. package/dist/task/string/StringJoinTask.d.ts.map +1 -1
  184. package/dist/task/string/StringLengthTask.d.ts +3 -2
  185. package/dist/task/string/StringLengthTask.d.ts.map +1 -1
  186. package/dist/task/string/StringLowerCaseTask.d.ts +3 -2
  187. package/dist/task/string/StringLowerCaseTask.d.ts.map +1 -1
  188. package/dist/task/string/StringReplaceTask.d.ts +3 -2
  189. package/dist/task/string/StringReplaceTask.d.ts.map +1 -1
  190. package/dist/task/string/StringSliceTask.d.ts +3 -2
  191. package/dist/task/string/StringSliceTask.d.ts.map +1 -1
  192. package/dist/task/string/StringTemplateTask.d.ts +3 -2
  193. package/dist/task/string/StringTemplateTask.d.ts.map +1 -1
  194. package/dist/task/string/StringTrimTask.d.ts +3 -2
  195. package/dist/task/string/StringTrimTask.d.ts.map +1 -1
  196. package/dist/task/string/StringUpperCaseTask.d.ts +3 -2
  197. package/dist/task/string/StringUpperCaseTask.d.ts.map +1 -1
  198. package/package.json +9 -9
  199. package/dist/task/image/ImageBlurTask.d.ts +0 -247
  200. package/dist/task/image/ImageBlurTask.d.ts.map +0 -1
  201. package/dist/task/image/ImageBorderTask.d.ts +0 -327
  202. package/dist/task/image/ImageBorderTask.d.ts.map +0 -1
  203. package/dist/task/image/ImageBrightnessTask.d.ts +0 -247
  204. package/dist/task/image/ImageBrightnessTask.d.ts.map +0 -1
  205. package/dist/task/image/ImageContrastTask.d.ts +0 -247
  206. package/dist/task/image/ImageContrastTask.d.ts.map +0 -1
  207. package/dist/task/image/ImageCropTask.d.ts +0 -279
  208. package/dist/task/image/ImageCropTask.d.ts.map +0 -1
  209. package/dist/task/image/ImageFlipTask.d.ts +0 -243
  210. package/dist/task/image/ImageFlipTask.d.ts.map +0 -1
  211. package/dist/task/image/ImageGrayscaleTask.d.ts +0 -231
  212. package/dist/task/image/ImageGrayscaleTask.d.ts.map +0 -1
  213. package/dist/task/image/ImageInvertTask.d.ts +0 -231
  214. package/dist/task/image/ImageInvertTask.d.ts.map +0 -1
  215. package/dist/task/image/ImagePixelateTask.d.ts +0 -245
  216. package/dist/task/image/ImagePixelateTask.d.ts.map +0 -1
  217. package/dist/task/image/ImagePosterizeTask.d.ts +0 -247
  218. package/dist/task/image/ImagePosterizeTask.d.ts.map +0 -1
  219. package/dist/task/image/ImageResizeTask.d.ts +0 -255
  220. package/dist/task/image/ImageResizeTask.d.ts.map +0 -1
  221. package/dist/task/image/ImageRotateTask.d.ts +0 -243
  222. package/dist/task/image/ImageRotateTask.d.ts.map +0 -1
  223. package/dist/task/image/ImageSepiaTask.d.ts +0 -231
  224. package/dist/task/image/ImageSepiaTask.d.ts.map +0 -1
  225. package/dist/task/image/ImageTextTask.d.ts.map +0 -1
  226. package/dist/task/image/ImageThresholdTask.d.ts +0 -247
  227. package/dist/task/image/ImageThresholdTask.d.ts.map +0 -1
  228. package/dist/task/image/ImageTintTask.d.ts +0 -329
  229. package/dist/task/image/ImageTintTask.d.ts.map +0 -1
  230. package/dist/task/image/ImageTransparencyTask.d.ts +0 -245
  231. package/dist/task/image/ImageTransparencyTask.d.ts.map +0 -1
  232. package/dist/task/image/ImageWatermarkTask.d.ts +0 -275
  233. package/dist/task/image/ImageWatermarkTask.d.ts.map +0 -1
  234. package/dist/task/image/imageTaskIo.d.ts +0 -20
  235. package/dist/task/image/imageTaskIo.d.ts.map +0 -1
package/dist/node.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 = [
@@ -2155,11 +2754,11 @@ class ArrayTaskRunner extends GraphAsTaskRunner {
2155
2754
  async executeTaskChildren(_input) {
2156
2755
  return super.executeTaskChildren({});
2157
2756
  }
2158
- async executeTaskChildrenReactive() {
2159
- return this.task.subGraph.runReactive({});
2757
+ async executeTaskChildrenPreview() {
2758
+ return this.task.subGraph.runPreview({});
2160
2759
  }
2161
- async executeTaskReactive(input, output) {
2162
- await super.executeTaskReactive(input, output);
2760
+ async executeTaskPreview(input) {
2761
+ await super.executeTaskPreview(input);
2163
2762
  if (this.task.hasChildren()) {
2164
2763
  this.task.runOutputData = this.task.executeMerge(input, this.task.runOutputData);
2165
2764
  }
@@ -4856,6 +5455,29 @@ import {
4856
5455
  Task as Task36,
4857
5456
  Workflow as Workflow11
4858
5457
  } from "@workglow/task-graph";
5458
+ function formatDate(input) {
5459
+ const dateInput = /^\d+$/.test(input.value) ? Number(input.value) : input.value;
5460
+ const date = new Date(dateInput);
5461
+ if (isNaN(date.getTime())) {
5462
+ throw new Error(`Invalid date: ${input.value}`);
5463
+ }
5464
+ const format = input.format ?? "iso";
5465
+ const locale = input.locale;
5466
+ const timeZone = input.timeZone;
5467
+ switch (format) {
5468
+ case "iso":
5469
+ return date.toISOString();
5470
+ case "date":
5471
+ return date.toLocaleDateString(locale, timeZone ? { timeZone } : undefined);
5472
+ case "time":
5473
+ return date.toLocaleTimeString(locale, timeZone ? { timeZone } : undefined);
5474
+ case "unix":
5475
+ return String(date.getTime());
5476
+ case "datetime":
5477
+ default:
5478
+ return date.toLocaleString(locale, timeZone ? { timeZone } : undefined);
5479
+ }
5480
+ }
4859
5481
  var inputSchema36 = {
4860
5482
  type: "object",
4861
5483
  properties: {
@@ -4910,35 +5532,11 @@ class DateFormatTask extends Task36 {
4910
5532
  static outputSchema() {
4911
5533
  return outputSchema36;
4912
5534
  }
4913
- async executeReactive(input, _output, _context) {
4914
- const dateInput = /^\d+$/.test(input.value) ? Number(input.value) : input.value;
4915
- const date = new Date(dateInput);
4916
- if (isNaN(date.getTime())) {
4917
- throw new Error(`Invalid date: ${input.value}`);
4918
- }
4919
- const format = input.format ?? "iso";
4920
- const locale = input.locale;
4921
- const timeZone = input.timeZone;
4922
- let result;
4923
- switch (format) {
4924
- case "iso":
4925
- result = date.toISOString();
4926
- break;
4927
- case "date":
4928
- result = date.toLocaleDateString(locale, timeZone ? { timeZone } : undefined);
4929
- break;
4930
- case "time":
4931
- result = date.toLocaleTimeString(locale, timeZone ? { timeZone } : undefined);
4932
- break;
4933
- case "unix":
4934
- result = String(date.getTime());
4935
- break;
4936
- case "datetime":
4937
- default:
4938
- result = date.toLocaleString(locale, timeZone ? { timeZone } : undefined);
4939
- break;
4940
- }
4941
- return { result };
5535
+ async execute(input, _context) {
5536
+ return { result: formatDate(input) };
5537
+ }
5538
+ async executePreview(input, _context) {
5539
+ return { result: formatDate(input) };
4942
5540
  }
4943
5541
  }
4944
5542
  Workflow11.prototype.dateFormat = CreateWorkflow10(DateFormatTask);
@@ -4970,6 +5568,17 @@ var outputSchema37 = {
4970
5568
  properties: {},
4971
5569
  additionalProperties: true
4972
5570
  };
5571
+ function logAndPassthrough(input, log_level) {
5572
+ const inputRecord = input;
5573
+ if (log_level === "dir") {
5574
+ console.dir(inputRecord, { depth: null });
5575
+ } else {
5576
+ console[log_level](inputRecord);
5577
+ }
5578
+ const output = {};
5579
+ Object.assign(output, inputRecord);
5580
+ return output;
5581
+ }
4973
5582
 
4974
5583
  class DebugLogTask extends Task37 {
4975
5584
  static type = "DebugLogTask";
@@ -4989,16 +5598,11 @@ class DebugLogTask extends Task37 {
4989
5598
  static outputSchema() {
4990
5599
  return outputSchema37;
4991
5600
  }
4992
- async executeReactive(input, output) {
4993
- const log_level = this.config.log_level ?? DEFAULT_LOG_LEVEL;
4994
- const inputRecord = input;
4995
- if (log_level === "dir") {
4996
- console.dir(inputRecord, { depth: null });
4997
- } else {
4998
- console[log_level](inputRecord);
4999
- }
5000
- Object.assign(output, inputRecord);
5001
- return output;
5601
+ async execute(input) {
5602
+ return logAndPassthrough(input, this.config.log_level ?? DEFAULT_LOG_LEVEL);
5603
+ }
5604
+ async executePreview(input) {
5605
+ return logAndPassthrough(input, this.config.log_level ?? DEFAULT_LOG_LEVEL);
5002
5606
  }
5003
5607
  }
5004
5608
  var debugLog = (input, config = {}) => {
@@ -5872,134 +6476,100 @@ ${input.prompt}` : input.prompt : this.config.message ?? "";
5872
6476
  }
5873
6477
  }
5874
6478
  Workflow16.prototype.humanInput = CreateWorkflow15(HumanInputTask);
5875
- // 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
5876
6489
  import {
5877
- CreateWorkflow as CreateWorkflow16,
5878
- Task as Task42,
5879
- Workflow as Workflow17
6490
+ Task as Task42
5880
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";
5881
6500
 
5882
- // src/task/image/ImageSchemas.ts
5883
- import { FromSchemaDefaultOptions } from "@workglow/util/schema";
5884
- var ImageBinaryType = null;
5885
- var ImageBinarySchemaOptions = {
5886
- ...FromSchemaDefaultOptions,
5887
- deserialize: [
5888
- {
5889
- pattern: { type: "object", format: "image:ImageBinary" },
5890
- output: ImageBinaryType
5891
- }
5892
- ]
5893
- };
5894
- var ImageBinarySchema = (annotations = {}) => ({
5895
- type: "object",
5896
- properties: {
5897
- data: {
5898
- type: "array",
5899
- items: { type: "number", format: "Uint8Clamped" },
5900
- format: "Uint8ClampedArray",
5901
- title: "Data",
5902
- description: "Pixel data of the image"
5903
- },
5904
- width: {
5905
- type: "integer",
5906
- minimum: 1,
5907
- title: "Width",
5908
- description: "Width in pixels"
5909
- },
5910
- height: {
5911
- type: "integer",
5912
- minimum: 1,
5913
- title: "Height",
5914
- description: "Height in pixels"
5915
- },
5916
- channels: {
5917
- type: "integer",
5918
- enum: [1, 3, 4],
5919
- title: "Channels",
5920
- description: "1 (gray), 3 (RGB), or 4 (RGBA)"
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;
5921
6508
  }
5922
- },
5923
- additionalProperties: false,
5924
- required: ["data", "width", "height", "channels"],
5925
- format: "image:ImageBinary",
5926
- title: "Image",
5927
- description: "Raw pixel image data",
5928
- ...annotations
5929
- });
5930
- var ImageBinaryOrDataUriSchema = (annotations = {}) => ({
5931
- oneOf: [
5932
- ImageBinarySchema(annotations),
5933
- {
5934
- type: "string",
5935
- format: "image:data-uri",
5936
- title: annotations.title ?? "Image",
5937
- description: annotations.description ?? "Image as ImageBinary or data URI (data:image/png;base64,...)"
6509
+ if (typeof image === "string" && image.startsWith("data:")) {
6510
+ return GpuImageFactory.fromDataUri(image);
5938
6511
  }
5939
- ]
5940
- });
5941
- var ColorSchema = (annotations = {}) => ({
5942
- type: "object",
5943
- properties: {
5944
- r: { type: "integer", minimum: 0, maximum: 255, title: "Red" },
5945
- g: { type: "integer", minimum: 0, maximum: 255, title: "Green" },
5946
- b: { type: "integer", minimum: 0, maximum: 255, title: "Blue" },
5947
- a: { type: "integer", minimum: 0, maximum: 255, title: "Alpha", default: 255 }
5948
- },
5949
- required: ["r", "g", "b"],
5950
- format: "color",
5951
- additionalProperties: false,
5952
- ...annotations
5953
- });
5954
- var HexColorSchema = (annotations = {}) => ({
5955
- type: "string",
5956
- format: "color",
5957
- pattern: "^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$",
5958
- title: "Color (hex)",
5959
- description: "Color as a `#RRGGBB[AA]` or `#RGB[A]` hex string",
5960
- ...annotations
5961
- });
5962
- var ColorValueSchema = (annotations = {}) => ({
5963
- oneOf: [
5964
- ColorSchema(),
5965
- HexColorSchema({
5966
- title: annotations.title ?? "Color",
5967
- description: annotations.description ?? "Color as {r,g,b,a} object or `#RRGGBB[AA]` / `#RGB[A]` hex string"
5968
- })
5969
- ],
5970
- ...annotations
5971
- });
5972
- var ColorObjectType = null;
5973
- var ColorFromSchemaOptions = {
5974
- ...FromSchemaDefaultOptions,
5975
- deserialize: [
5976
- {
5977
- pattern: { type: "object", format: "color" },
5978
- output: ColorObjectType
6512
+ if (typeof Blob !== "undefined" && image instanceof Blob) {
6513
+ return GpuImageFactory.fromBlob(image);
5979
6514
  }
5980
- ]
5981
- };
5982
-
5983
- // src/task/image/imageTaskIo.ts
5984
- import { Image, getImageRasterCodec } from "@workglow/util/media";
5985
- async function produceImageOutput(inputImage, run) {
5986
- const image = Image.is(inputImage) ? inputImage : Image.from(inputImage);
5987
- const pixels = await image.getPixels();
5988
- const out = await run(pixels);
5989
- if (image.kind === "dataUri") {
5990
- const mime = image.mimeType ?? "image/png";
5991
- return getImageRasterCodec().encodeDataUri(out, mime);
5992
- }
5993
- return out;
5994
- }
5995
-
5996
- // src/task/image/ImageBlurTask.ts
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";
5997
6567
  var inputSchema41 = {
5998
6568
  type: "object",
5999
6569
  properties: {
6000
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6570
+ image: GpuImageSchema({ title: "Image", description: "Source image" }),
6001
6571
  radius: {
6002
- type: "integer",
6572
+ type: "number",
6003
6573
  title: "Radius",
6004
6574
  description: "Blur radius (1-10)",
6005
6575
  minimum: 1,
@@ -6012,14 +6582,12 @@ var inputSchema41 = {
6012
6582
  };
6013
6583
  var outputSchema40 = {
6014
6584
  type: "object",
6015
- properties: {
6016
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Blurred image" })
6017
- },
6585
+ properties: { image: GpuImageSchema({ title: "Image", description: "Blurred image" }) },
6018
6586
  required: ["image"],
6019
6587
  additionalProperties: false
6020
6588
  };
6021
6589
 
6022
- class ImageBlurTask extends Task42 {
6590
+ class ImageBlurTask extends ImageFilterTask {
6023
6591
  static type = "ImageBlurTask";
6024
6592
  static category = "Image";
6025
6593
  static title = "Blur Image";
@@ -6030,84 +6598,60 @@ class ImageBlurTask extends Task42 {
6030
6598
  static outputSchema() {
6031
6599
  return outputSchema40;
6032
6600
  }
6033
- async executeReactive(input, _output, _context) {
6034
- const { radius = 1 } = input;
6035
- const image = await produceImageOutput(input.image, (img) => {
6036
- const { data: src, width, height, channels } = img;
6037
- const kernelSize = radius * 2 + 1;
6038
- const tmp = new Uint8ClampedArray(src.length);
6039
- for (let y = 0;y < height; y++) {
6040
- for (let c = 0;c < channels; c++) {
6041
- let sum = 0;
6042
- for (let k = -radius;k <= radius; k++) {
6043
- const x = Math.max(0, Math.min(k, width - 1));
6044
- sum += src[(y * width + x) * channels + c];
6045
- }
6046
- tmp[y * width * channels + c] = sum / kernelSize + 0.5 | 0;
6047
- for (let x = 1;x < width; x++) {
6048
- const addX = Math.min(x + radius, width - 1);
6049
- const removeX = Math.max(x - radius - 1, 0);
6050
- sum += src[(y * width + addX) * channels + c] - src[(y * width + removeX) * channels + c];
6051
- tmp[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6052
- }
6053
- }
6054
- }
6055
- const dst = new Uint8ClampedArray(src.length);
6056
- for (let x = 0;x < width; x++) {
6057
- for (let c = 0;c < channels; c++) {
6058
- let sum = 0;
6059
- for (let k = -radius;k <= radius; k++) {
6060
- const y = Math.max(0, Math.min(k, height - 1));
6061
- sum += tmp[(y * width + x) * channels + c];
6062
- }
6063
- dst[x * channels + c] = sum / kernelSize + 0.5 | 0;
6064
- for (let y = 1;y < height; y++) {
6065
- const addY = Math.min(y + radius, height - 1);
6066
- const removeY = Math.max(y - radius - 1, 0);
6067
- sum += tmp[(addY * width + x) * channels + c] - tmp[(removeY * width + x) * channels + c];
6068
- dst[(y * width + x) * channels + c] = sum / kernelSize + 0.5 | 0;
6069
- }
6070
- }
6071
- }
6072
- return { data: dst, width, height, channels };
6073
- });
6074
- return { image };
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)) };
6075
6607
  }
6076
6608
  }
6077
6609
  Workflow17.prototype.imageBlur = CreateWorkflow16(ImageBlurTask);
6078
- // src/task/image/ImageBorderTask.ts
6079
- import {
6080
- CreateWorkflow as CreateWorkflow17,
6081
- Task as Task43,
6082
- Workflow as Workflow18
6083
- } from "@workglow/task-graph";
6084
- import { resolveColor } from "@workglow/util/media";
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";
6085
6613
  var inputSchema42 = {
6086
6614
  type: "object",
6087
6615
  properties: {
6088
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6616
+ image: GpuImageSchema2({ title: "Image", description: "Source image" }),
6089
6617
  borderWidth: {
6090
6618
  type: "integer",
6091
6619
  title: "Border Width",
6092
6620
  description: "Border width in pixels",
6093
6621
  minimum: 1,
6094
- default: 1
6622
+ default: 10
6095
6623
  },
6096
- color: ColorValueSchema({ title: "Color", description: "Border color" })
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"
6642
+ }
6097
6643
  },
6098
6644
  required: ["image", "color"],
6099
6645
  additionalProperties: false
6100
6646
  };
6101
6647
  var outputSchema41 = {
6102
6648
  type: "object",
6103
- properties: {
6104
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Image with border" })
6105
- },
6649
+ properties: { image: GpuImageSchema2({ title: "Image", description: "Image with border" }) },
6106
6650
  required: ["image"],
6107
6651
  additionalProperties: false
6108
6652
  };
6109
6653
 
6110
- class ImageBorderTask extends Task43 {
6654
+ class ImageBorderTask extends ImageFilterTask {
6111
6655
  static type = "ImageBorderTask";
6112
6656
  static category = "Image";
6113
6657
  static title = "Add Border";
@@ -6118,51 +6662,25 @@ class ImageBorderTask extends Task43 {
6118
6662
  static outputSchema() {
6119
6663
  return outputSchema41;
6120
6664
  }
6121
- async executeReactive(input, _output, _context) {
6122
- const { borderWidth: bw = 1 } = input;
6123
- const color = resolveColor(input.color);
6124
- const image = await produceImageOutput(input.image, (img) => {
6125
- const { data: src, width: srcW, height: srcH, channels: srcCh } = img;
6126
- const outCh = 4;
6127
- const dstW = srcW + bw * 2;
6128
- const dstH = srcH + bw * 2;
6129
- const dst = new Uint8ClampedArray(dstW * dstH * outCh);
6130
- const r = color.r;
6131
- const g = color.g;
6132
- const b = color.b;
6133
- const a = color.a;
6134
- for (let i = 0;i < dst.length; i += outCh) {
6135
- dst[i] = r;
6136
- dst[i + 1] = g;
6137
- dst[i + 2] = b;
6138
- dst[i + 3] = a;
6139
- }
6140
- for (let y = 0;y < srcH; y++) {
6141
- for (let x = 0;x < srcW; x++) {
6142
- const srcIdx = (y * srcW + x) * srcCh;
6143
- const dstIdx = ((y + bw) * dstW + (x + bw)) * outCh;
6144
- dst[dstIdx] = src[srcIdx];
6145
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
6146
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
6147
- dst[dstIdx + 3] = srcCh === 4 ? src[srcIdx + 3] : 255;
6148
- }
6149
- }
6150
- return { data: dst, width: dstW, height: dstH, channels: outCh };
6151
- });
6152
- return { image };
6665
+ filterName = "border";
6666
+ opParams(input) {
6667
+ return {
6668
+ borderWidth: input.borderWidth ?? 10,
6669
+ color: input.color
6670
+ };
6671
+ }
6672
+ scalePreviewParams({ borderWidth, color }, s) {
6673
+ return { borderWidth: Math.max(1, Math.round(borderWidth * s)), color };
6153
6674
  }
6154
6675
  }
6155
6676
  Workflow18.prototype.imageBorder = CreateWorkflow17(ImageBorderTask);
6156
- // src/task/image/ImageBrightnessTask.ts
6157
- import {
6158
- CreateWorkflow as CreateWorkflow18,
6159
- Task as Task44,
6160
- Workflow as Workflow19
6161
- } from "@workglow/task-graph";
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";
6162
6680
  var inputSchema43 = {
6163
6681
  type: "object",
6164
6682
  properties: {
6165
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6683
+ image: GpuImageSchema3({ title: "Image", description: "Source image" }),
6166
6684
  amount: {
6167
6685
  type: "number",
6168
6686
  title: "Amount",
@@ -6177,14 +6695,12 @@ var inputSchema43 = {
6177
6695
  };
6178
6696
  var outputSchema42 = {
6179
6697
  type: "object",
6180
- properties: {
6181
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Brightness-adjusted image" })
6182
- },
6698
+ properties: { image: GpuImageSchema3({ title: "Image", description: "Brightness-adjusted image" }) },
6183
6699
  required: ["image"],
6184
6700
  additionalProperties: false
6185
6701
  };
6186
6702
 
6187
- class ImageBrightnessTask extends Task44 {
6703
+ class ImageBrightnessTask extends ImageFilterTask {
6188
6704
  static type = "ImageBrightnessTask";
6189
6705
  static category = "Image";
6190
6706
  static title = "Adjust Brightness";
@@ -6195,39 +6711,19 @@ class ImageBrightnessTask extends Task44 {
6195
6711
  static outputSchema() {
6196
6712
  return outputSchema42;
6197
6713
  }
6198
- async executeReactive(input, _output, _context) {
6199
- const amount = input.amount ?? 0;
6200
- const image = await produceImageOutput(input.image, (img) => {
6201
- const { data: src, width, height, channels } = img;
6202
- const dst = new Uint8ClampedArray(src.length);
6203
- if (channels === 4) {
6204
- for (let i = 0;i < src.length; i += 4) {
6205
- dst[i] = src[i] + amount;
6206
- dst[i + 1] = src[i + 1] + amount;
6207
- dst[i + 2] = src[i + 2] + amount;
6208
- dst[i + 3] = src[i + 3];
6209
- }
6210
- } else {
6211
- for (let i = 0;i < src.length; i++) {
6212
- dst[i] = src[i] + amount;
6213
- }
6214
- }
6215
- return { data: dst, width, height, channels };
6216
- });
6217
- return { image };
6714
+ filterName = "brightness";
6715
+ opParams(input) {
6716
+ return { amount: input.amount ?? 0 };
6218
6717
  }
6219
6718
  }
6220
6719
  Workflow19.prototype.imageBrightness = CreateWorkflow18(ImageBrightnessTask);
6221
- // src/task/image/ImageContrastTask.ts
6222
- import {
6223
- CreateWorkflow as CreateWorkflow19,
6224
- Task as Task45,
6225
- Workflow as Workflow20
6226
- } from "@workglow/task-graph";
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";
6227
6723
  var inputSchema44 = {
6228
6724
  type: "object",
6229
6725
  properties: {
6230
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6726
+ image: GpuImageSchema4({ title: "Image", description: "Source image" }),
6231
6727
  amount: {
6232
6728
  type: "number",
6233
6729
  title: "Amount",
@@ -6242,14 +6738,12 @@ var inputSchema44 = {
6242
6738
  };
6243
6739
  var outputSchema43 = {
6244
6740
  type: "object",
6245
- properties: {
6246
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Contrast-adjusted image" })
6247
- },
6741
+ properties: { image: GpuImageSchema4({ title: "Image", description: "Contrast-adjusted image" }) },
6248
6742
  required: ["image"],
6249
6743
  additionalProperties: false
6250
6744
  };
6251
6745
 
6252
- class ImageContrastTask extends Task45 {
6746
+ class ImageContrastTask extends ImageFilterTask {
6253
6747
  static type = "ImageContrastTask";
6254
6748
  static category = "Image";
6255
6749
  static title = "Adjust Contrast";
@@ -6260,62 +6754,35 @@ class ImageContrastTask extends Task45 {
6260
6754
  static outputSchema() {
6261
6755
  return outputSchema43;
6262
6756
  }
6263
- async executeReactive(input, _output, _context) {
6264
- const amount = input.amount ?? 0;
6265
- const image = await produceImageOutput(input.image, (img) => {
6266
- const { data: src, width, height, channels } = img;
6267
- const factor = 259 * (amount + 255) / (255 * (259 - amount));
6268
- const lut = new Uint8ClampedArray(256);
6269
- for (let i = 0;i < 256; i++) {
6270
- lut[i] = factor * (i - 128) + 128;
6271
- }
6272
- const dst = new Uint8ClampedArray(src.length);
6273
- if (channels === 4) {
6274
- for (let i = 0;i < src.length; i += 4) {
6275
- dst[i] = lut[src[i]];
6276
- dst[i + 1] = lut[src[i + 1]];
6277
- dst[i + 2] = lut[src[i + 2]];
6278
- dst[i + 3] = src[i + 3];
6279
- }
6280
- } else {
6281
- for (let i = 0;i < src.length; i++) {
6282
- dst[i] = lut[src[i]];
6283
- }
6284
- }
6285
- return { data: dst, width, height, channels };
6286
- });
6287
- return { image };
6757
+ filterName = "contrast";
6758
+ opParams(input) {
6759
+ return { amount: input.amount ?? 0 };
6288
6760
  }
6289
6761
  }
6290
6762
  Workflow20.prototype.imageContrast = CreateWorkflow19(ImageContrastTask);
6291
- // src/task/image/ImageCropTask.ts
6292
- import {
6293
- CreateWorkflow as CreateWorkflow20,
6294
- Task as Task46,
6295
- Workflow as Workflow21
6296
- } from "@workglow/task-graph";
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";
6297
6766
  var inputSchema45 = {
6298
6767
  type: "object",
6299
6768
  properties: {
6300
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6301
- x: { type: "integer", title: "X", description: "Left offset", minimum: 0 },
6302
- 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 },
6303
6772
  width: { type: "integer", title: "Width", description: "Crop width", minimum: 1 },
6304
6773
  height: { type: "integer", title: "Height", description: "Crop height", minimum: 1 }
6305
6774
  },
6306
- required: ["image", "x", "y", "width", "height"],
6775
+ required: ["image", "left", "top", "width", "height"],
6307
6776
  additionalProperties: false
6308
6777
  };
6309
6778
  var outputSchema44 = {
6310
6779
  type: "object",
6311
- properties: {
6312
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Cropped image" })
6313
- },
6780
+ properties: { image: GpuImageSchema5({ title: "Image", description: "Cropped image" }) },
6314
6781
  required: ["image"],
6315
6782
  additionalProperties: false
6316
6783
  };
6317
6784
 
6318
- class ImageCropTask extends Task46 {
6785
+ class ImageCropTask extends ImageFilterTask {
6319
6786
  static type = "ImageCropTask";
6320
6787
  static category = "Image";
6321
6788
  static title = "Crop Image";
@@ -6326,48 +6793,38 @@ class ImageCropTask extends Task46 {
6326
6793
  static outputSchema() {
6327
6794
  return outputSchema44;
6328
6795
  }
6329
- async executeReactive(input, _output, _context) {
6330
- const { x: rawX, y: rawY, width: rawW, height: rawH } = input;
6331
- const image = await produceImageOutput(input.image, (img) => {
6332
- const { data: src, width: srcW, height: srcH, channels } = img;
6333
- if (srcW < 1 || srcH < 1) {
6334
- throw new RangeError("Cannot crop an empty image");
6335
- }
6336
- if (rawX < 0 || rawX >= srcW || rawY < 0 || rawY >= srcH) {
6337
- throw new RangeError("Crop origin is outside the source image bounds");
6338
- }
6339
- const x = rawX;
6340
- const y = rawY;
6341
- const w = Math.min(rawW, srcW - x);
6342
- const h = Math.min(rawH, srcH - y);
6343
- const dst = new Uint8ClampedArray(w * h * channels);
6344
- const rowBytes = w * channels;
6345
- for (let row = 0;row < h; row++) {
6346
- const srcOffset = ((y + row) * srcW + x) * channels;
6347
- const dstOffset = row * rowBytes;
6348
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6349
- }
6350
- return { data: dst, width: w, height: h, channels };
6351
- });
6352
- return { image };
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
+ };
6804
+ }
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
+ };
6353
6812
  }
6354
6813
  }
6355
6814
  Workflow21.prototype.imageCrop = CreateWorkflow20(ImageCropTask);
6356
- // src/task/image/ImageFlipTask.ts
6357
- import {
6358
- CreateWorkflow as CreateWorkflow21,
6359
- Task as Task47,
6360
- Workflow as Workflow22
6361
- } from "@workglow/task-graph";
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";
6362
6818
  var inputSchema46 = {
6363
6819
  type: "object",
6364
6820
  properties: {
6365
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6821
+ image: GpuImageSchema6({ title: "Image", description: "Source image" }),
6366
6822
  direction: {
6367
6823
  type: "string",
6368
6824
  enum: ["horizontal", "vertical"],
6369
6825
  title: "Direction",
6370
- description: "Flip direction"
6826
+ description: "Flip direction",
6827
+ default: "horizontal"
6371
6828
  }
6372
6829
  },
6373
6830
  required: ["image", "direction"],
@@ -6375,14 +6832,12 @@ var inputSchema46 = {
6375
6832
  };
6376
6833
  var outputSchema45 = {
6377
6834
  type: "object",
6378
- properties: {
6379
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Flipped image" })
6380
- },
6835
+ properties: { image: GpuImageSchema6({ title: "Image", description: "Flipped image" }) },
6381
6836
  required: ["image"],
6382
6837
  additionalProperties: false
6383
6838
  };
6384
6839
 
6385
- class ImageFlipTask extends Task47 {
6840
+ class ImageFlipTask extends ImageFilterTask {
6386
6841
  static type = "ImageFlipTask";
6387
6842
  static category = "Image";
6388
6843
  static title = "Flip Image";
@@ -6393,59 +6848,29 @@ class ImageFlipTask extends Task47 {
6393
6848
  static outputSchema() {
6394
6849
  return outputSchema45;
6395
6850
  }
6396
- async executeReactive(input, _output, _context) {
6397
- const { direction } = input;
6398
- const image = await produceImageOutput(input.image, (img) => {
6399
- const { data: src, width, height, channels } = img;
6400
- const dst = new Uint8ClampedArray(src.length);
6401
- const rowBytes = width * channels;
6402
- if (direction === "vertical") {
6403
- for (let y = 0;y < height; y++) {
6404
- const srcOffset = y * rowBytes;
6405
- const dstOffset = (height - 1 - y) * rowBytes;
6406
- dst.set(src.subarray(srcOffset, srcOffset + rowBytes), dstOffset);
6407
- }
6408
- } else {
6409
- for (let y = 0;y < height; y++) {
6410
- for (let x = 0;x < width; x++) {
6411
- const srcIdx = (y * width + x) * channels;
6412
- const dstIdx = (y * width + (width - 1 - x)) * channels;
6413
- for (let c = 0;c < channels; c++) {
6414
- dst[dstIdx + c] = src[srcIdx + c];
6415
- }
6416
- }
6417
- }
6418
- }
6419
- return { data: dst, width, height, channels };
6420
- });
6421
- return { image };
6851
+ filterName = "flip";
6852
+ opParams(input) {
6853
+ return { direction: input.direction ?? "horizontal" };
6422
6854
  }
6423
6855
  }
6424
6856
  Workflow22.prototype.imageFlip = CreateWorkflow21(ImageFlipTask);
6425
- // src/task/image/ImageGrayscaleTask.ts
6426
- import {
6427
- CreateWorkflow as CreateWorkflow22,
6428
- Task as Task48,
6429
- Workflow as Workflow23
6430
- } from "@workglow/task-graph";
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";
6431
6860
  var inputSchema47 = {
6432
6861
  type: "object",
6433
- properties: {
6434
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" })
6435
- },
6862
+ properties: { image: GpuImageSchema7({ title: "Image", description: "Source image" }) },
6436
6863
  required: ["image"],
6437
6864
  additionalProperties: false
6438
6865
  };
6439
6866
  var outputSchema46 = {
6440
6867
  type: "object",
6441
- properties: {
6442
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Grayscale image" })
6443
- },
6868
+ properties: { image: GpuImageSchema7({ title: "Image", description: "Grayscale image" }) },
6444
6869
  required: ["image"],
6445
6870
  additionalProperties: false
6446
6871
  };
6447
6872
 
6448
- class ImageGrayscaleTask extends Task48 {
6873
+ class ImageGrayscaleTask extends ImageFilterTask {
6449
6874
  static type = "ImageGrayscaleTask";
6450
6875
  static category = "Image";
6451
6876
  static title = "Grayscale";
@@ -6456,48 +6881,29 @@ class ImageGrayscaleTask extends Task48 {
6456
6881
  static outputSchema() {
6457
6882
  return outputSchema46;
6458
6883
  }
6459
- async executeReactive(input, _output, _context) {
6460
- const image = await produceImageOutput(input.image, (img) => {
6461
- const { data: src, width, height, channels } = img;
6462
- if (channels === 1) {
6463
- return { data: new Uint8ClampedArray(src), width, height, channels: 1 };
6464
- }
6465
- const pixelCount = width * height;
6466
- const dst = new Uint8ClampedArray(pixelCount);
6467
- for (let i = 0;i < pixelCount; i++) {
6468
- const idx = i * channels;
6469
- dst[i] = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
6470
- }
6471
- return { data: dst, width, height, channels: 1 };
6472
- });
6473
- return { image };
6884
+ filterName = "grayscale";
6885
+ opParams(_input) {
6886
+ return;
6474
6887
  }
6475
6888
  }
6476
6889
  Workflow23.prototype.imageGrayscale = CreateWorkflow22(ImageGrayscaleTask);
6477
- // src/task/image/ImageInvertTask.ts
6478
- import {
6479
- CreateWorkflow as CreateWorkflow23,
6480
- Task as Task49,
6481
- Workflow as Workflow24
6482
- } from "@workglow/task-graph";
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";
6483
6893
  var inputSchema48 = {
6484
6894
  type: "object",
6485
- properties: {
6486
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" })
6487
- },
6895
+ properties: { image: GpuImageSchema8({ title: "Image", description: "Source image" }) },
6488
6896
  required: ["image"],
6489
6897
  additionalProperties: false
6490
6898
  };
6491
6899
  var outputSchema47 = {
6492
6900
  type: "object",
6493
- properties: {
6494
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Inverted image" })
6495
- },
6901
+ properties: { image: GpuImageSchema8({ title: "Image", description: "Inverted image" }) },
6496
6902
  required: ["image"],
6497
6903
  additionalProperties: false
6498
6904
  };
6499
6905
 
6500
- class ImageInvertTask extends Task49 {
6906
+ class ImageInvertTask extends ImageFilterTask {
6501
6907
  static type = "ImageInvertTask";
6502
6908
  static category = "Image";
6503
6909
  static title = "Invert Colors";
@@ -6508,44 +6914,26 @@ class ImageInvertTask extends Task49 {
6508
6914
  static outputSchema() {
6509
6915
  return outputSchema47;
6510
6916
  }
6511
- async executeReactive(input, _output, _context) {
6512
- const image = await produceImageOutput(input.image, (img) => {
6513
- const { data: src, width, height, channels } = img;
6514
- const dst = new Uint8ClampedArray(src.length);
6515
- if (channels === 4) {
6516
- for (let i = 0;i < src.length; i += 4) {
6517
- dst[i] = 255 - src[i];
6518
- dst[i + 1] = 255 - src[i + 1];
6519
- dst[i + 2] = 255 - src[i + 2];
6520
- dst[i + 3] = src[i + 3];
6521
- }
6522
- } else {
6523
- for (let i = 0;i < src.length; i++) {
6524
- dst[i] = 255 - src[i];
6525
- }
6526
- }
6527
- return { data: dst, width, height, channels };
6528
- });
6529
- return { image };
6917
+ filterName = "invert";
6918
+ opParams(_input) {
6919
+ return;
6530
6920
  }
6531
6921
  }
6532
6922
  Workflow24.prototype.imageInvert = CreateWorkflow23(ImageInvertTask);
6533
- // src/task/image/ImagePixelateTask.ts
6534
- import {
6535
- CreateWorkflow as CreateWorkflow24,
6536
- Task as Task50,
6537
- Workflow as Workflow25
6538
- } from "@workglow/task-graph";
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";
6539
6926
  var inputSchema49 = {
6540
6927
  type: "object",
6541
6928
  properties: {
6542
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6929
+ image: GpuImageSchema9({ title: "Image", description: "Source image" }),
6543
6930
  blockSize: {
6544
6931
  type: "integer",
6545
6932
  title: "Block Size",
6546
6933
  description: "Size of each pixelation block",
6547
6934
  minimum: 2,
6548
- default: 8
6935
+ maximum: 64,
6936
+ default: 4
6549
6937
  }
6550
6938
  },
6551
6939
  required: ["image"],
@@ -6553,14 +6941,12 @@ var inputSchema49 = {
6553
6941
  };
6554
6942
  var outputSchema48 = {
6555
6943
  type: "object",
6556
- properties: {
6557
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Pixelated image" })
6558
- },
6944
+ properties: { image: GpuImageSchema9({ title: "Image", description: "Pixelated image" }) },
6559
6945
  required: ["image"],
6560
6946
  additionalProperties: false
6561
6947
  };
6562
6948
 
6563
- class ImagePixelateTask extends Task50 {
6949
+ class ImagePixelateTask extends ImageFilterTask {
6564
6950
  static type = "ImagePixelateTask";
6565
6951
  static category = "Image";
6566
6952
  static title = "Pixelate Image";
@@ -6571,58 +6957,28 @@ class ImagePixelateTask extends Task50 {
6571
6957
  static outputSchema() {
6572
6958
  return outputSchema48;
6573
6959
  }
6574
- async executeReactive(input, _output, _context) {
6575
- const { blockSize = 8 } = input;
6576
- const image = await produceImageOutput(input.image, (img) => {
6577
- const { data: src, width, height, channels } = img;
6578
- const dst = new Uint8ClampedArray(src.length);
6579
- for (let by = 0;by < height; by += blockSize) {
6580
- const blockH = Math.min(blockSize, height - by);
6581
- for (let bx = 0;bx < width; bx += blockSize) {
6582
- const blockW = Math.min(blockSize, width - bx);
6583
- const blockArea = blockW * blockH;
6584
- const sums = new Array(channels).fill(0);
6585
- for (let y = by;y < by + blockH; y++) {
6586
- for (let x = bx;x < bx + blockW; x++) {
6587
- const idx = (y * width + x) * channels;
6588
- for (let c = 0;c < channels; c++) {
6589
- sums[c] += src[idx + c];
6590
- }
6591
- }
6592
- }
6593
- const avg = sums.map((s) => s / blockArea + 0.5 | 0);
6594
- for (let y = by;y < by + blockH; y++) {
6595
- for (let x = bx;x < bx + blockW; x++) {
6596
- const idx = (y * width + x) * channels;
6597
- for (let c = 0;c < channels; c++) {
6598
- dst[idx + c] = avg[c];
6599
- }
6600
- }
6601
- }
6602
- }
6603
- }
6604
- return { data: dst, width, height, channels };
6605
- });
6606
- return { image };
6960
+ filterName = "pixelate";
6961
+ opParams(input) {
6962
+ return { blockSize: input.blockSize ?? 4 };
6963
+ }
6964
+ scalePreviewParams({ blockSize }, s) {
6965
+ return { blockSize: Math.max(1, Math.round(blockSize * s)) };
6607
6966
  }
6608
6967
  }
6609
6968
  Workflow25.prototype.imagePixelate = CreateWorkflow24(ImagePixelateTask);
6610
- // src/task/image/ImagePosterizeTask.ts
6611
- import {
6612
- CreateWorkflow as CreateWorkflow25,
6613
- Task as Task51,
6614
- Workflow as Workflow26
6615
- } from "@workglow/task-graph";
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";
6616
6972
  var inputSchema50 = {
6617
6973
  type: "object",
6618
6974
  properties: {
6619
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
6975
+ image: GpuImageSchema10({ title: "Image", description: "Source image" }),
6620
6976
  levels: {
6621
6977
  type: "integer",
6622
6978
  title: "Levels",
6623
- description: "Number of color levels per channel (2-32)",
6979
+ description: "Number of color levels per channel (2-16)",
6624
6980
  minimum: 2,
6625
- maximum: 32,
6981
+ maximum: 16,
6626
6982
  default: 4
6627
6983
  }
6628
6984
  },
@@ -6631,14 +6987,12 @@ var inputSchema50 = {
6631
6987
  };
6632
6988
  var outputSchema49 = {
6633
6989
  type: "object",
6634
- properties: {
6635
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Posterized image" })
6636
- },
6990
+ properties: { image: GpuImageSchema10({ title: "Image", description: "Posterized image" }) },
6637
6991
  required: ["image"],
6638
6992
  additionalProperties: false
6639
6993
  };
6640
6994
 
6641
- class ImagePosterizeTask extends Task51 {
6995
+ class ImagePosterizeTask extends ImageFilterTask {
6642
6996
  static type = "ImagePosterizeTask";
6643
6997
  static category = "Image";
6644
6998
  static title = "Posterize";
@@ -6649,52 +7003,34 @@ class ImagePosterizeTask extends Task51 {
6649
7003
  static outputSchema() {
6650
7004
  return outputSchema49;
6651
7005
  }
6652
- async executeReactive(input, _output, _context) {
6653
- const levels = input.levels ?? 4;
6654
- const image = await produceImageOutput(input.image, (img) => {
6655
- const { data: src, width, height, channels } = img;
6656
- const step = 255 / (levels - 1);
6657
- const lut = new Uint8ClampedArray(256);
6658
- for (let i = 0;i < 256; i++) {
6659
- lut[i] = Math.round(Math.round(i / step) * step);
6660
- }
6661
- const dst = new Uint8ClampedArray(src.length);
6662
- if (channels === 4) {
6663
- for (let i = 0;i < src.length; i += 4) {
6664
- dst[i] = lut[src[i]];
6665
- dst[i + 1] = lut[src[i + 1]];
6666
- dst[i + 2] = lut[src[i + 2]];
6667
- dst[i + 3] = src[i + 3];
6668
- }
6669
- } else {
6670
- for (let i = 0;i < src.length; i++) {
6671
- dst[i] = lut[src[i]];
6672
- }
6673
- }
6674
- return { data: dst, width, height, channels };
6675
- });
6676
- return { image };
7006
+ filterName = "posterize";
7007
+ opParams(input) {
7008
+ return { levels: input.levels ?? 4 };
6677
7009
  }
6678
7010
  }
6679
7011
  Workflow26.prototype.imagePosterize = CreateWorkflow25(ImagePosterizeTask);
6680
7012
  // src/task/image/imageRasterCodecRegistry.ts
6681
- import { getImageRasterCodec as getImageRasterCodec2, registerImageRasterCodec as registerImageRasterCodec2 } from "@workglow/util/media";
6682
- // src/task/image/ImageResizeTask.ts
6683
- import {
6684
- CreateWorkflow as CreateWorkflow26,
6685
- Task as Task52,
6686
- Workflow as Workflow27
6687
- } from "@workglow/task-graph";
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";
6688
7017
  var inputSchema51 = {
6689
7018
  type: "object",
6690
7019
  properties: {
6691
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7020
+ image: GpuImageSchema11({ title: "Image", description: "Source image" }),
6692
7021
  width: { type: "integer", title: "Width", description: "Target width in pixels", minimum: 1 },
6693
- height: {
6694
- type: "integer",
6695
- title: "Height",
6696
- description: "Target height in pixels",
6697
- 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"
6698
7034
  }
6699
7035
  },
6700
7036
  required: ["image", "width", "height"],
@@ -6702,14 +7038,12 @@ var inputSchema51 = {
6702
7038
  };
6703
7039
  var outputSchema50 = {
6704
7040
  type: "object",
6705
- properties: {
6706
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Resized image" })
6707
- },
7041
+ properties: { image: GpuImageSchema11({ title: "Image", description: "Resized image" }) },
6708
7042
  required: ["image"],
6709
7043
  additionalProperties: false
6710
7044
  };
6711
7045
 
6712
- class ImageResizeTask extends Task52 {
7046
+ class ImageResizeTask extends ImageFilterTask {
6713
7047
  static type = "ImageResizeTask";
6714
7048
  static category = "Image";
6715
7049
  static title = "Resize Image";
@@ -6720,43 +7054,42 @@ class ImageResizeTask extends Task52 {
6720
7054
  static outputSchema() {
6721
7055
  return outputSchema50;
6722
7056
  }
6723
- async executeReactive(input, _output, _context) {
6724
- const { width: dstW, height: dstH } = input;
6725
- const image = await produceImageOutput(input.image, (img) => {
6726
- const { data: src, width: srcW, height: srcH, channels } = img;
6727
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6728
- for (let dy = 0;dy < dstH; dy++) {
6729
- const srcY = Math.min(Math.floor(dy * srcH / dstH), srcH - 1);
6730
- for (let dx = 0;dx < dstW; dx++) {
6731
- const srcX = Math.min(Math.floor(dx * srcW / dstW), srcW - 1);
6732
- const srcIdx = (srcY * srcW + srcX) * channels;
6733
- const dstIdx = (dy * dstW + dx) * channels;
6734
- for (let c = 0;c < channels; c++) {
6735
- dst[dstIdx + c] = src[srcIdx + c];
6736
- }
6737
- }
6738
- }
6739
- return { data: dst, width: dstW, height: dstH, channels };
6740
- });
6741
- return { image };
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
+ };
7065
+ }
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
+ };
6742
7073
  }
6743
7074
  }
6744
7075
  Workflow27.prototype.imageResize = CreateWorkflow26(ImageResizeTask);
6745
- // src/task/image/ImageRotateTask.ts
6746
- import {
6747
- CreateWorkflow as CreateWorkflow27,
6748
- Task as Task53,
6749
- Workflow as Workflow28
6750
- } from "@workglow/task-graph";
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";
6751
7079
  var inputSchema52 = {
6752
7080
  type: "object",
6753
7081
  properties: {
6754
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7082
+ image: GpuImageSchema12({ title: "Image", description: "Source image" }),
6755
7083
  angle: {
6756
7084
  type: "integer",
6757
7085
  enum: [90, 180, 270],
6758
7086
  title: "Angle",
6759
7087
  description: "Rotation angle in degrees (clockwise)"
7088
+ },
7089
+ background: {
7090
+ type: "string",
7091
+ title: "Background",
7092
+ description: "Background color for rotation (hex string)"
6760
7093
  }
6761
7094
  },
6762
7095
  required: ["image", "angle"],
@@ -6764,14 +7097,12 @@ var inputSchema52 = {
6764
7097
  };
6765
7098
  var outputSchema51 = {
6766
7099
  type: "object",
6767
- properties: {
6768
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Rotated image" })
6769
- },
7100
+ properties: { image: GpuImageSchema12({ title: "Image", description: "Rotated image" }) },
6770
7101
  required: ["image"],
6771
7102
  additionalProperties: false
6772
7103
  };
6773
7104
 
6774
- class ImageRotateTask extends Task53 {
7105
+ class ImageRotateTask extends ImageFilterTask {
6775
7106
  static type = "ImageRotateTask";
6776
7107
  static category = "Image";
6777
7108
  static title = "Rotate Image";
@@ -6782,64 +7113,87 @@ class ImageRotateTask extends Task53 {
6782
7113
  static outputSchema() {
6783
7114
  return outputSchema51;
6784
7115
  }
6785
- async executeReactive(input, _output, _context) {
6786
- const { angle } = input;
6787
- const image = await produceImageOutput(input.image, (img) => {
6788
- const { data: src, width: srcW, height: srcH, channels } = img;
6789
- const swap = angle === 90 || angle === 270;
6790
- const dstW = swap ? srcH : srcW;
6791
- const dstH = swap ? srcW : srcH;
6792
- const dst = new Uint8ClampedArray(dstW * dstH * channels);
6793
- for (let sy = 0;sy < srcH; sy++) {
6794
- for (let sx = 0;sx < srcW; sx++) {
6795
- let dx, dy;
6796
- if (angle === 90) {
6797
- dx = srcH - 1 - sy;
6798
- dy = sx;
6799
- } else if (angle === 180) {
6800
- dx = srcW - 1 - sx;
6801
- dy = srcH - 1 - sy;
6802
- } else {
6803
- dx = sy;
6804
- dy = srcW - 1 - sx;
6805
- }
6806
- const srcIdx = (sy * srcW + sx) * channels;
6807
- const dstIdx = (dy * dstW + dx) * channels;
6808
- for (let c = 0;c < channels; c++) {
6809
- dst[dstIdx + c] = src[srcIdx + c];
6810
- }
6811
- }
6812
- }
6813
- return { data: dst, width: dstW, height: dstH, channels };
6814
- });
6815
- return { image };
7116
+ filterName = "rotate";
7117
+ opParams(input) {
7118
+ return {
7119
+ angle: input.angle,
7120
+ background: input.background
7121
+ };
6816
7122
  }
6817
7123
  }
6818
7124
  Workflow28.prototype.imageRotate = CreateWorkflow27(ImageRotateTask);
6819
- // src/task/image/ImageSepiaTask.ts
6820
- import {
6821
- CreateWorkflow as CreateWorkflow28,
6822
- Task as Task54,
6823
- Workflow as Workflow29
6824
- } from "@workglow/task-graph";
6825
- var inputSchema53 = {
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 = {}) => ({
6826
7131
  type: "object",
6827
7132
  properties: {
6828
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" })
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 }
6829
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
7177
+ }
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";
7183
+ var inputSchema53 = {
7184
+ type: "object",
7185
+ properties: { image: GpuImageSchema13({ title: "Image", description: "Source image" }) },
6830
7186
  required: ["image"],
6831
7187
  additionalProperties: false
6832
7188
  };
6833
7189
  var outputSchema52 = {
6834
7190
  type: "object",
6835
- properties: {
6836
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Sepia-toned image" })
6837
- },
7191
+ properties: { image: GpuImageSchema13({ title: "Image", description: "Sepia-toned image" }) },
6838
7192
  required: ["image"],
6839
7193
  additionalProperties: false
6840
7194
  };
6841
7195
 
6842
- class ImageSepiaTask extends Task54 {
7196
+ class ImageSepiaTask extends ImageFilterTask {
6843
7197
  static type = "ImageSepiaTask";
6844
7198
  static category = "Image";
6845
7199
  static title = "Sepia Tone";
@@ -6850,41 +7204,24 @@ class ImageSepiaTask extends Task54 {
6850
7204
  static outputSchema() {
6851
7205
  return outputSchema52;
6852
7206
  }
6853
- async executeReactive(input, _output, _context) {
6854
- const image = await produceImageOutput(input.image, (img) => {
6855
- const { data: src, width, height, channels } = img;
6856
- const dst = new Uint8ClampedArray(src.length);
6857
- const pixelCount = width * height;
6858
- for (let i = 0;i < pixelCount; i++) {
6859
- const idx = i * channels;
6860
- const r = channels === 1 ? src[idx] : src[idx];
6861
- const g = channels === 1 ? src[idx] : src[idx + 1];
6862
- const b = channels === 1 ? src[idx] : src[idx + 2];
6863
- const outR = r * 402 + g * 787 + b * 194 >> 10;
6864
- const outG = r * 357 + g * 702 + b * 172 >> 10;
6865
- const outB = r * 279 + g * 547 + b * 134 >> 10;
6866
- dst[idx] = outR > 255 ? 255 : outR;
6867
- if (channels >= 3) {
6868
- dst[idx + 1] = outG > 255 ? 255 : outG;
6869
- dst[idx + 2] = outB > 255 ? 255 : outB;
6870
- }
6871
- if (channels === 4) {
6872
- dst[idx + 3] = src[idx + 3];
6873
- }
6874
- }
6875
- return { data: dst, width, height, channels };
6876
- });
6877
- return { image };
7207
+ filterName = "sepia";
7208
+ opParams(_input) {
7209
+ return;
6878
7210
  }
6879
7211
  }
6880
7212
  Workflow29.prototype.imageSepia = CreateWorkflow28(ImageSepiaTask);
6881
- // src/task/image/ImageTextTask.ts
7213
+ // src/task/image/text/ImageTextTask.ts
6882
7214
  import {
6883
7215
  CreateWorkflow as CreateWorkflow29,
6884
- Task as Task55,
7216
+ Task as Task43,
6885
7217
  Workflow as Workflow30
6886
7218
  } from "@workglow/task-graph";
6887
- 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";
6888
7225
  function toRgbaImage(image) {
6889
7226
  const { data, width, height, channels } = image;
6890
7227
  const rgba = new Uint8ClampedArray(width * height * 4);
@@ -6959,7 +7296,7 @@ var IMAGE_TEXT_POSITION_LABELS = {
6959
7296
  "bottom-center": "Bottom center",
6960
7297
  "bottom-right": "Bottom right"
6961
7298
  };
6962
- var backgroundImageProperty = ImageBinaryOrDataUriSchema({
7299
+ var backgroundImageProperty = GpuImageSchema14({
6963
7300
  title: "Image",
6964
7301
  description: "Background image to render the text onto"
6965
7302
  });
@@ -7024,23 +7361,73 @@ var inputSchema54 = {
7024
7361
  var outputSchema53 = {
7025
7362
  type: "object",
7026
7363
  properties: {
7027
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Raster image with text" })
7364
+ image: GpuImageSchema14({ title: "Image", description: "Raster image with text" })
7028
7365
  },
7029
7366
  required: ["image"],
7030
7367
  additionalProperties: false
7031
7368
  };
7032
- function hasUsableBackgroundImage(value) {
7033
- if (typeof value === "string") {
7034
- return value.length > 0;
7035
- }
7036
- if (typeof value !== "object" || value === null) {
7037
- return false;
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
+ };
7403
+ }
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);
7422
+ const backgroundImage = "image" in input ? input.image : undefined;
7423
+ if (backgroundImage != null) {
7424
+ return renderTextOverBackground(params, backgroundImage, 1);
7038
7425
  }
7039
- const candidate = value;
7040
- return typeof candidate.width === "number" && typeof candidate.height === "number" && typeof candidate.channels === "number" && candidate.data !== undefined;
7426
+ const { width, height } = requireStandaloneDims(input);
7427
+ return renderTextStandalone(params, width, height, 1);
7041
7428
  }
7042
7429
 
7043
- class ImageTextTask extends Task55 {
7430
+ class ImageTextTask extends Task43 {
7044
7431
  static type = "ImageTextTask";
7045
7432
  static category = "Image";
7046
7433
  static title = "Render Text to Image";
@@ -7058,63 +7445,33 @@ class ImageTextTask extends Task55 {
7058
7445
  delete defaults.height;
7059
7446
  return defaults;
7060
7447
  }
7061
- async executeReactive(input, _output, _context) {
7062
- const color = resolveColor2(input.color);
7063
- const fontSize = input.fontSize ?? 24;
7064
- const font = input.font ?? "sans-serif";
7065
- const bold = input.bold ?? false;
7066
- const italic = input.italic ?? false;
7067
- const position = input.position ?? "middle-center";
7448
+ async execute(input, _context) {
7449
+ return await runText(input);
7450
+ }
7451
+ async executePreview(input, _context) {
7452
+ const params = resolveTextParams(input);
7068
7453
  const backgroundImage = "image" in input ? input.image : undefined;
7069
- let image;
7070
- if (hasUsableBackgroundImage(backgroundImage)) {
7071
- image = await produceImageOutput(backgroundImage, async (background) => {
7072
- const overlay = await renderImageTextToRgba({
7073
- text: input.text,
7074
- font,
7075
- fontSize,
7076
- bold,
7077
- italic,
7078
- color,
7079
- width: background.width,
7080
- height: background.height,
7081
- position
7082
- });
7083
- return compositeTextOverBackground(background, overlay);
7084
- });
7085
- } else {
7086
- if (!("width" in input) || !("height" in input) || typeof input.width !== "number" || typeof input.height !== "number") {
7087
- throw new Error("ImageTextTask: width and height are required when no background image is provided");
7088
- }
7089
- image = await renderImageTextToRgba({
7090
- text: input.text,
7091
- font,
7092
- fontSize,
7093
- bold,
7094
- italic,
7095
- color,
7096
- width: input.width,
7097
- height: input.height,
7098
- position
7099
- });
7454
+ if (backgroundImage != null) {
7455
+ return await renderTextOverBackground(params, backgroundImage, backgroundImage.previewScale);
7100
7456
  }
7101
- return { image };
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);
7102
7462
  }
7103
7463
  }
7104
7464
  Workflow30.prototype.imageText = CreateWorkflow29(ImageTextTask);
7105
- // src/task/image/ImageThresholdTask.ts
7106
- import {
7107
- CreateWorkflow as CreateWorkflow30,
7108
- Task as Task56,
7109
- Workflow as Workflow31
7110
- } from "@workglow/task-graph";
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";
7111
7468
  var inputSchema55 = {
7112
7469
  type: "object",
7113
7470
  properties: {
7114
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7115
- threshold: {
7116
- type: "integer",
7117
- title: "Threshold",
7471
+ image: GpuImageSchema15({ title: "Image", description: "Source image" }),
7472
+ value: {
7473
+ type: "number",
7474
+ title: "Value",
7118
7475
  description: "Threshold value (0-255)",
7119
7476
  minimum: 0,
7120
7477
  maximum: 255,
@@ -7126,57 +7483,35 @@ var inputSchema55 = {
7126
7483
  };
7127
7484
  var outputSchema54 = {
7128
7485
  type: "object",
7129
- properties: {
7130
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Thresholded binary image" })
7131
- },
7486
+ properties: { image: GpuImageSchema15({ title: "Image", description: "Thresholded image" }) },
7132
7487
  required: ["image"],
7133
7488
  additionalProperties: false
7134
7489
  };
7135
7490
 
7136
- class ImageThresholdTask extends Task56 {
7491
+ class ImageThresholdTask extends ImageFilterTask {
7137
7492
  static type = "ImageThresholdTask";
7138
7493
  static category = "Image";
7139
7494
  static title = "Threshold";
7140
- static description = "Converts an image to binary black and white";
7495
+ static description = "Applies a binary threshold per channel";
7141
7496
  static inputSchema() {
7142
7497
  return inputSchema55;
7143
7498
  }
7144
7499
  static outputSchema() {
7145
7500
  return outputSchema54;
7146
7501
  }
7147
- async executeReactive(input, _output, _context) {
7148
- const threshold = input.threshold ?? 128;
7149
- const image = await produceImageOutput(input.image, (img) => {
7150
- const { data: src, width, height, channels } = img;
7151
- const pixelCount = width * height;
7152
- const dst = new Uint8ClampedArray(pixelCount);
7153
- for (let i = 0;i < pixelCount; i++) {
7154
- const idx = i * channels;
7155
- let gray;
7156
- if (channels === 1) {
7157
- gray = src[idx];
7158
- } else {
7159
- gray = src[idx] * 77 + src[idx + 1] * 150 + src[idx + 2] * 29 >> 8;
7160
- }
7161
- dst[i] = gray >= threshold ? 255 : 0;
7162
- }
7163
- return { data: dst, width, height, channels: 1 };
7164
- });
7165
- return { image };
7502
+ filterName = "threshold";
7503
+ opParams(input) {
7504
+ return { value: input.value ?? 128 };
7166
7505
  }
7167
7506
  }
7168
7507
  Workflow31.prototype.imageThreshold = CreateWorkflow30(ImageThresholdTask);
7169
- // src/task/image/ImageTintTask.ts
7170
- import {
7171
- CreateWorkflow as CreateWorkflow31,
7172
- Task as Task57,
7173
- Workflow as Workflow32
7174
- } from "@workglow/task-graph";
7175
- import { resolveColor as resolveColor3 } from "@workglow/util/media";
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";
7176
7511
  var inputSchema56 = {
7177
7512
  type: "object",
7178
7513
  properties: {
7179
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7514
+ image: GpuImageSchema16({ title: "Image", description: "Source image" }),
7180
7515
  color: ColorValueSchema({ title: "Color", description: "Tint color" }),
7181
7516
  amount: {
7182
7517
  type: "number",
@@ -7192,14 +7527,12 @@ var inputSchema56 = {
7192
7527
  };
7193
7528
  var outputSchema55 = {
7194
7529
  type: "object",
7195
- properties: {
7196
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Tinted image" })
7197
- },
7530
+ properties: { image: GpuImageSchema16({ title: "Image", description: "Tinted image" }) },
7198
7531
  required: ["image"],
7199
7532
  additionalProperties: false
7200
7533
  };
7201
7534
 
7202
- class ImageTintTask extends Task57 {
7535
+ class ImageTintTask extends ImageFilterTask {
7203
7536
  static type = "ImageTintTask";
7204
7537
  static category = "Image";
7205
7538
  static title = "Tint Image";
@@ -7210,76 +7543,42 @@ class ImageTintTask extends Task57 {
7210
7543
  static outputSchema() {
7211
7544
  return outputSchema55;
7212
7545
  }
7213
- async executeReactive(input, _output, _context) {
7214
- const { r: tr, g: tg, b: tb } = resolveColor3(input.color);
7215
- const amount = input.amount ?? 0.5;
7216
- const invAmount = 1 - amount;
7217
- const tintR = tr * amount;
7218
- const tintG = tg * amount;
7219
- const tintB = tb * amount;
7220
- const image = await produceImageOutput(input.image, (img) => {
7221
- const { data: src, width, height, channels } = img;
7222
- const pixelCount = width * height;
7223
- if (channels === 1) {
7224
- const dst2 = new Uint8ClampedArray(pixelCount * 3);
7225
- for (let i = 0;i < pixelCount; i++) {
7226
- const gray = src[i];
7227
- dst2[i * 3] = gray * invAmount + tintR;
7228
- dst2[i * 3 + 1] = gray * invAmount + tintG;
7229
- dst2[i * 3 + 2] = gray * invAmount + tintB;
7230
- }
7231
- return { data: dst2, width, height, channels: 3 };
7232
- }
7233
- const dst = new Uint8ClampedArray(src.length);
7234
- for (let i = 0;i < pixelCount; i++) {
7235
- const idx = i * channels;
7236
- dst[idx] = src[idx] * invAmount + tintR;
7237
- dst[idx + 1] = src[idx + 1] * invAmount + tintG;
7238
- dst[idx + 2] = src[idx + 2] * invAmount + tintB;
7239
- if (channels === 4) {
7240
- dst[idx + 3] = src[idx + 3];
7241
- }
7242
- }
7243
- return { data: dst, width, height, channels };
7244
- });
7245
- return { image };
7546
+ filterName = "tint";
7547
+ opParams(input) {
7548
+ return {
7549
+ color: input.color,
7550
+ amount: input.amount ?? 0.5
7551
+ };
7246
7552
  }
7247
7553
  }
7248
7554
  Workflow32.prototype.imageTint = CreateWorkflow31(ImageTintTask);
7249
- // src/task/image/ImageTransparencyTask.ts
7250
- import {
7251
- CreateWorkflow as CreateWorkflow32,
7252
- Task as Task58,
7253
- Workflow as Workflow33
7254
- } from "@workglow/task-graph";
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";
7255
7558
  var inputSchema57 = {
7256
7559
  type: "object",
7257
7560
  properties: {
7258
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7259
- opacity: {
7561
+ image: GpuImageSchema17({ title: "Image", description: "Source image" }),
7562
+ amount: {
7260
7563
  type: "number",
7261
- title: "Opacity",
7564
+ title: "Amount",
7262
7565
  description: "Opacity level (0.0 = fully transparent, 1.0 = fully opaque)",
7263
7566
  minimum: 0,
7264
- maximum: 1
7567
+ maximum: 1,
7568
+ default: 1
7265
7569
  }
7266
7570
  },
7267
- required: ["image", "opacity"],
7571
+ required: ["image"],
7268
7572
  additionalProperties: false
7269
7573
  };
7270
7574
  var outputSchema56 = {
7271
7575
  type: "object",
7272
- properties: {
7273
- image: ImageBinaryOrDataUriSchema({
7274
- title: "Image",
7275
- description: "Image with adjusted transparency"
7276
- })
7277
- },
7576
+ properties: { image: GpuImageSchema17({ title: "Image", description: "Image with adjusted transparency" }) },
7278
7577
  required: ["image"],
7279
7578
  additionalProperties: false
7280
7579
  };
7281
7580
 
7282
- class ImageTransparencyTask extends Task58 {
7581
+ class ImageTransparencyTask extends ImageFilterTask {
7283
7582
  static type = "ImageTransparencyTask";
7284
7583
  static category = "Image";
7285
7584
  static title = "Set Transparency";
@@ -7290,138 +7589,19 @@ class ImageTransparencyTask extends Task58 {
7290
7589
  static outputSchema() {
7291
7590
  return outputSchema56;
7292
7591
  }
7293
- async executeReactive(input, _output, _context) {
7294
- const { opacity } = input;
7295
- const image = await produceImageOutput(input.image, (img) => {
7296
- const { data: src, width, height, channels: srcCh } = img;
7297
- const pixelCount = width * height;
7298
- const dst = new Uint8ClampedArray(pixelCount * 4);
7299
- const alphaScale = Math.round(opacity * 255);
7300
- for (let i = 0;i < pixelCount; i++) {
7301
- const srcIdx = i * srcCh;
7302
- const dstIdx = i * 4;
7303
- dst[dstIdx] = src[srcIdx];
7304
- dst[dstIdx + 1] = srcCh >= 3 ? src[srcIdx + 1] : src[srcIdx];
7305
- dst[dstIdx + 2] = srcCh >= 3 ? src[srcIdx + 2] : src[srcIdx];
7306
- const srcAlpha = srcCh === 4 ? src[srcIdx + 3] : 255;
7307
- dst[dstIdx + 3] = (srcAlpha * alphaScale + 127) / 255;
7308
- }
7309
- return { data: dst, width, height, channels: 4 };
7310
- });
7311
- return { image };
7592
+ filterName = "transparency";
7593
+ opParams(input) {
7594
+ return { amount: input.amount ?? 1 };
7312
7595
  }
7313
7596
  }
7314
7597
  Workflow33.prototype.imageTransparency = CreateWorkflow32(ImageTransparencyTask);
7315
- // src/task/image/ImageWatermarkTask.ts
7316
- import {
7317
- CreateWorkflow as CreateWorkflow33,
7318
- Task as Task59,
7319
- Workflow as Workflow34
7320
- } from "@workglow/task-graph";
7321
- var inputSchema58 = {
7322
- type: "object",
7323
- properties: {
7324
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Source image" }),
7325
- spacing: {
7326
- type: "integer",
7327
- title: "Spacing",
7328
- description: "Pattern spacing in pixels",
7329
- minimum: 8,
7330
- default: 64
7331
- },
7332
- opacity: {
7333
- type: "number",
7334
- title: "Opacity",
7335
- description: "Watermark opacity (0.0-1.0)",
7336
- minimum: 0,
7337
- maximum: 1,
7338
- default: 0.3
7339
- },
7340
- pattern: {
7341
- type: "string",
7342
- enum: ["diagonal-lines", "grid", "dots"],
7343
- title: "Pattern",
7344
- description: "Watermark pattern type",
7345
- default: "diagonal-lines"
7346
- }
7347
- },
7348
- required: ["image"],
7349
- additionalProperties: false
7350
- };
7351
- var outputSchema57 = {
7352
- type: "object",
7353
- properties: {
7354
- image: ImageBinaryOrDataUriSchema({ title: "Image", description: "Watermarked image" })
7355
- },
7356
- required: ["image"],
7357
- additionalProperties: false
7358
- };
7359
-
7360
- class ImageWatermarkTask extends Task59 {
7361
- static type = "ImageWatermarkTask";
7362
- static category = "Image";
7363
- static title = "Add Watermark";
7364
- static description = "Adds a repeating pattern watermark to an image";
7365
- static inputSchema() {
7366
- return inputSchema58;
7367
- }
7368
- static outputSchema() {
7369
- return outputSchema57;
7370
- }
7371
- async executeReactive(input, _output, _context) {
7372
- const { spacing = 64, opacity = 0.3, pattern = "diagonal-lines" } = input;
7373
- const image = await produceImageOutput(input.image, (img) => {
7374
- const { data: src, width, height, channels: srcCh } = img;
7375
- const outCh = 4;
7376
- const dst = new Uint8ClampedArray(width * height * outCh);
7377
- const lineWidth = 2;
7378
- const dotRadius = Math.max(2, spacing >> 3);
7379
- const dotRadiusSq = dotRadius * dotRadius;
7380
- const half = spacing >> 1;
7381
- const alpha = Math.round(opacity * 255);
7382
- for (let y = 0;y < height; y++) {
7383
- for (let x = 0;x < width; x++) {
7384
- const srcIdx = (y * width + x) * srcCh;
7385
- const dstIdx = (y * width + x) * outCh;
7386
- const sr = src[srcIdx];
7387
- const sg = srcCh >= 3 ? src[srcIdx + 1] : sr;
7388
- const sb = srcCh >= 3 ? src[srcIdx + 2] : sr;
7389
- const sa = srcCh === 4 ? src[srcIdx + 3] : 255;
7390
- let isPattern = false;
7391
- if (pattern === "diagonal-lines") {
7392
- isPattern = (x + y) % spacing < lineWidth;
7393
- } else if (pattern === "grid") {
7394
- isPattern = x % spacing < lineWidth || y % spacing < lineWidth;
7395
- } else {
7396
- const dx = x % spacing - half;
7397
- const dy = y % spacing - half;
7398
- isPattern = dx * dx + dy * dy < dotRadiusSq;
7399
- }
7400
- if (isPattern) {
7401
- const blend = alpha;
7402
- const invBlend = 255 - blend;
7403
- dst[dstIdx] = (sr * invBlend + 255 * blend + 127) / 255;
7404
- dst[dstIdx + 1] = (sg * invBlend + 255 * blend + 127) / 255;
7405
- dst[dstIdx + 2] = (sb * invBlend + 255 * blend + 127) / 255;
7406
- dst[dstIdx + 3] = sa;
7407
- } else {
7408
- dst[dstIdx] = sr;
7409
- dst[dstIdx + 1] = sg;
7410
- dst[dstIdx + 2] = sb;
7411
- dst[dstIdx + 3] = sa;
7412
- }
7413
- }
7414
- }
7415
- return { data: dst, width, height, channels: outCh };
7416
- });
7417
- return { image };
7418
- }
7419
- }
7420
- Workflow34.prototype.imageWatermark = CreateWorkflow33(ImageWatermarkTask);
7421
7598
  // src/task/InputTask.ts
7422
- 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";
7600
+ function passthroughInput(input) {
7601
+ return input;
7602
+ }
7423
7603
 
7424
- class InputTask extends Task60 {
7604
+ class InputTask extends Task44 {
7425
7605
  static type = "InputTask";
7426
7606
  static category = "Flow Control";
7427
7607
  static title = "Input";
@@ -7449,8 +7629,11 @@ class InputTask extends Task60 {
7449
7629
  outputSchema() {
7450
7630
  return this.config?.outputSchema ?? this.constructor.outputSchema();
7451
7631
  }
7452
- async executeReactive(input) {
7453
- return input;
7632
+ async execute(input, _context) {
7633
+ return passthroughInput(input);
7634
+ }
7635
+ async executePreview(input) {
7636
+ return passthroughInput(input);
7454
7637
  }
7455
7638
  async* executeStream(input, context) {
7456
7639
  if (context.inputStreams) {
@@ -7473,15 +7656,15 @@ class InputTask extends Task60 {
7473
7656
  yield { type: "finish", data: input };
7474
7657
  }
7475
7658
  }
7476
- Workflow35.prototype.input = CreateWorkflow34(InputTask);
7659
+ Workflow34.prototype.input = CreateWorkflow33(InputTask);
7477
7660
  // src/task/JavaScriptTask.ts
7478
7661
  import {
7479
- CreateWorkflow as CreateWorkflow35,
7662
+ CreateWorkflow as CreateWorkflow34,
7480
7663
  Entitlements as Entitlements7,
7481
- Task as Task61,
7664
+ Task as Task45,
7482
7665
  TaskConfigSchema as TaskConfigSchema32,
7483
7666
  TaskInvalidInputError as TaskInvalidInputError3,
7484
- Workflow as Workflow36
7667
+ Workflow as Workflow35
7485
7668
  } from "@workglow/task-graph";
7486
7669
 
7487
7670
  // src/util/acorn.js
@@ -11946,6 +12129,23 @@ Interpreter["Status"] = Interpreter.Status;
11946
12129
 
11947
12130
  // src/task/JavaScriptTask.ts
11948
12131
  var isValidIdentifier = (key) => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key);
12132
+ function runJavaScript(input2, configuredCode) {
12133
+ const output = {};
12134
+ const code = input2.javascript_code || configuredCode;
12135
+ if (code) {
12136
+ try {
12137
+ const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code").filter(isValidIdentifier);
12138
+ const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
12139
+ `);
12140
+ const myInterpreter = new Interpreter(`${inputVariablesString} ${code}`);
12141
+ myInterpreter.run();
12142
+ output.output = myInterpreter.value;
12143
+ } catch (e) {
12144
+ throw new TaskInvalidInputError3(`JavaScript execution failed: ${e instanceof Error ? e.message : String(e)}`);
12145
+ }
12146
+ }
12147
+ return output;
12148
+ }
11949
12149
  var configSchema = {
11950
12150
  type: "object",
11951
12151
  properties: {
@@ -11960,7 +12160,7 @@ var configSchema = {
11960
12160
  },
11961
12161
  additionalProperties: false
11962
12162
  };
11963
- var inputSchema59 = {
12163
+ var inputSchema58 = {
11964
12164
  type: "object",
11965
12165
  properties: {
11966
12166
  javascript_code: {
@@ -11974,7 +12174,7 @@ var inputSchema59 = {
11974
12174
  required: ["javascript_code"],
11975
12175
  additionalProperties: true
11976
12176
  };
11977
- var outputSchema58 = {
12177
+ var outputSchema57 = {
11978
12178
  type: "object",
11979
12179
  properties: {
11980
12180
  output: {
@@ -11986,7 +12186,7 @@ var outputSchema58 = {
11986
12186
  additionalProperties: false
11987
12187
  };
11988
12188
 
11989
- class JavaScriptTask extends Task61 {
12189
+ class JavaScriptTask extends Task45 {
11990
12190
  static type = "JavaScriptTask";
11991
12191
  static category = "Utility";
11992
12192
  static title = "JavaScript Interpreter";
@@ -12007,10 +12207,10 @@ class JavaScriptTask extends Task61 {
12007
12207
  return configSchema;
12008
12208
  }
12009
12209
  static inputSchema() {
12010
- return inputSchema59;
12210
+ return inputSchema58;
12011
12211
  }
12012
12212
  static outputSchema() {
12013
- return outputSchema58;
12213
+ return outputSchema57;
12014
12214
  }
12015
12215
  inputSchema() {
12016
12216
  if (this.config?.javascript_code) {
@@ -12023,36 +12223,26 @@ class JavaScriptTask extends Task61 {
12023
12223
  additionalProperties: true
12024
12224
  };
12025
12225
  }
12026
- return inputSchema59;
12226
+ return inputSchema58;
12027
12227
  }
12028
- async executeReactive(input2, output) {
12029
- const code = input2.javascript_code || this.config.javascript_code;
12030
- if (code) {
12031
- try {
12032
- const inputVariables = Object.keys(input2).filter((key) => key !== "javascript_code").filter(isValidIdentifier);
12033
- const inputVariablesString = inputVariables.map((key) => `var ${key} = ${JSON.stringify(input2[key])};`).join(`
12034
- `);
12035
- const myInterpreter = new Interpreter(`${inputVariablesString} ${code}`);
12036
- myInterpreter.run();
12037
- output.output = myInterpreter.value;
12038
- } catch (e) {
12039
- throw new TaskInvalidInputError3(`JavaScript execution failed: ${e instanceof Error ? e.message : String(e)}`);
12040
- }
12041
- }
12042
- return output;
12228
+ async execute(input2) {
12229
+ return runJavaScript(input2, this.config.javascript_code);
12230
+ }
12231
+ async executePreview(input2) {
12232
+ return runJavaScript(input2, this.config.javascript_code);
12043
12233
  }
12044
12234
  }
12045
12235
  var javaScript = (input2, config = {}) => {
12046
12236
  return new JavaScriptTask(config).run(input2);
12047
12237
  };
12048
- Workflow36.prototype.javaScript = CreateWorkflow35(JavaScriptTask);
12238
+ Workflow35.prototype.javaScript = CreateWorkflow34(JavaScriptTask);
12049
12239
  // src/task/JsonPathTask.ts
12050
12240
  import {
12051
- CreateWorkflow as CreateWorkflow36,
12052
- Task as Task62,
12053
- Workflow as Workflow37
12241
+ CreateWorkflow as CreateWorkflow35,
12242
+ Task as Task46,
12243
+ Workflow as Workflow36
12054
12244
  } from "@workglow/task-graph";
12055
- var inputSchema60 = {
12245
+ var inputSchema59 = {
12056
12246
  type: "object",
12057
12247
  properties: {
12058
12248
  value: {
@@ -12068,7 +12258,7 @@ var inputSchema60 = {
12068
12258
  required: ["value", "path"],
12069
12259
  additionalProperties: false
12070
12260
  };
12071
- var outputSchema59 = {
12261
+ var outputSchema58 = {
12072
12262
  type: "object",
12073
12263
  properties: {
12074
12264
  result: {
@@ -12100,36 +12290,41 @@ function resolvePath(obj, segments) {
12100
12290
  const next2 = obj[head];
12101
12291
  return resolvePath(next2, tail);
12102
12292
  }
12293
+ function extractJsonPath(value, path) {
12294
+ const segments = path.split(".");
12295
+ return resolvePath(value, segments);
12296
+ }
12103
12297
 
12104
- class JsonPathTask extends Task62 {
12298
+ class JsonPathTask extends Task46 {
12105
12299
  static type = "JsonPathTask";
12106
12300
  static category = "Utility";
12107
12301
  static title = "JSON Path";
12108
12302
  static description = "Extracts a value from an object using a dot-notation path";
12109
12303
  static inputSchema() {
12110
- return inputSchema60;
12304
+ return inputSchema59;
12111
12305
  }
12112
12306
  static outputSchema() {
12113
- return outputSchema59;
12307
+ return outputSchema58;
12308
+ }
12309
+ async execute(input2, _context) {
12310
+ return { result: extractJsonPath(input2.value, input2.path) };
12114
12311
  }
12115
- async executeReactive(input2, _output, _context) {
12116
- const segments = input2.path.split(".");
12117
- const result = resolvePath(input2.value, segments);
12118
- return { result };
12312
+ async executePreview(input2, _context) {
12313
+ return { result: extractJsonPath(input2.value, input2.path) };
12119
12314
  }
12120
12315
  }
12121
- Workflow37.prototype.jsonPath = CreateWorkflow36(JsonPathTask);
12316
+ Workflow36.prototype.jsonPath = CreateWorkflow35(JsonPathTask);
12122
12317
  // src/task/JsonTask.ts
12123
12318
  import {
12124
12319
  createGraphFromDependencyJSON,
12125
12320
  createGraphFromGraphJSON,
12126
- CreateWorkflow as CreateWorkflow37,
12321
+ CreateWorkflow as CreateWorkflow36,
12127
12322
  Dataflow,
12128
12323
  GraphAsTask as GraphAsTask2,
12129
12324
  TaskConfigurationError as TaskConfigurationError3,
12130
- Workflow as Workflow38
12325
+ Workflow as Workflow37
12131
12326
  } from "@workglow/task-graph";
12132
- var inputSchema61 = {
12327
+ var inputSchema60 = {
12133
12328
  type: "object",
12134
12329
  properties: {
12135
12330
  json: {
@@ -12140,7 +12335,7 @@ var inputSchema61 = {
12140
12335
  },
12141
12336
  additionalProperties: false
12142
12337
  };
12143
- var outputSchema60 = {
12338
+ var outputSchema59 = {
12144
12339
  type: "object",
12145
12340
  properties: {
12146
12341
  output: {
@@ -12157,10 +12352,10 @@ class JsonTask extends GraphAsTask2 {
12157
12352
  static title = "JSON Task";
12158
12353
  static description = "A task that creates and manages task graphs from JSON configurations";
12159
12354
  static inputSchema() {
12160
- return inputSchema61;
12355
+ return inputSchema60;
12161
12356
  }
12162
12357
  static outputSchema() {
12163
- return outputSchema60;
12358
+ return outputSchema59;
12164
12359
  }
12165
12360
  regenerateGraph() {
12166
12361
  if (!this.runInputData.json)
@@ -12194,26 +12389,26 @@ class JsonTask extends GraphAsTask2 {
12194
12389
  var json = (input2, config = {}) => {
12195
12390
  return new JsonTask(config).run(input2);
12196
12391
  };
12197
- Workflow38.prototype.json = CreateWorkflow37(JsonTask);
12392
+ Workflow37.prototype.json = CreateWorkflow36(JsonTask);
12198
12393
  // src/task/LambdaTask.ts
12199
12394
  import {
12200
- CreateWorkflow as CreateWorkflow38,
12395
+ CreateWorkflow as CreateWorkflow37,
12201
12396
  DATAFLOW_ALL_PORTS,
12202
- Task as Task63,
12397
+ Task as Task47,
12203
12398
  TaskConfigSchema as TaskConfigSchema33,
12204
12399
  TaskConfigurationError as TaskConfigurationError4,
12205
- Workflow as Workflow39
12400
+ Workflow as Workflow38
12206
12401
  } from "@workglow/task-graph";
12207
12402
  var lambdaTaskConfigSchema = {
12208
12403
  type: "object",
12209
12404
  properties: {
12210
12405
  ...TaskConfigSchema33["properties"],
12211
12406
  execute: {},
12212
- executeReactive: {}
12407
+ executePreview: {}
12213
12408
  },
12214
12409
  additionalProperties: false
12215
12410
  };
12216
- var inputSchema62 = {
12411
+ var inputSchema61 = {
12217
12412
  type: "object",
12218
12413
  properties: {
12219
12414
  [DATAFLOW_ALL_PORTS]: {
@@ -12223,7 +12418,7 @@ var inputSchema62 = {
12223
12418
  },
12224
12419
  additionalProperties: true
12225
12420
  };
12226
- var outputSchema61 = {
12421
+ var outputSchema60 = {
12227
12422
  type: "object",
12228
12423
  properties: {
12229
12424
  [DATAFLOW_ALL_PORTS]: {
@@ -12234,7 +12429,7 @@ var outputSchema61 = {
12234
12429
  additionalProperties: true
12235
12430
  };
12236
12431
 
12237
- class LambdaTask extends Task63 {
12432
+ class LambdaTask extends Task47 {
12238
12433
  static type = "LambdaTask";
12239
12434
  static title = "Lambda Task";
12240
12435
  static description = "A task that wraps a provided function and its input";
@@ -12244,17 +12439,17 @@ class LambdaTask extends Task63 {
12244
12439
  return lambdaTaskConfigSchema;
12245
12440
  }
12246
12441
  static inputSchema() {
12247
- return inputSchema62;
12442
+ return inputSchema61;
12248
12443
  }
12249
12444
  static outputSchema() {
12250
- return outputSchema61;
12445
+ return outputSchema60;
12251
12446
  }
12252
12447
  canSerializeConfig() {
12253
12448
  return false;
12254
12449
  }
12255
12450
  constructor(config = {}) {
12256
- if (!config.execute && !config.executeReactive) {
12257
- throw new TaskConfigurationError4("LambdaTask must have either execute or executeReactive function in config");
12451
+ if (!config.execute && !config.executePreview) {
12452
+ throw new TaskConfigurationError4("LambdaTask must have either execute or executePreview function in config");
12258
12453
  }
12259
12454
  super(config);
12260
12455
  }
@@ -12264,11 +12459,11 @@ class LambdaTask extends Task63 {
12264
12459
  }
12265
12460
  return {};
12266
12461
  }
12267
- async executeReactive(input2, output, context) {
12268
- if (typeof this.config.executeReactive === "function") {
12269
- return await this.config.executeReactive(input2, output, context) ?? output;
12462
+ async executePreview(input2, context) {
12463
+ if (typeof this.config.executePreview === "function") {
12464
+ return await this.config.executePreview(input2, context);
12270
12465
  }
12271
- return output;
12466
+ return;
12272
12467
  }
12273
12468
  }
12274
12469
  function lambda(input2, config) {
@@ -12281,14 +12476,14 @@ function lambda(input2, config) {
12281
12476
  const task = new LambdaTask({ ...config, defaults: input2 });
12282
12477
  return task.run();
12283
12478
  }
12284
- Workflow39.prototype.lambda = CreateWorkflow38(LambdaTask);
12479
+ Workflow38.prototype.lambda = CreateWorkflow37(LambdaTask);
12285
12480
  // src/task/mcp/McpListTask.ts
12286
12481
  import {
12287
- CreateWorkflow as CreateWorkflow39,
12482
+ CreateWorkflow as CreateWorkflow38,
12288
12483
  Entitlements as Entitlements8,
12289
12484
  mergeEntitlements as mergeEntitlements4,
12290
- Task as Task64,
12291
- Workflow as Workflow40
12485
+ Task as Task48,
12486
+ Workflow as Workflow39
12292
12487
  } from "@workglow/task-graph";
12293
12488
 
12294
12489
  // src/util/getMcpServerTransport.ts
@@ -12462,7 +12657,7 @@ var outputSchemaAll = {
12462
12657
  additionalProperties: false
12463
12658
  };
12464
12659
 
12465
- class McpListTask extends Task64 {
12660
+ class McpListTask extends Task48 {
12466
12661
  static type = "McpListTask";
12467
12662
  static category = "MCP";
12468
12663
  static title = "MCP List";
@@ -12569,15 +12764,15 @@ class McpListTask extends Task64 {
12569
12764
  var mcpList = async (input2, config = {}) => {
12570
12765
  return new McpListTask(config).run(input2);
12571
12766
  };
12572
- Workflow40.prototype.mcpList = CreateWorkflow39(McpListTask);
12767
+ Workflow39.prototype.mcpList = CreateWorkflow38(McpListTask);
12573
12768
  // src/task/mcp/McpPromptGetTask.ts
12574
12769
  import {
12575
- CreateWorkflow as CreateWorkflow40,
12770
+ CreateWorkflow as CreateWorkflow39,
12576
12771
  Entitlements as Entitlements9,
12577
12772
  mergeEntitlements as mergeEntitlements5,
12578
- Task as Task65,
12773
+ Task as Task49,
12579
12774
  TaskConfigSchema as TaskConfigSchema34,
12580
- Workflow as Workflow41
12775
+ Workflow as Workflow40
12581
12776
  } from "@workglow/task-graph";
12582
12777
  var annotationsSchema = {
12583
12778
  type: "object",
@@ -12712,7 +12907,7 @@ var fallbackInputSchema = {
12712
12907
  additionalProperties: false
12713
12908
  };
12714
12909
 
12715
- class McpPromptGetTask extends Task65 {
12910
+ class McpPromptGetTask extends Task49 {
12716
12911
  static type = "McpPromptGetTask";
12717
12912
  static category = "MCP";
12718
12913
  static title = "MCP Get Prompt";
@@ -12835,15 +13030,15 @@ class McpPromptGetTask extends Task65 {
12835
13030
  var mcpPromptGet = async (input2, config) => {
12836
13031
  return new McpPromptGetTask(config).run(input2);
12837
13032
  };
12838
- Workflow41.prototype.mcpPromptGet = CreateWorkflow40(McpPromptGetTask);
13033
+ Workflow40.prototype.mcpPromptGet = CreateWorkflow39(McpPromptGetTask);
12839
13034
  // src/task/mcp/McpResourceReadTask.ts
12840
13035
  import {
12841
- CreateWorkflow as CreateWorkflow41,
13036
+ CreateWorkflow as CreateWorkflow40,
12842
13037
  Entitlements as Entitlements10,
12843
13038
  mergeEntitlements as mergeEntitlements6,
12844
- Task as Task66,
13039
+ Task as Task50,
12845
13040
  TaskConfigSchema as TaskConfigSchema35,
12846
- Workflow as Workflow42
13041
+ Workflow as Workflow41
12847
13042
  } from "@workglow/task-graph";
12848
13043
  var contentItemSchema = {
12849
13044
  anyOf: [
@@ -12871,12 +13066,12 @@ var contentItemSchema = {
12871
13066
  }
12872
13067
  ]
12873
13068
  };
12874
- var inputSchema63 = {
13069
+ var inputSchema62 = {
12875
13070
  type: "object",
12876
13071
  properties: {},
12877
13072
  additionalProperties: false
12878
13073
  };
12879
- var outputSchema62 = {
13074
+ var outputSchema61 = {
12880
13075
  type: "object",
12881
13076
  properties: {
12882
13077
  contents: {
@@ -12890,7 +13085,7 @@ var outputSchema62 = {
12890
13085
  additionalProperties: false
12891
13086
  };
12892
13087
 
12893
- class McpResourceReadTask extends Task66 {
13088
+ class McpResourceReadTask extends Task50 {
12894
13089
  static type = "McpResourceReadTask";
12895
13090
  static category = "MCP";
12896
13091
  static title = "MCP Read Resource";
@@ -12923,10 +13118,10 @@ class McpResourceReadTask extends Task66 {
12923
13118
  });
12924
13119
  }
12925
13120
  static inputSchema() {
12926
- return inputSchema63;
13121
+ return inputSchema62;
12927
13122
  }
12928
13123
  static outputSchema() {
12929
- return outputSchema62;
13124
+ return outputSchema61;
12930
13125
  }
12931
13126
  static configSchema() {
12932
13127
  const { mcpServerConfigSchema: mcpServerConfigSchema2 } = getMcpTaskDeps();
@@ -12963,13 +13158,13 @@ class McpResourceReadTask extends Task66 {
12963
13158
  var mcpResourceRead = async (config) => {
12964
13159
  return new McpResourceReadTask(config).run({});
12965
13160
  };
12966
- Workflow42.prototype.mcpResourceRead = CreateWorkflow41(McpResourceReadTask);
13161
+ Workflow41.prototype.mcpResourceRead = CreateWorkflow40(McpResourceReadTask);
12967
13162
  // src/task/mcp/McpSearchTask.ts
12968
13163
  import {
12969
- CreateWorkflow as CreateWorkflow42,
13164
+ CreateWorkflow as CreateWorkflow41,
12970
13165
  Entitlements as Entitlements11,
12971
- Task as Task67,
12972
- Workflow as Workflow43
13166
+ Task as Task51,
13167
+ Workflow as Workflow42
12973
13168
  } from "@workglow/task-graph";
12974
13169
  var MCP_REGISTRY_BASE = "https://registry.modelcontextprotocol.io/v0.1";
12975
13170
  var McpSearchInputSchema = {
@@ -13109,7 +13304,7 @@ async function searchMcpRegistry(query, signal) {
13109
13304
  return page.results;
13110
13305
  }
13111
13306
 
13112
- class McpSearchTask extends Task67 {
13307
+ class McpSearchTask extends Task51 {
13113
13308
  static type = "McpSearchTask";
13114
13309
  static category = "MCP";
13115
13310
  static title = "MCP Search";
@@ -13136,15 +13331,15 @@ class McpSearchTask extends Task67 {
13136
13331
  var mcpSearch = (input2, config) => {
13137
13332
  return new McpSearchTask(config).run(input2);
13138
13333
  };
13139
- Workflow43.prototype.mcpSearch = CreateWorkflow42(McpSearchTask);
13334
+ Workflow42.prototype.mcpSearch = CreateWorkflow41(McpSearchTask);
13140
13335
  // src/task/mcp/McpToolCallTask.ts
13141
13336
  import {
13142
- CreateWorkflow as CreateWorkflow43,
13337
+ CreateWorkflow as CreateWorkflow42,
13143
13338
  Entitlements as Entitlements12,
13144
13339
  mergeEntitlements as mergeEntitlements7,
13145
- Task as Task68,
13340
+ Task as Task52,
13146
13341
  TaskConfigSchema as TaskConfigSchema36,
13147
- Workflow as Workflow44
13342
+ Workflow as Workflow43
13148
13343
  } from "@workglow/task-graph";
13149
13344
  var annotationsSchema2 = {
13150
13345
  type: "object",
@@ -13271,7 +13466,7 @@ var fallbackInputSchema2 = {
13271
13466
  additionalProperties: true
13272
13467
  };
13273
13468
 
13274
- class McpToolCallTask extends Task68 {
13469
+ class McpToolCallTask extends Task52 {
13275
13470
  static type = "McpToolCallTask";
13276
13471
  static category = "MCP";
13277
13472
  static title = "MCP Call Tool";
@@ -13409,7 +13604,7 @@ class McpToolCallTask extends Task68 {
13409
13604
  var mcpToolCall = async (input2, config) => {
13410
13605
  return new McpToolCallTask(config).run(input2);
13411
13606
  };
13412
- Workflow44.prototype.mcpToolCall = CreateWorkflow43(McpToolCallTask);
13607
+ Workflow43.prototype.mcpToolCall = CreateWorkflow42(McpToolCallTask);
13413
13608
  // src/task/McpElicitationConnector.ts
13414
13609
  function defaultAbortError() {
13415
13610
  const err = new Error("The operation was aborted");
@@ -13503,13 +13698,13 @@ class McpElicitationConnector {
13503
13698
  }
13504
13699
  }
13505
13700
  // src/task/MergeTask.ts
13506
- import { CreateWorkflow as CreateWorkflow44, Task as Task69, Workflow as Workflow45 } from "@workglow/task-graph";
13507
- var inputSchema64 = {
13701
+ import { CreateWorkflow as CreateWorkflow43, Task as Task53, Workflow as Workflow44 } from "@workglow/task-graph";
13702
+ var inputSchema63 = {
13508
13703
  type: "object",
13509
13704
  properties: {},
13510
13705
  additionalProperties: true
13511
13706
  };
13512
- var outputSchema63 = {
13707
+ var outputSchema62 = {
13513
13708
  type: "object",
13514
13709
  properties: {
13515
13710
  output: {
@@ -13521,17 +13716,17 @@ var outputSchema63 = {
13521
13716
  additionalProperties: false
13522
13717
  };
13523
13718
 
13524
- class MergeTask extends Task69 {
13719
+ class MergeTask extends Task53 {
13525
13720
  static type = "MergeTask";
13526
13721
  static category = "Utility";
13527
13722
  static title = "Merge";
13528
13723
  static description = "Merges multiple inputs into a single array output";
13529
13724
  static cacheable = true;
13530
13725
  static inputSchema() {
13531
- return inputSchema64;
13726
+ return inputSchema63;
13532
13727
  }
13533
13728
  static outputSchema() {
13534
- return outputSchema63;
13729
+ return outputSchema62;
13535
13730
  }
13536
13731
  async execute(input2, _context) {
13537
13732
  const keys = Object.keys(input2).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
@@ -13545,11 +13740,14 @@ var merge = (input2, config = {}) => {
13545
13740
  const task = new MergeTask(config);
13546
13741
  return task.run(input2);
13547
13742
  };
13548
- Workflow45.prototype.merge = CreateWorkflow44(MergeTask);
13743
+ Workflow44.prototype.merge = CreateWorkflow43(MergeTask);
13549
13744
  // src/task/OutputTask.ts
13550
- 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";
13746
+ function passthroughInput2(input2) {
13747
+ return input2;
13748
+ }
13551
13749
 
13552
- class OutputTask extends Task70 {
13750
+ class OutputTask extends Task54 {
13553
13751
  static type = "OutputTask";
13554
13752
  static category = "Flow Control";
13555
13753
  static title = "Output";
@@ -13578,8 +13776,11 @@ class OutputTask extends Task70 {
13578
13776
  outputSchema() {
13579
13777
  return this.config?.outputSchema ?? this.constructor.outputSchema();
13580
13778
  }
13581
- async executeReactive(input2) {
13582
- return input2;
13779
+ async execute(input2, _context) {
13780
+ return passthroughInput2(input2);
13781
+ }
13782
+ async executePreview(input2) {
13783
+ return passthroughInput2(input2);
13583
13784
  }
13584
13785
  async* executeStream(input2, context) {
13585
13786
  if (context.inputStreams) {
@@ -13602,20 +13803,46 @@ class OutputTask extends Task70 {
13602
13803
  yield { type: "finish", data: input2 };
13603
13804
  }
13604
13805
  }
13605
- Workflow46.prototype.output = CreateWorkflow45(OutputTask);
13806
+ Workflow45.prototype.output = CreateWorkflow44(OutputTask);
13606
13807
  // src/task/RegexTask.ts
13607
13808
  import {
13608
- CreateWorkflow as CreateWorkflow46,
13609
- Task as Task71,
13809
+ CreateWorkflow as CreateWorkflow45,
13810
+ Task as Task55,
13610
13811
  TaskInvalidInputError as TaskInvalidInputError4,
13611
- Workflow as Workflow47
13812
+ Workflow as Workflow46
13612
13813
  } from "@workglow/task-graph";
13613
13814
  var MAX_BRACKET_COUNT = 100;
13614
13815
  function hasNestedQuantifiers(pattern) {
13615
13816
  const withoutClasses = pattern.replace(/\[(?:[^\]\\]|\\.)*\]/g, "X");
13616
13817
  return /\([^)]*[+*][^)]*\)[+*?]|\([^)]*[+*][^)]*\)\{/.test(withoutClasses);
13617
13818
  }
13618
- var inputSchema65 = {
13819
+ function executeRegex(input2) {
13820
+ const bracketCount = (input2.pattern.match(/\[/g) ?? []).length;
13821
+ if (bracketCount > MAX_BRACKET_COUNT) {
13822
+ throw new TaskInvalidInputError4("Regex pattern rejected: too many '[' characters (potential ReDoS). " + "Simplify the pattern to reduce complexity.");
13823
+ }
13824
+ if (hasNestedQuantifiers(input2.pattern)) {
13825
+ throw new TaskInvalidInputError4("Regex pattern rejected: nested quantifiers detected (potential ReDoS). " + "Simplify the pattern to avoid catastrophic backtracking.");
13826
+ }
13827
+ const flags = input2.flags ?? "";
13828
+ const regex = new RegExp(input2.pattern, flags);
13829
+ if (flags.includes("g")) {
13830
+ const allMatches = Array.from(input2.value.matchAll(new RegExp(input2.pattern, flags)));
13831
+ return {
13832
+ match: allMatches.length > 0,
13833
+ matches: allMatches.map((m) => m[0])
13834
+ };
13835
+ }
13836
+ const result = regex.exec(input2.value);
13837
+ if (!result) {
13838
+ return { match: false, matches: [] };
13839
+ }
13840
+ return {
13841
+ match: true,
13842
+ matches: result.slice(0)
13843
+ };
13844
+ }
13845
+ var inputSchema64 = {
13619
13846
  type: "object",
13620
13847
  properties: {
13621
13848
  value: {
@@ -13638,7 +13865,7 @@ var inputSchema65 = {
13638
13865
  required: ["value", "pattern"],
13639
13866
  additionalProperties: false
13640
13867
  };
13641
- var outputSchema64 = {
13868
+ var outputSchema63 = {
13642
13869
  type: "object",
13643
13870
  properties: {
13644
13871
  match: {
@@ -13657,48 +13884,28 @@ var outputSchema64 = {
13657
13884
  additionalProperties: false
13658
13885
  };
13659
13886
 
13660
- class RegexTask extends Task71 {
13887
+ class RegexTask extends Task55 {
13661
13888
  static type = "RegexTask";
13662
13889
  static category = "String";
13663
13890
  static title = "Regex";
13664
13891
  static description = "Matches a string against a regular expression pattern";
13665
13892
  static inputSchema() {
13666
- return inputSchema65;
13893
+ return inputSchema64;
13667
13894
  }
13668
13895
  static outputSchema() {
13669
- return outputSchema64;
13896
+ return outputSchema63;
13670
13897
  }
13671
- async executeReactive(input2, _output, _context) {
13672
- const bracketCount = (input2.pattern.match(/\[/g) ?? []).length;
13673
- if (bracketCount > MAX_BRACKET_COUNT) {
13674
- throw new TaskInvalidInputError4("Regex pattern rejected: too many '[' characters (potential ReDoS). " + "Simplify the pattern to reduce complexity.");
13675
- }
13676
- if (hasNestedQuantifiers(input2.pattern)) {
13677
- throw new TaskInvalidInputError4("Regex pattern rejected: nested quantifiers detected (potential ReDoS). " + "Simplify the pattern to avoid catastrophic backtracking.");
13678
- }
13679
- const flags = input2.flags ?? "";
13680
- const regex = new RegExp(input2.pattern, flags);
13681
- if (flags.includes("g")) {
13682
- const allMatches = Array.from(input2.value.matchAll(new RegExp(input2.pattern, flags)));
13683
- return {
13684
- match: allMatches.length > 0,
13685
- matches: allMatches.map((m) => m[0])
13686
- };
13687
- }
13688
- const result = regex.exec(input2.value);
13689
- if (!result) {
13690
- return { match: false, matches: [] };
13691
- }
13692
- return {
13693
- match: true,
13694
- matches: result.slice(0)
13695
- };
13898
+ async execute(input2, _context) {
13899
+ return executeRegex(input2);
13900
+ }
13901
+ async executePreview(input2, _context) {
13902
+ return executeRegex(input2);
13696
13903
  }
13697
13904
  }
13698
- Workflow47.prototype.regex = CreateWorkflow46(RegexTask);
13905
+ Workflow46.prototype.regex = CreateWorkflow45(RegexTask);
13699
13906
  // src/task/scalar/ScalarAbsTask.ts
13700
- import { CreateWorkflow as CreateWorkflow47, Task as Task72, Workflow as Workflow48 } from "@workglow/task-graph";
13701
- var inputSchema66 = {
13907
+ import { CreateWorkflow as CreateWorkflow46, Task as Task56, Workflow as Workflow47 } from "@workglow/task-graph";
13908
+ var inputSchema65 = {
13702
13909
  type: "object",
13703
13910
  properties: {
13704
13911
  value: {
@@ -13710,7 +13917,7 @@ var inputSchema66 = {
13710
13917
  required: ["value"],
13711
13918
  additionalProperties: false
13712
13919
  };
13713
- var outputSchema65 = {
13920
+ var outputSchema64 = {
13714
13921
  type: "object",
13715
13922
  properties: {
13716
13923
  result: {
@@ -13723,25 +13930,25 @@ var outputSchema65 = {
13723
13930
  additionalProperties: false
13724
13931
  };
13725
13932
 
13726
- class ScalarAbsTask extends Task72 {
13933
+ class ScalarAbsTask extends Task56 {
13727
13934
  static type = "ScalarAbsTask";
13728
13935
  static category = "Math";
13729
13936
  static title = "Abs";
13730
13937
  static description = "Returns the absolute value of a number";
13731
13938
  static inputSchema() {
13732
- return inputSchema66;
13939
+ return inputSchema65;
13733
13940
  }
13734
13941
  static outputSchema() {
13735
- return outputSchema65;
13942
+ return outputSchema64;
13736
13943
  }
13737
13944
  async execute(input2, _context) {
13738
13945
  return { result: Math.abs(input2.value) };
13739
13946
  }
13740
13947
  }
13741
- Workflow48.prototype.scalarAbs = CreateWorkflow47(ScalarAbsTask);
13948
+ Workflow47.prototype.scalarAbs = CreateWorkflow46(ScalarAbsTask);
13742
13949
  // src/task/scalar/ScalarCeilTask.ts
13743
- import { CreateWorkflow as CreateWorkflow48, Task as Task73, Workflow as Workflow49 } from "@workglow/task-graph";
13744
- var inputSchema67 = {
13950
+ import { CreateWorkflow as CreateWorkflow47, Task as Task57, Workflow as Workflow48 } from "@workglow/task-graph";
13951
+ var inputSchema66 = {
13745
13952
  type: "object",
13746
13953
  properties: {
13747
13954
  value: {
@@ -13753,7 +13960,7 @@ var inputSchema67 = {
13753
13960
  required: ["value"],
13754
13961
  additionalProperties: false
13755
13962
  };
13756
- var outputSchema66 = {
13963
+ var outputSchema65 = {
13757
13964
  type: "object",
13758
13965
  properties: {
13759
13966
  result: {
@@ -13766,25 +13973,25 @@ var outputSchema66 = {
13766
13973
  additionalProperties: false
13767
13974
  };
13768
13975
 
13769
- class ScalarCeilTask extends Task73 {
13976
+ class ScalarCeilTask extends Task57 {
13770
13977
  static type = "ScalarCeilTask";
13771
13978
  static category = "Math";
13772
13979
  static title = "Ceil";
13773
13980
  static description = "Returns the smallest integer greater than or equal to a number";
13774
13981
  static inputSchema() {
13775
- return inputSchema67;
13982
+ return inputSchema66;
13776
13983
  }
13777
13984
  static outputSchema() {
13778
- return outputSchema66;
13985
+ return outputSchema65;
13779
13986
  }
13780
13987
  async execute(input2, _context) {
13781
13988
  return { result: Math.ceil(input2.value) };
13782
13989
  }
13783
13990
  }
13784
- Workflow49.prototype.scalarCeil = CreateWorkflow48(ScalarCeilTask);
13991
+ Workflow48.prototype.scalarCeil = CreateWorkflow47(ScalarCeilTask);
13785
13992
  // src/task/scalar/ScalarFloorTask.ts
13786
- import { CreateWorkflow as CreateWorkflow49, Task as Task74, Workflow as Workflow50 } from "@workglow/task-graph";
13787
- var inputSchema68 = {
13993
+ import { CreateWorkflow as CreateWorkflow48, Task as Task58, Workflow as Workflow49 } from "@workglow/task-graph";
13994
+ var inputSchema67 = {
13788
13995
  type: "object",
13789
13996
  properties: {
13790
13997
  value: {
@@ -13796,7 +14003,7 @@ var inputSchema68 = {
13796
14003
  required: ["value"],
13797
14004
  additionalProperties: false
13798
14005
  };
13799
- var outputSchema67 = {
14006
+ var outputSchema66 = {
13800
14007
  type: "object",
13801
14008
  properties: {
13802
14009
  result: {
@@ -13809,25 +14016,25 @@ var outputSchema67 = {
13809
14016
  additionalProperties: false
13810
14017
  };
13811
14018
 
13812
- class ScalarFloorTask extends Task74 {
14019
+ class ScalarFloorTask extends Task58 {
13813
14020
  static type = "ScalarFloorTask";
13814
14021
  static category = "Math";
13815
14022
  static title = "Floor";
13816
14023
  static description = "Returns the largest integer less than or equal to a number";
13817
14024
  static inputSchema() {
13818
- return inputSchema68;
14025
+ return inputSchema67;
13819
14026
  }
13820
14027
  static outputSchema() {
13821
- return outputSchema67;
14028
+ return outputSchema66;
13822
14029
  }
13823
14030
  async execute(input2, _context) {
13824
14031
  return { result: Math.floor(input2.value) };
13825
14032
  }
13826
14033
  }
13827
- Workflow50.prototype.scalarFloor = CreateWorkflow49(ScalarFloorTask);
14034
+ Workflow49.prototype.scalarFloor = CreateWorkflow48(ScalarFloorTask);
13828
14035
  // src/task/scalar/ScalarMaxTask.ts
13829
- import { CreateWorkflow as CreateWorkflow50, Task as Task75, Workflow as Workflow51 } from "@workglow/task-graph";
13830
- var inputSchema69 = {
14036
+ import { CreateWorkflow as CreateWorkflow49, Task as Task59, Workflow as Workflow50 } from "@workglow/task-graph";
14037
+ var inputSchema68 = {
13831
14038
  type: "object",
13832
14039
  properties: {
13833
14040
  values: {
@@ -13840,7 +14047,7 @@ var inputSchema69 = {
13840
14047
  required: ["values"],
13841
14048
  additionalProperties: false
13842
14049
  };
13843
- var outputSchema68 = {
14050
+ var outputSchema67 = {
13844
14051
  type: "object",
13845
14052
  properties: {
13846
14053
  result: {
@@ -13853,25 +14060,25 @@ var outputSchema68 = {
13853
14060
  additionalProperties: false
13854
14061
  };
13855
14062
 
13856
- class ScalarMaxTask extends Task75 {
14063
+ class ScalarMaxTask extends Task59 {
13857
14064
  static type = "ScalarMaxTask";
13858
14065
  static category = "Math";
13859
14066
  static title = "Max";
13860
14067
  static description = "Returns the largest of the given numbers";
13861
14068
  static inputSchema() {
13862
- return inputSchema69;
14069
+ return inputSchema68;
13863
14070
  }
13864
14071
  static outputSchema() {
13865
- return outputSchema68;
14072
+ return outputSchema67;
13866
14073
  }
13867
14074
  async execute(input2, _context) {
13868
14075
  return { result: Math.max(...input2.values) };
13869
14076
  }
13870
14077
  }
13871
- Workflow51.prototype.scalarMax = CreateWorkflow50(ScalarMaxTask);
14078
+ Workflow50.prototype.scalarMax = CreateWorkflow49(ScalarMaxTask);
13872
14079
  // src/task/scalar/ScalarMinTask.ts
13873
- import { CreateWorkflow as CreateWorkflow51, Task as Task76, Workflow as Workflow52 } from "@workglow/task-graph";
13874
- var inputSchema70 = {
14080
+ import { CreateWorkflow as CreateWorkflow50, Task as Task60, Workflow as Workflow51 } from "@workglow/task-graph";
14081
+ var inputSchema69 = {
13875
14082
  type: "object",
13876
14083
  properties: {
13877
14084
  values: {
@@ -13884,7 +14091,7 @@ var inputSchema70 = {
13884
14091
  required: ["values"],
13885
14092
  additionalProperties: false
13886
14093
  };
13887
- var outputSchema69 = {
14094
+ var outputSchema68 = {
13888
14095
  type: "object",
13889
14096
  properties: {
13890
14097
  result: {
@@ -13897,25 +14104,25 @@ var outputSchema69 = {
13897
14104
  additionalProperties: false
13898
14105
  };
13899
14106
 
13900
- class ScalarMinTask extends Task76 {
14107
+ class ScalarMinTask extends Task60 {
13901
14108
  static type = "ScalarMinTask";
13902
14109
  static category = "Math";
13903
14110
  static title = "Min";
13904
14111
  static description = "Returns the smallest of the given numbers";
13905
14112
  static inputSchema() {
13906
- return inputSchema70;
14113
+ return inputSchema69;
13907
14114
  }
13908
14115
  static outputSchema() {
13909
- return outputSchema69;
14116
+ return outputSchema68;
13910
14117
  }
13911
14118
  async execute(input2, _context) {
13912
14119
  return { result: Math.min(...input2.values) };
13913
14120
  }
13914
14121
  }
13915
- Workflow52.prototype.scalarMin = CreateWorkflow51(ScalarMinTask);
14122
+ Workflow51.prototype.scalarMin = CreateWorkflow50(ScalarMinTask);
13916
14123
  // src/task/scalar/ScalarRoundTask.ts
13917
- import { CreateWorkflow as CreateWorkflow52, Task as Task77, Workflow as Workflow53 } from "@workglow/task-graph";
13918
- var inputSchema71 = {
14124
+ import { CreateWorkflow as CreateWorkflow51, Task as Task61, Workflow as Workflow52 } from "@workglow/task-graph";
14125
+ var inputSchema70 = {
13919
14126
  type: "object",
13920
14127
  properties: {
13921
14128
  value: {
@@ -13927,7 +14134,7 @@ var inputSchema71 = {
13927
14134
  required: ["value"],
13928
14135
  additionalProperties: false
13929
14136
  };
13930
- var outputSchema70 = {
14137
+ var outputSchema69 = {
13931
14138
  type: "object",
13932
14139
  properties: {
13933
14140
  result: {
@@ -13940,25 +14147,25 @@ var outputSchema70 = {
13940
14147
  additionalProperties: false
13941
14148
  };
13942
14149
 
13943
- class ScalarRoundTask extends Task77 {
14150
+ class ScalarRoundTask extends Task61 {
13944
14151
  static type = "ScalarRoundTask";
13945
14152
  static category = "Math";
13946
14153
  static title = "Round";
13947
14154
  static description = "Returns the value of a number rounded to the nearest integer";
13948
14155
  static inputSchema() {
13949
- return inputSchema71;
14156
+ return inputSchema70;
13950
14157
  }
13951
14158
  static outputSchema() {
13952
- return outputSchema70;
14159
+ return outputSchema69;
13953
14160
  }
13954
14161
  async execute(input2, _context) {
13955
14162
  return { result: Math.round(input2.value) };
13956
14163
  }
13957
14164
  }
13958
- Workflow53.prototype.scalarRound = CreateWorkflow52(ScalarRoundTask);
14165
+ Workflow52.prototype.scalarRound = CreateWorkflow51(ScalarRoundTask);
13959
14166
  // src/task/scalar/ScalarTruncTask.ts
13960
- import { CreateWorkflow as CreateWorkflow53, Task as Task78, Workflow as Workflow54 } from "@workglow/task-graph";
13961
- var inputSchema72 = {
14167
+ import { CreateWorkflow as CreateWorkflow52, Task as Task62, Workflow as Workflow53 } from "@workglow/task-graph";
14168
+ var inputSchema71 = {
13962
14169
  type: "object",
13963
14170
  properties: {
13964
14171
  value: {
@@ -13970,7 +14177,7 @@ var inputSchema72 = {
13970
14177
  required: ["value"],
13971
14178
  additionalProperties: false
13972
14179
  };
13973
- var outputSchema71 = {
14180
+ var outputSchema70 = {
13974
14181
  type: "object",
13975
14182
  properties: {
13976
14183
  result: {
@@ -13983,25 +14190,25 @@ var outputSchema71 = {
13983
14190
  additionalProperties: false
13984
14191
  };
13985
14192
 
13986
- class ScalarTruncTask extends Task78 {
14193
+ class ScalarTruncTask extends Task62 {
13987
14194
  static type = "ScalarTruncTask";
13988
14195
  static category = "Math";
13989
14196
  static title = "Truncate";
13990
14197
  static description = "Returns the integer part of a number by removing fractional digits";
13991
14198
  static inputSchema() {
13992
- return inputSchema72;
14199
+ return inputSchema71;
13993
14200
  }
13994
14201
  static outputSchema() {
13995
- return outputSchema71;
14202
+ return outputSchema70;
13996
14203
  }
13997
14204
  async execute(input2, _context) {
13998
14205
  return { result: Math.trunc(input2.value) };
13999
14206
  }
14000
14207
  }
14001
- Workflow54.prototype.scalarTrunc = CreateWorkflow53(ScalarTruncTask);
14208
+ Workflow53.prototype.scalarTrunc = CreateWorkflow52(ScalarTruncTask);
14002
14209
  // src/task/SplitTask.ts
14003
- import { CreateWorkflow as CreateWorkflow54, Task as Task79, Workflow as Workflow55 } from "@workglow/task-graph";
14004
- var inputSchema73 = {
14210
+ import { CreateWorkflow as CreateWorkflow53, Task as Task63, Workflow as Workflow54 } from "@workglow/task-graph";
14211
+ var inputSchema72 = {
14005
14212
  type: "object",
14006
14213
  properties: {
14007
14214
  input: {
@@ -14011,54 +14218,62 @@ var inputSchema73 = {
14011
14218
  },
14012
14219
  additionalProperties: false
14013
14220
  };
14014
- var outputSchema72 = {
14221
+ var outputSchema71 = {
14015
14222
  type: "object",
14016
14223
  properties: {},
14017
14224
  additionalProperties: true
14018
14225
  };
14226
+ function fanoutToIndexedOutputs(inputValue) {
14227
+ const output = {};
14228
+ if (Array.isArray(inputValue)) {
14229
+ inputValue.forEach((item, index) => {
14230
+ output[`output_${index}`] = item;
14231
+ });
14232
+ } else {
14233
+ output.output_0 = inputValue;
14234
+ }
14235
+ return output;
14236
+ }
14019
14237
 
14020
- class SplitTask extends Task79 {
14238
+ class SplitTask extends Task63 {
14021
14239
  static type = "SplitTask";
14022
14240
  static category = "Utility";
14023
14241
  static title = "Split";
14024
14242
  static description = "Splits an array into individual outputs, creating one output per element";
14025
14243
  static cacheable = false;
14026
14244
  static inputSchema() {
14027
- return inputSchema73;
14245
+ return inputSchema72;
14028
14246
  }
14029
14247
  static outputSchema() {
14030
- return outputSchema72;
14248
+ return outputSchema71;
14031
14249
  }
14032
- async executeReactive(input2) {
14033
- const inputValue = input2.input;
14034
- const output = {};
14035
- if (Array.isArray(inputValue)) {
14036
- inputValue.forEach((item, index) => {
14037
- output[`output_${index}`] = item;
14038
- });
14039
- } else {
14040
- output.output_0 = inputValue;
14041
- }
14042
- return output;
14250
+ async execute(input2, _context) {
14251
+ return fanoutToIndexedOutputs(input2.input);
14252
+ }
14253
+ async executePreview(input2) {
14254
+ return fanoutToIndexedOutputs(input2.input);
14043
14255
  }
14044
14256
  }
14045
14257
  var split = (input2, config = {}) => {
14046
14258
  const task = new SplitTask(config);
14047
14259
  return task.run(input2);
14048
14260
  };
14049
- Workflow55.prototype.split = CreateWorkflow54(SplitTask);
14261
+ Workflow54.prototype.split = CreateWorkflow53(SplitTask);
14050
14262
  // src/task/string/StringConcatTask.ts
14051
14263
  import {
14052
- CreateWorkflow as CreateWorkflow55,
14053
- Task as Task80,
14054
- Workflow as Workflow56
14264
+ CreateWorkflow as CreateWorkflow54,
14265
+ Task as Task64,
14266
+ Workflow as Workflow55
14055
14267
  } from "@workglow/task-graph";
14056
- var inputSchema74 = {
14268
+ function concatStrings(input2) {
14269
+ return Object.values(input2).join("");
14270
+ }
14271
+ var inputSchema73 = {
14057
14272
  type: "object",
14058
14273
  properties: {},
14059
14274
  additionalProperties: { type: "string" }
14060
14275
  };
14061
- var outputSchema73 = {
14276
+ var outputSchema72 = {
14062
14277
  type: "object",
14063
14278
  properties: {
14064
14279
  text: {
@@ -14071,29 +14286,35 @@ var outputSchema73 = {
14071
14286
  additionalProperties: false
14072
14287
  };
14073
14288
 
14074
- class StringConcatTask extends Task80 {
14289
+ class StringConcatTask extends Task64 {
14075
14290
  static type = "StringConcatTask";
14076
14291
  static category = "String";
14077
14292
  static title = "Concat";
14078
14293
  static description = "Concatenates all input strings";
14079
14294
  static inputSchema() {
14080
- return inputSchema74;
14295
+ return inputSchema73;
14081
14296
  }
14082
14297
  static outputSchema() {
14083
- return outputSchema73;
14298
+ return outputSchema72;
14299
+ }
14300
+ async execute(input2, _context) {
14301
+ return { text: concatStrings(input2) };
14084
14302
  }
14085
- async executeReactive(input2, _output, _context) {
14086
- return { text: Object.values(input2).join("") };
14303
+ async executePreview(input2, _context) {
14304
+ return { text: concatStrings(input2) };
14087
14305
  }
14088
14306
  }
14089
- Workflow56.prototype.stringConcat = CreateWorkflow55(StringConcatTask);
14307
+ Workflow55.prototype.stringConcat = CreateWorkflow54(StringConcatTask);
14090
14308
  // src/task/string/StringIncludesTask.ts
14091
14309
  import {
14092
- CreateWorkflow as CreateWorkflow56,
14093
- Task as Task81,
14094
- Workflow as Workflow57
14310
+ CreateWorkflow as CreateWorkflow55,
14311
+ Task as Task65,
14312
+ Workflow as Workflow56
14095
14313
  } from "@workglow/task-graph";
14096
- var inputSchema75 = {
14314
+ function stringIncludes(text, search) {
14315
+ return text.includes(search);
14316
+ }
14317
+ var inputSchema74 = {
14097
14318
  type: "object",
14098
14319
  properties: {
14099
14320
  text: {
@@ -14110,7 +14331,7 @@ var inputSchema75 = {
14110
14331
  required: ["text", "search"],
14111
14332
  additionalProperties: false
14112
14333
  };
14113
- var outputSchema74 = {
14334
+ var outputSchema73 = {
14114
14335
  type: "object",
14115
14336
  properties: {
14116
14337
  included: {
@@ -14123,29 +14344,35 @@ var outputSchema74 = {
14123
14344
  additionalProperties: false
14124
14345
  };
14125
14346
 
14126
- class StringIncludesTask extends Task81 {
14347
+ class StringIncludesTask extends Task65 {
14127
14348
  static type = "StringIncludesTask";
14128
14349
  static category = "String";
14129
14350
  static title = "Includes";
14130
14351
  static description = "Checks if a string contains a substring";
14131
14352
  static inputSchema() {
14132
- return inputSchema75;
14353
+ return inputSchema74;
14133
14354
  }
14134
14355
  static outputSchema() {
14135
- return outputSchema74;
14356
+ return outputSchema73;
14357
+ }
14358
+ async execute(input2, _context) {
14359
+ return { included: stringIncludes(input2.text, input2.search) };
14136
14360
  }
14137
- async executeReactive(input2, _output, _context) {
14138
- return { included: input2.text.includes(input2.search) };
14361
+ async executePreview(input2, _context) {
14362
+ return { included: stringIncludes(input2.text, input2.search) };
14139
14363
  }
14140
14364
  }
14141
- Workflow57.prototype.stringIncludes = CreateWorkflow56(StringIncludesTask);
14365
+ Workflow56.prototype.stringIncludes = CreateWorkflow55(StringIncludesTask);
14142
14366
  // src/task/string/StringJoinTask.ts
14143
14367
  import {
14144
- CreateWorkflow as CreateWorkflow57,
14145
- Task as Task82,
14146
- Workflow as Workflow58
14368
+ CreateWorkflow as CreateWorkflow56,
14369
+ Task as Task66,
14370
+ Workflow as Workflow57
14147
14371
  } from "@workglow/task-graph";
14148
- var inputSchema76 = {
14372
+ function joinStrings(texts, separator) {
14373
+ return texts.join(separator ?? "");
14374
+ }
14375
+ var inputSchema75 = {
14149
14376
  type: "object",
14150
14377
  properties: {
14151
14378
  texts: {
@@ -14164,7 +14391,7 @@ var inputSchema76 = {
14164
14391
  required: ["texts"],
14165
14392
  additionalProperties: false
14166
14393
  };
14167
- var outputSchema75 = {
14394
+ var outputSchema74 = {
14168
14395
  type: "object",
14169
14396
  properties: {
14170
14397
  text: {
@@ -14177,30 +14404,35 @@ var outputSchema75 = {
14177
14404
  additionalProperties: false
14178
14405
  };
14179
14406
 
14180
- class StringJoinTask extends Task82 {
14407
+ class StringJoinTask extends Task66 {
14181
14408
  static type = "StringJoinTask";
14182
14409
  static category = "String";
14183
14410
  static title = "Join";
14184
14411
  static description = "Joins an array of strings with a separator";
14185
14412
  static inputSchema() {
14186
- return inputSchema76;
14413
+ return inputSchema75;
14187
14414
  }
14188
14415
  static outputSchema() {
14189
- return outputSchema75;
14416
+ return outputSchema74;
14417
+ }
14418
+ async execute(input2, _context) {
14419
+ return { text: joinStrings(input2.texts, input2.separator) };
14190
14420
  }
14191
- async executeReactive(input2, _output, _context) {
14192
- const separator = input2.separator ?? "";
14193
- return { text: input2.texts.join(separator) };
14421
+ async executePreview(input2, _context) {
14422
+ return { text: joinStrings(input2.texts, input2.separator) };
14194
14423
  }
14195
14424
  }
14196
- Workflow58.prototype.stringJoin = CreateWorkflow57(StringJoinTask);
14425
+ Workflow57.prototype.stringJoin = CreateWorkflow56(StringJoinTask);
14197
14426
  // src/task/string/StringLengthTask.ts
14198
14427
  import {
14199
- CreateWorkflow as CreateWorkflow58,
14200
- Task as Task83,
14201
- Workflow as Workflow59
14428
+ CreateWorkflow as CreateWorkflow57,
14429
+ Task as Task67,
14430
+ Workflow as Workflow58
14202
14431
  } from "@workglow/task-graph";
14203
- var inputSchema77 = {
14432
+ function stringLength(text) {
14433
+ return text.length;
14434
+ }
14435
+ var inputSchema76 = {
14204
14436
  type: "object",
14205
14437
  properties: {
14206
14438
  text: {
@@ -14212,7 +14444,7 @@ var inputSchema77 = {
14212
14444
  required: ["text"],
14213
14445
  additionalProperties: false
14214
14446
  };
14215
- var outputSchema76 = {
14447
+ var outputSchema75 = {
14216
14448
  type: "object",
14217
14449
  properties: {
14218
14450
  length: {
@@ -14225,29 +14457,35 @@ var outputSchema76 = {
14225
14457
  additionalProperties: false
14226
14458
  };
14227
14459
 
14228
- class StringLengthTask extends Task83 {
14460
+ class StringLengthTask extends Task67 {
14229
14461
  static type = "StringLengthTask";
14230
14462
  static category = "String";
14231
14463
  static title = "Length";
14232
14464
  static description = "Returns the length of a string";
14233
14465
  static inputSchema() {
14234
- return inputSchema77;
14466
+ return inputSchema76;
14235
14467
  }
14236
14468
  static outputSchema() {
14237
- return outputSchema76;
14469
+ return outputSchema75;
14470
+ }
14471
+ async execute(input2, _context) {
14472
+ return { length: stringLength(input2.text) };
14238
14473
  }
14239
- async executeReactive(input2, _output, _context) {
14240
- return { length: input2.text.length };
14474
+ async executePreview(input2, _context) {
14475
+ return { length: stringLength(input2.text) };
14241
14476
  }
14242
14477
  }
14243
- Workflow59.prototype.stringLength = CreateWorkflow58(StringLengthTask);
14478
+ Workflow58.prototype.stringLength = CreateWorkflow57(StringLengthTask);
14244
14479
  // src/task/string/StringLowerCaseTask.ts
14245
14480
  import {
14246
- CreateWorkflow as CreateWorkflow59,
14247
- Task as Task84,
14248
- Workflow as Workflow60
14481
+ CreateWorkflow as CreateWorkflow58,
14482
+ Task as Task68,
14483
+ Workflow as Workflow59
14249
14484
  } from "@workglow/task-graph";
14250
- var inputSchema78 = {
14485
+ function toLowerCase(text) {
14486
+ return text.toLowerCase();
14487
+ }
14488
+ var inputSchema77 = {
14251
14489
  type: "object",
14252
14490
  properties: {
14253
14491
  text: {
@@ -14259,7 +14497,7 @@ var inputSchema78 = {
14259
14497
  required: ["text"],
14260
14498
  additionalProperties: false
14261
14499
  };
14262
- var outputSchema77 = {
14500
+ var outputSchema76 = {
14263
14501
  type: "object",
14264
14502
  properties: {
14265
14503
  text: {
@@ -14272,29 +14510,35 @@ var outputSchema77 = {
14272
14510
  additionalProperties: false
14273
14511
  };
14274
14512
 
14275
- class StringLowerCaseTask extends Task84 {
14513
+ class StringLowerCaseTask extends Task68 {
14276
14514
  static type = "StringLowerCaseTask";
14277
14515
  static category = "String";
14278
14516
  static title = "Lower Case";
14279
14517
  static description = "Converts a string to lower case";
14280
14518
  static inputSchema() {
14281
- return inputSchema78;
14519
+ return inputSchema77;
14282
14520
  }
14283
14521
  static outputSchema() {
14284
- return outputSchema77;
14522
+ return outputSchema76;
14523
+ }
14524
+ async execute(input2, _context) {
14525
+ return { text: toLowerCase(input2.text) };
14285
14526
  }
14286
- async executeReactive(input2, _output, _context) {
14287
- return { text: input2.text.toLowerCase() };
14527
+ async executePreview(input2, _context) {
14528
+ return { text: toLowerCase(input2.text) };
14288
14529
  }
14289
14530
  }
14290
- Workflow60.prototype.stringLowerCase = CreateWorkflow59(StringLowerCaseTask);
14531
+ Workflow59.prototype.stringLowerCase = CreateWorkflow58(StringLowerCaseTask);
14291
14532
  // src/task/string/StringReplaceTask.ts
14292
14533
  import {
14293
- CreateWorkflow as CreateWorkflow60,
14294
- Task as Task85,
14295
- Workflow as Workflow61
14534
+ CreateWorkflow as CreateWorkflow59,
14535
+ Task as Task69,
14536
+ Workflow as Workflow60
14296
14537
  } from "@workglow/task-graph";
14297
- var inputSchema79 = {
14538
+ function replaceString(text, search, replace) {
14539
+ return text.replaceAll(search, replace);
14540
+ }
14541
+ var inputSchema78 = {
14298
14542
  type: "object",
14299
14543
  properties: {
14300
14544
  text: {
@@ -14316,7 +14560,7 @@ var inputSchema79 = {
14316
14560
  required: ["text", "search", "replace"],
14317
14561
  additionalProperties: false
14318
14562
  };
14319
- var outputSchema78 = {
14563
+ var outputSchema77 = {
14320
14564
  type: "object",
14321
14565
  properties: {
14322
14566
  text: {
@@ -14329,29 +14573,35 @@ var outputSchema78 = {
14329
14573
  additionalProperties: false
14330
14574
  };
14331
14575
 
14332
- class StringReplaceTask extends Task85 {
14576
+ class StringReplaceTask extends Task69 {
14333
14577
  static type = "StringReplaceTask";
14334
14578
  static category = "String";
14335
14579
  static title = "Replace";
14336
14580
  static description = "Replaces all occurrences of a substring";
14337
14581
  static inputSchema() {
14338
- return inputSchema79;
14582
+ return inputSchema78;
14339
14583
  }
14340
14584
  static outputSchema() {
14341
- return outputSchema78;
14585
+ return outputSchema77;
14342
14586
  }
14343
- async executeReactive(input2, _output, _context) {
14344
- return { text: input2.text.replaceAll(input2.search, input2.replace) };
14587
+ async execute(input2, _context) {
14588
+ return { text: replaceString(input2.text, input2.search, input2.replace) };
14589
+ }
14590
+ async executePreview(input2, _context) {
14591
+ return { text: replaceString(input2.text, input2.search, input2.replace) };
14345
14592
  }
14346
14593
  }
14347
- Workflow61.prototype.stringReplace = CreateWorkflow60(StringReplaceTask);
14594
+ Workflow60.prototype.stringReplace = CreateWorkflow59(StringReplaceTask);
14348
14595
  // src/task/string/StringSliceTask.ts
14349
14596
  import {
14350
- CreateWorkflow as CreateWorkflow61,
14351
- Task as Task86,
14352
- Workflow as Workflow62
14597
+ CreateWorkflow as CreateWorkflow60,
14598
+ Task as Task70,
14599
+ Workflow as Workflow61
14353
14600
  } from "@workglow/task-graph";
14354
- var inputSchema80 = {
14601
+ function sliceString(text, start, end) {
14602
+ return text.slice(start, end);
14603
+ }
14604
+ var inputSchema79 = {
14355
14605
  type: "object",
14356
14606
  properties: {
14357
14607
  text: {
@@ -14373,7 +14623,7 @@ var inputSchema80 = {
14373
14623
  required: ["text", "start"],
14374
14624
  additionalProperties: false
14375
14625
  };
14376
- var outputSchema79 = {
14626
+ var outputSchema78 = {
14377
14627
  type: "object",
14378
14628
  properties: {
14379
14629
  text: {
@@ -14386,29 +14636,39 @@ var outputSchema79 = {
14386
14636
  additionalProperties: false
14387
14637
  };
14388
14638
 
14389
- class StringSliceTask extends Task86 {
14639
+ class StringSliceTask extends Task70 {
14390
14640
  static type = "StringSliceTask";
14391
14641
  static category = "String";
14392
14642
  static title = "Slice";
14393
14643
  static description = "Extracts a substring by start and optional end index";
14394
14644
  static inputSchema() {
14395
- return inputSchema80;
14645
+ return inputSchema79;
14396
14646
  }
14397
14647
  static outputSchema() {
14398
- return outputSchema79;
14648
+ return outputSchema78;
14649
+ }
14650
+ async execute(input2, _context) {
14651
+ return { text: sliceString(input2.text, input2.start, input2.end) };
14399
14652
  }
14400
- async executeReactive(input2, _output, _context) {
14401
- return { text: input2.text.slice(input2.start, input2.end) };
14653
+ async executePreview(input2, _context) {
14654
+ return { text: sliceString(input2.text, input2.start, input2.end) };
14402
14655
  }
14403
14656
  }
14404
- Workflow62.prototype.stringSlice = CreateWorkflow61(StringSliceTask);
14657
+ Workflow61.prototype.stringSlice = CreateWorkflow60(StringSliceTask);
14405
14658
  // src/task/string/StringTemplateTask.ts
14406
14659
  import {
14407
- CreateWorkflow as CreateWorkflow62,
14408
- Task as Task87,
14409
- Workflow as Workflow63
14660
+ CreateWorkflow as CreateWorkflow61,
14661
+ Task as Task71,
14662
+ Workflow as Workflow62
14410
14663
  } from "@workglow/task-graph";
14411
- var inputSchema81 = {
14664
+ function renderStringTemplate(template, values) {
14665
+ let text = template;
14666
+ for (const [key, value] of Object.entries(values)) {
14667
+ text = text.replaceAll(`{{${key}}}`, String(value));
14668
+ }
14669
+ return text;
14670
+ }
14671
+ var inputSchema80 = {
14412
14672
  type: "object",
14413
14673
  properties: {
14414
14674
  template: {
@@ -14426,7 +14686,7 @@ var inputSchema81 = {
14426
14686
  required: ["template", "values"],
14427
14687
  additionalProperties: false
14428
14688
  };
14429
- var outputSchema80 = {
14689
+ var outputSchema79 = {
14430
14690
  type: "object",
14431
14691
  properties: {
14432
14692
  text: {
@@ -14439,33 +14699,35 @@ var outputSchema80 = {
14439
14699
  additionalProperties: false
14440
14700
  };
14441
14701
 
14442
- class StringTemplateTask extends Task87 {
14702
+ class StringTemplateTask extends Task71 {
14443
14703
  static type = "StringTemplateTask";
14444
14704
  static category = "String";
14445
14705
  static title = "Template";
14446
14706
  static description = "Replaces {{key}} placeholders in a template string with values";
14447
14707
  static inputSchema() {
14448
- return inputSchema81;
14708
+ return inputSchema80;
14449
14709
  }
14450
14710
  static outputSchema() {
14451
- return outputSchema80;
14711
+ return outputSchema79;
14452
14712
  }
14453
- async executeReactive(input2, _output, _context) {
14454
- let text = input2.template;
14455
- for (const [key, value] of Object.entries(input2.values)) {
14456
- text = text.replaceAll(`{{${key}}}`, String(value));
14457
- }
14458
- return { text };
14713
+ async execute(input2, _context) {
14714
+ return { text: renderStringTemplate(input2.template, input2.values) };
14715
+ }
14716
+ async executePreview(input2, _context) {
14717
+ return { text: renderStringTemplate(input2.template, input2.values) };
14459
14718
  }
14460
14719
  }
14461
- Workflow63.prototype.stringTemplate = CreateWorkflow62(StringTemplateTask);
14720
+ Workflow62.prototype.stringTemplate = CreateWorkflow61(StringTemplateTask);
14462
14721
  // src/task/string/StringTrimTask.ts
14463
14722
  import {
14464
- CreateWorkflow as CreateWorkflow63,
14465
- Task as Task88,
14466
- Workflow as Workflow64
14723
+ CreateWorkflow as CreateWorkflow62,
14724
+ Task as Task72,
14725
+ Workflow as Workflow63
14467
14726
  } from "@workglow/task-graph";
14468
- var inputSchema82 = {
14727
+ function trimString(text) {
14728
+ return text.trim();
14729
+ }
14730
+ var inputSchema81 = {
14469
14731
  type: "object",
14470
14732
  properties: {
14471
14733
  text: {
@@ -14477,7 +14739,7 @@ var inputSchema82 = {
14477
14739
  required: ["text"],
14478
14740
  additionalProperties: false
14479
14741
  };
14480
- var outputSchema81 = {
14742
+ var outputSchema80 = {
14481
14743
  type: "object",
14482
14744
  properties: {
14483
14745
  text: {
@@ -14490,29 +14752,35 @@ var outputSchema81 = {
14490
14752
  additionalProperties: false
14491
14753
  };
14492
14754
 
14493
- class StringTrimTask extends Task88 {
14755
+ class StringTrimTask extends Task72 {
14494
14756
  static type = "StringTrimTask";
14495
14757
  static category = "String";
14496
14758
  static title = "Trim";
14497
14759
  static description = "Removes leading and trailing whitespace from a string";
14498
14760
  static inputSchema() {
14499
- return inputSchema82;
14761
+ return inputSchema81;
14500
14762
  }
14501
14763
  static outputSchema() {
14502
- return outputSchema81;
14764
+ return outputSchema80;
14503
14765
  }
14504
- async executeReactive(input2, _output, _context) {
14505
- return { text: input2.text.trim() };
14766
+ async execute(input2, _context) {
14767
+ return { text: trimString(input2.text) };
14768
+ }
14769
+ async executePreview(input2, _context) {
14770
+ return { text: trimString(input2.text) };
14506
14771
  }
14507
14772
  }
14508
- Workflow64.prototype.stringTrim = CreateWorkflow63(StringTrimTask);
14773
+ Workflow63.prototype.stringTrim = CreateWorkflow62(StringTrimTask);
14509
14774
  // src/task/string/StringUpperCaseTask.ts
14510
14775
  import {
14511
- CreateWorkflow as CreateWorkflow64,
14512
- Task as Task89,
14513
- Workflow as Workflow65
14776
+ CreateWorkflow as CreateWorkflow63,
14777
+ Task as Task73,
14778
+ Workflow as Workflow64
14514
14779
  } from "@workglow/task-graph";
14515
- var inputSchema83 = {
14780
+ function toUpperCase(text) {
14781
+ return text.toUpperCase();
14782
+ }
14783
+ var inputSchema82 = {
14516
14784
  type: "object",
14517
14785
  properties: {
14518
14786
  text: {
@@ -14524,7 +14792,7 @@ var inputSchema83 = {
14524
14792
  required: ["text"],
14525
14793
  additionalProperties: false
14526
14794
  };
14527
- var outputSchema82 = {
14795
+ var outputSchema81 = {
14528
14796
  type: "object",
14529
14797
  properties: {
14530
14798
  text: {
@@ -14537,29 +14805,50 @@ var outputSchema82 = {
14537
14805
  additionalProperties: false
14538
14806
  };
14539
14807
 
14540
- class StringUpperCaseTask extends Task89 {
14808
+ class StringUpperCaseTask extends Task73 {
14541
14809
  static type = "StringUpperCaseTask";
14542
14810
  static category = "String";
14543
14811
  static title = "Upper Case";
14544
14812
  static description = "Converts a string to upper case";
14545
14813
  static inputSchema() {
14546
- return inputSchema83;
14814
+ return inputSchema82;
14547
14815
  }
14548
14816
  static outputSchema() {
14549
- return outputSchema82;
14817
+ return outputSchema81;
14818
+ }
14819
+ async execute(input2, _context) {
14820
+ return { text: toUpperCase(input2.text) };
14550
14821
  }
14551
- async executeReactive(input2, _output, _context) {
14552
- return { text: input2.text.toUpperCase() };
14822
+ async executePreview(input2, _context) {
14823
+ return { text: toUpperCase(input2.text) };
14553
14824
  }
14554
14825
  }
14555
- Workflow65.prototype.stringUpperCase = CreateWorkflow64(StringUpperCaseTask);
14826
+ Workflow64.prototype.stringUpperCase = CreateWorkflow63(StringUpperCaseTask);
14556
14827
  // src/task/TemplateTask.ts
14557
14828
  import {
14558
- CreateWorkflow as CreateWorkflow65,
14559
- Task as Task90,
14560
- Workflow as Workflow66
14829
+ CreateWorkflow as CreateWorkflow64,
14830
+ Task as Task74,
14831
+ Workflow as Workflow65
14561
14832
  } from "@workglow/task-graph";
14562
- var inputSchema84 = {
14833
+ function renderTemplate(template, values) {
14834
+ return template.replace(/\{\{([^{}]+)\}\}/g, (_match, expr) => {
14835
+ const [path, defaultValue] = expr.split("|").map((s) => s.trim());
14836
+ const segments = path.split(".");
14837
+ let current = values;
14838
+ for (const segment of segments) {
14839
+ if (current === null || current === undefined || typeof current !== "object") {
14840
+ current = undefined;
14841
+ break;
14842
+ }
14843
+ current = current[segment];
14844
+ }
14845
+ if (current !== undefined && current !== null) {
14846
+ return String(current);
14847
+ }
14848
+ return defaultValue !== undefined ? defaultValue : "";
14849
+ });
14850
+ }
14851
+ var inputSchema83 = {
14563
14852
  type: "object",
14564
14853
  properties: {
14565
14854
  template: {
@@ -14577,7 +14866,7 @@ var inputSchema84 = {
14577
14866
  required: ["template", "values"],
14578
14867
  additionalProperties: false
14579
14868
  };
14580
- var outputSchema83 = {
14869
+ var outputSchema82 = {
14581
14870
  type: "object",
14582
14871
  properties: {
14583
14872
  result: {
@@ -14590,44 +14879,31 @@ var outputSchema83 = {
14590
14879
  additionalProperties: false
14591
14880
  };
14592
14881
 
14593
- class TemplateTask extends Task90 {
14882
+ class TemplateTask extends Task74 {
14594
14883
  static type = "TemplateTask";
14595
14884
  static category = "Utility";
14596
14885
  static title = "Template";
14597
14886
  static description = "Renders a template string with {{key}} placeholders and optional defaults";
14598
14887
  static inputSchema() {
14599
- return inputSchema84;
14888
+ return inputSchema83;
14600
14889
  }
14601
14890
  static outputSchema() {
14602
- return outputSchema83;
14891
+ return outputSchema82;
14603
14892
  }
14604
- async executeReactive(input2, _output, _context) {
14605
- const result = input2.template.replace(/\{\{([^}]+)\}\}/g, (_match, expr) => {
14606
- const [path, defaultValue] = expr.split("|").map((s) => s.trim());
14607
- const segments = path.split(".");
14608
- let current = input2.values;
14609
- for (const segment of segments) {
14610
- if (current === null || current === undefined || typeof current !== "object") {
14611
- current = undefined;
14612
- break;
14613
- }
14614
- current = current[segment];
14615
- }
14616
- if (current !== undefined && current !== null) {
14617
- return String(current);
14618
- }
14619
- return defaultValue !== undefined ? defaultValue : "";
14620
- });
14621
- return { result };
14893
+ async execute(input2, _context) {
14894
+ return { result: renderTemplate(input2.template, input2.values) };
14895
+ }
14896
+ async executePreview(input2, _context) {
14897
+ return { result: renderTemplate(input2.template, input2.values) };
14622
14898
  }
14623
14899
  }
14624
- Workflow66.prototype.template = CreateWorkflow65(TemplateTask);
14900
+ Workflow65.prototype.template = CreateWorkflow64(TemplateTask);
14625
14901
  // src/task/vector/VectorDistanceTask.ts
14626
- 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";
14627
14903
  import {
14628
14904
  TypedArraySchema as TypedArraySchema5
14629
14905
  } from "@workglow/util/schema";
14630
- var inputSchema85 = {
14906
+ var inputSchema84 = {
14631
14907
  type: "object",
14632
14908
  properties: {
14633
14909
  vectors: {
@@ -14643,7 +14919,7 @@ var inputSchema85 = {
14643
14919
  required: ["vectors"],
14644
14920
  additionalProperties: false
14645
14921
  };
14646
- var outputSchema84 = {
14922
+ var outputSchema83 = {
14647
14923
  type: "object",
14648
14924
  properties: {
14649
14925
  result: {
@@ -14656,16 +14932,16 @@ var outputSchema84 = {
14656
14932
  additionalProperties: false
14657
14933
  };
14658
14934
 
14659
- class VectorDistanceTask extends Task91 {
14935
+ class VectorDistanceTask extends Task75 {
14660
14936
  static type = "VectorDistanceTask";
14661
14937
  static category = "Vector";
14662
14938
  static title = "Distance";
14663
14939
  static description = "Returns the Euclidean distance between the first two vectors";
14664
14940
  static inputSchema() {
14665
- return inputSchema85;
14941
+ return inputSchema84;
14666
14942
  }
14667
14943
  static outputSchema() {
14668
- return outputSchema84;
14944
+ return outputSchema83;
14669
14945
  }
14670
14946
  async execute(input2, _context) {
14671
14947
  const { vectors } = input2;
@@ -14683,13 +14959,13 @@ class VectorDistanceTask extends Task91 {
14683
14959
  return { result: Math.sqrt(sumPrecise(diffs)) };
14684
14960
  }
14685
14961
  }
14686
- Workflow67.prototype.vectorDistance = CreateWorkflow66(VectorDistanceTask);
14962
+ Workflow66.prototype.vectorDistance = CreateWorkflow65(VectorDistanceTask);
14687
14963
  // src/task/vector/VectorDotProductTask.ts
14688
- 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";
14689
14965
  import {
14690
14966
  TypedArraySchema as TypedArraySchema6
14691
14967
  } from "@workglow/util/schema";
14692
- var inputSchema86 = {
14968
+ var inputSchema85 = {
14693
14969
  type: "object",
14694
14970
  properties: {
14695
14971
  vectors: {
@@ -14705,7 +14981,7 @@ var inputSchema86 = {
14705
14981
  required: ["vectors"],
14706
14982
  additionalProperties: false
14707
14983
  };
14708
- var outputSchema85 = {
14984
+ var outputSchema84 = {
14709
14985
  type: "object",
14710
14986
  properties: {
14711
14987
  result: {
@@ -14718,16 +14994,16 @@ var outputSchema85 = {
14718
14994
  additionalProperties: false
14719
14995
  };
14720
14996
 
14721
- class VectorDotProductTask extends Task92 {
14997
+ class VectorDotProductTask extends Task76 {
14722
14998
  static type = "VectorDotProductTask";
14723
14999
  static category = "Vector";
14724
15000
  static title = "Dot Product";
14725
15001
  static description = "Returns the dot (inner) product of the first two vectors";
14726
15002
  static inputSchema() {
14727
- return inputSchema86;
15003
+ return inputSchema85;
14728
15004
  }
14729
15005
  static outputSchema() {
14730
- return outputSchema85;
15006
+ return outputSchema84;
14731
15007
  }
14732
15008
  async execute(input2, _context) {
14733
15009
  const { vectors } = input2;
@@ -14742,14 +15018,14 @@ class VectorDotProductTask extends Task92 {
14742
15018
  return { result: sumPrecise(products) };
14743
15019
  }
14744
15020
  }
14745
- Workflow68.prototype.vectorDotProduct = CreateWorkflow67(VectorDotProductTask);
15021
+ Workflow67.prototype.vectorDotProduct = CreateWorkflow66(VectorDotProductTask);
14746
15022
  // src/task/vector/VectorNormalizeTask.ts
14747
- 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";
14748
15024
  import {
14749
15025
  TypedArraySchema as TypedArraySchema7,
14750
15026
  normalize
14751
15027
  } from "@workglow/util/schema";
14752
- var inputSchema87 = {
15028
+ var inputSchema86 = {
14753
15029
  type: "object",
14754
15030
  properties: {
14755
15031
  vector: TypedArraySchema7({
@@ -14760,7 +15036,7 @@ var inputSchema87 = {
14760
15036
  required: ["vector"],
14761
15037
  additionalProperties: false
14762
15038
  };
14763
- var outputSchema86 = {
15039
+ var outputSchema85 = {
14764
15040
  type: "object",
14765
15041
  properties: {
14766
15042
  result: TypedArraySchema7({
@@ -14772,29 +15048,29 @@ var outputSchema86 = {
14772
15048
  additionalProperties: false
14773
15049
  };
14774
15050
 
14775
- class VectorNormalizeTask extends Task93 {
15051
+ class VectorNormalizeTask extends Task77 {
14776
15052
  static type = "VectorNormalizeTask";
14777
15053
  static category = "Vector";
14778
15054
  static title = "Normalize";
14779
15055
  static description = "Returns the L2-normalized (unit length) vector";
14780
15056
  static inputSchema() {
14781
- return inputSchema87;
15057
+ return inputSchema86;
14782
15058
  }
14783
15059
  static outputSchema() {
14784
- return outputSchema86;
15060
+ return outputSchema85;
14785
15061
  }
14786
15062
  async execute(input2, _context) {
14787
15063
  return { result: normalize(input2.vector) };
14788
15064
  }
14789
15065
  }
14790
- Workflow69.prototype.vectorNormalize = CreateWorkflow68(VectorNormalizeTask);
15066
+ Workflow68.prototype.vectorNormalize = CreateWorkflow67(VectorNormalizeTask);
14791
15067
  // src/task/vector/VectorScaleTask.ts
14792
- 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";
14793
15069
  import {
14794
15070
  createTypedArrayFrom as createTypedArrayFrom5,
14795
15071
  TypedArraySchema as TypedArraySchema8
14796
15072
  } from "@workglow/util/schema";
14797
- var inputSchema88 = {
15073
+ var inputSchema87 = {
14798
15074
  type: "object",
14799
15075
  properties: {
14800
15076
  vector: TypedArraySchema8({
@@ -14810,7 +15086,7 @@ var inputSchema88 = {
14810
15086
  required: ["vector", "scalar"],
14811
15087
  additionalProperties: false
14812
15088
  };
14813
- var outputSchema87 = {
15089
+ var outputSchema86 = {
14814
15090
  type: "object",
14815
15091
  properties: {
14816
15092
  result: TypedArraySchema8({
@@ -14822,16 +15098,16 @@ var outputSchema87 = {
14822
15098
  additionalProperties: false
14823
15099
  };
14824
15100
 
14825
- class VectorScaleTask extends Task94 {
15101
+ class VectorScaleTask extends Task78 {
14826
15102
  static type = "VectorScaleTask";
14827
15103
  static category = "Vector";
14828
15104
  static title = "Scale";
14829
15105
  static description = "Multiplies each element of a vector by a scalar";
14830
15106
  static inputSchema() {
14831
- return inputSchema88;
15107
+ return inputSchema87;
14832
15108
  }
14833
15109
  static outputSchema() {
14834
- return outputSchema87;
15110
+ return outputSchema86;
14835
15111
  }
14836
15112
  async execute(input2, _context) {
14837
15113
  const { vector, scalar } = input2;
@@ -14839,7 +15115,7 @@ class VectorScaleTask extends Task94 {
14839
15115
  return { result: createTypedArrayFrom5([vector], values) };
14840
15116
  }
14841
15117
  }
14842
- Workflow70.prototype.vectorScale = CreateWorkflow69(VectorScaleTask);
15118
+ Workflow69.prototype.vectorScale = CreateWorkflow68(VectorScaleTask);
14843
15119
 
14844
15120
  // src/common.ts
14845
15121
  import { TaskRegistry as TaskRegistry2 } from "@workglow/task-graph";
@@ -14940,7 +15216,6 @@ var registerCommonTasks = () => {
14940
15216
  ImageBorderTask,
14941
15217
  ImageTransparencyTask,
14942
15218
  ImageBlurTask,
14943
- ImageWatermarkTask,
14944
15219
  ImagePixelateTask,
14945
15220
  ImageInvertTask,
14946
15221
  ImageBrightnessTask,
@@ -15430,18 +15705,18 @@ class PlaywrightBackend {
15430
15705
  }
15431
15706
  // src/task/FileLoaderTask.server.ts
15432
15707
  import {
15433
- CreateWorkflow as CreateWorkflow71,
15708
+ CreateWorkflow as CreateWorkflow70,
15434
15709
  TaskAbortedError as TaskAbortedError5,
15435
- Workflow as Workflow72
15710
+ Workflow as Workflow71
15436
15711
  } from "@workglow/task-graph";
15437
15712
  import { readFile } from "node:fs/promises";
15438
15713
 
15439
15714
  // src/task/FileLoaderTask.ts
15440
15715
  import {
15441
- CreateWorkflow as CreateWorkflow70,
15442
- Task as Task95,
15716
+ CreateWorkflow as CreateWorkflow69,
15717
+ Task as Task79,
15443
15718
  TaskAbortedError as TaskAbortedError4,
15444
- Workflow as Workflow71
15719
+ Workflow as Workflow70
15445
15720
  } from "@workglow/task-graph";
15446
15721
  var _papaParse;
15447
15722
  async function getPapaParse() {
@@ -15455,7 +15730,7 @@ async function getPapaParse() {
15455
15730
  }
15456
15731
  return _papaParse;
15457
15732
  }
15458
- var inputSchema89 = {
15733
+ var inputSchema88 = {
15459
15734
  type: "object",
15460
15735
  properties: {
15461
15736
  url: {
@@ -15475,7 +15750,7 @@ var inputSchema89 = {
15475
15750
  required: ["url"],
15476
15751
  additionalProperties: false
15477
15752
  };
15478
- var outputSchema88 = {
15753
+ var outputSchema87 = {
15479
15754
  type: "object",
15480
15755
  properties: {
15481
15756
  text: {
@@ -15526,17 +15801,17 @@ var outputSchema88 = {
15526
15801
  additionalProperties: false
15527
15802
  };
15528
15803
 
15529
- class FileLoaderTask extends Task95 {
15804
+ class FileLoaderTask extends Task79 {
15530
15805
  static type = "FileLoaderTask";
15531
15806
  static category = "Document";
15532
15807
  static title = "File Loader";
15533
15808
  static description = "Load documents from URLs (http://, https://)";
15534
15809
  static cacheable = true;
15535
15810
  static inputSchema() {
15536
- return inputSchema89;
15811
+ return inputSchema88;
15537
15812
  }
15538
15813
  static outputSchema() {
15539
- return outputSchema88;
15814
+ return outputSchema87;
15540
15815
  }
15541
15816
  async execute(input2, context) {
15542
15817
  const { url, format = "auto" } = input2;
@@ -15889,7 +16164,7 @@ class FileLoaderTask extends Task95 {
15889
16164
  });
15890
16165
  }
15891
16166
  }
15892
- Workflow71.prototype.fileLoader = CreateWorkflow70(FileLoaderTask);
16167
+ Workflow70.prototype.fileLoader = CreateWorkflow69(FileLoaderTask);
15893
16168
 
15894
16169
  // src/task/FileLoaderTask.server.ts
15895
16170
  class FileLoaderTask2 extends FileLoaderTask {
@@ -16078,7 +16353,7 @@ class FileLoaderTask2 extends FileLoaderTask {
16078
16353
  var fileLoader = (input2, config) => {
16079
16354
  return new FileLoaderTask2(config).run(input2);
16080
16355
  };
16081
- Workflow72.prototype.fileLoader = CreateWorkflow71(FileLoaderTask2);
16356
+ Workflow71.prototype.fileLoader = CreateWorkflow70(FileLoaderTask2);
16082
16357
 
16083
16358
  // src/node.ts
16084
16359
  import { TaskRegistry as TaskRegistry3 } from "@workglow/task-graph";
@@ -16157,9 +16432,9 @@ export {
16157
16432
  registerMcpTaskDeps,
16158
16433
  registerMcpServer,
16159
16434
  registerImageRasterCodec2 as registerImageRasterCodec,
16435
+ registerFilterOp31 as registerFilterOp,
16160
16436
  registerCommonTasks2 as registerCommonTasks,
16161
16437
  registerBrowserDeps,
16162
- produceImageOutput,
16163
16438
  normalizeOutputMimeType,
16164
16439
  merge,
16165
16440
  mcpTransportTypes,
@@ -16177,11 +16452,12 @@ export {
16177
16452
  lambda,
16178
16453
  json,
16179
16454
  javaScript,
16455
+ hasFilterOp2 as hasFilterOp,
16180
16456
  getSafeFetchImpl,
16181
16457
  getMcpTaskDeps,
16182
16458
  getMcpServerConfig,
16183
16459
  getMcpServer,
16184
- getImageRasterCodec2 as getImageRasterCodec,
16460
+ getImageRasterCodec,
16185
16461
  getGlobalMcpServers,
16186
16462
  getGlobalMcpServerRepository,
16187
16463
  getBrowserDeps,
@@ -16198,6 +16474,8 @@ export {
16198
16474
  assertWithinPixelBudget,
16199
16475
  assertWithinByteBudget,
16200
16476
  assertIsDataUri,
16477
+ applyFilter3 as applyFilter,
16478
+ _resetFilterRegistryForTests,
16201
16479
  VectorSumTask,
16202
16480
  VectorSubtractTask,
16203
16481
  VectorScaleTask,
@@ -16259,7 +16537,6 @@ export {
16259
16537
  JavaScriptTask,
16260
16538
  InputTask,
16261
16539
  InMemoryMcpServerRepository,
16262
- ImageWatermarkTask,
16263
16540
  ImageTransparencyTask,
16264
16541
  ImageTintTask,
16265
16542
  ImageThresholdTask,
@@ -16272,14 +16549,12 @@ export {
16272
16549
  ImageInvertTask,
16273
16550
  ImageGrayscaleTask,
16274
16551
  ImageFlipTask,
16552
+ ImageFilterTask,
16275
16553
  ImageCropTask,
16276
16554
  ImageContrastTask,
16277
16555
  ImageBrightnessTask,
16278
16556
  ImageBorderTask,
16279
16557
  ImageBlurTask,
16280
- ImageBinarySchemaOptions,
16281
- ImageBinarySchema,
16282
- ImageBinaryOrDataUriSchema,
16283
16558
  HumanInputTask,
16284
16559
  HumanApprovalTask,
16285
16560
  HexColorSchema,
@@ -16289,6 +16564,7 @@ export {
16289
16564
  DelayTask,
16290
16565
  DebugLogTask,
16291
16566
  DateFormatTask,
16567
+ CssRgbColorSchema,
16292
16568
  CredentialStoreOAuthProvider,
16293
16569
  ColorValueSchema,
16294
16570
  ColorSchema,
@@ -16326,4 +16602,4 @@ export {
16326
16602
  ArrayTask
16327
16603
  };
16328
16604
 
16329
- //# debugId=0C340BEB980722A064756E2164756E21
16605
+ //# debugId=FAF7FA49938F2E7164756E2164756E21