@workglow/ai 0.0.120 → 0.0.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +20 -27
  2. package/dist/browser.js +234 -124
  3. package/dist/browser.js.map +18 -15
  4. package/dist/bun.js +234 -124
  5. package/dist/bun.js.map +18 -15
  6. package/dist/common.d.ts +2 -0
  7. package/dist/common.d.ts.map +1 -1
  8. package/dist/job/AiJob.d.ts.map +1 -1
  9. package/dist/model/InMemoryModelRepository.d.ts.map +1 -1
  10. package/dist/model/ModelRepository.d.ts +10 -10
  11. package/dist/model/ModelRepository.d.ts.map +1 -1
  12. package/dist/model/ModelSchema.d.ts +1 -1
  13. package/dist/model/ModelSchema.d.ts.map +1 -1
  14. package/dist/node.js +234 -124
  15. package/dist/node.js.map +18 -15
  16. package/dist/provider/AiProvider.d.ts +33 -30
  17. package/dist/provider/AiProvider.d.ts.map +1 -1
  18. package/dist/provider/AiProviderRegistry.d.ts +4 -4
  19. package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
  20. package/dist/provider/QueuedAiProvider.d.ts +18 -0
  21. package/dist/provider/QueuedAiProvider.d.ts.map +1 -0
  22. package/dist/task/AgentTask.d.ts +2 -2
  23. package/dist/task/AgentTask.d.ts.map +1 -1
  24. package/dist/task/AgentTypes.d.ts +1 -1
  25. package/dist/task/AgentTypes.d.ts.map +1 -1
  26. package/dist/task/AgentUtils.d.ts +1 -1
  27. package/dist/task/AgentUtils.d.ts.map +1 -1
  28. package/dist/task/BackgroundRemovalTask.d.ts +31 -1
  29. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  30. package/dist/task/ChunkRetrievalTask.d.ts +6 -6
  31. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
  32. package/dist/task/ChunkToVectorTask.d.ts +25 -3
  33. package/dist/task/ChunkToVectorTask.d.ts.map +1 -1
  34. package/dist/task/ChunkVectorHybridSearchTask.d.ts +22 -1
  35. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -1
  36. package/dist/task/ChunkVectorSearchTask.d.ts +12 -4
  37. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -1
  38. package/dist/task/ChunkVectorUpsertTask.d.ts +11 -2
  39. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -1
  40. package/dist/task/ContextBuilderTask.d.ts +29 -3
  41. package/dist/task/ContextBuilderTask.d.ts.map +1 -1
  42. package/dist/task/CountTokensTask.d.ts +18 -1
  43. package/dist/task/CountTokensTask.d.ts.map +1 -1
  44. package/dist/task/DocumentEnricherTask.d.ts +38 -17
  45. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  46. package/dist/task/DownloadModelTask.d.ts +24 -3
  47. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  48. package/dist/task/FaceDetectorTask.d.ts +38 -6
  49. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  50. package/dist/task/FaceLandmarkerTask.d.ts +43 -7
  51. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  52. package/dist/task/GestureRecognizerTask.d.ts +48 -14
  53. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  54. package/dist/task/HandLandmarkerTask.d.ts +45 -11
  55. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  56. package/dist/task/HierarchicalChunkerTask.d.ts +32 -21
  57. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -1
  58. package/dist/task/HierarchyJoinTask.d.ts +35 -10
  59. package/dist/task/HierarchyJoinTask.d.ts.map +1 -1
  60. package/dist/task/ImageClassificationTask.d.ts +36 -4
  61. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  62. package/dist/task/ImageEmbeddingTask.d.ts +31 -1
  63. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  64. package/dist/task/ImageSegmentationTask.d.ts +36 -4
  65. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  66. package/dist/task/ImageToTextTask.d.ts +32 -1
  67. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  68. package/dist/task/ModelInfoTask.d.ts +35 -9
  69. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  70. package/dist/task/ModelSearchTask.d.ts +66 -0
  71. package/dist/task/ModelSearchTask.d.ts.map +1 -0
  72. package/dist/task/ObjectDetectionTask.d.ts +38 -6
  73. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  74. package/dist/task/PoseLandmarkerTask.d.ts +52 -17
  75. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  76. package/dist/task/QueryExpanderTask.d.ts +8 -3
  77. package/dist/task/QueryExpanderTask.d.ts.map +1 -1
  78. package/dist/task/RerankerTask.d.ts +26 -2
  79. package/dist/task/RerankerTask.d.ts.map +1 -1
  80. package/dist/task/StructuralParserTask.d.ts +7 -1
  81. package/dist/task/StructuralParserTask.d.ts.map +1 -1
  82. package/dist/task/StructuredGenerationTask.d.ts +23 -1
  83. package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
  84. package/dist/task/TextChunkerTask.d.ts +10 -5
  85. package/dist/task/TextChunkerTask.d.ts.map +1 -1
  86. package/dist/task/TextClassificationTask.d.ts +23 -4
  87. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  88. package/dist/task/TextEmbeddingTask.d.ts +19 -2
  89. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  90. package/dist/task/TextFillMaskTask.d.ts +22 -5
  91. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  92. package/dist/task/TextGenerationTask.d.ts +23 -1
  93. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  94. package/dist/task/TextLanguageDetectionTask.d.ts +22 -4
  95. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  96. package/dist/task/TextNamedEntityRecognitionTask.d.ts +23 -5
  97. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  98. package/dist/task/TextQuestionAnswerTask.d.ts +19 -1
  99. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  100. package/dist/task/TextRewriterTask.d.ts +19 -1
  101. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  102. package/dist/task/TextSummaryTask.d.ts +18 -1
  103. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  104. package/dist/task/TextTranslationTask.d.ts +20 -1
  105. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  106. package/dist/task/ToolCallingTask.d.ts +9 -66
  107. package/dist/task/ToolCallingTask.d.ts.map +1 -1
  108. package/dist/task/ToolCallingUtils.d.ts +65 -0
  109. package/dist/task/ToolCallingUtils.d.ts.map +1 -0
  110. package/dist/task/TopicSegmenterTask.d.ts +10 -4
  111. package/dist/task/TopicSegmenterTask.d.ts.map +1 -1
  112. package/dist/task/UnloadModelTask.d.ts +18 -2
  113. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  114. package/dist/task/VectorQuantizeTask.d.ts +11 -7
  115. package/dist/task/VectorQuantizeTask.d.ts.map +1 -1
  116. package/dist/task/VectorSimilarityTask.d.ts +8 -3
  117. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  118. package/dist/task/base/AiTask.d.ts.map +1 -1
  119. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  120. package/dist/task/base/AiVisionTask.d.ts.map +1 -1
  121. package/dist/task/base/StreamingAiTask.d.ts.map +1 -1
  122. package/dist/task/index.d.ts +4 -1
  123. package/dist/task/index.d.ts.map +1 -1
  124. package/dist/worker.d.ts +21 -0
  125. package/dist/worker.d.ts.map +1 -0
  126. package/dist/worker.js +460 -0
  127. package/dist/worker.js.map +14 -0
  128. package/package.json +28 -21
package/dist/browser.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@workglow/job-queue";
8
8
 
9
9
  // src/provider/AiProviderRegistry.ts
10
- import { globalServiceRegistry, WORKER_MANAGER } from "@workglow/util";
10
+ import { globalServiceRegistry, WORKER_MANAGER } from "@workglow/util/worker";
11
11
 
12
12
  class AiProviderRegistry {
13
13
  runFnRegistry = new Map;
@@ -145,6 +145,34 @@ class AiJob extends Job {
145
145
  yield* streamFn(input.taskInput, model, context.signal, input.outputSchema);
146
146
  }
147
147
  }
148
+
149
+ // src/task/ToolCallingUtils.ts
150
+ import { getLogger } from "@workglow/util/worker";
151
+ function buildToolDescription(tool) {
152
+ let desc = tool.description;
153
+ if (tool.outputSchema && typeof tool.outputSchema === "object") {
154
+ desc += `
155
+
156
+ Returns: ${JSON.stringify(tool.outputSchema)}`;
157
+ }
158
+ return desc;
159
+ }
160
+ function isAllowedToolName(name, allowedTools) {
161
+ return allowedTools.some((t) => t.name === name);
162
+ }
163
+ function filterValidToolCalls(toolCalls, allowedTools) {
164
+ return toolCalls.filter((tc) => {
165
+ if (tc.name && isAllowedToolName(tc.name, allowedTools)) {
166
+ return true;
167
+ }
168
+ getLogger().warn(`Filtered out tool call with unknown name "${tc.name ?? "(missing)"}"`, {
169
+ callId: tc.id,
170
+ toolName: tc.name
171
+ });
172
+ return false;
173
+ });
174
+ }
175
+
148
176
  // src/model/InMemoryModelRepository.ts
149
177
  import { InMemoryTabularStorage } from "@workglow/storage";
150
178
 
@@ -283,6 +311,7 @@ class InMemoryModelRepository extends ModelRepository {
283
311
  super(new InMemoryTabularStorage(ModelRecordSchema, ModelPrimaryKeyNames));
284
312
  }
285
313
  }
314
+
286
315
  // src/model/ModelRegistry.ts
287
316
  import {
288
317
  createServiceToken,
@@ -308,31 +337,12 @@ async function resolveModelFromRegistry(id, format, registry) {
308
337
  return model;
309
338
  }
310
339
  registerInputResolver("model", resolveModelFromRegistry);
311
- // src/provider/AiProvider.ts
312
- import { globalServiceRegistry as globalServiceRegistry3, WORKER_MANAGER as WORKER_MANAGER2 } from "@workglow/util";
313
-
314
- // src/queue/createDefaultQueue.ts
315
- import { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from "@workglow/job-queue";
316
- import { InMemoryQueueStorage } from "@workglow/storage";
317
- import { getTaskQueueRegistry } from "@workglow/task-graph";
318
- async function createDefaultQueue(providerName, concurrency) {
319
- const storage = new InMemoryQueueStorage(providerName);
320
- await storage.setupDatabase();
321
- const server = new JobQueueServer(AiJob, {
322
- storage,
323
- queueName: providerName,
324
- limiter: new ConcurrencyLimiter(concurrency)
325
- });
326
- const client = new JobQueueClient({
327
- storage,
328
- queueName: providerName
329
- });
330
- client.attach(server);
331
- getTaskQueueRegistry().registerQueue({ server, client, storage });
332
- await server.start();
333
- }
334
340
 
335
341
  // src/provider/AiProvider.ts
342
+ import {
343
+ globalServiceRegistry as globalServiceRegistry3,
344
+ WORKER_MANAGER as WORKER_MANAGER2
345
+ } from "@workglow/util/worker";
336
346
  class AiProvider {
337
347
  tasks;
338
348
  streamTasks;
@@ -354,19 +364,21 @@ class AiProvider {
354
364
  getReactiveRunFn(taskType) {
355
365
  return this.reactiveTasks?.[taskType];
356
366
  }
357
- async register(options = { mode: "inline" }) {
358
- await this.onInitialize(options);
359
- if (options.mode === "worker") {
360
- if (!options.worker) {
361
- throw new Error(`AiProvider "${this.name}": worker is required when mode is "worker". ` + `Pass a Web Worker instance, e.g. register({ mode: "worker", worker: new Worker(...) }).`);
367
+ async register(options = {}) {
368
+ const isInline = !!this.tasks;
369
+ const context = { ...options, isInline };
370
+ await this.onInitialize(context);
371
+ if (isInline) {
372
+ if (!this.tasks) {
373
+ throw new Error(`AiProvider "${this.name}": tasks must be provided via the constructor for inline registration. ` + `Pass the tasks record when constructing the provider, e.g. new MyProvider(MY_TASKS).`);
362
374
  }
363
375
  } else {
364
- if (!this.tasks) {
365
- throw new Error(`AiProvider "${this.name}": tasks must be provided via the constructor for inline mode. ` + `Pass the tasks record when constructing the provider, e.g. new MyProvider(MY_TASKS).`);
376
+ if (!options.worker) {
377
+ throw new Error(`AiProvider "${this.name}": worker is required when no tasks are provided (worker-backed registration). ` + `Pass worker: new Worker(...) or worker: () => new Worker(...).`);
366
378
  }
367
379
  }
368
380
  const registry = getAiProviderRegistry();
369
- if (options.mode === "worker" && options.worker) {
381
+ if (!isInline && options.worker) {
370
382
  const workerManager = globalServiceRegistry3.get(WORKER_MANAGER2);
371
383
  workerManager.registerWorker(this.name, options.worker);
372
384
  for (const taskType of this.taskTypes) {
@@ -390,9 +402,7 @@ class AiProvider {
390
402
  }
391
403
  }
392
404
  registry.registerProvider(this);
393
- if (options.queue?.autoCreate !== false) {
394
- await this.createQueue(options.queue?.concurrency ?? 1);
395
- }
405
+ await this.afterRegister(options);
396
406
  }
397
407
  registerOnWorkerServer(workerServer) {
398
408
  if (!this.tasks) {
@@ -414,10 +424,39 @@ class AiProvider {
414
424
  }
415
425
  async onInitialize(_options) {}
416
426
  async dispose() {}
417
- async createQueue(concurrency) {
418
- await createDefaultQueue(this.name, concurrency);
427
+ async afterRegister(_options) {}
428
+ }
429
+
430
+ // src/queue/createDefaultQueue.ts
431
+ import { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from "@workglow/job-queue";
432
+ import { InMemoryQueueStorage } from "@workglow/storage";
433
+ import { getTaskQueueRegistry } from "@workglow/task-graph";
434
+ async function createDefaultQueue(providerName, concurrency) {
435
+ const storage = new InMemoryQueueStorage(providerName);
436
+ await storage.setupDatabase();
437
+ const server = new JobQueueServer(AiJob, {
438
+ storage,
439
+ queueName: providerName,
440
+ limiter: new ConcurrencyLimiter(concurrency)
441
+ });
442
+ const client = new JobQueueClient({
443
+ storage,
444
+ queueName: providerName
445
+ });
446
+ client.attach(server);
447
+ getTaskQueueRegistry().registerQueue({ server, client, storage });
448
+ await server.start();
449
+ }
450
+
451
+ // src/provider/QueuedAiProvider.ts
452
+ class QueuedAiProvider extends AiProvider {
453
+ async afterRegister(options) {
454
+ if (options.queue?.autoCreate !== false) {
455
+ await createDefaultQueue(this.name, options.queue?.concurrency ?? 1);
456
+ }
419
457
  }
420
458
  }
459
+
421
460
  // src/task/index.ts
422
461
  import { TaskRegistry } from "@workglow/task-graph";
423
462
 
@@ -497,7 +536,6 @@ import {
497
536
  getTaskConstructors,
498
537
  Workflow
499
538
  } from "@workglow/task-graph";
500
- import { getLogger } from "@workglow/util";
501
539
 
502
540
  // src/task/base/AiTaskSchemas.ts
503
541
  var TypeLanguage = (annotations = {}) => ({
@@ -817,30 +855,6 @@ class StreamingAiTask extends AiTask {
817
855
  }
818
856
 
819
857
  // src/task/ToolCallingTask.ts
820
- function buildToolDescription(tool) {
821
- let desc = tool.description;
822
- if (tool.outputSchema && typeof tool.outputSchema === "object") {
823
- desc += `
824
-
825
- Returns: ${JSON.stringify(tool.outputSchema)}`;
826
- }
827
- return desc;
828
- }
829
- function isAllowedToolName(name, allowedTools) {
830
- return allowedTools.some((t) => t.name === name);
831
- }
832
- function filterValidToolCalls(toolCalls, allowedTools) {
833
- return toolCalls.filter((tc) => {
834
- if (tc.name && isAllowedToolName(tc.name, allowedTools)) {
835
- return true;
836
- }
837
- getLogger().warn(`Filtered out tool call with unknown name "${tc.name ?? "(missing)"}"`, {
838
- callId: tc.id,
839
- toolName: tc.name
840
- });
841
- return false;
842
- });
843
- }
844
858
  function taskTypesToTools(taskNames, registry) {
845
859
  const constructors = getTaskConstructors(registry);
846
860
  return taskNames.map((name) => {
@@ -1457,9 +1471,9 @@ class AiVisionTask extends AiTask {
1457
1471
  const queueName = registeredQueue?.server.queueName;
1458
1472
  const supports = ["Blob"];
1459
1473
  if (input.image) {
1460
- if (queueName === "TENSORFLOW_MEDIAPIPE" && "ImageBitmap" in globalThis) {
1474
+ if (typeof queueName === "string" && queueName.startsWith("TENSORFLOW_MEDIAPIPE") && "ImageBitmap" in globalThis) {
1461
1475
  supports.push("ImageBitmap");
1462
- } else if (queueName === "TENSORFLOW_MEDIAPIPE" && "VideoFrame" in globalThis) {
1476
+ } else if (typeof queueName === "string" && queueName.startsWith("TENSORFLOW_MEDIAPIPE") && "VideoFrame" in globalThis) {
1463
1477
  supports.push("VideoFrame");
1464
1478
  }
1465
1479
  const image = await convertImageDataToUseableForm(input.image, supports);
@@ -3062,7 +3076,7 @@ var DownloadModelOutputSchema = {
3062
3076
 
3063
3077
  class DownloadModelTask extends AiTask {
3064
3078
  static type = "DownloadModelTask";
3065
- static category = "AI Text Model";
3079
+ static category = "AI Model";
3066
3080
  static title = "Download Model";
3067
3081
  static description = "Downloads and caches AI models locally with progress tracking";
3068
3082
  static inputSchema() {
@@ -3081,7 +3095,18 @@ class DownloadModelTask extends AiTask {
3081
3095
  });
3082
3096
  }
3083
3097
  processProgress(progress, message = "", details) {
3084
- if (details?.file) {
3098
+ if (details?.files && typeof details.files === "object") {
3099
+ const entries = Object.entries(details.files);
3100
+ if (entries.length > 0) {
3101
+ this.files = entries.map(([file, info]) => ({
3102
+ file,
3103
+ progress: info.total > 0 ? info.loaded / info.total * 100 : 0
3104
+ })).sort((a, b) => a.file.localeCompare(b.file));
3105
+ this.progress = progress;
3106
+ return;
3107
+ }
3108
+ }
3109
+ if (details?.file !== undefined && details.progress !== undefined) {
3085
3110
  const file = this.files.find((f) => f.file === details.file);
3086
3111
  if (file) {
3087
3112
  file.progress = details.progress;
@@ -4375,7 +4400,10 @@ var imageToText = (input, config) => {
4375
4400
  Workflow25.prototype.imageToText = CreateWorkflow25(ImageToTextTask);
4376
4401
 
4377
4402
  // src/task/ModelInfoTask.ts
4378
- import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4403
+ import {
4404
+ CreateWorkflow as CreateWorkflow26,
4405
+ Workflow as Workflow26
4406
+ } from "@workglow/task-graph";
4379
4407
  var modelSchema19 = TypeModel("model");
4380
4408
  var ModelInfoInputSchema = {
4381
4409
  type: "object",
@@ -4400,7 +4428,12 @@ var ModelInfoOutputSchema = {
4400
4428
  supports_node: { type: "boolean" },
4401
4429
  is_cached: { type: "boolean" },
4402
4430
  is_loaded: { type: "boolean" },
4403
- file_sizes: {}
4431
+ file_sizes: {},
4432
+ quantizations: {
4433
+ type: "array",
4434
+ items: { type: "string" },
4435
+ description: "Available quantization variants (e.g. fp32, fp16, q8). Only present for models with quantization options."
4436
+ }
4404
4437
  },
4405
4438
  required: [
4406
4439
  "model",
@@ -4417,7 +4450,8 @@ var ModelInfoOutputSchema = {
4417
4450
 
4418
4451
  class ModelInfoTask extends AiTask {
4419
4452
  static type = "ModelInfoTask";
4420
- static category = "Hidden";
4453
+ static category = "AI Model";
4454
+ static cacheable = false;
4421
4455
  static title = "Model Info";
4422
4456
  static description = "Returns runtime information about a model including locality, cache status, and file sizes";
4423
4457
  static inputSchema() {
@@ -4426,15 +4460,87 @@ class ModelInfoTask extends AiTask {
4426
4460
  static outputSchema() {
4427
4461
  return ModelInfoOutputSchema;
4428
4462
  }
4429
- static cacheable = false;
4463
+ async execute(input, context) {
4464
+ const model = input.model;
4465
+ const registry = getAiProviderRegistry();
4466
+ const noop = () => {};
4467
+ const runFn = registry.getDirectRunFn(model.provider, "ModelInfoTask");
4468
+ return runFn(input, model, noop, context.signal);
4469
+ }
4430
4470
  }
4431
4471
  var modelInfo = (input, config) => {
4432
4472
  return new ModelInfoTask({}, config).run(input);
4433
4473
  };
4434
4474
  Workflow26.prototype.modelInfo = CreateWorkflow26(ModelInfoTask);
4435
4475
 
4476
+ // src/task/ModelSearchTask.ts
4477
+ import { CreateWorkflow as CreateWorkflow27, Task as Task11, Workflow as Workflow27 } from "@workglow/task-graph";
4478
+ var ModelSearchInputSchema = {
4479
+ type: "object",
4480
+ properties: {
4481
+ provider: {
4482
+ type: "string",
4483
+ title: "Provider",
4484
+ description: "The model provider to search (e.g. ANTHROPIC, OPENAI, HF_TRANSFORMERS_ONNX)"
4485
+ },
4486
+ query: {
4487
+ type: "string",
4488
+ title: "Query",
4489
+ description: "Search query string"
4490
+ }
4491
+ },
4492
+ required: ["provider", "query"],
4493
+ additionalProperties: false
4494
+ };
4495
+ var ModelSearchOutputSchema = {
4496
+ type: "object",
4497
+ properties: {
4498
+ results: {
4499
+ type: "array",
4500
+ items: {
4501
+ type: "object",
4502
+ properties: {
4503
+ id: { type: "string" },
4504
+ label: { type: "string" },
4505
+ description: { type: "string" },
4506
+ record: { type: "object", additionalProperties: true },
4507
+ raw: {}
4508
+ },
4509
+ required: ["id", "label", "description", "record"],
4510
+ additionalProperties: false
4511
+ }
4512
+ }
4513
+ },
4514
+ required: ["results"],
4515
+ additionalProperties: false
4516
+ };
4517
+
4518
+ class ModelSearchTask extends Task11 {
4519
+ static type = "ModelSearchTask";
4520
+ static category = "AI Model";
4521
+ static title = "Model Search";
4522
+ static description = "Search for models using provider-specific search functions";
4523
+ static cacheable = false;
4524
+ static inputSchema() {
4525
+ return ModelSearchInputSchema;
4526
+ }
4527
+ static outputSchema() {
4528
+ return ModelSearchOutputSchema;
4529
+ }
4530
+ async execute(input, context) {
4531
+ const registry = getAiProviderRegistry();
4532
+ const noop = () => {};
4533
+ const runFn = registry.getDirectRunFn(input.provider, "ModelSearchTask");
4534
+ return runFn(input, undefined, noop, context.signal);
4535
+ }
4536
+ }
4537
+ var modelSearch = (input, config) => {
4538
+ return new ModelSearchTask({}, config).run(input);
4539
+ };
4540
+ Workflow27.prototype.modelSearch = CreateWorkflow27(ModelSearchTask);
4541
+
4436
4542
  // src/task/ObjectDetectionTask.ts
4437
- import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow27 } from "@workglow/task-graph";
4543
+ import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4438
4544
  var modelSchema20 = TypeModel("model:ObjectDetectionTask");
4439
4545
  var detectionSchema = {
4440
4546
  type: "object",
@@ -4514,10 +4620,10 @@ class ObjectDetectionTask extends AiVisionTask {
4514
4620
  var objectDetection = (input, config) => {
4515
4621
  return new ObjectDetectionTask({}, config).run(input);
4516
4622
  };
4517
- Workflow27.prototype.objectDetection = CreateWorkflow27(ObjectDetectionTask);
4623
+ Workflow28.prototype.objectDetection = CreateWorkflow28(ObjectDetectionTask);
4518
4624
 
4519
4625
  // src/task/PoseLandmarkerTask.ts
4520
- import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4626
+ import { CreateWorkflow as CreateWorkflow29, Workflow as Workflow29 } from "@workglow/task-graph";
4521
4627
  var modelSchema21 = TypeModel("model:PoseLandmarkerTask");
4522
4628
  var TypePoseLandmark = {
4523
4629
  type: "object",
@@ -4676,13 +4782,13 @@ class PoseLandmarkerTask extends AiVisionTask {
4676
4782
  var poseLandmarker = (input, config) => {
4677
4783
  return new PoseLandmarkerTask({}, config).run(input);
4678
4784
  };
4679
- Workflow28.prototype.poseLandmarker = CreateWorkflow28(PoseLandmarkerTask);
4785
+ Workflow29.prototype.poseLandmarker = CreateWorkflow29(PoseLandmarkerTask);
4680
4786
 
4681
4787
  // src/task/QueryExpanderTask.ts
4682
4788
  import {
4683
- CreateWorkflow as CreateWorkflow29,
4684
- Task as Task11,
4685
- Workflow as Workflow29
4789
+ CreateWorkflow as CreateWorkflow30,
4790
+ Task as Task12,
4791
+ Workflow as Workflow30
4686
4792
  } from "@workglow/task-graph";
4687
4793
  var QueryExpansionMethod = {
4688
4794
  MULTI_QUERY: "multi-query",
@@ -4751,7 +4857,7 @@ var outputSchema10 = {
4751
4857
  additionalProperties: false
4752
4858
  };
4753
4859
 
4754
- class QueryExpanderTask extends Task11 {
4860
+ class QueryExpanderTask extends Task12 {
4755
4861
  static type = "QueryExpanderTask";
4756
4862
  static category = "RAG";
4757
4863
  static title = "Query Expander";
@@ -4893,17 +4999,17 @@ class QueryExpanderTask extends Task11 {
4893
4999
  var queryExpander = (input, config) => {
4894
5000
  return new QueryExpanderTask({}, config).run(input);
4895
5001
  };
4896
- Workflow29.prototype.queryExpander = CreateWorkflow29(QueryExpanderTask);
5002
+ Workflow30.prototype.queryExpander = CreateWorkflow30(QueryExpanderTask);
4897
5003
 
4898
5004
  // src/task/RerankerTask.ts
4899
5005
  import {
4900
- CreateWorkflow as CreateWorkflow31,
4901
- Task as Task12,
4902
- Workflow as Workflow31
5006
+ CreateWorkflow as CreateWorkflow32,
5007
+ Task as Task13,
5008
+ Workflow as Workflow32
4903
5009
  } from "@workglow/task-graph";
4904
5010
 
4905
5011
  // src/task/TextClassificationTask.ts
4906
- import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow30 } from "@workglow/task-graph";
5012
+ import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow31 } from "@workglow/task-graph";
4907
5013
  var modelSchema22 = TypeModel("model:TextClassificationTask");
4908
5014
  var TextClassificationInputSchema = {
4909
5015
  type: "object",
@@ -4981,7 +5087,7 @@ class TextClassificationTask extends AiTask {
4981
5087
  var textClassification = (input, config) => {
4982
5088
  return new TextClassificationTask({}, config).run(input);
4983
5089
  };
4984
- Workflow30.prototype.textClassification = CreateWorkflow30(TextClassificationTask);
5090
+ Workflow31.prototype.textClassification = CreateWorkflow31(TextClassificationTask);
4985
5091
 
4986
5092
  // src/task/RerankerTask.ts
4987
5093
  var inputSchema11 = {
@@ -5076,7 +5182,7 @@ var outputSchema11 = {
5076
5182
  additionalProperties: false
5077
5183
  };
5078
5184
 
5079
- class RerankerTask extends Task12 {
5185
+ class RerankerTask extends Task13 {
5080
5186
  static type = "RerankerTask";
5081
5187
  static category = "RAG";
5082
5188
  static title = "Reranker";
@@ -5205,14 +5311,14 @@ class RerankerTask extends Task12 {
5205
5311
  var reranker = (input, config) => {
5206
5312
  return new RerankerTask({}, config).run(input);
5207
5313
  };
5208
- Workflow31.prototype.reranker = CreateWorkflow31(RerankerTask);
5314
+ Workflow32.prototype.reranker = CreateWorkflow32(RerankerTask);
5209
5315
 
5210
5316
  // src/task/StructuralParserTask.ts
5211
5317
  import { StructuralParser } from "@workglow/knowledge-base";
5212
5318
  import {
5213
- CreateWorkflow as CreateWorkflow32,
5214
- Task as Task13,
5215
- Workflow as Workflow32
5319
+ CreateWorkflow as CreateWorkflow33,
5320
+ Task as Task14,
5321
+ Workflow as Workflow33
5216
5322
  } from "@workglow/task-graph";
5217
5323
  import { uuid4 as uuid42 } from "@workglow/util";
5218
5324
  var inputSchema12 = {
@@ -5271,7 +5377,7 @@ var outputSchema12 = {
5271
5377
  additionalProperties: false
5272
5378
  };
5273
5379
 
5274
- class StructuralParserTask extends Task13 {
5380
+ class StructuralParserTask extends Task14 {
5275
5381
  static type = "StructuralParserTask";
5276
5382
  static category = "Document";
5277
5383
  static title = "Structural Parser";
@@ -5314,10 +5420,10 @@ class StructuralParserTask extends Task13 {
5314
5420
  var structuralParser = (input, config) => {
5315
5421
  return new StructuralParserTask({}, config).run(input);
5316
5422
  };
5317
- Workflow32.prototype.structuralParser = CreateWorkflow32(StructuralParserTask);
5423
+ Workflow33.prototype.structuralParser = CreateWorkflow33(StructuralParserTask);
5318
5424
 
5319
5425
  // src/task/StructuredGenerationTask.ts
5320
- import { CreateWorkflow as CreateWorkflow33, Workflow as Workflow33 } from "@workglow/task-graph";
5426
+ import { CreateWorkflow as CreateWorkflow34, Workflow as Workflow34 } from "@workglow/task-graph";
5321
5427
  var modelSchema23 = TypeModel("model:StructuredGenerationTask");
5322
5428
  var StructuredGenerationInputSchema = {
5323
5429
  type: "object",
@@ -5385,13 +5491,13 @@ class StructuredGenerationTask extends StreamingAiTask {
5385
5491
  var structuredGeneration = (input, config) => {
5386
5492
  return new StructuredGenerationTask({}, config).run(input);
5387
5493
  };
5388
- Workflow33.prototype.structuredGeneration = CreateWorkflow33(StructuredGenerationTask);
5494
+ Workflow34.prototype.structuredGeneration = CreateWorkflow34(StructuredGenerationTask);
5389
5495
 
5390
5496
  // src/task/TextChunkerTask.ts
5391
5497
  import {
5392
- CreateWorkflow as CreateWorkflow34,
5393
- Task as Task14,
5394
- Workflow as Workflow34
5498
+ CreateWorkflow as CreateWorkflow35,
5499
+ Task as Task15,
5500
+ Workflow as Workflow35
5395
5501
  } from "@workglow/task-graph";
5396
5502
  var ChunkingStrategy = {
5397
5503
  FIXED: "fixed",
@@ -5461,7 +5567,7 @@ var outputSchema13 = {
5461
5567
  additionalProperties: false
5462
5568
  };
5463
5569
 
5464
- class TextChunkerTask extends Task14 {
5570
+ class TextChunkerTask extends Task15 {
5465
5571
  static type = "TextChunkerTask";
5466
5572
  static category = "Document";
5467
5573
  static title = "Text Chunker";
@@ -5641,10 +5747,10 @@ class TextChunkerTask extends Task14 {
5641
5747
  var textChunker = (input, config) => {
5642
5748
  return new TextChunkerTask({}, config).run(input);
5643
5749
  };
5644
- Workflow34.prototype.textChunker = CreateWorkflow34(TextChunkerTask);
5750
+ Workflow35.prototype.textChunker = CreateWorkflow35(TextChunkerTask);
5645
5751
 
5646
5752
  // src/task/TextFillMaskTask.ts
5647
- import { CreateWorkflow as CreateWorkflow35, Workflow as Workflow35 } from "@workglow/task-graph";
5753
+ import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5648
5754
  var modelSchema24 = TypeModel("model:TextFillMaskTask");
5649
5755
  var TextFillMaskInputSchema = {
5650
5756
  type: "object",
@@ -5709,10 +5815,10 @@ class TextFillMaskTask extends AiTask {
5709
5815
  var textFillMask = (input, config) => {
5710
5816
  return new TextFillMaskTask({}, config).run(input);
5711
5817
  };
5712
- Workflow35.prototype.textFillMask = CreateWorkflow35(TextFillMaskTask);
5818
+ Workflow36.prototype.textFillMask = CreateWorkflow36(TextFillMaskTask);
5713
5819
 
5714
5820
  // src/task/TextGenerationTask.ts
5715
- import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5821
+ import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
5716
5822
  var generatedTextSchema2 = TypeSingleOrArray({
5717
5823
  type: "string",
5718
5824
  title: "Text",
@@ -5797,10 +5903,10 @@ class TextGenerationTask extends StreamingAiTask {
5797
5903
  var textGeneration = (input, config) => {
5798
5904
  return new TextGenerationTask({}, config).run(input);
5799
5905
  };
5800
- Workflow36.prototype.textGeneration = CreateWorkflow36(TextGenerationTask);
5906
+ Workflow37.prototype.textGeneration = CreateWorkflow37(TextGenerationTask);
5801
5907
 
5802
5908
  // src/task/TextLanguageDetectionTask.ts
5803
- import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
5909
+ import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
5804
5910
  var modelSchema26 = TypeModel("model:TextLanguageDetectionTask");
5805
5911
  var TextLanguageDetectionInputSchema = {
5806
5912
  type: "object",
@@ -5868,10 +5974,10 @@ class TextLanguageDetectionTask extends AiTask {
5868
5974
  var textLanguageDetection = (input, config) => {
5869
5975
  return new TextLanguageDetectionTask({}, config).run(input);
5870
5976
  };
5871
- Workflow37.prototype.textLanguageDetection = CreateWorkflow37(TextLanguageDetectionTask);
5977
+ Workflow38.prototype.textLanguageDetection = CreateWorkflow38(TextLanguageDetectionTask);
5872
5978
 
5873
5979
  // src/task/TextQuestionAnswerTask.ts
5874
- import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
5980
+ import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
5875
5981
  var contextSchema = TypeSingleOrArray({
5876
5982
  type: "string",
5877
5983
  title: "Context",
@@ -5923,10 +6029,10 @@ class TextQuestionAnswerTask extends StreamingAiTask {
5923
6029
  var textQuestionAnswer = (input, config) => {
5924
6030
  return new TextQuestionAnswerTask({}, config).run(input);
5925
6031
  };
5926
- Workflow38.prototype.textQuestionAnswer = CreateWorkflow38(TextQuestionAnswerTask);
6032
+ Workflow39.prototype.textQuestionAnswer = CreateWorkflow39(TextQuestionAnswerTask);
5927
6033
 
5928
6034
  // src/task/TextRewriterTask.ts
5929
- import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6035
+ import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
5930
6036
  var modelSchema28 = TypeModel("model:TextRewriterTask");
5931
6037
  var TextRewriterInputSchema = {
5932
6038
  type: "object",
@@ -5975,10 +6081,10 @@ class TextRewriterTask extends StreamingAiTask {
5975
6081
  var textRewriter = (input, config) => {
5976
6082
  return new TextRewriterTask({}, config).run(input);
5977
6083
  };
5978
- Workflow39.prototype.textRewriter = CreateWorkflow39(TextRewriterTask);
6084
+ Workflow40.prototype.textRewriter = CreateWorkflow40(TextRewriterTask);
5979
6085
 
5980
6086
  // src/task/TextTranslationTask.ts
5981
- import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6087
+ import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
5982
6088
  var modelSchema29 = TypeModel("model:TextTranslationTask");
5983
6089
  var translationTextSchema = TypeSingleOrArray({
5984
6090
  type: "string",
@@ -6041,13 +6147,13 @@ class TextTranslationTask extends StreamingAiTask {
6041
6147
  var textTranslation = (input, config) => {
6042
6148
  return new TextTranslationTask({}, config).run(input);
6043
6149
  };
6044
- Workflow40.prototype.textTranslation = CreateWorkflow40(TextTranslationTask);
6150
+ Workflow41.prototype.textTranslation = CreateWorkflow41(TextTranslationTask);
6045
6151
 
6046
6152
  // src/task/TopicSegmenterTask.ts
6047
6153
  import {
6048
- CreateWorkflow as CreateWorkflow41,
6049
- Task as Task15,
6050
- Workflow as Workflow41
6154
+ CreateWorkflow as CreateWorkflow42,
6155
+ Task as Task16,
6156
+ Workflow as Workflow42
6051
6157
  } from "@workglow/task-graph";
6052
6158
  var SegmentationMethod = {
6053
6159
  HEURISTIC: "heuristic",
@@ -6123,7 +6229,7 @@ var outputSchema14 = {
6123
6229
  additionalProperties: false
6124
6230
  };
6125
6231
 
6126
- class TopicSegmenterTask extends Task15 {
6232
+ class TopicSegmenterTask extends Task16 {
6127
6233
  static type = "TopicSegmenterTask";
6128
6234
  static category = "Document";
6129
6235
  static title = "Topic Segmenter";
@@ -6328,10 +6434,10 @@ class TopicSegmenterTask extends Task15 {
6328
6434
  var topicSegmenter = (input, config) => {
6329
6435
  return new TopicSegmenterTask({}, config).run(input);
6330
6436
  };
6331
- Workflow41.prototype.topicSegmenter = CreateWorkflow41(TopicSegmenterTask);
6437
+ Workflow42.prototype.topicSegmenter = CreateWorkflow42(TopicSegmenterTask);
6332
6438
 
6333
6439
  // src/task/UnloadModelTask.ts
6334
- import { CreateWorkflow as CreateWorkflow42, Workflow as Workflow42 } from "@workglow/task-graph";
6440
+ import { CreateWorkflow as CreateWorkflow43, Workflow as Workflow43 } from "@workglow/task-graph";
6335
6441
  var modelSchema30 = TypeModel("model");
6336
6442
  var UnloadModelInputSchema = {
6337
6443
  type: "object",
@@ -6352,7 +6458,7 @@ var UnloadModelOutputSchema = {
6352
6458
 
6353
6459
  class UnloadModelTask extends AiTask {
6354
6460
  static type = "UnloadModelTask";
6355
- static category = "Hidden";
6461
+ static category = "AI Model";
6356
6462
  static title = "Unload Model";
6357
6463
  static description = "Unloads and clears cached AI models from memory and storage";
6358
6464
  static inputSchema() {
@@ -6366,10 +6472,10 @@ class UnloadModelTask extends AiTask {
6366
6472
  var unloadModel = (input, config) => {
6367
6473
  return new UnloadModelTask({}, config).run(input);
6368
6474
  };
6369
- Workflow42.prototype.unloadModel = CreateWorkflow42(UnloadModelTask);
6475
+ Workflow43.prototype.unloadModel = CreateWorkflow43(UnloadModelTask);
6370
6476
 
6371
6477
  // src/task/VectorQuantizeTask.ts
6372
- import { CreateWorkflow as CreateWorkflow43, Task as Task16, Workflow as Workflow43 } from "@workglow/task-graph";
6478
+ import { CreateWorkflow as CreateWorkflow44, Task as Task17, Workflow as Workflow44 } from "@workglow/task-graph";
6373
6479
  import {
6374
6480
  normalizeNumberArray,
6375
6481
  TensorType,
@@ -6449,7 +6555,7 @@ var outputSchema15 = {
6449
6555
  additionalProperties: false
6450
6556
  };
6451
6557
 
6452
- class VectorQuantizeTask extends Task16 {
6558
+ class VectorQuantizeTask extends Task17 {
6453
6559
  static type = "VectorQuantizeTask";
6454
6560
  static category = "Vector";
6455
6561
  static title = "Quantize";
@@ -6549,10 +6655,10 @@ class VectorQuantizeTask extends Task16 {
6549
6655
  var vectorQuantize = (input, config) => {
6550
6656
  return new VectorQuantizeTask({}, config).run(input);
6551
6657
  };
6552
- Workflow43.prototype.vectorQuantize = CreateWorkflow43(VectorQuantizeTask);
6658
+ Workflow44.prototype.vectorQuantize = CreateWorkflow44(VectorQuantizeTask);
6553
6659
 
6554
6660
  // src/task/VectorSimilarityTask.ts
6555
- import { CreateWorkflow as CreateWorkflow44, GraphAsTask, Workflow as Workflow44 } from "@workglow/task-graph";
6661
+ import { CreateWorkflow as CreateWorkflow45, GraphAsTask, Workflow as Workflow45 } from "@workglow/task-graph";
6556
6662
  import {
6557
6663
  cosineSimilarity,
6558
6664
  hammingSimilarity,
@@ -6658,7 +6764,7 @@ class VectorSimilarityTask extends GraphAsTask {
6658
6764
  var similarity = (input, config) => {
6659
6765
  return new VectorSimilarityTask({}, config).run(input);
6660
6766
  };
6661
- Workflow44.prototype.similarity = CreateWorkflow44(VectorSimilarityTask);
6767
+ Workflow45.prototype.similarity = CreateWorkflow45(VectorSimilarityTask);
6662
6768
  // src/task/MessageConversion.ts
6663
6769
  function getInputMessages(input) {
6664
6770
  const messages = input.messages;
@@ -6881,6 +6987,7 @@ var registerAiTasks = () => {
6881
6987
  ImageSegmentationTask,
6882
6988
  ImageToTextTask,
6883
6989
  ModelInfoTask,
6990
+ ModelSearchTask,
6884
6991
  ObjectDetectionTask,
6885
6992
  PoseLandmarkerTask,
6886
6993
  QueryExpanderTask,
@@ -6940,6 +7047,7 @@ export {
6940
7047
  queryExpander,
6941
7048
  poseLandmarker,
6942
7049
  objectDetection,
7050
+ modelSearch,
6943
7051
  modelInfo,
6944
7052
  isAllowedToolName,
6945
7053
  imageToText,
@@ -7032,6 +7140,7 @@ export {
7032
7140
  SimilarityFn,
7033
7141
  SegmentationMethod,
7034
7142
  RerankerTask,
7143
+ QueuedAiProvider,
7035
7144
  QueryExpansionMethod,
7036
7145
  QueryExpanderTask,
7037
7146
  PoseLandmarkerTask,
@@ -7040,6 +7149,7 @@ export {
7040
7149
  ObjectDetectionTask,
7041
7150
  ObjectDetectionOutputSchema,
7042
7151
  ObjectDetectionInputSchema,
7152
+ ModelSearchTask,
7043
7153
  ModelRepository,
7044
7154
  ModelRecordSchema,
7045
7155
  ModelPrimaryKeyNames,
@@ -7098,4 +7208,4 @@ export {
7098
7208
  AgentInputSchema
7099
7209
  };
7100
7210
 
7101
- //# debugId=7632C16D204CE7AB64756E2164756E21
7211
+ //# debugId=A00982DDB1044BF764756E2164756E21