@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/bun.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  } from "@workglow/job-queue";
9
9
 
10
10
  // src/provider/AiProviderRegistry.ts
11
- import { globalServiceRegistry, WORKER_MANAGER } from "@workglow/util";
11
+ import { globalServiceRegistry, WORKER_MANAGER } from "@workglow/util/worker";
12
12
 
13
13
  class AiProviderRegistry {
14
14
  runFnRegistry = new Map;
@@ -146,6 +146,34 @@ class AiJob extends Job {
146
146
  yield* streamFn(input.taskInput, model, context.signal, input.outputSchema);
147
147
  }
148
148
  }
149
+
150
+ // src/task/ToolCallingUtils.ts
151
+ import { getLogger } from "@workglow/util/worker";
152
+ function buildToolDescription(tool) {
153
+ let desc = tool.description;
154
+ if (tool.outputSchema && typeof tool.outputSchema === "object") {
155
+ desc += `
156
+
157
+ Returns: ${JSON.stringify(tool.outputSchema)}`;
158
+ }
159
+ return desc;
160
+ }
161
+ function isAllowedToolName(name, allowedTools) {
162
+ return allowedTools.some((t) => t.name === name);
163
+ }
164
+ function filterValidToolCalls(toolCalls, allowedTools) {
165
+ return toolCalls.filter((tc) => {
166
+ if (tc.name && isAllowedToolName(tc.name, allowedTools)) {
167
+ return true;
168
+ }
169
+ getLogger().warn(`Filtered out tool call with unknown name "${tc.name ?? "(missing)"}"`, {
170
+ callId: tc.id,
171
+ toolName: tc.name
172
+ });
173
+ return false;
174
+ });
175
+ }
176
+
149
177
  // src/model/InMemoryModelRepository.ts
150
178
  import { InMemoryTabularStorage } from "@workglow/storage";
151
179
 
@@ -284,6 +312,7 @@ class InMemoryModelRepository extends ModelRepository {
284
312
  super(new InMemoryTabularStorage(ModelRecordSchema, ModelPrimaryKeyNames));
285
313
  }
286
314
  }
315
+
287
316
  // src/model/ModelRegistry.ts
288
317
  import {
289
318
  createServiceToken,
@@ -309,31 +338,12 @@ async function resolveModelFromRegistry(id, format, registry) {
309
338
  return model;
310
339
  }
311
340
  registerInputResolver("model", resolveModelFromRegistry);
312
- // src/provider/AiProvider.ts
313
- import { globalServiceRegistry as globalServiceRegistry3, WORKER_MANAGER as WORKER_MANAGER2 } from "@workglow/util";
314
-
315
- // src/queue/createDefaultQueue.ts
316
- import { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from "@workglow/job-queue";
317
- import { InMemoryQueueStorage } from "@workglow/storage";
318
- import { getTaskQueueRegistry } from "@workglow/task-graph";
319
- async function createDefaultQueue(providerName, concurrency) {
320
- const storage = new InMemoryQueueStorage(providerName);
321
- await storage.setupDatabase();
322
- const server = new JobQueueServer(AiJob, {
323
- storage,
324
- queueName: providerName,
325
- limiter: new ConcurrencyLimiter(concurrency)
326
- });
327
- const client = new JobQueueClient({
328
- storage,
329
- queueName: providerName
330
- });
331
- client.attach(server);
332
- getTaskQueueRegistry().registerQueue({ server, client, storage });
333
- await server.start();
334
- }
335
341
 
336
342
  // src/provider/AiProvider.ts
343
+ import {
344
+ globalServiceRegistry as globalServiceRegistry3,
345
+ WORKER_MANAGER as WORKER_MANAGER2
346
+ } from "@workglow/util/worker";
337
347
  class AiProvider {
338
348
  tasks;
339
349
  streamTasks;
@@ -355,19 +365,21 @@ class AiProvider {
355
365
  getReactiveRunFn(taskType) {
356
366
  return this.reactiveTasks?.[taskType];
357
367
  }
358
- async register(options = { mode: "inline" }) {
359
- await this.onInitialize(options);
360
- if (options.mode === "worker") {
361
- if (!options.worker) {
362
- 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(...) }).`);
368
+ async register(options = {}) {
369
+ const isInline = !!this.tasks;
370
+ const context = { ...options, isInline };
371
+ await this.onInitialize(context);
372
+ if (isInline) {
373
+ if (!this.tasks) {
374
+ 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).`);
363
375
  }
364
376
  } else {
365
- if (!this.tasks) {
366
- 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).`);
377
+ if (!options.worker) {
378
+ 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(...).`);
367
379
  }
368
380
  }
369
381
  const registry = getAiProviderRegistry();
370
- if (options.mode === "worker" && options.worker) {
382
+ if (!isInline && options.worker) {
371
383
  const workerManager = globalServiceRegistry3.get(WORKER_MANAGER2);
372
384
  workerManager.registerWorker(this.name, options.worker);
373
385
  for (const taskType of this.taskTypes) {
@@ -391,9 +403,7 @@ class AiProvider {
391
403
  }
392
404
  }
393
405
  registry.registerProvider(this);
394
- if (options.queue?.autoCreate !== false) {
395
- await this.createQueue(options.queue?.concurrency ?? 1);
396
- }
406
+ await this.afterRegister(options);
397
407
  }
398
408
  registerOnWorkerServer(workerServer) {
399
409
  if (!this.tasks) {
@@ -415,10 +425,39 @@ class AiProvider {
415
425
  }
416
426
  async onInitialize(_options) {}
417
427
  async dispose() {}
418
- async createQueue(concurrency) {
419
- await createDefaultQueue(this.name, concurrency);
428
+ async afterRegister(_options) {}
429
+ }
430
+
431
+ // src/queue/createDefaultQueue.ts
432
+ import { ConcurrencyLimiter, JobQueueClient, JobQueueServer } from "@workglow/job-queue";
433
+ import { InMemoryQueueStorage } from "@workglow/storage";
434
+ import { getTaskQueueRegistry } from "@workglow/task-graph";
435
+ async function createDefaultQueue(providerName, concurrency) {
436
+ const storage = new InMemoryQueueStorage(providerName);
437
+ await storage.setupDatabase();
438
+ const server = new JobQueueServer(AiJob, {
439
+ storage,
440
+ queueName: providerName,
441
+ limiter: new ConcurrencyLimiter(concurrency)
442
+ });
443
+ const client = new JobQueueClient({
444
+ storage,
445
+ queueName: providerName
446
+ });
447
+ client.attach(server);
448
+ getTaskQueueRegistry().registerQueue({ server, client, storage });
449
+ await server.start();
450
+ }
451
+
452
+ // src/provider/QueuedAiProvider.ts
453
+ class QueuedAiProvider extends AiProvider {
454
+ async afterRegister(options) {
455
+ if (options.queue?.autoCreate !== false) {
456
+ await createDefaultQueue(this.name, options.queue?.concurrency ?? 1);
457
+ }
420
458
  }
421
459
  }
460
+
422
461
  // src/task/index.ts
423
462
  import { TaskRegistry } from "@workglow/task-graph";
424
463
 
@@ -498,7 +537,6 @@ import {
498
537
  getTaskConstructors,
499
538
  Workflow
500
539
  } from "@workglow/task-graph";
501
- import { getLogger } from "@workglow/util";
502
540
 
503
541
  // src/task/base/AiTaskSchemas.ts
504
542
  var TypeLanguage = (annotations = {}) => ({
@@ -818,30 +856,6 @@ class StreamingAiTask extends AiTask {
818
856
  }
819
857
 
820
858
  // src/task/ToolCallingTask.ts
821
- function buildToolDescription(tool) {
822
- let desc = tool.description;
823
- if (tool.outputSchema && typeof tool.outputSchema === "object") {
824
- desc += `
825
-
826
- Returns: ${JSON.stringify(tool.outputSchema)}`;
827
- }
828
- return desc;
829
- }
830
- function isAllowedToolName(name, allowedTools) {
831
- return allowedTools.some((t) => t.name === name);
832
- }
833
- function filterValidToolCalls(toolCalls, allowedTools) {
834
- return toolCalls.filter((tc) => {
835
- if (tc.name && isAllowedToolName(tc.name, allowedTools)) {
836
- return true;
837
- }
838
- getLogger().warn(`Filtered out tool call with unknown name "${tc.name ?? "(missing)"}"`, {
839
- callId: tc.id,
840
- toolName: tc.name
841
- });
842
- return false;
843
- });
844
- }
845
859
  function taskTypesToTools(taskNames, registry) {
846
860
  const constructors = getTaskConstructors(registry);
847
861
  return taskNames.map((name) => {
@@ -1458,9 +1472,9 @@ class AiVisionTask extends AiTask {
1458
1472
  const queueName = registeredQueue?.server.queueName;
1459
1473
  const supports = ["Blob"];
1460
1474
  if (input.image) {
1461
- if (queueName === "TENSORFLOW_MEDIAPIPE" && "ImageBitmap" in globalThis) {
1475
+ if (typeof queueName === "string" && queueName.startsWith("TENSORFLOW_MEDIAPIPE") && "ImageBitmap" in globalThis) {
1462
1476
  supports.push("ImageBitmap");
1463
- } else if (queueName === "TENSORFLOW_MEDIAPIPE" && "VideoFrame" in globalThis) {
1477
+ } else if (typeof queueName === "string" && queueName.startsWith("TENSORFLOW_MEDIAPIPE") && "VideoFrame" in globalThis) {
1464
1478
  supports.push("VideoFrame");
1465
1479
  }
1466
1480
  const image = await convertImageDataToUseableForm(input.image, supports);
@@ -3063,7 +3077,7 @@ var DownloadModelOutputSchema = {
3063
3077
 
3064
3078
  class DownloadModelTask extends AiTask {
3065
3079
  static type = "DownloadModelTask";
3066
- static category = "AI Text Model";
3080
+ static category = "AI Model";
3067
3081
  static title = "Download Model";
3068
3082
  static description = "Downloads and caches AI models locally with progress tracking";
3069
3083
  static inputSchema() {
@@ -3082,7 +3096,18 @@ class DownloadModelTask extends AiTask {
3082
3096
  });
3083
3097
  }
3084
3098
  processProgress(progress, message = "", details) {
3085
- if (details?.file) {
3099
+ if (details?.files && typeof details.files === "object") {
3100
+ const entries = Object.entries(details.files);
3101
+ if (entries.length > 0) {
3102
+ this.files = entries.map(([file, info]) => ({
3103
+ file,
3104
+ progress: info.total > 0 ? info.loaded / info.total * 100 : 0
3105
+ })).sort((a, b) => a.file.localeCompare(b.file));
3106
+ this.progress = progress;
3107
+ return;
3108
+ }
3109
+ }
3110
+ if (details?.file !== undefined && details.progress !== undefined) {
3086
3111
  const file = this.files.find((f) => f.file === details.file);
3087
3112
  if (file) {
3088
3113
  file.progress = details.progress;
@@ -4376,7 +4401,10 @@ var imageToText = (input, config) => {
4376
4401
  Workflow25.prototype.imageToText = CreateWorkflow25(ImageToTextTask);
4377
4402
 
4378
4403
  // src/task/ModelInfoTask.ts
4379
- import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4404
+ import {
4405
+ CreateWorkflow as CreateWorkflow26,
4406
+ Workflow as Workflow26
4407
+ } from "@workglow/task-graph";
4380
4408
  var modelSchema19 = TypeModel("model");
4381
4409
  var ModelInfoInputSchema = {
4382
4410
  type: "object",
@@ -4401,7 +4429,12 @@ var ModelInfoOutputSchema = {
4401
4429
  supports_node: { type: "boolean" },
4402
4430
  is_cached: { type: "boolean" },
4403
4431
  is_loaded: { type: "boolean" },
4404
- file_sizes: {}
4432
+ file_sizes: {},
4433
+ quantizations: {
4434
+ type: "array",
4435
+ items: { type: "string" },
4436
+ description: "Available quantization variants (e.g. fp32, fp16, q8). Only present for models with quantization options."
4437
+ }
4405
4438
  },
4406
4439
  required: [
4407
4440
  "model",
@@ -4418,7 +4451,8 @@ var ModelInfoOutputSchema = {
4418
4451
 
4419
4452
  class ModelInfoTask extends AiTask {
4420
4453
  static type = "ModelInfoTask";
4421
- static category = "Hidden";
4454
+ static category = "AI Model";
4455
+ static cacheable = false;
4422
4456
  static title = "Model Info";
4423
4457
  static description = "Returns runtime information about a model including locality, cache status, and file sizes";
4424
4458
  static inputSchema() {
@@ -4427,15 +4461,87 @@ class ModelInfoTask extends AiTask {
4427
4461
  static outputSchema() {
4428
4462
  return ModelInfoOutputSchema;
4429
4463
  }
4430
- static cacheable = false;
4464
+ async execute(input, context) {
4465
+ const model = input.model;
4466
+ const registry = getAiProviderRegistry();
4467
+ const noop = () => {};
4468
+ const runFn = registry.getDirectRunFn(model.provider, "ModelInfoTask");
4469
+ return runFn(input, model, noop, context.signal);
4470
+ }
4431
4471
  }
4432
4472
  var modelInfo = (input, config) => {
4433
4473
  return new ModelInfoTask({}, config).run(input);
4434
4474
  };
4435
4475
  Workflow26.prototype.modelInfo = CreateWorkflow26(ModelInfoTask);
4436
4476
 
4477
+ // src/task/ModelSearchTask.ts
4478
+ import { CreateWorkflow as CreateWorkflow27, Task as Task11, Workflow as Workflow27 } from "@workglow/task-graph";
4479
+ var ModelSearchInputSchema = {
4480
+ type: "object",
4481
+ properties: {
4482
+ provider: {
4483
+ type: "string",
4484
+ title: "Provider",
4485
+ description: "The model provider to search (e.g. ANTHROPIC, OPENAI, HF_TRANSFORMERS_ONNX)"
4486
+ },
4487
+ query: {
4488
+ type: "string",
4489
+ title: "Query",
4490
+ description: "Search query string"
4491
+ }
4492
+ },
4493
+ required: ["provider", "query"],
4494
+ additionalProperties: false
4495
+ };
4496
+ var ModelSearchOutputSchema = {
4497
+ type: "object",
4498
+ properties: {
4499
+ results: {
4500
+ type: "array",
4501
+ items: {
4502
+ type: "object",
4503
+ properties: {
4504
+ id: { type: "string" },
4505
+ label: { type: "string" },
4506
+ description: { type: "string" },
4507
+ record: { type: "object", additionalProperties: true },
4508
+ raw: {}
4509
+ },
4510
+ required: ["id", "label", "description", "record"],
4511
+ additionalProperties: false
4512
+ }
4513
+ }
4514
+ },
4515
+ required: ["results"],
4516
+ additionalProperties: false
4517
+ };
4518
+
4519
+ class ModelSearchTask extends Task11 {
4520
+ static type = "ModelSearchTask";
4521
+ static category = "AI Model";
4522
+ static title = "Model Search";
4523
+ static description = "Search for models using provider-specific search functions";
4524
+ static cacheable = false;
4525
+ static inputSchema() {
4526
+ return ModelSearchInputSchema;
4527
+ }
4528
+ static outputSchema() {
4529
+ return ModelSearchOutputSchema;
4530
+ }
4531
+ async execute(input, context) {
4532
+ const registry = getAiProviderRegistry();
4533
+ const noop = () => {};
4534
+ const runFn = registry.getDirectRunFn(input.provider, "ModelSearchTask");
4535
+ return runFn(input, undefined, noop, context.signal);
4536
+ }
4537
+ }
4538
+ var modelSearch = (input, config) => {
4539
+ return new ModelSearchTask({}, config).run(input);
4540
+ };
4541
+ Workflow27.prototype.modelSearch = CreateWorkflow27(ModelSearchTask);
4542
+
4437
4543
  // src/task/ObjectDetectionTask.ts
4438
- import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow27 } from "@workglow/task-graph";
4544
+ import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4439
4545
  var modelSchema20 = TypeModel("model:ObjectDetectionTask");
4440
4546
  var detectionSchema = {
4441
4547
  type: "object",
@@ -4515,10 +4621,10 @@ class ObjectDetectionTask extends AiVisionTask {
4515
4621
  var objectDetection = (input, config) => {
4516
4622
  return new ObjectDetectionTask({}, config).run(input);
4517
4623
  };
4518
- Workflow27.prototype.objectDetection = CreateWorkflow27(ObjectDetectionTask);
4624
+ Workflow28.prototype.objectDetection = CreateWorkflow28(ObjectDetectionTask);
4519
4625
 
4520
4626
  // src/task/PoseLandmarkerTask.ts
4521
- import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4627
+ import { CreateWorkflow as CreateWorkflow29, Workflow as Workflow29 } from "@workglow/task-graph";
4522
4628
  var modelSchema21 = TypeModel("model:PoseLandmarkerTask");
4523
4629
  var TypePoseLandmark = {
4524
4630
  type: "object",
@@ -4677,13 +4783,13 @@ class PoseLandmarkerTask extends AiVisionTask {
4677
4783
  var poseLandmarker = (input, config) => {
4678
4784
  return new PoseLandmarkerTask({}, config).run(input);
4679
4785
  };
4680
- Workflow28.prototype.poseLandmarker = CreateWorkflow28(PoseLandmarkerTask);
4786
+ Workflow29.prototype.poseLandmarker = CreateWorkflow29(PoseLandmarkerTask);
4681
4787
 
4682
4788
  // src/task/QueryExpanderTask.ts
4683
4789
  import {
4684
- CreateWorkflow as CreateWorkflow29,
4685
- Task as Task11,
4686
- Workflow as Workflow29
4790
+ CreateWorkflow as CreateWorkflow30,
4791
+ Task as Task12,
4792
+ Workflow as Workflow30
4687
4793
  } from "@workglow/task-graph";
4688
4794
  var QueryExpansionMethod = {
4689
4795
  MULTI_QUERY: "multi-query",
@@ -4752,7 +4858,7 @@ var outputSchema10 = {
4752
4858
  additionalProperties: false
4753
4859
  };
4754
4860
 
4755
- class QueryExpanderTask extends Task11 {
4861
+ class QueryExpanderTask extends Task12 {
4756
4862
  static type = "QueryExpanderTask";
4757
4863
  static category = "RAG";
4758
4864
  static title = "Query Expander";
@@ -4894,17 +5000,17 @@ class QueryExpanderTask extends Task11 {
4894
5000
  var queryExpander = (input, config) => {
4895
5001
  return new QueryExpanderTask({}, config).run(input);
4896
5002
  };
4897
- Workflow29.prototype.queryExpander = CreateWorkflow29(QueryExpanderTask);
5003
+ Workflow30.prototype.queryExpander = CreateWorkflow30(QueryExpanderTask);
4898
5004
 
4899
5005
  // src/task/RerankerTask.ts
4900
5006
  import {
4901
- CreateWorkflow as CreateWorkflow31,
4902
- Task as Task12,
4903
- Workflow as Workflow31
5007
+ CreateWorkflow as CreateWorkflow32,
5008
+ Task as Task13,
5009
+ Workflow as Workflow32
4904
5010
  } from "@workglow/task-graph";
4905
5011
 
4906
5012
  // src/task/TextClassificationTask.ts
4907
- import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow30 } from "@workglow/task-graph";
5013
+ import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow31 } from "@workglow/task-graph";
4908
5014
  var modelSchema22 = TypeModel("model:TextClassificationTask");
4909
5015
  var TextClassificationInputSchema = {
4910
5016
  type: "object",
@@ -4982,7 +5088,7 @@ class TextClassificationTask extends AiTask {
4982
5088
  var textClassification = (input, config) => {
4983
5089
  return new TextClassificationTask({}, config).run(input);
4984
5090
  };
4985
- Workflow30.prototype.textClassification = CreateWorkflow30(TextClassificationTask);
5091
+ Workflow31.prototype.textClassification = CreateWorkflow31(TextClassificationTask);
4986
5092
 
4987
5093
  // src/task/RerankerTask.ts
4988
5094
  var inputSchema11 = {
@@ -5077,7 +5183,7 @@ var outputSchema11 = {
5077
5183
  additionalProperties: false
5078
5184
  };
5079
5185
 
5080
- class RerankerTask extends Task12 {
5186
+ class RerankerTask extends Task13 {
5081
5187
  static type = "RerankerTask";
5082
5188
  static category = "RAG";
5083
5189
  static title = "Reranker";
@@ -5206,14 +5312,14 @@ class RerankerTask extends Task12 {
5206
5312
  var reranker = (input, config) => {
5207
5313
  return new RerankerTask({}, config).run(input);
5208
5314
  };
5209
- Workflow31.prototype.reranker = CreateWorkflow31(RerankerTask);
5315
+ Workflow32.prototype.reranker = CreateWorkflow32(RerankerTask);
5210
5316
 
5211
5317
  // src/task/StructuralParserTask.ts
5212
5318
  import { StructuralParser } from "@workglow/knowledge-base";
5213
5319
  import {
5214
- CreateWorkflow as CreateWorkflow32,
5215
- Task as Task13,
5216
- Workflow as Workflow32
5320
+ CreateWorkflow as CreateWorkflow33,
5321
+ Task as Task14,
5322
+ Workflow as Workflow33
5217
5323
  } from "@workglow/task-graph";
5218
5324
  import { uuid4 as uuid42 } from "@workglow/util";
5219
5325
  var inputSchema12 = {
@@ -5272,7 +5378,7 @@ var outputSchema12 = {
5272
5378
  additionalProperties: false
5273
5379
  };
5274
5380
 
5275
- class StructuralParserTask extends Task13 {
5381
+ class StructuralParserTask extends Task14 {
5276
5382
  static type = "StructuralParserTask";
5277
5383
  static category = "Document";
5278
5384
  static title = "Structural Parser";
@@ -5315,10 +5421,10 @@ class StructuralParserTask extends Task13 {
5315
5421
  var structuralParser = (input, config) => {
5316
5422
  return new StructuralParserTask({}, config).run(input);
5317
5423
  };
5318
- Workflow32.prototype.structuralParser = CreateWorkflow32(StructuralParserTask);
5424
+ Workflow33.prototype.structuralParser = CreateWorkflow33(StructuralParserTask);
5319
5425
 
5320
5426
  // src/task/StructuredGenerationTask.ts
5321
- import { CreateWorkflow as CreateWorkflow33, Workflow as Workflow33 } from "@workglow/task-graph";
5427
+ import { CreateWorkflow as CreateWorkflow34, Workflow as Workflow34 } from "@workglow/task-graph";
5322
5428
  var modelSchema23 = TypeModel("model:StructuredGenerationTask");
5323
5429
  var StructuredGenerationInputSchema = {
5324
5430
  type: "object",
@@ -5386,13 +5492,13 @@ class StructuredGenerationTask extends StreamingAiTask {
5386
5492
  var structuredGeneration = (input, config) => {
5387
5493
  return new StructuredGenerationTask({}, config).run(input);
5388
5494
  };
5389
- Workflow33.prototype.structuredGeneration = CreateWorkflow33(StructuredGenerationTask);
5495
+ Workflow34.prototype.structuredGeneration = CreateWorkflow34(StructuredGenerationTask);
5390
5496
 
5391
5497
  // src/task/TextChunkerTask.ts
5392
5498
  import {
5393
- CreateWorkflow as CreateWorkflow34,
5394
- Task as Task14,
5395
- Workflow as Workflow34
5499
+ CreateWorkflow as CreateWorkflow35,
5500
+ Task as Task15,
5501
+ Workflow as Workflow35
5396
5502
  } from "@workglow/task-graph";
5397
5503
  var ChunkingStrategy = {
5398
5504
  FIXED: "fixed",
@@ -5462,7 +5568,7 @@ var outputSchema13 = {
5462
5568
  additionalProperties: false
5463
5569
  };
5464
5570
 
5465
- class TextChunkerTask extends Task14 {
5571
+ class TextChunkerTask extends Task15 {
5466
5572
  static type = "TextChunkerTask";
5467
5573
  static category = "Document";
5468
5574
  static title = "Text Chunker";
@@ -5642,10 +5748,10 @@ class TextChunkerTask extends Task14 {
5642
5748
  var textChunker = (input, config) => {
5643
5749
  return new TextChunkerTask({}, config).run(input);
5644
5750
  };
5645
- Workflow34.prototype.textChunker = CreateWorkflow34(TextChunkerTask);
5751
+ Workflow35.prototype.textChunker = CreateWorkflow35(TextChunkerTask);
5646
5752
 
5647
5753
  // src/task/TextFillMaskTask.ts
5648
- import { CreateWorkflow as CreateWorkflow35, Workflow as Workflow35 } from "@workglow/task-graph";
5754
+ import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5649
5755
  var modelSchema24 = TypeModel("model:TextFillMaskTask");
5650
5756
  var TextFillMaskInputSchema = {
5651
5757
  type: "object",
@@ -5710,10 +5816,10 @@ class TextFillMaskTask extends AiTask {
5710
5816
  var textFillMask = (input, config) => {
5711
5817
  return new TextFillMaskTask({}, config).run(input);
5712
5818
  };
5713
- Workflow35.prototype.textFillMask = CreateWorkflow35(TextFillMaskTask);
5819
+ Workflow36.prototype.textFillMask = CreateWorkflow36(TextFillMaskTask);
5714
5820
 
5715
5821
  // src/task/TextGenerationTask.ts
5716
- import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5822
+ import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
5717
5823
  var generatedTextSchema2 = TypeSingleOrArray({
5718
5824
  type: "string",
5719
5825
  title: "Text",
@@ -5798,10 +5904,10 @@ class TextGenerationTask extends StreamingAiTask {
5798
5904
  var textGeneration = (input, config) => {
5799
5905
  return new TextGenerationTask({}, config).run(input);
5800
5906
  };
5801
- Workflow36.prototype.textGeneration = CreateWorkflow36(TextGenerationTask);
5907
+ Workflow37.prototype.textGeneration = CreateWorkflow37(TextGenerationTask);
5802
5908
 
5803
5909
  // src/task/TextLanguageDetectionTask.ts
5804
- import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
5910
+ import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
5805
5911
  var modelSchema26 = TypeModel("model:TextLanguageDetectionTask");
5806
5912
  var TextLanguageDetectionInputSchema = {
5807
5913
  type: "object",
@@ -5869,10 +5975,10 @@ class TextLanguageDetectionTask extends AiTask {
5869
5975
  var textLanguageDetection = (input, config) => {
5870
5976
  return new TextLanguageDetectionTask({}, config).run(input);
5871
5977
  };
5872
- Workflow37.prototype.textLanguageDetection = CreateWorkflow37(TextLanguageDetectionTask);
5978
+ Workflow38.prototype.textLanguageDetection = CreateWorkflow38(TextLanguageDetectionTask);
5873
5979
 
5874
5980
  // src/task/TextQuestionAnswerTask.ts
5875
- import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
5981
+ import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
5876
5982
  var contextSchema = TypeSingleOrArray({
5877
5983
  type: "string",
5878
5984
  title: "Context",
@@ -5924,10 +6030,10 @@ class TextQuestionAnswerTask extends StreamingAiTask {
5924
6030
  var textQuestionAnswer = (input, config) => {
5925
6031
  return new TextQuestionAnswerTask({}, config).run(input);
5926
6032
  };
5927
- Workflow38.prototype.textQuestionAnswer = CreateWorkflow38(TextQuestionAnswerTask);
6033
+ Workflow39.prototype.textQuestionAnswer = CreateWorkflow39(TextQuestionAnswerTask);
5928
6034
 
5929
6035
  // src/task/TextRewriterTask.ts
5930
- import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6036
+ import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
5931
6037
  var modelSchema28 = TypeModel("model:TextRewriterTask");
5932
6038
  var TextRewriterInputSchema = {
5933
6039
  type: "object",
@@ -5976,10 +6082,10 @@ class TextRewriterTask extends StreamingAiTask {
5976
6082
  var textRewriter = (input, config) => {
5977
6083
  return new TextRewriterTask({}, config).run(input);
5978
6084
  };
5979
- Workflow39.prototype.textRewriter = CreateWorkflow39(TextRewriterTask);
6085
+ Workflow40.prototype.textRewriter = CreateWorkflow40(TextRewriterTask);
5980
6086
 
5981
6087
  // src/task/TextTranslationTask.ts
5982
- import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6088
+ import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
5983
6089
  var modelSchema29 = TypeModel("model:TextTranslationTask");
5984
6090
  var translationTextSchema = TypeSingleOrArray({
5985
6091
  type: "string",
@@ -6042,13 +6148,13 @@ class TextTranslationTask extends StreamingAiTask {
6042
6148
  var textTranslation = (input, config) => {
6043
6149
  return new TextTranslationTask({}, config).run(input);
6044
6150
  };
6045
- Workflow40.prototype.textTranslation = CreateWorkflow40(TextTranslationTask);
6151
+ Workflow41.prototype.textTranslation = CreateWorkflow41(TextTranslationTask);
6046
6152
 
6047
6153
  // src/task/TopicSegmenterTask.ts
6048
6154
  import {
6049
- CreateWorkflow as CreateWorkflow41,
6050
- Task as Task15,
6051
- Workflow as Workflow41
6155
+ CreateWorkflow as CreateWorkflow42,
6156
+ Task as Task16,
6157
+ Workflow as Workflow42
6052
6158
  } from "@workglow/task-graph";
6053
6159
  var SegmentationMethod = {
6054
6160
  HEURISTIC: "heuristic",
@@ -6124,7 +6230,7 @@ var outputSchema14 = {
6124
6230
  additionalProperties: false
6125
6231
  };
6126
6232
 
6127
- class TopicSegmenterTask extends Task15 {
6233
+ class TopicSegmenterTask extends Task16 {
6128
6234
  static type = "TopicSegmenterTask";
6129
6235
  static category = "Document";
6130
6236
  static title = "Topic Segmenter";
@@ -6329,10 +6435,10 @@ class TopicSegmenterTask extends Task15 {
6329
6435
  var topicSegmenter = (input, config) => {
6330
6436
  return new TopicSegmenterTask({}, config).run(input);
6331
6437
  };
6332
- Workflow41.prototype.topicSegmenter = CreateWorkflow41(TopicSegmenterTask);
6438
+ Workflow42.prototype.topicSegmenter = CreateWorkflow42(TopicSegmenterTask);
6333
6439
 
6334
6440
  // src/task/UnloadModelTask.ts
6335
- import { CreateWorkflow as CreateWorkflow42, Workflow as Workflow42 } from "@workglow/task-graph";
6441
+ import { CreateWorkflow as CreateWorkflow43, Workflow as Workflow43 } from "@workglow/task-graph";
6336
6442
  var modelSchema30 = TypeModel("model");
6337
6443
  var UnloadModelInputSchema = {
6338
6444
  type: "object",
@@ -6353,7 +6459,7 @@ var UnloadModelOutputSchema = {
6353
6459
 
6354
6460
  class UnloadModelTask extends AiTask {
6355
6461
  static type = "UnloadModelTask";
6356
- static category = "Hidden";
6462
+ static category = "AI Model";
6357
6463
  static title = "Unload Model";
6358
6464
  static description = "Unloads and clears cached AI models from memory and storage";
6359
6465
  static inputSchema() {
@@ -6367,10 +6473,10 @@ class UnloadModelTask extends AiTask {
6367
6473
  var unloadModel = (input, config) => {
6368
6474
  return new UnloadModelTask({}, config).run(input);
6369
6475
  };
6370
- Workflow42.prototype.unloadModel = CreateWorkflow42(UnloadModelTask);
6476
+ Workflow43.prototype.unloadModel = CreateWorkflow43(UnloadModelTask);
6371
6477
 
6372
6478
  // src/task/VectorQuantizeTask.ts
6373
- import { CreateWorkflow as CreateWorkflow43, Task as Task16, Workflow as Workflow43 } from "@workglow/task-graph";
6479
+ import { CreateWorkflow as CreateWorkflow44, Task as Task17, Workflow as Workflow44 } from "@workglow/task-graph";
6374
6480
  import {
6375
6481
  normalizeNumberArray,
6376
6482
  TensorType,
@@ -6450,7 +6556,7 @@ var outputSchema15 = {
6450
6556
  additionalProperties: false
6451
6557
  };
6452
6558
 
6453
- class VectorQuantizeTask extends Task16 {
6559
+ class VectorQuantizeTask extends Task17 {
6454
6560
  static type = "VectorQuantizeTask";
6455
6561
  static category = "Vector";
6456
6562
  static title = "Quantize";
@@ -6550,10 +6656,10 @@ class VectorQuantizeTask extends Task16 {
6550
6656
  var vectorQuantize = (input, config) => {
6551
6657
  return new VectorQuantizeTask({}, config).run(input);
6552
6658
  };
6553
- Workflow43.prototype.vectorQuantize = CreateWorkflow43(VectorQuantizeTask);
6659
+ Workflow44.prototype.vectorQuantize = CreateWorkflow44(VectorQuantizeTask);
6554
6660
 
6555
6661
  // src/task/VectorSimilarityTask.ts
6556
- import { CreateWorkflow as CreateWorkflow44, GraphAsTask, Workflow as Workflow44 } from "@workglow/task-graph";
6662
+ import { CreateWorkflow as CreateWorkflow45, GraphAsTask, Workflow as Workflow45 } from "@workglow/task-graph";
6557
6663
  import {
6558
6664
  cosineSimilarity,
6559
6665
  hammingSimilarity,
@@ -6659,7 +6765,7 @@ class VectorSimilarityTask extends GraphAsTask {
6659
6765
  var similarity = (input, config) => {
6660
6766
  return new VectorSimilarityTask({}, config).run(input);
6661
6767
  };
6662
- Workflow44.prototype.similarity = CreateWorkflow44(VectorSimilarityTask);
6768
+ Workflow45.prototype.similarity = CreateWorkflow45(VectorSimilarityTask);
6663
6769
  // src/task/MessageConversion.ts
6664
6770
  function getInputMessages(input) {
6665
6771
  const messages = input.messages;
@@ -6882,6 +6988,7 @@ var registerAiTasks = () => {
6882
6988
  ImageSegmentationTask,
6883
6989
  ImageToTextTask,
6884
6990
  ModelInfoTask,
6991
+ ModelSearchTask,
6885
6992
  ObjectDetectionTask,
6886
6993
  PoseLandmarkerTask,
6887
6994
  QueryExpanderTask,
@@ -6941,6 +7048,7 @@ export {
6941
7048
  queryExpander,
6942
7049
  poseLandmarker,
6943
7050
  objectDetection,
7051
+ modelSearch,
6944
7052
  modelInfo,
6945
7053
  isAllowedToolName,
6946
7054
  imageToText,
@@ -7033,6 +7141,7 @@ export {
7033
7141
  SimilarityFn,
7034
7142
  SegmentationMethod,
7035
7143
  RerankerTask,
7144
+ QueuedAiProvider,
7036
7145
  QueryExpansionMethod,
7037
7146
  QueryExpanderTask,
7038
7147
  PoseLandmarkerTask,
@@ -7041,6 +7150,7 @@ export {
7041
7150
  ObjectDetectionTask,
7042
7151
  ObjectDetectionOutputSchema,
7043
7152
  ObjectDetectionInputSchema,
7153
+ ModelSearchTask,
7044
7154
  ModelRepository,
7045
7155
  ModelRecordSchema,
7046
7156
  ModelPrimaryKeyNames,
@@ -7099,4 +7209,4 @@ export {
7099
7209
  AgentInputSchema
7100
7210
  };
7101
7211
 
7102
- //# debugId=470E906FF8218D7164756E2164756E21
7212
+ //# debugId=01FBA636739047B364756E2164756E21