@workglow/ai 0.2.6 → 0.2.7

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 (90) hide show
  1. package/dist/browser.js +211 -83
  2. package/dist/browser.js.map +9 -8
  3. package/dist/bun.js +211 -83
  4. package/dist/bun.js.map +9 -8
  5. package/dist/model/ModelRepository.d.ts +2 -0
  6. package/dist/model/ModelRepository.d.ts.map +1 -1
  7. package/dist/model/ModelSchema.d.ts +16 -0
  8. package/dist/model/ModelSchema.d.ts.map +1 -1
  9. package/dist/node.js +211 -83
  10. package/dist/node.js.map +9 -8
  11. package/dist/provider/AiProvider.d.ts +6 -0
  12. package/dist/provider/AiProvider.d.ts.map +1 -1
  13. package/dist/provider/AiProviderRegistry.d.ts +2 -0
  14. package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
  15. package/dist/task/AgentTask.d.ts +16 -0
  16. package/dist/task/AgentTask.d.ts.map +1 -1
  17. package/dist/task/BackgroundRemovalTask.d.ts +8 -0
  18. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  19. package/dist/task/ChunkRetrievalTask.d.ts +8 -0
  20. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
  21. package/dist/task/ContextBuilderTask.d.ts +8 -0
  22. package/dist/task/ContextBuilderTask.d.ts.map +1 -1
  23. package/dist/task/CountTokensTask.d.ts +8 -0
  24. package/dist/task/CountTokensTask.d.ts.map +1 -1
  25. package/dist/task/DocumentEnricherTask.d.ts +16 -0
  26. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  27. package/dist/task/DownloadModelTask.d.ts +18 -0
  28. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  29. package/dist/task/FaceDetectorTask.d.ts +8 -0
  30. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  31. package/dist/task/FaceLandmarkerTask.d.ts +8 -0
  32. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  33. package/dist/task/GestureRecognizerTask.d.ts +8 -0
  34. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  35. package/dist/task/HandLandmarkerTask.d.ts +8 -0
  36. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  37. package/dist/task/HierarchicalChunkerTask.d.ts +8 -0
  38. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -1
  39. package/dist/task/ImageClassificationTask.d.ts +8 -0
  40. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  41. package/dist/task/ImageEmbeddingTask.d.ts +8 -0
  42. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  43. package/dist/task/ImageSegmentationTask.d.ts +8 -0
  44. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  45. package/dist/task/ImageToTextTask.d.ts +8 -0
  46. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  47. package/dist/task/KbToDocumentsTask.d.ts +98 -0
  48. package/dist/task/KbToDocumentsTask.d.ts.map +1 -0
  49. package/dist/task/ModelInfoTask.d.ts +29 -1
  50. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  51. package/dist/task/ObjectDetectionTask.d.ts +8 -0
  52. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  53. package/dist/task/PoseLandmarkerTask.d.ts +8 -0
  54. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  55. package/dist/task/RerankerTask.d.ts +8 -0
  56. package/dist/task/RerankerTask.d.ts.map +1 -1
  57. package/dist/task/StructuredGenerationTask.d.ts +8 -0
  58. package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
  59. package/dist/task/TextClassificationTask.d.ts +8 -0
  60. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  61. package/dist/task/TextEmbeddingTask.d.ts +8 -0
  62. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  63. package/dist/task/TextFillMaskTask.d.ts +8 -0
  64. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  65. package/dist/task/TextGenerationTask.d.ts +8 -0
  66. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  67. package/dist/task/TextLanguageDetectionTask.d.ts +8 -0
  68. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  69. package/dist/task/TextNamedEntityRecognitionTask.d.ts +8 -0
  70. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  71. package/dist/task/TextQuestionAnswerTask.d.ts +8 -0
  72. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  73. package/dist/task/TextRewriterTask.d.ts +8 -0
  74. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  75. package/dist/task/TextSummaryTask.d.ts +8 -0
  76. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  77. package/dist/task/TextTranslationTask.d.ts +8 -0
  78. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  79. package/dist/task/ToolCallingTask.d.ts +8 -0
  80. package/dist/task/ToolCallingTask.d.ts.map +1 -1
  81. package/dist/task/UnloadModelTask.d.ts +18 -0
  82. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  83. package/dist/task/base/AiTask.d.ts.map +1 -1
  84. package/dist/task/base/AiTaskSchemas.d.ts +16 -0
  85. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  86. package/dist/task/index.d.ts +3 -1
  87. package/dist/task/index.d.ts.map +1 -1
  88. package/dist/worker.js +19 -3
  89. package/dist/worker.js.map +4 -4
  90. package/package.json +11 -11
package/dist/bun.js CHANGED
@@ -455,7 +455,15 @@ var ModelConfigSchema = {
455
455
  provider_config: {
456
456
  type: "object",
457
457
  properties: {
458
- credential_key: { type: "string", format: "credential", "x-ui-hidden": true }
458
+ credential_key: { type: "string", format: "credential", "x-ui-hidden": true },
459
+ native_dimensions: {
460
+ type: "integer",
461
+ description: "Native output vector dimensions for embedding models"
462
+ },
463
+ mrl: {
464
+ type: "boolean",
465
+ description: "Whether the model supports Matryoshka Representation Learning"
466
+ }
459
467
  },
460
468
  additionalProperties: true,
461
469
  default: {}
@@ -649,6 +657,7 @@ registerInputCompactor("model", async (value, _format, registry) => {
649
657
 
650
658
  // src/provider/AiProvider.ts
651
659
  import { globalServiceRegistry as globalServiceRegistry3, WORKER_MANAGER as WORKER_MANAGER2 } from "@workglow/util/worker";
660
+ var DEFAULT_AI_PROVIDER_WORKER_IDLE_TIMEOUT_MS = 15 * 60 * 1000;
652
661
  function resolveAiProviderGpuQueueConcurrency(concurrency) {
653
662
  if (concurrency === undefined) {
654
663
  return 1;
@@ -696,7 +705,13 @@ class AiProvider {
696
705
  const registry = getAiProviderRegistry();
697
706
  if (!isInline && options.worker) {
698
707
  const workerManager = globalServiceRegistry3.get(WORKER_MANAGER2);
699
- workerManager.registerWorker(this.name, options.worker);
708
+ if (typeof options.worker === "function") {
709
+ workerManager.registerWorker(this.name, options.worker, {
710
+ idleTimeoutMs: options.workerIdleTimeoutMs ?? DEFAULT_AI_PROVIDER_WORKER_IDLE_TIMEOUT_MS
711
+ });
712
+ } else {
713
+ workerManager.registerWorker(this.name, options.worker);
714
+ }
700
715
  for (const taskType of this.taskTypes) {
701
716
  registry.registerAsWorkerRunFn(this.name, taskType);
702
717
  registry.registerAsWorkerStreamFn(this.name, taskType);
@@ -1050,6 +1065,18 @@ class AiTask extends Task {
1050
1065
  const jobInput = await this.getJobInput(input);
1051
1066
  const strategy = getAiProviderRegistry().getStrategy(model);
1052
1067
  const output = await strategy.execute(jobInput, executeContext, this.runConfig.runnerId);
1068
+ if (executeContext.resourceScope) {
1069
+ const registry = getAiProviderRegistry();
1070
+ const provider = registry.getProvider(model.provider);
1071
+ const unloadFn = provider?.getRunFn("UnloadModelTask");
1072
+ if (unloadFn) {
1073
+ const modelPath = model.provider_config?.model_path ?? model.model;
1074
+ const resourceKey = `ai:${model.provider}:${modelPath}`;
1075
+ executeContext.resourceScope.register(resourceKey, async () => {
1076
+ await unloadFn({ model }, model, () => {}, AbortSignal.timeout(30000));
1077
+ });
1078
+ }
1079
+ }
1053
1080
  return output;
1054
1081
  }
1055
1082
  async getJobInput(input) {
@@ -4597,8 +4624,97 @@ var hierarchyJoin = (input, config) => {
4597
4624
  };
4598
4625
  Workflow22.prototype.hierarchyJoin = CreateWorkflow22(HierarchyJoinTask);
4599
4626
 
4627
+ // src/task/KbToDocumentsTask.ts
4628
+ import { TypeKnowledgeBase as TypeKnowledgeBase7 } from "@workglow/knowledge-base";
4629
+ import { CreateWorkflow as CreateWorkflow23, Task as Task13, Workflow as Workflow23 } from "@workglow/task-graph";
4630
+ var inputSchema11 = {
4631
+ type: "object",
4632
+ properties: {
4633
+ knowledgeBase: TypeKnowledgeBase7({
4634
+ title: "Knowledge Base",
4635
+ description: "The knowledge base instance to list documents from"
4636
+ }),
4637
+ onlyStale: {
4638
+ type: "boolean",
4639
+ title: "Only Stale",
4640
+ description: "If true, only return documents that have no chunks (need embedding)",
4641
+ default: true
4642
+ }
4643
+ },
4644
+ required: ["knowledgeBase"],
4645
+ additionalProperties: false
4646
+ };
4647
+ var outputSchema11 = {
4648
+ type: "object",
4649
+ properties: {
4650
+ doc_id: {
4651
+ type: "array",
4652
+ items: { type: "string" },
4653
+ title: "Document IDs",
4654
+ description: "Array of document IDs"
4655
+ },
4656
+ documentTree: {
4657
+ type: "array",
4658
+ items: { type: "object", additionalProperties: true },
4659
+ title: "Document Trees",
4660
+ description: "Array of document root nodes (parallel to doc_id)"
4661
+ },
4662
+ title: {
4663
+ type: "array",
4664
+ items: { type: "string" },
4665
+ title: "Titles",
4666
+ description: "Array of document titles (parallel to doc_id)"
4667
+ }
4668
+ },
4669
+ required: ["doc_id", "documentTree", "title"],
4670
+ additionalProperties: false
4671
+ };
4672
+
4673
+ class KbToDocumentsTask extends Task13 {
4674
+ static type = "KbToDocumentsTask";
4675
+ static category = "Vector Store";
4676
+ static title = "Knowledge Base to Documents";
4677
+ static description = "List documents from a knowledge base, optionally filtering to only those that need embedding";
4678
+ static cacheable = false;
4679
+ static inputSchema() {
4680
+ return inputSchema11;
4681
+ }
4682
+ static outputSchema() {
4683
+ return outputSchema11;
4684
+ }
4685
+ async execute(input, context) {
4686
+ const { knowledgeBase, onlyStale = true } = input;
4687
+ const kb = knowledgeBase;
4688
+ await context.updateProgress(1, "Listing documents");
4689
+ const allDocIds = await kb.listDocuments();
4690
+ const doc_id = [];
4691
+ const documentTree = [];
4692
+ const title = [];
4693
+ for (const id of allDocIds) {
4694
+ if (onlyStale) {
4695
+ const chunks = await kb.getChunksForDocument(id);
4696
+ if (chunks.length > 0) {
4697
+ continue;
4698
+ }
4699
+ }
4700
+ const doc = await kb.getDocument(id);
4701
+ if (!doc) {
4702
+ continue;
4703
+ }
4704
+ doc_id.push(id);
4705
+ documentTree.push(doc.root);
4706
+ title.push(doc.metadata.title);
4707
+ }
4708
+ return { doc_id, documentTree, title };
4709
+ }
4710
+ }
4711
+ var kbToDocuments = (input, config) => {
4712
+ return new KbToDocumentsTask(config).run(input);
4713
+ };
4714
+ Workflow23.prototype.kbToDocuments = CreateWorkflow23(KbToDocumentsTask);
4715
+
4600
4716
  // src/task/ImageClassificationTask.ts
4601
- import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow23 } from "@workglow/task-graph";
4717
+ import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow24 } from "@workglow/task-graph";
4602
4718
  var modelSchema15 = TypeModel("model:ImageClassificationTask");
4603
4719
  var ImageClassificationInputSchema = {
4604
4720
  type: "object",
@@ -4658,10 +4774,10 @@ class ImageClassificationTask extends AiVisionTask {
4658
4774
  var imageClassification = (input, config) => {
4659
4775
  return new ImageClassificationTask(config).run(input);
4660
4776
  };
4661
- Workflow23.prototype.imageClassification = CreateWorkflow23(ImageClassificationTask);
4777
+ Workflow24.prototype.imageClassification = CreateWorkflow24(ImageClassificationTask);
4662
4778
 
4663
4779
  // src/task/ImageEmbeddingTask.ts
4664
- import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow24 } from "@workglow/task-graph";
4780
+ import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow25 } from "@workglow/task-graph";
4665
4781
  import {
4666
4782
  TypedArraySchema as TypedArraySchema7
4667
4783
  } from "@workglow/util/schema";
@@ -4702,10 +4818,10 @@ class ImageEmbeddingTask extends AiVisionTask {
4702
4818
  var imageEmbedding = (input, config) => {
4703
4819
  return new ImageEmbeddingTask(config).run(input);
4704
4820
  };
4705
- Workflow24.prototype.imageEmbedding = CreateWorkflow24(ImageEmbeddingTask);
4821
+ Workflow25.prototype.imageEmbedding = CreateWorkflow25(ImageEmbeddingTask);
4706
4822
 
4707
4823
  // src/task/ImageSegmentationTask.ts
4708
- import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow25 } from "@workglow/task-graph";
4824
+ import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4709
4825
  var modelSchema17 = TypeModel("model:ImageSegmentationTask");
4710
4826
  var ImageSegmentationInputSchema = {
4711
4827
  type: "object",
@@ -4790,10 +4906,10 @@ class ImageSegmentationTask extends AiVisionTask {
4790
4906
  var imageSegmentation = (input, config) => {
4791
4907
  return new ImageSegmentationTask(config).run(input);
4792
4908
  };
4793
- Workflow25.prototype.imageSegmentation = CreateWorkflow25(ImageSegmentationTask);
4909
+ Workflow26.prototype.imageSegmentation = CreateWorkflow26(ImageSegmentationTask);
4794
4910
 
4795
4911
  // src/task/ImageToTextTask.ts
4796
- import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4912
+ import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow27 } from "@workglow/task-graph";
4797
4913
  var modelSchema18 = TypeModel("model:ImageToTextTask");
4798
4914
  var generatedTextSchema = {
4799
4915
  type: "string",
@@ -4845,10 +4961,10 @@ class ImageToTextTask extends AiVisionTask {
4845
4961
  var imageToText = (input, config) => {
4846
4962
  return new ImageToTextTask(config).run(input);
4847
4963
  };
4848
- Workflow26.prototype.imageToText = CreateWorkflow26(ImageToTextTask);
4964
+ Workflow27.prototype.imageToText = CreateWorkflow27(ImageToTextTask);
4849
4965
 
4850
4966
  // src/task/ModelInfoTask.ts
4851
- import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow27 } from "@workglow/task-graph";
4967
+ import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4852
4968
  var modelSchema19 = TypeModel("model");
4853
4969
  var ModelInfoInputSchema = {
4854
4970
  type: "object",
@@ -4856,7 +4972,7 @@ var ModelInfoInputSchema = {
4856
4972
  model: modelSchema19,
4857
4973
  detail: {
4858
4974
  type: "string",
4859
- enum: ["cached_status", "files", "files_with_metadata"],
4975
+ enum: ["cached_status", "files", "files_with_metadata", "dimensions"],
4860
4976
  default: "files_with_metadata"
4861
4977
  }
4862
4978
  },
@@ -4878,6 +4994,14 @@ var ModelInfoOutputSchema = {
4878
4994
  type: "array",
4879
4995
  items: { type: "string" },
4880
4996
  description: "Available quantization variants (e.g. fp32, fp16, q8). Only present for models with quantization options."
4997
+ },
4998
+ native_dimensions: {
4999
+ type: "integer",
5000
+ description: "Native output vector dimensions. Only present when detail is 'dimensions' and the provider can determine them."
5001
+ },
5002
+ mrl: {
5003
+ type: "boolean",
5004
+ description: "Whether the model supports Matryoshka Representation Learning. Only present when detail is 'dimensions'."
4881
5005
  }
4882
5006
  },
4883
5007
  required: [
@@ -4916,10 +5040,10 @@ class ModelInfoTask extends AiTask {
4916
5040
  var modelInfo = (input, config) => {
4917
5041
  return new ModelInfoTask(config).run(input);
4918
5042
  };
4919
- Workflow27.prototype.modelInfo = CreateWorkflow27(ModelInfoTask);
5043
+ Workflow28.prototype.modelInfo = CreateWorkflow28(ModelInfoTask);
4920
5044
 
4921
5045
  // src/task/ModelSearchTask.ts
4922
- import { CreateWorkflow as CreateWorkflow28, Task as Task13, Workflow as Workflow28 } from "@workglow/task-graph";
5046
+ import { CreateWorkflow as CreateWorkflow29, Task as Task14, Workflow as Workflow29 } from "@workglow/task-graph";
4923
5047
  var ModelSearchInputSchema = {
4924
5048
  type: "object",
4925
5049
  properties: {
@@ -4984,7 +5108,7 @@ var ModelSearchOutputSchema = {
4984
5108
  additionalProperties: false
4985
5109
  };
4986
5110
 
4987
- class ModelSearchTask extends Task13 {
5111
+ class ModelSearchTask extends Task14 {
4988
5112
  static type = "ModelSearchTask";
4989
5113
  static category = "AI Model";
4990
5114
  static title = "Model Search";
@@ -5010,10 +5134,10 @@ class ModelSearchTask extends Task13 {
5010
5134
  var modelSearch = (input, config) => {
5011
5135
  return new ModelSearchTask(config).run(input);
5012
5136
  };
5013
- Workflow28.prototype.modelSearch = CreateWorkflow28(ModelSearchTask);
5137
+ Workflow29.prototype.modelSearch = CreateWorkflow29(ModelSearchTask);
5014
5138
 
5015
5139
  // src/task/ObjectDetectionTask.ts
5016
- import { CreateWorkflow as CreateWorkflow29, Workflow as Workflow29 } from "@workglow/task-graph";
5140
+ import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow30 } from "@workglow/task-graph";
5017
5141
  var modelSchema20 = TypeModel("model:ObjectDetectionTask");
5018
5142
  var detectionSchema = {
5019
5143
  type: "object",
@@ -5093,10 +5217,10 @@ class ObjectDetectionTask extends AiVisionTask {
5093
5217
  var objectDetection = (input, config) => {
5094
5218
  return new ObjectDetectionTask(config).run(input);
5095
5219
  };
5096
- Workflow29.prototype.objectDetection = CreateWorkflow29(ObjectDetectionTask);
5220
+ Workflow30.prototype.objectDetection = CreateWorkflow30(ObjectDetectionTask);
5097
5221
 
5098
5222
  // src/task/PoseLandmarkerTask.ts
5099
- import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow30 } from "@workglow/task-graph";
5223
+ import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow31 } from "@workglow/task-graph";
5100
5224
  var modelSchema21 = TypeModel("model:PoseLandmarkerTask");
5101
5225
  var TypePoseLandmark = {
5102
5226
  type: "object",
@@ -5255,17 +5379,17 @@ class PoseLandmarkerTask extends AiVisionTask {
5255
5379
  var poseLandmarker = (input, config) => {
5256
5380
  return new PoseLandmarkerTask(config).run(input);
5257
5381
  };
5258
- Workflow30.prototype.poseLandmarker = CreateWorkflow30(PoseLandmarkerTask);
5382
+ Workflow31.prototype.poseLandmarker = CreateWorkflow31(PoseLandmarkerTask);
5259
5383
 
5260
5384
  // src/task/QueryExpanderTask.ts
5261
- import { CreateWorkflow as CreateWorkflow31, Task as Task14, Workflow as Workflow31 } from "@workglow/task-graph";
5385
+ import { CreateWorkflow as CreateWorkflow32, Task as Task15, Workflow as Workflow32 } from "@workglow/task-graph";
5262
5386
  var QueryExpansionMethod = {
5263
5387
  MULTI_QUERY: "multi-query",
5264
5388
  HYDE: "hyde",
5265
5389
  SYNONYMS: "synonyms",
5266
5390
  PARAPHRASE: "paraphrase"
5267
5391
  };
5268
- var inputSchema11 = {
5392
+ var inputSchema12 = {
5269
5393
  type: "object",
5270
5394
  properties: {
5271
5395
  query: {
@@ -5297,7 +5421,7 @@ var inputSchema11 = {
5297
5421
  required: ["query"],
5298
5422
  additionalProperties: false
5299
5423
  };
5300
- var outputSchema11 = {
5424
+ var outputSchema12 = {
5301
5425
  type: "object",
5302
5426
  properties: {
5303
5427
  query: {
@@ -5326,17 +5450,17 @@ var outputSchema11 = {
5326
5450
  additionalProperties: false
5327
5451
  };
5328
5452
 
5329
- class QueryExpanderTask extends Task14 {
5453
+ class QueryExpanderTask extends Task15 {
5330
5454
  static type = "QueryExpanderTask";
5331
5455
  static category = "RAG";
5332
5456
  static title = "Query Expander";
5333
5457
  static description = "Expand queries to improve retrieval coverage";
5334
5458
  static cacheable = true;
5335
5459
  static inputSchema() {
5336
- return inputSchema11;
5460
+ return inputSchema12;
5337
5461
  }
5338
5462
  static outputSchema() {
5339
- return outputSchema11;
5463
+ return outputSchema12;
5340
5464
  }
5341
5465
  async execute(input, context) {
5342
5466
  const { query, method = QueryExpansionMethod.MULTI_QUERY, numVariations = 3 } = input;
@@ -5468,13 +5592,13 @@ class QueryExpanderTask extends Task14 {
5468
5592
  var queryExpander = (input, config) => {
5469
5593
  return new QueryExpanderTask(config).run(input);
5470
5594
  };
5471
- Workflow31.prototype.queryExpander = CreateWorkflow31(QueryExpanderTask);
5595
+ Workflow32.prototype.queryExpander = CreateWorkflow32(QueryExpanderTask);
5472
5596
 
5473
5597
  // src/task/RerankerTask.ts
5474
- import { CreateWorkflow as CreateWorkflow33, Task as Task15, Workflow as Workflow33 } from "@workglow/task-graph";
5598
+ import { CreateWorkflow as CreateWorkflow34, Task as Task16, Workflow as Workflow34 } from "@workglow/task-graph";
5475
5599
 
5476
5600
  // src/task/TextClassificationTask.ts
5477
- import { CreateWorkflow as CreateWorkflow32, Workflow as Workflow32 } from "@workglow/task-graph";
5601
+ import { CreateWorkflow as CreateWorkflow33, Workflow as Workflow33 } from "@workglow/task-graph";
5478
5602
  var modelSchema22 = TypeModel("model:TextClassificationTask");
5479
5603
  var TextClassificationInputSchema = {
5480
5604
  type: "object",
@@ -5552,10 +5676,10 @@ class TextClassificationTask extends AiTask {
5552
5676
  var textClassification = (input, config) => {
5553
5677
  return new TextClassificationTask(config).run(input);
5554
5678
  };
5555
- Workflow32.prototype.textClassification = CreateWorkflow32(TextClassificationTask);
5679
+ Workflow33.prototype.textClassification = CreateWorkflow33(TextClassificationTask);
5556
5680
 
5557
5681
  // src/task/RerankerTask.ts
5558
- var inputSchema12 = {
5682
+ var inputSchema13 = {
5559
5683
  type: "object",
5560
5684
  properties: {
5561
5685
  query: {
@@ -5606,7 +5730,7 @@ var inputSchema12 = {
5606
5730
  required: ["query", "chunks"],
5607
5731
  additionalProperties: false
5608
5732
  };
5609
- var outputSchema12 = {
5733
+ var outputSchema13 = {
5610
5734
  type: "object",
5611
5735
  properties: {
5612
5736
  chunks: {
@@ -5647,17 +5771,17 @@ var outputSchema12 = {
5647
5771
  additionalProperties: false
5648
5772
  };
5649
5773
 
5650
- class RerankerTask extends Task15 {
5774
+ class RerankerTask extends Task16 {
5651
5775
  static type = "RerankerTask";
5652
5776
  static category = "RAG";
5653
5777
  static title = "Reranker";
5654
5778
  static description = "Rerank retrieved chunks to improve relevance";
5655
5779
  static cacheable = true;
5656
5780
  static inputSchema() {
5657
- return inputSchema12;
5781
+ return inputSchema13;
5658
5782
  }
5659
5783
  static outputSchema() {
5660
- return outputSchema12;
5784
+ return outputSchema13;
5661
5785
  }
5662
5786
  async execute(input, context) {
5663
5787
  const { query, chunks, scores = [], metadata = [], topK, method = "simple", model } = input;
@@ -5775,13 +5899,13 @@ class RerankerTask extends Task15 {
5775
5899
  var reranker = (input, config) => {
5776
5900
  return new RerankerTask(config).run(input);
5777
5901
  };
5778
- Workflow33.prototype.reranker = CreateWorkflow33(RerankerTask);
5902
+ Workflow34.prototype.reranker = CreateWorkflow34(RerankerTask);
5779
5903
 
5780
5904
  // src/task/StructuralParserTask.ts
5781
5905
  import { StructuralParser } from "@workglow/knowledge-base";
5782
- import { CreateWorkflow as CreateWorkflow34, Task as Task16, Workflow as Workflow34 } from "@workglow/task-graph";
5906
+ import { CreateWorkflow as CreateWorkflow35, Task as Task17, Workflow as Workflow35 } from "@workglow/task-graph";
5783
5907
  import { uuid4 as uuid42 } from "@workglow/util";
5784
- var inputSchema13 = {
5908
+ var inputSchema14 = {
5785
5909
  type: "object",
5786
5910
  properties: {
5787
5911
  text: {
@@ -5815,7 +5939,7 @@ var inputSchema13 = {
5815
5939
  required: ["text", "title"],
5816
5940
  additionalProperties: false
5817
5941
  };
5818
- var outputSchema13 = {
5942
+ var outputSchema14 = {
5819
5943
  type: "object",
5820
5944
  properties: {
5821
5945
  doc_id: {
@@ -5839,17 +5963,17 @@ var outputSchema13 = {
5839
5963
  additionalProperties: false
5840
5964
  };
5841
5965
 
5842
- class StructuralParserTask extends Task16 {
5966
+ class StructuralParserTask extends Task17 {
5843
5967
  static type = "StructuralParserTask";
5844
5968
  static category = "Document";
5845
5969
  static title = "Structural Parser";
5846
5970
  static description = "Parse documents into hierarchical tree structure";
5847
5971
  static cacheable = true;
5848
5972
  static inputSchema() {
5849
- return inputSchema13;
5973
+ return inputSchema14;
5850
5974
  }
5851
5975
  static outputSchema() {
5852
- return outputSchema13;
5976
+ return outputSchema14;
5853
5977
  }
5854
5978
  async execute(input, context) {
5855
5979
  const { text, title, format = "auto", sourceUri, doc_id: providedDocId } = input;
@@ -5882,10 +6006,10 @@ class StructuralParserTask extends Task16 {
5882
6006
  var structuralParser = (input, config) => {
5883
6007
  return new StructuralParserTask(config).run(input);
5884
6008
  };
5885
- Workflow34.prototype.structuralParser = CreateWorkflow34(StructuralParserTask);
6009
+ Workflow35.prototype.structuralParser = CreateWorkflow35(StructuralParserTask);
5886
6010
 
5887
6011
  // src/task/StructuredGenerationTask.ts
5888
- import { CreateWorkflow as CreateWorkflow35, Workflow as Workflow35 } from "@workglow/task-graph";
6012
+ import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5889
6013
  var modelSchema23 = TypeModel("model:StructuredGenerationTask");
5890
6014
  var StructuredGenerationInputSchema = {
5891
6015
  type: "object",
@@ -5953,17 +6077,17 @@ class StructuredGenerationTask extends StreamingAiTask {
5953
6077
  var structuredGeneration = (input, config) => {
5954
6078
  return new StructuredGenerationTask(config).run(input);
5955
6079
  };
5956
- Workflow35.prototype.structuredGeneration = CreateWorkflow35(StructuredGenerationTask);
6080
+ Workflow36.prototype.structuredGeneration = CreateWorkflow36(StructuredGenerationTask);
5957
6081
 
5958
6082
  // src/task/TextChunkerTask.ts
5959
- import { CreateWorkflow as CreateWorkflow36, Task as Task17, Workflow as Workflow36 } from "@workglow/task-graph";
6083
+ import { CreateWorkflow as CreateWorkflow37, Task as Task18, Workflow as Workflow37 } from "@workglow/task-graph";
5960
6084
  var ChunkingStrategy = {
5961
6085
  FIXED: "fixed",
5962
6086
  SENTENCE: "sentence",
5963
6087
  PARAGRAPH: "paragraph",
5964
6088
  SEMANTIC: "semantic"
5965
6089
  };
5966
- var inputSchema14 = {
6090
+ var inputSchema15 = {
5967
6091
  type: "object",
5968
6092
  properties: {
5969
6093
  text: {
@@ -5996,7 +6120,7 @@ var inputSchema14 = {
5996
6120
  required: ["text"],
5997
6121
  additionalProperties: false
5998
6122
  };
5999
- var outputSchema14 = {
6123
+ var outputSchema15 = {
6000
6124
  type: "object",
6001
6125
  properties: {
6002
6126
  chunks: {
@@ -6025,17 +6149,17 @@ var outputSchema14 = {
6025
6149
  additionalProperties: false
6026
6150
  };
6027
6151
 
6028
- class TextChunkerTask extends Task17 {
6152
+ class TextChunkerTask extends Task18 {
6029
6153
  static type = "TextChunkerTask";
6030
6154
  static category = "Document";
6031
6155
  static title = "Text Chunker";
6032
6156
  static description = "Splits text into chunks using various strategies (fixed, sentence, paragraph)";
6033
6157
  static cacheable = true;
6034
6158
  static inputSchema() {
6035
- return inputSchema14;
6159
+ return inputSchema15;
6036
6160
  }
6037
6161
  static outputSchema() {
6038
- return outputSchema14;
6162
+ return outputSchema15;
6039
6163
  }
6040
6164
  async execute(input, context) {
6041
6165
  const { text, chunkSize = 512, chunkOverlap = 50, strategy = ChunkingStrategy.FIXED } = input;
@@ -6205,10 +6329,10 @@ class TextChunkerTask extends Task17 {
6205
6329
  var textChunker = (input, config) => {
6206
6330
  return new TextChunkerTask(config).run(input);
6207
6331
  };
6208
- Workflow36.prototype.textChunker = CreateWorkflow36(TextChunkerTask);
6332
+ Workflow37.prototype.textChunker = CreateWorkflow37(TextChunkerTask);
6209
6333
 
6210
6334
  // src/task/TextFillMaskTask.ts
6211
- import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
6335
+ import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
6212
6336
  var modelSchema24 = TypeModel("model:TextFillMaskTask");
6213
6337
  var TextFillMaskInputSchema = {
6214
6338
  type: "object",
@@ -6273,10 +6397,10 @@ class TextFillMaskTask extends AiTask {
6273
6397
  var textFillMask = (input, config) => {
6274
6398
  return new TextFillMaskTask(config).run(input);
6275
6399
  };
6276
- Workflow37.prototype.textFillMask = CreateWorkflow37(TextFillMaskTask);
6400
+ Workflow38.prototype.textFillMask = CreateWorkflow38(TextFillMaskTask);
6277
6401
 
6278
6402
  // src/task/TextGenerationTask.ts
6279
- import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
6403
+ import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6280
6404
  var generatedTextSchema2 = {
6281
6405
  type: "string",
6282
6406
  title: "Text",
@@ -6361,10 +6485,10 @@ class TextGenerationTask extends StreamingAiTask {
6361
6485
  var textGeneration = (input, config) => {
6362
6486
  return new TextGenerationTask(config).run(input);
6363
6487
  };
6364
- Workflow38.prototype.textGeneration = CreateWorkflow38(TextGenerationTask);
6488
+ Workflow39.prototype.textGeneration = CreateWorkflow39(TextGenerationTask);
6365
6489
 
6366
6490
  // src/task/TextLanguageDetectionTask.ts
6367
- import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6491
+ import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6368
6492
  var modelSchema26 = TypeModel("model:TextLanguageDetectionTask");
6369
6493
  var TextLanguageDetectionInputSchema = {
6370
6494
  type: "object",
@@ -6432,10 +6556,10 @@ class TextLanguageDetectionTask extends AiTask {
6432
6556
  var textLanguageDetection = (input, config) => {
6433
6557
  return new TextLanguageDetectionTask(config).run(input);
6434
6558
  };
6435
- Workflow39.prototype.textLanguageDetection = CreateWorkflow39(TextLanguageDetectionTask);
6559
+ Workflow40.prototype.textLanguageDetection = CreateWorkflow40(TextLanguageDetectionTask);
6436
6560
 
6437
6561
  // src/task/TextQuestionAnswerTask.ts
6438
- import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6562
+ import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
6439
6563
  var contextSchema = {
6440
6564
  type: "string",
6441
6565
  title: "Context",
@@ -6487,10 +6611,10 @@ class TextQuestionAnswerTask extends StreamingAiTask {
6487
6611
  var textQuestionAnswer = (input, config) => {
6488
6612
  return new TextQuestionAnswerTask(config).run(input);
6489
6613
  };
6490
- Workflow40.prototype.textQuestionAnswer = CreateWorkflow40(TextQuestionAnswerTask);
6614
+ Workflow41.prototype.textQuestionAnswer = CreateWorkflow41(TextQuestionAnswerTask);
6491
6615
 
6492
6616
  // src/task/TextRewriterTask.ts
6493
- import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
6617
+ import { CreateWorkflow as CreateWorkflow42, Workflow as Workflow42 } from "@workglow/task-graph";
6494
6618
  var modelSchema28 = TypeModel("model:TextRewriterTask");
6495
6619
  var TextRewriterInputSchema = {
6496
6620
  type: "object",
@@ -6539,10 +6663,10 @@ class TextRewriterTask extends StreamingAiTask {
6539
6663
  var textRewriter = (input, config) => {
6540
6664
  return new TextRewriterTask(config).run(input);
6541
6665
  };
6542
- Workflow41.prototype.textRewriter = CreateWorkflow41(TextRewriterTask);
6666
+ Workflow42.prototype.textRewriter = CreateWorkflow42(TextRewriterTask);
6543
6667
 
6544
6668
  // src/task/TextTranslationTask.ts
6545
- import { CreateWorkflow as CreateWorkflow42, Workflow as Workflow42 } from "@workglow/task-graph";
6669
+ import { CreateWorkflow as CreateWorkflow43, Workflow as Workflow43 } from "@workglow/task-graph";
6546
6670
  var modelSchema29 = TypeModel("model:TextTranslationTask");
6547
6671
  var translationTextSchema = {
6548
6672
  type: "string",
@@ -6605,16 +6729,16 @@ class TextTranslationTask extends StreamingAiTask {
6605
6729
  var textTranslation = (input, config) => {
6606
6730
  return new TextTranslationTask(config).run(input);
6607
6731
  };
6608
- Workflow42.prototype.textTranslation = CreateWorkflow42(TextTranslationTask);
6732
+ Workflow43.prototype.textTranslation = CreateWorkflow43(TextTranslationTask);
6609
6733
 
6610
6734
  // src/task/TopicSegmenterTask.ts
6611
- import { CreateWorkflow as CreateWorkflow43, Task as Task18, Workflow as Workflow43 } from "@workglow/task-graph";
6735
+ import { CreateWorkflow as CreateWorkflow44, Task as Task19, Workflow as Workflow44 } from "@workglow/task-graph";
6612
6736
  var SegmentationMethod = {
6613
6737
  HEURISTIC: "heuristic",
6614
6738
  EMBEDDING_SIMILARITY: "embedding-similarity",
6615
6739
  HYBRID: "hybrid"
6616
6740
  };
6617
- var inputSchema15 = {
6741
+ var inputSchema16 = {
6618
6742
  type: "object",
6619
6743
  properties: {
6620
6744
  text: {
@@ -6655,7 +6779,7 @@ var inputSchema15 = {
6655
6779
  required: ["text"],
6656
6780
  additionalProperties: false
6657
6781
  };
6658
- var outputSchema15 = {
6782
+ var outputSchema16 = {
6659
6783
  type: "object",
6660
6784
  properties: {
6661
6785
  segments: {
@@ -6683,7 +6807,7 @@ var outputSchema15 = {
6683
6807
  additionalProperties: false
6684
6808
  };
6685
6809
 
6686
- class TopicSegmenterTask extends Task18 {
6810
+ class TopicSegmenterTask extends Task19 {
6687
6811
  static type = "TopicSegmenterTask";
6688
6812
  static category = "Document";
6689
6813
  static title = "Topic Segmenter";
@@ -6691,10 +6815,10 @@ class TopicSegmenterTask extends Task18 {
6691
6815
  static cacheable = true;
6692
6816
  static EMBEDDING_DIMENSIONS = 256;
6693
6817
  static inputSchema() {
6694
- return inputSchema15;
6818
+ return inputSchema16;
6695
6819
  }
6696
6820
  static outputSchema() {
6697
- return outputSchema15;
6821
+ return outputSchema16;
6698
6822
  }
6699
6823
  async execute(input, context) {
6700
6824
  const {
@@ -6888,10 +7012,10 @@ class TopicSegmenterTask extends Task18 {
6888
7012
  var topicSegmenter = (input, config) => {
6889
7013
  return new TopicSegmenterTask(config).run(input);
6890
7014
  };
6891
- Workflow43.prototype.topicSegmenter = CreateWorkflow43(TopicSegmenterTask);
7015
+ Workflow44.prototype.topicSegmenter = CreateWorkflow44(TopicSegmenterTask);
6892
7016
 
6893
7017
  // src/task/UnloadModelTask.ts
6894
- import { CreateWorkflow as CreateWorkflow44, Workflow as Workflow44 } from "@workglow/task-graph";
7018
+ import { CreateWorkflow as CreateWorkflow45, Workflow as Workflow45 } from "@workglow/task-graph";
6895
7019
  var modelSchema30 = TypeModel("model");
6896
7020
  var UnloadModelInputSchema = {
6897
7021
  type: "object",
@@ -6926,16 +7050,16 @@ class UnloadModelTask extends AiTask {
6926
7050
  var unloadModel = (input, config) => {
6927
7051
  return new UnloadModelTask(config).run(input);
6928
7052
  };
6929
- Workflow44.prototype.unloadModel = CreateWorkflow44(UnloadModelTask);
7053
+ Workflow45.prototype.unloadModel = CreateWorkflow45(UnloadModelTask);
6930
7054
 
6931
7055
  // src/task/VectorQuantizeTask.ts
6932
- import { CreateWorkflow as CreateWorkflow45, Task as Task19, Workflow as Workflow45 } from "@workglow/task-graph";
7056
+ import { CreateWorkflow as CreateWorkflow46, Task as Task20, Workflow as Workflow46 } from "@workglow/task-graph";
6933
7057
  import {
6934
7058
  normalizeNumberArray,
6935
7059
  TensorType,
6936
7060
  TypedArraySchema as TypedArraySchema8
6937
7061
  } from "@workglow/util/schema";
6938
- var inputSchema16 = {
7062
+ var inputSchema17 = {
6939
7063
  type: "object",
6940
7064
  properties: {
6941
7065
  vector: {
@@ -6972,7 +7096,7 @@ var inputSchema16 = {
6972
7096
  required: ["vector", "targetType"],
6973
7097
  additionalProperties: false
6974
7098
  };
6975
- var outputSchema16 = {
7099
+ var outputSchema17 = {
6976
7100
  type: "object",
6977
7101
  properties: {
6978
7102
  vector: {
@@ -7009,17 +7133,17 @@ var outputSchema16 = {
7009
7133
  additionalProperties: false
7010
7134
  };
7011
7135
 
7012
- class VectorQuantizeTask extends Task19 {
7136
+ class VectorQuantizeTask extends Task20 {
7013
7137
  static type = "VectorQuantizeTask";
7014
7138
  static category = "Vector";
7015
7139
  static title = "Quantize";
7016
7140
  static description = "Quantize vectors to reduce storage and improve performance";
7017
7141
  static cacheable = true;
7018
7142
  static inputSchema() {
7019
- return inputSchema16;
7143
+ return inputSchema17;
7020
7144
  }
7021
7145
  static outputSchema() {
7022
- return outputSchema16;
7146
+ return outputSchema17;
7023
7147
  }
7024
7148
  async executeReactive(input) {
7025
7149
  const { vector, targetType, normalize = true } = input;
@@ -7109,10 +7233,10 @@ class VectorQuantizeTask extends Task19 {
7109
7233
  var vectorQuantize = (input, config) => {
7110
7234
  return new VectorQuantizeTask(config).run(input);
7111
7235
  };
7112
- Workflow45.prototype.vectorQuantize = CreateWorkflow45(VectorQuantizeTask);
7236
+ Workflow46.prototype.vectorQuantize = CreateWorkflow46(VectorQuantizeTask);
7113
7237
 
7114
7238
  // src/task/VectorSimilarityTask.ts
7115
- import { CreateWorkflow as CreateWorkflow46, GraphAsTask, Workflow as Workflow46 } from "@workglow/task-graph";
7239
+ import { CreateWorkflow as CreateWorkflow47, GraphAsTask, Workflow as Workflow47 } from "@workglow/task-graph";
7116
7240
  import {
7117
7241
  cosineSimilarity,
7118
7242
  hammingSimilarity,
@@ -7218,7 +7342,7 @@ class VectorSimilarityTask extends GraphAsTask {
7218
7342
  var similarity = (input, config) => {
7219
7343
  return new VectorSimilarityTask(config).run(input);
7220
7344
  };
7221
- Workflow46.prototype.similarity = CreateWorkflow46(VectorSimilarityTask);
7345
+ Workflow47.prototype.similarity = CreateWorkflow47(VectorSimilarityTask);
7222
7346
  // src/task/MessageConversion.ts
7223
7347
  function getInputMessages(input) {
7224
7348
  const messages = input.messages;
@@ -7437,6 +7561,7 @@ var registerAiTasks = () => {
7437
7561
  HandLandmarkerTask,
7438
7562
  HierarchicalChunkerTask,
7439
7563
  HierarchyJoinTask,
7564
+ KbToDocumentsTask,
7440
7565
  ImageClassificationTask,
7441
7566
  ImageEmbeddingTask,
7442
7567
  ImageSegmentationTask,
@@ -7505,6 +7630,7 @@ export {
7505
7630
  objectDetection,
7506
7631
  modelSearch,
7507
7632
  modelInfo,
7633
+ kbToDocuments,
7508
7634
  isAllowedToolName,
7509
7635
  imageToText,
7510
7636
  imageSegmentation,
@@ -7615,6 +7741,7 @@ export {
7615
7741
  ModelInfoTask,
7616
7742
  ModelConfigSchema,
7617
7743
  MODEL_REPOSITORY,
7744
+ KbToDocumentsTask,
7618
7745
  InMemoryModelRepository,
7619
7746
  ImageToTextTask,
7620
7747
  ImageToTextOutputSchema,
@@ -7646,6 +7773,7 @@ export {
7646
7773
  DocumentUpsertTask,
7647
7774
  DocumentEnricherTask,
7648
7775
  DirectExecutionStrategy,
7776
+ DEFAULT_AI_PROVIDER_WORKER_IDLE_TIMEOUT_MS,
7649
7777
  CountTokensTask,
7650
7778
  CountTokensOutputSchema,
7651
7779
  CountTokensInputSchema,
@@ -7669,4 +7797,4 @@ export {
7669
7797
  AgentInputSchema
7670
7798
  };
7671
7799
 
7672
- //# debugId=3A8ABD53CB039BD464756E2164756E21
7800
+ //# debugId=8A9763DF6FDECCDA64756E2164756E21