@workglow/ai 0.0.72 → 0.0.74

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.
@@ -0,0 +1,576 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
7
+ import { DataPortSchema, FromSchema } from "@workglow/util";
8
+ import { DeReplicateFromSchema } from "./base/AiTaskSchemas";
9
+ import { AiVisionTask } from "./base/AiVisionTask";
10
+ export declare const HandLandmarkerInputSchema: {
11
+ readonly type: "object";
12
+ readonly properties: {
13
+ readonly image: {
14
+ readonly "x-replicate": true;
15
+ readonly format?: string | undefined;
16
+ readonly oneOf: readonly [{
17
+ readonly oneOf: readonly [{
18
+ readonly type: "string";
19
+ readonly title: "Image Data";
20
+ readonly description: "Image as data-uri";
21
+ }, {
22
+ readonly type: "object";
23
+ readonly additionalProperties: false;
24
+ readonly properties: {
25
+ readonly data: {
26
+ readonly oneOf: readonly [{
27
+ readonly type: "object";
28
+ readonly format: "image:ImageBitmap";
29
+ readonly title: "ImageBitmap";
30
+ }, {
31
+ readonly type: "object";
32
+ readonly format: "image:OffscreenCanvas";
33
+ readonly title: "OffscreenCanvas";
34
+ }, {
35
+ readonly type: "object";
36
+ readonly format: "image:VideoFrame";
37
+ readonly title: "VideoFrame";
38
+ }, {
39
+ readonly type: "object";
40
+ readonly properties: {
41
+ readonly data: {
42
+ readonly type: "array";
43
+ readonly items: {
44
+ readonly type: "number";
45
+ readonly format: "Uint8Clamped";
46
+ };
47
+ readonly format: "Uint8ClampedArray";
48
+ readonly title: "Data";
49
+ readonly description: "Data of the image";
50
+ };
51
+ readonly width: {
52
+ readonly type: "number";
53
+ readonly title: "Width";
54
+ readonly description: "Width of the image";
55
+ };
56
+ readonly height: {
57
+ readonly type: "number";
58
+ readonly title: "Height";
59
+ readonly description: "Height of the image";
60
+ };
61
+ readonly channels: {
62
+ readonly type: "number";
63
+ readonly title: "Channels";
64
+ readonly description: "Channels of the image";
65
+ };
66
+ readonly rawChannels: {
67
+ readonly type: "number";
68
+ readonly title: "Raw Channels";
69
+ readonly description: "Raw channels of the image";
70
+ };
71
+ };
72
+ readonly additionalProperties: false;
73
+ readonly required: readonly ["data", "width", "height", "channels"];
74
+ readonly format: "image:ImageBinary";
75
+ readonly title: "ImageBinary";
76
+ }];
77
+ };
78
+ readonly width: {
79
+ readonly type: "number";
80
+ readonly title: "Width";
81
+ readonly description: "Width of the image";
82
+ };
83
+ readonly height: {
84
+ readonly type: "number";
85
+ readonly title: "Height";
86
+ readonly description: "Height of the image";
87
+ };
88
+ readonly channels: {
89
+ readonly type: "number";
90
+ readonly title: "Channels";
91
+ readonly description: "Channels of the image";
92
+ readonly minimum: 1;
93
+ readonly maximum: 4;
94
+ };
95
+ };
96
+ readonly required: readonly ["data", "width", "height", "channels"];
97
+ }];
98
+ readonly title: "Image";
99
+ readonly description: "Image as URL or base64-encoded data";
100
+ }, {
101
+ readonly type: "array";
102
+ readonly items: {
103
+ readonly oneOf: readonly [{
104
+ readonly type: "string";
105
+ readonly title: "Image Data";
106
+ readonly description: "Image as data-uri";
107
+ }, {
108
+ readonly type: "object";
109
+ readonly additionalProperties: false;
110
+ readonly properties: {
111
+ readonly data: {
112
+ readonly oneOf: readonly [{
113
+ readonly type: "object";
114
+ readonly format: "image:ImageBitmap";
115
+ readonly title: "ImageBitmap";
116
+ }, {
117
+ readonly type: "object";
118
+ readonly format: "image:OffscreenCanvas";
119
+ readonly title: "OffscreenCanvas";
120
+ }, {
121
+ readonly type: "object";
122
+ readonly format: "image:VideoFrame";
123
+ readonly title: "VideoFrame";
124
+ }, {
125
+ readonly type: "object";
126
+ readonly properties: {
127
+ readonly data: {
128
+ readonly type: "array";
129
+ readonly items: {
130
+ readonly type: "number";
131
+ readonly format: "Uint8Clamped";
132
+ };
133
+ readonly format: "Uint8ClampedArray";
134
+ readonly title: "Data";
135
+ readonly description: "Data of the image";
136
+ };
137
+ readonly width: {
138
+ readonly type: "number";
139
+ readonly title: "Width";
140
+ readonly description: "Width of the image";
141
+ };
142
+ readonly height: {
143
+ readonly type: "number";
144
+ readonly title: "Height";
145
+ readonly description: "Height of the image";
146
+ };
147
+ readonly channels: {
148
+ readonly type: "number";
149
+ readonly title: "Channels";
150
+ readonly description: "Channels of the image";
151
+ };
152
+ readonly rawChannels: {
153
+ readonly type: "number";
154
+ readonly title: "Raw Channels";
155
+ readonly description: "Raw channels of the image";
156
+ };
157
+ };
158
+ readonly additionalProperties: false;
159
+ readonly required: readonly ["data", "width", "height", "channels"];
160
+ readonly format: "image:ImageBinary";
161
+ readonly title: "ImageBinary";
162
+ }];
163
+ };
164
+ readonly width: {
165
+ readonly type: "number";
166
+ readonly title: "Width";
167
+ readonly description: "Width of the image";
168
+ };
169
+ readonly height: {
170
+ readonly type: "number";
171
+ readonly title: "Height";
172
+ readonly description: "Height of the image";
173
+ };
174
+ readonly channels: {
175
+ readonly type: "number";
176
+ readonly title: "Channels";
177
+ readonly description: "Channels of the image";
178
+ readonly minimum: 1;
179
+ readonly maximum: 4;
180
+ };
181
+ };
182
+ readonly required: readonly ["data", "width", "height", "channels"];
183
+ }];
184
+ readonly title: "Image";
185
+ readonly description: "Image as URL or base64-encoded data";
186
+ };
187
+ }];
188
+ readonly title: string | undefined;
189
+ readonly description: string | undefined;
190
+ };
191
+ readonly model: {
192
+ readonly "x-replicate": true;
193
+ readonly format?: string | undefined;
194
+ readonly oneOf: readonly [{
195
+ readonly oneOf: readonly [{
196
+ readonly title: "Model";
197
+ readonly description: `The model ${string}`;
198
+ } & {
199
+ readonly format: import(".").TypeModelSemantic;
200
+ readonly type: "string";
201
+ }, {
202
+ readonly type: "object";
203
+ readonly properties: {
204
+ readonly model_id: {
205
+ readonly type: "string";
206
+ };
207
+ readonly tasks: {
208
+ readonly type: "array";
209
+ readonly items: {
210
+ readonly type: "string";
211
+ };
212
+ };
213
+ readonly title: {
214
+ readonly type: "string";
215
+ };
216
+ readonly description: {
217
+ readonly type: "string";
218
+ };
219
+ readonly provider: {
220
+ readonly type: "string";
221
+ };
222
+ readonly providerConfig: {
223
+ readonly type: "object";
224
+ readonly default: {};
225
+ };
226
+ readonly metadata: {
227
+ readonly type: "object";
228
+ readonly default: {};
229
+ };
230
+ };
231
+ readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "providerConfig", "metadata"];
232
+ readonly format: "model";
233
+ readonly additionalProperties: false;
234
+ } & {
235
+ readonly format: import(".").TypeModelSemantic;
236
+ }];
237
+ } & {
238
+ readonly format: import(".").TypeModelSemantic;
239
+ }, {
240
+ readonly type: "array";
241
+ readonly items: {
242
+ readonly oneOf: readonly [{
243
+ readonly title: "Model";
244
+ readonly description: `The model ${string}`;
245
+ } & {
246
+ readonly format: import(".").TypeModelSemantic;
247
+ readonly type: "string";
248
+ }, {
249
+ readonly type: "object";
250
+ readonly properties: {
251
+ readonly model_id: {
252
+ readonly type: "string";
253
+ };
254
+ readonly tasks: {
255
+ readonly type: "array";
256
+ readonly items: {
257
+ readonly type: "string";
258
+ };
259
+ };
260
+ readonly title: {
261
+ readonly type: "string";
262
+ };
263
+ readonly description: {
264
+ readonly type: "string";
265
+ };
266
+ readonly provider: {
267
+ readonly type: "string";
268
+ };
269
+ readonly providerConfig: {
270
+ readonly type: "object";
271
+ readonly default: {};
272
+ };
273
+ readonly metadata: {
274
+ readonly type: "object";
275
+ readonly default: {};
276
+ };
277
+ };
278
+ readonly required: readonly ["model_id", "tasks", "provider", "title", "description", "providerConfig", "metadata"];
279
+ readonly format: "model";
280
+ readonly additionalProperties: false;
281
+ } & {
282
+ readonly format: import(".").TypeModelSemantic;
283
+ }];
284
+ } & {
285
+ readonly format: import(".").TypeModelSemantic;
286
+ };
287
+ }];
288
+ readonly title: string | undefined;
289
+ readonly description: string | undefined;
290
+ };
291
+ readonly numHands: {
292
+ readonly type: "number";
293
+ readonly minimum: 1;
294
+ readonly maximum: 10;
295
+ readonly default: 1;
296
+ readonly title: "Number of Hands";
297
+ readonly description: "The maximum number of hands to detect";
298
+ readonly "x-ui-group": "Configuration";
299
+ };
300
+ readonly minHandDetectionConfidence: {
301
+ readonly type: "number";
302
+ readonly minimum: 0;
303
+ readonly maximum: 1;
304
+ readonly default: 0.5;
305
+ readonly title: "Min Hand Detection Confidence";
306
+ readonly description: "Minimum confidence score for hand detection";
307
+ readonly "x-ui-group": "Configuration";
308
+ };
309
+ readonly minHandPresenceConfidence: {
310
+ readonly type: "number";
311
+ readonly minimum: 0;
312
+ readonly maximum: 1;
313
+ readonly default: 0.5;
314
+ readonly title: "Min Hand Presence Confidence";
315
+ readonly description: "Minimum confidence score for hand presence";
316
+ readonly "x-ui-group": "Configuration";
317
+ };
318
+ readonly minTrackingConfidence: {
319
+ readonly type: "number";
320
+ readonly minimum: 0;
321
+ readonly maximum: 1;
322
+ readonly default: 0.5;
323
+ readonly title: "Min Tracking Confidence";
324
+ readonly description: "Minimum confidence score for hand tracking";
325
+ readonly "x-ui-group": "Configuration";
326
+ };
327
+ };
328
+ readonly required: readonly ["image", "model"];
329
+ readonly additionalProperties: false;
330
+ };
331
+ export declare const HandLandmarkerOutputSchema: {
332
+ readonly type: "object";
333
+ readonly properties: {
334
+ readonly hands: {
335
+ readonly oneOf: readonly [{
336
+ readonly type: "array";
337
+ readonly items: {
338
+ readonly type: "object";
339
+ readonly properties: {
340
+ readonly handedness: {
341
+ readonly type: "array";
342
+ readonly items: {
343
+ readonly type: "object";
344
+ readonly properties: {
345
+ readonly label: {
346
+ readonly type: "string";
347
+ readonly title: "Hand Label";
348
+ readonly description: "Whether the hand is 'Left' or 'Right'";
349
+ };
350
+ readonly score: {
351
+ readonly type: "number";
352
+ readonly title: "Confidence Score";
353
+ readonly description: "Confidence score for the handedness classification";
354
+ };
355
+ };
356
+ readonly required: readonly ["label", "score"];
357
+ readonly additionalProperties: false;
358
+ };
359
+ readonly title: "Handedness";
360
+ readonly description: "Handedness classification (left/right)";
361
+ };
362
+ readonly landmarks: {
363
+ readonly type: "array";
364
+ readonly items: {
365
+ readonly type: "object";
366
+ readonly properties: {
367
+ readonly x: {
368
+ readonly type: "number";
369
+ readonly title: "X Coordinate";
370
+ readonly description: "X coordinate normalized to [0.0, 1.0]";
371
+ };
372
+ readonly y: {
373
+ readonly type: "number";
374
+ readonly title: "Y Coordinate";
375
+ readonly description: "Y coordinate normalized to [0.0, 1.0]";
376
+ };
377
+ readonly z: {
378
+ readonly type: "number";
379
+ readonly title: "Z Coordinate";
380
+ readonly description: "Z coordinate (depth)";
381
+ };
382
+ };
383
+ readonly required: readonly ["x", "y", "z"];
384
+ readonly additionalProperties: false;
385
+ };
386
+ readonly title: "Landmarks";
387
+ readonly description: "21 hand landmarks in image coordinates";
388
+ };
389
+ readonly worldLandmarks: {
390
+ readonly type: "array";
391
+ readonly items: {
392
+ readonly type: "object";
393
+ readonly properties: {
394
+ readonly x: {
395
+ readonly type: "number";
396
+ readonly title: "X Coordinate";
397
+ readonly description: "X coordinate normalized to [0.0, 1.0]";
398
+ };
399
+ readonly y: {
400
+ readonly type: "number";
401
+ readonly title: "Y Coordinate";
402
+ readonly description: "Y coordinate normalized to [0.0, 1.0]";
403
+ };
404
+ readonly z: {
405
+ readonly type: "number";
406
+ readonly title: "Z Coordinate";
407
+ readonly description: "Z coordinate (depth)";
408
+ };
409
+ };
410
+ readonly required: readonly ["x", "y", "z"];
411
+ readonly additionalProperties: false;
412
+ };
413
+ readonly title: "World Landmarks";
414
+ readonly description: "21 hand landmarks in 3D world coordinates (meters)";
415
+ };
416
+ };
417
+ readonly required: readonly ["handedness", "landmarks", "worldLandmarks"];
418
+ readonly additionalProperties: false;
419
+ };
420
+ }, {
421
+ readonly type: "array";
422
+ readonly items: {
423
+ readonly type: "array";
424
+ readonly items: {
425
+ readonly type: "object";
426
+ readonly properties: {
427
+ readonly handedness: {
428
+ readonly type: "array";
429
+ readonly items: {
430
+ readonly type: "object";
431
+ readonly properties: {
432
+ readonly label: {
433
+ readonly type: "string";
434
+ readonly title: "Hand Label";
435
+ readonly description: "Whether the hand is 'Left' or 'Right'";
436
+ };
437
+ readonly score: {
438
+ readonly type: "number";
439
+ readonly title: "Confidence Score";
440
+ readonly description: "Confidence score for the handedness classification";
441
+ };
442
+ };
443
+ readonly required: readonly ["label", "score"];
444
+ readonly additionalProperties: false;
445
+ };
446
+ readonly title: "Handedness";
447
+ readonly description: "Handedness classification (left/right)";
448
+ };
449
+ readonly landmarks: {
450
+ readonly type: "array";
451
+ readonly items: {
452
+ readonly type: "object";
453
+ readonly properties: {
454
+ readonly x: {
455
+ readonly type: "number";
456
+ readonly title: "X Coordinate";
457
+ readonly description: "X coordinate normalized to [0.0, 1.0]";
458
+ };
459
+ readonly y: {
460
+ readonly type: "number";
461
+ readonly title: "Y Coordinate";
462
+ readonly description: "Y coordinate normalized to [0.0, 1.0]";
463
+ };
464
+ readonly z: {
465
+ readonly type: "number";
466
+ readonly title: "Z Coordinate";
467
+ readonly description: "Z coordinate (depth)";
468
+ };
469
+ };
470
+ readonly required: readonly ["x", "y", "z"];
471
+ readonly additionalProperties: false;
472
+ };
473
+ readonly title: "Landmarks";
474
+ readonly description: "21 hand landmarks in image coordinates";
475
+ };
476
+ readonly worldLandmarks: {
477
+ readonly type: "array";
478
+ readonly items: {
479
+ readonly type: "object";
480
+ readonly properties: {
481
+ readonly x: {
482
+ readonly type: "number";
483
+ readonly title: "X Coordinate";
484
+ readonly description: "X coordinate normalized to [0.0, 1.0]";
485
+ };
486
+ readonly y: {
487
+ readonly type: "number";
488
+ readonly title: "Y Coordinate";
489
+ readonly description: "Y coordinate normalized to [0.0, 1.0]";
490
+ };
491
+ readonly z: {
492
+ readonly type: "number";
493
+ readonly title: "Z Coordinate";
494
+ readonly description: "Z coordinate (depth)";
495
+ };
496
+ };
497
+ readonly required: readonly ["x", "y", "z"];
498
+ readonly additionalProperties: false;
499
+ };
500
+ readonly title: "World Landmarks";
501
+ readonly description: "21 hand landmarks in 3D world coordinates (meters)";
502
+ };
503
+ };
504
+ readonly required: readonly ["handedness", "landmarks", "worldLandmarks"];
505
+ readonly additionalProperties: false;
506
+ };
507
+ };
508
+ }];
509
+ readonly title: "Hand Detections";
510
+ readonly description: "Detected hands with handedness and landmarks";
511
+ };
512
+ };
513
+ readonly required: readonly ["hands"];
514
+ readonly additionalProperties: false;
515
+ };
516
+ export type HandLandmarkerTaskInput = FromSchema<typeof HandLandmarkerInputSchema>;
517
+ export type HandLandmarkerTaskOutput = FromSchema<typeof HandLandmarkerOutputSchema>;
518
+ export type HandLandmarkerTaskExecuteInput = DeReplicateFromSchema<typeof HandLandmarkerInputSchema>;
519
+ export type HandLandmarkerTaskExecuteOutput = DeReplicateFromSchema<typeof HandLandmarkerOutputSchema>;
520
+ /**
521
+ * Detects hand landmarks in images using MediaPipe Hand Landmarker.
522
+ * Identifies 21 hand landmarks and classifies left vs. right hands.
523
+ */
524
+ export declare class HandLandmarkerTask extends AiVisionTask<HandLandmarkerTaskInput, HandLandmarkerTaskOutput, JobQueueTaskConfig> {
525
+ static type: string;
526
+ static category: string;
527
+ static title: string;
528
+ static description: string;
529
+ static inputSchema(): DataPortSchema;
530
+ static outputSchema(): DataPortSchema;
531
+ }
532
+ /**
533
+ * Convenience function to run hand landmark detection tasks.
534
+ * Creates and executes a HandLandmarkerTask with the provided input.
535
+ * @param input The input parameters for hand landmark detection (image, model, and optional configuration)
536
+ * @returns Promise resolving to the detected hand landmarks and handedness
537
+ */
538
+ export declare const HandLandmarker: (input: HandLandmarkerTaskInput, config?: JobQueueTaskConfig) => Promise<{
539
+ hands: {
540
+ landmarks: {
541
+ x: number;
542
+ y: number;
543
+ z: number;
544
+ }[];
545
+ worldLandmarks: {
546
+ x: number;
547
+ y: number;
548
+ z: number;
549
+ }[];
550
+ handedness: {
551
+ score: number;
552
+ label: string;
553
+ }[];
554
+ }[] | {
555
+ landmarks: {
556
+ x: number;
557
+ y: number;
558
+ z: number;
559
+ }[];
560
+ worldLandmarks: {
561
+ x: number;
562
+ y: number;
563
+ z: number;
564
+ }[];
565
+ handedness: {
566
+ score: number;
567
+ label: string;
568
+ }[];
569
+ }[][];
570
+ }>;
571
+ declare module "@workglow/task-graph" {
572
+ interface Workflow {
573
+ HandLandmarker: CreateWorkflow<HandLandmarkerTaskInput, HandLandmarkerTaskOutput, JobQueueTaskConfig>;
574
+ }
575
+ }
576
+ //# sourceMappingURL=HandLandmarkerTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandLandmarkerTask.d.ts","sourceRoot":"","sources":["../../src/task/HandLandmarkerTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAA0B,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EACL,qBAAqB,EAItB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAgFnD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CH,CAAC;AAEpC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAcJ,CAAC;AAEpC,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACnF,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACrF,MAAM,MAAM,8BAA8B,GAAG,qBAAqB,CAChE,OAAO,yBAAyB,CACjC,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,qBAAqB,CACjE,OAAO,0BAA0B,CAClC,CAAC;AAEF;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,YAAY,CAClD,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAwB;IAC1C,OAAc,QAAQ,SAAqB;IAC3C,OAAc,KAAK,SAAqB;IACxC,OAAc,WAAW,SAC+E;WAC1F,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAID;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,uBAAuB,EAAE,SAAS,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEzF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,cAAc,EAAE,cAAc,CAC5B,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,CACnB,CAAC;KACH;CACF"}