@workglow/ai 0.1.1 → 0.2.0

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 (137) hide show
  1. package/README.md +8 -7
  2. package/dist/browser.js +1436 -397
  3. package/dist/browser.js.map +64 -58
  4. package/dist/bun.js +1436 -397
  5. package/dist/bun.js.map +64 -58
  6. package/dist/common.d.ts +1 -0
  7. package/dist/common.d.ts.map +1 -1
  8. package/dist/execution/DirectExecutionStrategy.d.ts +1 -1
  9. package/dist/execution/DirectExecutionStrategy.d.ts.map +1 -1
  10. package/dist/execution/QueuedExecutionStrategy.d.ts +2 -2
  11. package/dist/execution/QueuedExecutionStrategy.d.ts.map +1 -1
  12. package/dist/job/AiJob.d.ts +2 -1
  13. package/dist/job/AiJob.d.ts.map +1 -1
  14. package/dist/model/ModelRegistry.d.ts.map +1 -1
  15. package/dist/model/ModelRepository.d.ts +11 -15
  16. package/dist/model/ModelRepository.d.ts.map +1 -1
  17. package/dist/model/ModelSchema.d.ts.map +1 -1
  18. package/dist/node.js +1436 -397
  19. package/dist/node.js.map +64 -58
  20. package/dist/provider/AiProvider.d.ts +2 -2
  21. package/dist/provider/AiProvider.d.ts.map +1 -1
  22. package/dist/provider/AiProviderRegistry.d.ts +3 -2
  23. package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
  24. package/dist/provider/QueuedAiProvider.d.ts +2 -1
  25. package/dist/provider/QueuedAiProvider.d.ts.map +1 -1
  26. package/dist/task/AgentTask.d.ts +525 -0
  27. package/dist/task/AgentTask.d.ts.map +1 -0
  28. package/dist/task/AgentTypes.d.ts +183 -0
  29. package/dist/task/AgentTypes.d.ts.map +1 -0
  30. package/dist/task/AgentUtils.d.ts +55 -0
  31. package/dist/task/AgentUtils.d.ts.map +1 -0
  32. package/dist/task/BackgroundRemovalTask.d.ts +6 -34
  33. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  34. package/dist/task/ChunkRetrievalTask.d.ts +6 -4
  35. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
  36. package/dist/task/ChunkToVectorTask.d.ts +6 -26
  37. package/dist/task/ChunkToVectorTask.d.ts.map +1 -1
  38. package/dist/task/ChunkVectorHybridSearchTask.d.ts +6 -25
  39. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -1
  40. package/dist/task/ChunkVectorSearchTask.d.ts +6 -12
  41. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -1
  42. package/dist/task/ChunkVectorUpsertTask.d.ts +6 -13
  43. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -1
  44. package/dist/task/ContextBuilderTask.d.ts +6 -30
  45. package/dist/task/ContextBuilderTask.d.ts.map +1 -1
  46. package/dist/task/CountTokensTask.d.ts +6 -21
  47. package/dist/task/CountTokensTask.d.ts.map +1 -1
  48. package/dist/task/DocumentEnricherTask.d.ts +6 -40
  49. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  50. package/dist/task/DownloadModelTask.d.ts +7 -21
  51. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  52. package/dist/task/FaceDetectorTask.d.ts +6 -36
  53. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  54. package/dist/task/FaceLandmarkerTask.d.ts +6 -40
  55. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  56. package/dist/task/GestureRecognizerTask.d.ts +6 -38
  57. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  58. package/dist/task/HandLandmarkerTask.d.ts +6 -38
  59. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  60. package/dist/task/HierarchicalChunkerTask.d.ts +6 -26
  61. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -1
  62. package/dist/task/HierarchyJoinTask.d.ts +6 -29
  63. package/dist/task/HierarchyJoinTask.d.ts.map +1 -1
  64. package/dist/task/ImageClassificationTask.d.ts +6 -36
  65. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  66. package/dist/task/ImageEmbeddingTask.d.ts +6 -47
  67. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  68. package/dist/task/ImageSegmentationTask.d.ts +6 -36
  69. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  70. package/dist/task/ImageToTextTask.d.ts +6 -35
  71. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  72. package/dist/task/MessageConversion.d.ts +52 -0
  73. package/dist/task/MessageConversion.d.ts.map +1 -0
  74. package/dist/task/ModelInfoTask.d.ts +7 -22
  75. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  76. package/dist/task/ModelSearchTask.d.ts +6 -7
  77. package/dist/task/ModelSearchTask.d.ts.map +1 -1
  78. package/dist/task/ObjectDetectionTask.d.ts +6 -36
  79. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  80. package/dist/task/PoseLandmarkerTask.d.ts +6 -39
  81. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  82. package/dist/task/QueryExpanderTask.d.ts +6 -9
  83. package/dist/task/QueryExpanderTask.d.ts.map +1 -1
  84. package/dist/task/RerankerTask.d.ts +6 -28
  85. package/dist/task/RerankerTask.d.ts.map +1 -1
  86. package/dist/task/StructuralParserTask.d.ts +6 -10
  87. package/dist/task/StructuralParserTask.d.ts.map +1 -1
  88. package/dist/task/StructuredGenerationTask.d.ts +6 -26
  89. package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
  90. package/dist/task/TextChunkerTask.d.ts +6 -9
  91. package/dist/task/TextChunkerTask.d.ts.map +1 -1
  92. package/dist/task/TextClassificationTask.d.ts +6 -23
  93. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  94. package/dist/task/TextEmbeddingTask.d.ts +6 -21
  95. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  96. package/dist/task/TextFillMaskTask.d.ts +6 -21
  97. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  98. package/dist/task/TextGenerationTask.d.ts +6 -26
  99. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  100. package/dist/task/TextLanguageDetectionTask.d.ts +6 -22
  101. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  102. package/dist/task/TextNamedEntityRecognitionTask.d.ts +6 -22
  103. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  104. package/dist/task/TextQuestionAnswerTask.d.ts +6 -22
  105. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  106. package/dist/task/TextRewriterTask.d.ts +6 -22
  107. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  108. package/dist/task/TextSummaryTask.d.ts +6 -21
  109. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  110. package/dist/task/TextTranslationTask.d.ts +6 -23
  111. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  112. package/dist/task/ToolCallingTask.d.ts +348 -0
  113. package/dist/task/ToolCallingTask.d.ts.map +1 -0
  114. package/dist/task/ToolCallingUtils.d.ts +75 -0
  115. package/dist/task/ToolCallingUtils.d.ts.map +1 -0
  116. package/dist/task/TopicSegmenterTask.d.ts +6 -10
  117. package/dist/task/TopicSegmenterTask.d.ts.map +1 -1
  118. package/dist/task/UnloadModelTask.d.ts +6 -20
  119. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  120. package/dist/task/VectorQuantizeTask.d.ts +6 -8
  121. package/dist/task/VectorQuantizeTask.d.ts.map +1 -1
  122. package/dist/task/VectorSimilarityTask.d.ts +7 -10
  123. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  124. package/dist/task/base/AiTask.d.ts +8 -5
  125. package/dist/task/base/AiTask.d.ts.map +1 -1
  126. package/dist/task/base/AiTaskSchemas.d.ts.map +1 -1
  127. package/dist/task/base/AiVisionTask.d.ts +3 -7
  128. package/dist/task/base/AiVisionTask.d.ts.map +1 -1
  129. package/dist/task/base/StreamingAiTask.d.ts +4 -7
  130. package/dist/task/base/StreamingAiTask.d.ts.map +1 -1
  131. package/dist/task/index.d.ts +9 -1
  132. package/dist/task/index.d.ts.map +1 -1
  133. package/dist/worker.d.ts +2 -0
  134. package/dist/worker.d.ts.map +1 -1
  135. package/dist/worker.js +247 -25
  136. package/dist/worker.js.map +9 -7
  137. package/package.json +16 -11
@@ -3,7 +3,8 @@
3
3
  * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CreateWorkflow, TaskConfig } from "@workglow/task-graph";
6
+ import { CreateWorkflow } from "@workglow/task-graph";
7
+ import type { TaskConfig } from "@workglow/task-graph";
7
8
  import { DataPortSchema, FromSchema } from "@workglow/util/schema";
8
9
  import { StreamingAiTask } from "./base/StreamingAiTask";
9
10
  export declare const TextTranslationInputSchema: {
@@ -111,10 +112,11 @@ export declare const TextTranslationOutputSchema: {
111
112
  };
112
113
  export type TextTranslationTaskInput = FromSchema<typeof TextTranslationInputSchema>;
113
114
  export type TextTranslationTaskOutput = FromSchema<typeof TextTranslationOutputSchema>;
115
+ export type TextTranslationTaskConfig = TaskConfig<TextTranslationTaskInput>;
114
116
  /**
115
117
  * This translates text from one language to another
116
118
  */
117
- export declare class TextTranslationTask extends StreamingAiTask<TextTranslationTaskInput, TextTranslationTaskOutput> {
119
+ export declare class TextTranslationTask extends StreamingAiTask<TextTranslationTaskInput, TextTranslationTaskOutput, TextTranslationTaskConfig> {
118
120
  static type: string;
119
121
  static category: string;
120
122
  static title: string;
@@ -128,32 +130,13 @@ export declare class TextTranslationTask extends StreamingAiTask<TextTranslation
128
130
  * @param input The input parameters for text translation (text, model, source_lang, and target_lang)
129
131
  * @returns Promise resolving to the translated text output(s)
130
132
  */
131
- export declare const textTranslation: (input: {
132
- model: string | {
133
- [x: string]: unknown;
134
- description?: string | undefined;
135
- metadata?: {
136
- [x: string]: unknown;
137
- } | undefined;
138
- model_id?: string | undefined;
139
- provider: string;
140
- provider_config: {
141
- [x: string]: unknown;
142
- credential_key?: string | undefined;
143
- };
144
- tasks?: string[] | undefined;
145
- title?: string | undefined;
146
- };
147
- source_lang: string;
148
- target_lang: string;
149
- text: string;
150
- }, config?: TaskConfig | undefined) => Promise<{
133
+ export declare const textTranslation: (input: TextTranslationTaskInput, config?: TextTranslationTaskConfig) => Promise<{
151
134
  target_lang: string;
152
135
  text: string;
153
136
  }>;
154
137
  declare module "@workglow/task-graph" {
155
138
  interface Workflow {
156
- textTranslation: CreateWorkflow<TextTranslationTaskInput, TextTranslationTaskOutput, TaskConfig>;
139
+ textTranslation: CreateWorkflow<TextTranslationTaskInput, TextTranslationTaskOutput, TextTranslationTaskConfig>;
157
140
  }
158
141
  }
159
142
  //# sourceMappingURL=TextTranslationTask.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TextTranslationTask.d.ts","sourceRoot":"","sources":["../../src/task/TextTranslationTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAWzD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBJ,CAAC;AAEpC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;CAaL,CAAC;AAEpC,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACrF,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEvF;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,eAAe,CACtD,wBAAwB,EACxB,yBAAyB,CAC1B;IACC,OAAuB,IAAI,SAAyB;IACpD,OAAuB,QAAQ,SAAmB;IAClD,OAAuB,KAAK,SAAsB;IAClD,OAAuB,WAAW,SAAwE;IAC1G,OAAuB,W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AAwB,CAAC,CAAC;AAE7E;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,eAAe,CACtD,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,CAC1B;IACC,OAAuB,IAAI,SAAyB;IACpD,OAAuB,QAAQ,SAAmB;IAClD,OAAuB,KAAK,SAAsB;IAClD,OAAuB,WAAW,SACqC;IACvE,OAAuB,WAAW,IAAI,cAAc,CAEnD;IACD,OAAuB,YAAY,IAAI,cAAc,CAEpD;CACF;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UACnB,wBAAwB,WACtB,yBAAyB;;;EAGnC,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,eAAe,EAAE,cAAc,CAC7B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,CAC1B,CAAC;KACH;CACF"}
@@ -0,0 +1,348 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { CreateWorkflow } from "@workglow/task-graph";
7
+ import type { TaskConfig } from "@workglow/task-graph";
8
+ import { DataPortSchema, FromSchema } from "@workglow/util/schema";
9
+ import { ServiceRegistry } from "@workglow/util";
10
+ import { StreamingAiTask } from "./base/StreamingAiTask";
11
+ import type { ToolDefinition } from "./ToolCallingUtils";
12
+ export interface ToolDefinitionWithTaskType extends ToolDefinition {
13
+ /** The task type name this definition was generated from. */
14
+ readonly taskType: string;
15
+ }
16
+ /**
17
+ * Converts an allow-list of task type names into {@link ToolDefinitionWithTaskType} objects
18
+ * suitable for the ToolCallingTask input. Each entry carries the originating
19
+ * `taskType` so callers don't need to rely on index correspondence.
20
+ *
21
+ * Each task's `type`, `description`, `inputSchema()`, and `outputSchema()`
22
+ * are used to build the tool definition.
23
+ *
24
+ * @param taskNames - Array of task type names registered in the task constructors
25
+ * @param registry - Optional service registry for DI-based lookups
26
+ * @returns Array of ToolDefinitionWithTaskType objects
27
+ * @throws Error if a task name is not found in the registry
28
+ */
29
+ export declare function taskTypesToTools(taskNames: ReadonlyArray<string>, registry?: ServiceRegistry): ToolDefinitionWithTaskType[];
30
+ export declare const ToolDefinitionSchema: {
31
+ readonly type: "object";
32
+ readonly properties: {
33
+ readonly name: {
34
+ readonly type: "string";
35
+ readonly title: "Name";
36
+ readonly description: "The tool name";
37
+ };
38
+ readonly description: {
39
+ readonly type: "string";
40
+ readonly title: "Description";
41
+ readonly description: "A description of what the tool does";
42
+ };
43
+ readonly inputSchema: {
44
+ readonly type: "object";
45
+ readonly title: "Input Schema";
46
+ readonly description: "JSON Schema describing the tool's input parameters";
47
+ readonly additionalProperties: true;
48
+ };
49
+ readonly outputSchema: {
50
+ readonly type: "object";
51
+ readonly title: "Output Schema";
52
+ readonly description: "JSON Schema describing what the tool returns";
53
+ readonly additionalProperties: true;
54
+ };
55
+ readonly configSchema: {
56
+ readonly type: "object";
57
+ readonly title: "Config Schema";
58
+ readonly description: "JSON Schema describing the task's configuration options (not sent to the LLM)";
59
+ readonly additionalProperties: true;
60
+ };
61
+ readonly config: {
62
+ readonly type: "object";
63
+ readonly title: "Config";
64
+ readonly description: "Concrete configuration values for the backing task (not sent to the LLM)";
65
+ readonly additionalProperties: true;
66
+ };
67
+ };
68
+ readonly required: readonly ["name", "description", "inputSchema"];
69
+ readonly additionalProperties: true;
70
+ };
71
+ export declare const ToolCallingInputSchema: {
72
+ readonly type: "object";
73
+ readonly properties: {
74
+ readonly model: {
75
+ readonly oneOf: readonly [{
76
+ readonly title: "Model";
77
+ readonly description: `The model ${string}`;
78
+ } & {
79
+ readonly format: import(".").TypeModelSemantic;
80
+ readonly type: "string";
81
+ }, {
82
+ readonly type: "object";
83
+ readonly properties: {
84
+ readonly model_id: {
85
+ readonly type: "string";
86
+ };
87
+ readonly tasks: {
88
+ readonly type: "array";
89
+ readonly items: {
90
+ readonly type: "string";
91
+ };
92
+ readonly "x-ui-editor": "multiselect";
93
+ };
94
+ readonly title: {
95
+ readonly type: "string";
96
+ };
97
+ readonly description: {
98
+ readonly type: "string";
99
+ readonly "x-ui-editor": "textarea";
100
+ };
101
+ readonly provider: {
102
+ readonly type: "string";
103
+ };
104
+ readonly provider_config: {
105
+ readonly type: "object";
106
+ readonly properties: {
107
+ readonly credential_key: {
108
+ readonly type: "string";
109
+ readonly format: "credential";
110
+ readonly "x-ui-hidden": true;
111
+ };
112
+ };
113
+ readonly additionalProperties: true;
114
+ readonly default: {};
115
+ };
116
+ readonly metadata: {
117
+ readonly type: "object";
118
+ readonly default: {};
119
+ readonly "x-ui-hidden": true;
120
+ };
121
+ };
122
+ readonly required: readonly ["provider", "provider_config"];
123
+ readonly format: "model";
124
+ readonly additionalProperties: true;
125
+ } & {
126
+ readonly format: import(".").TypeModelSemantic;
127
+ }];
128
+ } & {
129
+ readonly format: import(".").TypeModelSemantic;
130
+ };
131
+ readonly prompt: {
132
+ readonly oneOf: readonly [{
133
+ readonly type: "string";
134
+ readonly title: "Prompt";
135
+ readonly description: "The prompt to send to the model";
136
+ }, {
137
+ readonly type: "array";
138
+ readonly title: "Prompt";
139
+ readonly description: "The prompt as an array of strings or content blocks";
140
+ readonly items: {
141
+ readonly oneOf: readonly [{
142
+ readonly type: "string";
143
+ }, {
144
+ readonly type: "object";
145
+ readonly properties: {
146
+ readonly type: {
147
+ readonly type: "string";
148
+ readonly enum: readonly ["text", "image", "audio"];
149
+ };
150
+ };
151
+ readonly required: readonly ["type"];
152
+ readonly additionalProperties: true;
153
+ }];
154
+ };
155
+ }];
156
+ readonly title: "Prompt";
157
+ readonly description: "The prompt to send to the model";
158
+ };
159
+ readonly systemPrompt: {
160
+ readonly type: "string";
161
+ readonly title: "System Prompt";
162
+ readonly description: "Optional system instructions for the model";
163
+ };
164
+ readonly messages: {
165
+ readonly type: "array";
166
+ readonly title: "Messages";
167
+ readonly description: "Full conversation history for multi-turn interactions. When provided, used instead of prompt to construct the messages array sent to the provider.";
168
+ readonly items: {
169
+ readonly type: "object";
170
+ readonly properties: {
171
+ readonly role: {
172
+ readonly type: "string";
173
+ readonly enum: readonly ["user", "assistant", "tool"];
174
+ };
175
+ readonly content: {};
176
+ };
177
+ readonly required: readonly ["role", "content"];
178
+ readonly additionalProperties: true;
179
+ };
180
+ };
181
+ readonly tools: {
182
+ readonly type: "array";
183
+ readonly format: "tasks";
184
+ readonly title: "Tools";
185
+ readonly description: "Tool definitions available for the model to call";
186
+ readonly items: {
187
+ readonly oneOf: readonly [{
188
+ readonly type: "string";
189
+ readonly format: "tasks";
190
+ readonly description: "Task type name";
191
+ }, {
192
+ readonly type: "object";
193
+ readonly properties: {
194
+ readonly name: {
195
+ readonly type: "string";
196
+ readonly title: "Name";
197
+ readonly description: "The tool name";
198
+ };
199
+ readonly description: {
200
+ readonly type: "string";
201
+ readonly title: "Description";
202
+ readonly description: "A description of what the tool does";
203
+ };
204
+ readonly inputSchema: {
205
+ readonly type: "object";
206
+ readonly title: "Input Schema";
207
+ readonly description: "JSON Schema describing the tool's input parameters";
208
+ readonly additionalProperties: true;
209
+ };
210
+ readonly outputSchema: {
211
+ readonly type: "object";
212
+ readonly title: "Output Schema";
213
+ readonly description: "JSON Schema describing what the tool returns";
214
+ readonly additionalProperties: true;
215
+ };
216
+ readonly configSchema: {
217
+ readonly type: "object";
218
+ readonly title: "Config Schema";
219
+ readonly description: "JSON Schema describing the task's configuration options (not sent to the LLM)";
220
+ readonly additionalProperties: true;
221
+ };
222
+ readonly config: {
223
+ readonly type: "object";
224
+ readonly title: "Config";
225
+ readonly description: "Concrete configuration values for the backing task (not sent to the LLM)";
226
+ readonly additionalProperties: true;
227
+ };
228
+ };
229
+ readonly required: readonly ["name", "description", "inputSchema"];
230
+ readonly additionalProperties: true;
231
+ }];
232
+ };
233
+ };
234
+ readonly toolChoice: {
235
+ readonly type: "string";
236
+ readonly title: "Tool Choice";
237
+ readonly description: 'Controls tool selection: "auto" (model decides), "none" (no tools), "required" (must call a tool), or a specific tool name';
238
+ readonly "x-ui-group": "Configuration";
239
+ };
240
+ readonly maxTokens: {
241
+ readonly type: "number";
242
+ readonly title: "Max Tokens";
243
+ readonly description: "The maximum number of tokens to generate";
244
+ readonly minimum: 1;
245
+ readonly "x-ui-group": "Configuration";
246
+ };
247
+ readonly temperature: {
248
+ readonly type: "number";
249
+ readonly title: "Temperature";
250
+ readonly description: "The temperature to use for sampling";
251
+ readonly minimum: 0;
252
+ readonly maximum: 2;
253
+ readonly "x-ui-group": "Configuration";
254
+ };
255
+ };
256
+ readonly required: readonly ["model", "prompt", "tools"];
257
+ readonly additionalProperties: false;
258
+ };
259
+ export declare const ToolCallingOutputSchema: {
260
+ readonly type: "object";
261
+ readonly properties: {
262
+ readonly text: {
263
+ readonly type: "string";
264
+ readonly title: "Text";
265
+ readonly description: "Any text content generated by the model";
266
+ readonly "x-stream": "append";
267
+ };
268
+ readonly toolCalls: {
269
+ readonly type: "array";
270
+ readonly items: {
271
+ readonly type: "object";
272
+ readonly properties: {
273
+ readonly id: {
274
+ readonly type: "string";
275
+ readonly title: "ID";
276
+ readonly description: "Unique identifier for this tool call";
277
+ };
278
+ readonly name: {
279
+ readonly type: "string";
280
+ readonly title: "Name";
281
+ readonly description: "The name of the tool to invoke";
282
+ };
283
+ readonly input: {
284
+ readonly type: "object";
285
+ readonly title: "Input";
286
+ readonly description: "The input arguments for the tool call";
287
+ readonly additionalProperties: true;
288
+ };
289
+ };
290
+ readonly required: readonly ["id", "name", "input"];
291
+ readonly additionalProperties: false;
292
+ };
293
+ readonly title: "Tool Calls";
294
+ readonly description: "Tool calls requested by the model";
295
+ readonly "x-stream": "object";
296
+ };
297
+ };
298
+ readonly required: readonly ["text", "toolCalls"];
299
+ readonly additionalProperties: false;
300
+ };
301
+ /**
302
+ * Runtime input type for ToolCallingTask.
303
+ *
304
+ * The schema uses `oneOf: [string, object]` so the UI can accept both task-name
305
+ * references and inline tool definitions, but the input resolver converts all
306
+ * strings to {@link ToolDefinition} objects before execution. The `tools` field
307
+ * is therefore narrowed to `ToolDefinition[]` here.
308
+ *
309
+ * Extends the schema-derived base with the
310
+ * `messages` field typed explicitly (the loose `content: {}` in the
311
+ * schema prevents `FromSchema` from producing a useful type).
312
+ */
313
+ export type ToolCallingTaskInput = Omit<FromSchema<typeof ToolCallingInputSchema>, "tools"> & {
314
+ readonly tools: ToolDefinition[];
315
+ readonly messages?: ReadonlyArray<{
316
+ readonly role: "user" | "assistant" | "tool";
317
+ readonly content: unknown;
318
+ }>;
319
+ };
320
+ export type ToolCallingTaskOutput = FromSchema<typeof ToolCallingOutputSchema>;
321
+ export type ToolCallingTaskConfig = TaskConfig<ToolCallingTaskInput>;
322
+ export declare class ToolCallingTask extends StreamingAiTask<ToolCallingTaskInput, ToolCallingTaskOutput, ToolCallingTaskConfig> {
323
+ static type: string;
324
+ static category: string;
325
+ static title: string;
326
+ static description: string;
327
+ static inputSchema(): DataPortSchema;
328
+ static outputSchema(): DataPortSchema;
329
+ }
330
+ /**
331
+ * Convenience function to run a tool calling task.
332
+ */
333
+ export declare const toolCalling: (input: ToolCallingTaskInput, config?: ToolCallingTaskConfig) => Promise<{
334
+ text: string;
335
+ toolCalls: {
336
+ id: string;
337
+ input: {
338
+ [x: string]: unknown;
339
+ };
340
+ name: string;
341
+ }[];
342
+ }>;
343
+ declare module "@workglow/task-graph" {
344
+ interface Workflow {
345
+ toolCalling: CreateWorkflow<ToolCallingTaskInput, ToolCallingTaskOutput, ToolCallingTaskConfig>;
346
+ }
347
+ }
348
+ //# sourceMappingURL=ToolCallingTask.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolCallingTask.d.ts","sourceRoot":"","sources":["../../src/task/ToolCallingTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAiC,MAAM,sBAAsB,CAAC;AAErF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBA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;GAWG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAAE,OAAO,CAAC,GAAG;IAC5F,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC;QAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;QAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAMrE,qBAAa,eAAgB,SAAQ,eAAe,CAClD,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,CACtB;IACC,OAAuB,IAAI,SAAqB;IAChD,OAAuB,QAAQ,SAAmB;IAClD,OAAuB,KAAK,SAAkB;IAC9C,OAAuB,WAAW,SACyF;IAC3H,OAAuB,WAAW,IAAI,cAAc,CAEnD;IACD,OAAuB,YAAY,IAAI,cAAc,CAEpD;CACF;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,UAAW,oBAAoB,WAAW,qBAAqB;;;;;;;;;EAEtF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,WAAW,EAAE,cAAc,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC,CAAC;KACjG;CACF"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { JsonSchema } from "@workglow/util/worker";
7
+ /**
8
+ * A tool definition that can be passed to an LLM for tool calling.
9
+ * Can be created manually or generated from TaskRegistry entries via `taskTypesToTools` in ToolCallingTask.
10
+ *
11
+ * The `name` is used both as the tool name presented to the LLM and as a
12
+ * lookup key for the backing Task in the TaskRegistry. When a tool is
13
+ * backed by a configurable task (e.g. `McpToolCallTask`, `JavaScriptTask`),
14
+ * `configSchema` describes what configuration the task accepts and `config`
15
+ * provides the concrete values. The LLM never sees `configSchema` or
16
+ * `config` — they are setup-time concerns used when instantiating the task.
17
+ */
18
+ export interface ToolDefinition {
19
+ name: string;
20
+ description: string;
21
+ inputSchema: JsonSchema;
22
+ outputSchema?: JsonSchema;
23
+ /**
24
+ * Optional discriminator for tool resolution. When specified, skips
25
+ * duck-typing heuristics:
26
+ * - `"function"` — uses the `execute` function directly
27
+ * - `"task"` — looks up the task by `name` in the TaskRegistry
28
+ *
29
+ * When omitted, resolution falls back to the existing heuristic
30
+ * (check `execute`, then registry lookup, then stub).
31
+ */
32
+ type?: "function" | "task";
33
+ /** JSON Schema describing the task's configuration options. */
34
+ configSchema?: JsonSchema;
35
+ /** Concrete configuration values matching {@link configSchema}. */
36
+ config?: Record<string, unknown>;
37
+ /**
38
+ * Optional custom executor function. When provided, the tool is executed
39
+ * by calling this function directly instead of instantiating a Task.
40
+ */
41
+ execute?: (input: Record<string, unknown>) => Promise<Record<string, unknown>>;
42
+ }
43
+ /**
44
+ * A tool call returned by the LLM, requesting invocation of a specific tool.
45
+ */
46
+ export interface ToolCall {
47
+ id: string;
48
+ name: string;
49
+ input: Record<string, unknown>;
50
+ }
51
+ export type ToolCalls = Array<ToolCall>;
52
+ /**
53
+ * Controls which tools the model may call.
54
+ * - `"auto"` — model decides whether to call tools
55
+ * - `"none"` — model must not call any tools
56
+ * - `"required"` — model must call at least one tool
57
+ * - any other string — model must call the tool with that name
58
+ */
59
+ export type ToolChoiceOption = "auto" | "none" | "required" | (string & {});
60
+ /**
61
+ * Builds a tool description string for provider APIs, appending the output
62
+ * schema when present. Shared across all provider implementations.
63
+ */
64
+ export declare function buildToolDescription(tool: ToolDefinition): string;
65
+ /**
66
+ * Validates that a tool call name returned by the LLM matches one of the
67
+ * allowed tool definitions. Returns true if valid, false otherwise.
68
+ */
69
+ export declare function isAllowedToolName(name: string, allowedTools: ReadonlyArray<ToolDefinition>): boolean;
70
+ /**
71
+ * Filters an array of tool calls, removing any whose name does not appear
72
+ * in the provided tools list. Returns the filtered array.
73
+ */
74
+ export declare function filterValidToolCalls(toolCalls: ToolCalls, allowedTools: ReadonlyArray<ToolDefinition>): ToolCalls;
75
+ //# sourceMappingURL=ToolCallingUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolCallingUtils.d.ts","sourceRoot":"","sources":["../../src/task/ToolCallingUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAChF;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAMjE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,GAC1C,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,GAC1C,SAAS,CAWX"}
@@ -3,7 +3,8 @@
3
3
  * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CreateWorkflow, IExecuteContext, TaskConfig, Task } from "@workglow/task-graph";
6
+ import { CreateWorkflow, IExecuteContext, Task } from "@workglow/task-graph";
7
+ import type { TaskConfig } from "@workglow/task-graph";
7
8
  import { DataPortSchema, FromSchema } from "@workglow/util/schema";
8
9
  export declare const SegmentationMethod: {
9
10
  readonly HEURISTIC: "heuristic";
@@ -87,11 +88,12 @@ declare const outputSchema: {
87
88
  };
88
89
  export type TopicSegmenterTaskInput = FromSchema<typeof inputSchema>;
89
90
  export type TopicSegmenterTaskOutput = FromSchema<typeof outputSchema>;
91
+ export type TopicSegmenterTaskConfig = TaskConfig<TopicSegmenterTaskInput>;
90
92
  /**
91
93
  * Task for segmenting text into topic-based sections
92
94
  * Uses hybrid approach: heuristics + optional embedding similarity
93
95
  */
94
- export declare class TopicSegmenterTask extends Task<TopicSegmenterTaskInput, TopicSegmenterTaskOutput, TaskConfig> {
96
+ export declare class TopicSegmenterTask extends Task<TopicSegmenterTaskInput, TopicSegmenterTaskOutput, TopicSegmenterTaskConfig> {
95
97
  static type: string;
96
98
  static category: string;
97
99
  static title: string;
@@ -131,13 +133,7 @@ export declare class TopicSegmenterTask extends Task<TopicSegmenterTaskInput, To
131
133
  */
132
134
  private mergeSmallSegments;
133
135
  }
134
- export declare const topicSegmenter: (input: {
135
- maxSegmentSize?: number | undefined;
136
- method?: "embedding-similarity" | "heuristic" | "hybrid" | undefined;
137
- minSegmentSize?: number | undefined;
138
- similarityThreshold?: number | undefined;
139
- text: string;
140
- }, config?: TaskConfig | undefined) => Promise<{
136
+ export declare const topicSegmenter: (input: TopicSegmenterTaskInput, config?: TopicSegmenterTaskConfig) => Promise<{
141
137
  count: number;
142
138
  segments: {
143
139
  endOffset: number;
@@ -147,7 +143,7 @@ export declare const topicSegmenter: (input: {
147
143
  }>;
148
144
  declare module "@workglow/task-graph" {
149
145
  interface Workflow {
150
- topicSegmenter: CreateWorkflow<TopicSegmenterTaskInput, TopicSegmenterTaskOutput, TaskConfig>;
146
+ topicSegmenter: CreateWorkflow<TopicSegmenterTaskInput, TopicSegmenterTaskOutput, TopicSegmenterTaskConfig>;
151
147
  }
152
148
  }
153
149
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"TopicSegmenterTask.d.ts","sourceRoot":"","sources":["../../src/task/TopicSegmenterTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAY,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCkB,CAAC;AAEpC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAyC3B;AAED,eAAO,MAAM,cAAc,UAClB,uBAAuB,WACrB,wBAAwB;;;;;;;EAGlC,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,cAAc,EAAE,cAAc,CAC5B,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,CACzB,CAAC;KACH;CACF"}
@@ -3,7 +3,8 @@
3
3
  * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { CreateWorkflow, TaskConfig } from "@workglow/task-graph";
6
+ import { CreateWorkflow } from "@workglow/task-graph";
7
+ import type { TaskConfig } from "@workglow/task-graph";
7
8
  import { DataPortSchema, FromSchema } from "@workglow/util/schema";
8
9
  import { AiTask } from "./base/AiTask";
9
10
  declare const UnloadModelInputSchema: {
@@ -136,13 +137,14 @@ declare const UnloadModelOutputSchema: {
136
137
  };
137
138
  export type UnloadModelTaskRunInput = FromSchema<typeof UnloadModelInputSchema>;
138
139
  export type UnloadModelTaskRunOutput = FromSchema<typeof UnloadModelOutputSchema>;
140
+ export type UnloadModelTaskConfig = TaskConfig<UnloadModelTaskRunInput>;
139
141
  /**
140
142
  * Unload a model from memory and clear its cache.
141
143
  *
142
144
  * @remarks
143
145
  * This task has a side effect of removing the model from memory and deleting cached files
144
146
  */
145
- export declare class UnloadModelTask extends AiTask<UnloadModelTaskRunInput, UnloadModelTaskRunOutput, TaskConfig> {
147
+ export declare class UnloadModelTask extends AiTask<UnloadModelTaskRunInput, UnloadModelTaskRunOutput, UnloadModelTaskConfig> {
146
148
  static type: string;
147
149
  static category: string;
148
150
  static title: string;
@@ -157,23 +159,7 @@ export declare class UnloadModelTask extends AiTask<UnloadModelTaskRunInput, Unl
157
159
  * @param input - Input containing model(s) to unload
158
160
  * @returns Promise resolving to the unloaded model(s)
159
161
  */
160
- export declare const unloadModel: (input: {
161
- model: string | {
162
- [x: string]: unknown;
163
- description?: string | undefined;
164
- metadata?: {
165
- [x: string]: unknown;
166
- } | undefined;
167
- model_id?: string | undefined;
168
- provider: string;
169
- provider_config: {
170
- [x: string]: unknown;
171
- credential_key?: string | undefined;
172
- };
173
- tasks?: string[] | undefined;
174
- title?: string | undefined;
175
- };
176
- }, config?: TaskConfig | undefined) => Promise<{
162
+ export declare const unloadModel: (input: UnloadModelTaskRunInput, config?: UnloadModelTaskConfig) => Promise<{
177
163
  model: string | {
178
164
  [x: string]: unknown;
179
165
  description?: string | undefined;
@@ -192,7 +178,7 @@ export declare const unloadModel: (input: {
192
178
  }>;
193
179
  declare module "@workglow/task-graph" {
194
180
  interface Workflow {
195
- unloadModel: CreateWorkflow<UnloadModelTaskRunInput, UnloadModelTaskRunOutput, TaskConfig>;
181
+ unloadModel: CreateWorkflow<UnloadModelTaskRunInput, UnloadModelTaskRunOutput, UnloadModelTaskConfig>;
196
182
  }
197
183
  }
198
184
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"UnloadModelTask.d.ts","sourceRoot":"","sources":["../../src/task/UnloadModelTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvC,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOO,CAAC;AAEpC,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOM,CAAC;AAEpC,MAAM,MAAM,uBAAuB,GA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