@workglow/ai 0.0.125 → 0.1.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 (143) hide show
  1. package/README.md +218 -47
  2. package/dist/browser.d.ts +7 -0
  3. package/dist/browser.d.ts.map +1 -0
  4. package/dist/browser.js +565 -1277
  5. package/dist/browser.js.map +56 -61
  6. package/dist/{types.d.ts → bun.d.ts} +1 -1
  7. package/dist/bun.d.ts.map +1 -0
  8. package/dist/bun.js +565 -1277
  9. package/dist/bun.js.map +56 -61
  10. package/dist/common.d.ts +3 -1
  11. package/dist/common.d.ts.map +1 -1
  12. package/dist/execution/DirectExecutionStrategy.d.ts +20 -0
  13. package/dist/execution/DirectExecutionStrategy.d.ts.map +1 -0
  14. package/dist/execution/IAiExecutionStrategy.d.ts +33 -0
  15. package/dist/execution/IAiExecutionStrategy.d.ts.map +1 -0
  16. package/dist/execution/QueuedExecutionStrategy.d.ts +50 -0
  17. package/dist/execution/QueuedExecutionStrategy.d.ts.map +1 -0
  18. package/dist/job/AiJob.d.ts +6 -0
  19. package/dist/job/AiJob.d.ts.map +1 -1
  20. package/dist/node.d.ts +7 -0
  21. package/dist/node.d.ts.map +1 -0
  22. package/dist/node.js +565 -1277
  23. package/dist/node.js.map +56 -61
  24. package/dist/provider/AiProvider.d.ts +16 -2
  25. package/dist/provider/AiProvider.d.ts.map +1 -1
  26. package/dist/provider/AiProviderRegistry.d.ts +20 -0
  27. package/dist/provider/AiProviderRegistry.d.ts.map +1 -1
  28. package/dist/provider/QueuedAiProvider.d.ts +23 -2
  29. package/dist/provider/QueuedAiProvider.d.ts.map +1 -1
  30. package/dist/task/BackgroundRemovalTask.d.ts +3 -3
  31. package/dist/task/BackgroundRemovalTask.d.ts.map +1 -1
  32. package/dist/task/ChunkRetrievalTask.d.ts +4 -4
  33. package/dist/task/ChunkRetrievalTask.d.ts.map +1 -1
  34. package/dist/task/ChunkToVectorTask.d.ts +4 -4
  35. package/dist/task/ChunkToVectorTask.d.ts.map +1 -1
  36. package/dist/task/ChunkVectorHybridSearchTask.d.ts +4 -4
  37. package/dist/task/ChunkVectorHybridSearchTask.d.ts.map +1 -1
  38. package/dist/task/ChunkVectorSearchTask.d.ts +4 -4
  39. package/dist/task/ChunkVectorSearchTask.d.ts.map +1 -1
  40. package/dist/task/ChunkVectorUpsertTask.d.ts +4 -4
  41. package/dist/task/ChunkVectorUpsertTask.d.ts.map +1 -1
  42. package/dist/task/ContextBuilderTask.d.ts +4 -4
  43. package/dist/task/ContextBuilderTask.d.ts.map +1 -1
  44. package/dist/task/CountTokensTask.d.ts +11 -29
  45. package/dist/task/CountTokensTask.d.ts.map +1 -1
  46. package/dist/task/DocumentEnricherTask.d.ts +4 -4
  47. package/dist/task/DocumentEnricherTask.d.ts.map +1 -1
  48. package/dist/task/DownloadModelTask.d.ts +5 -5
  49. package/dist/task/DownloadModelTask.d.ts.map +1 -1
  50. package/dist/task/FaceDetectorTask.d.ts +4 -4
  51. package/dist/task/FaceDetectorTask.d.ts.map +1 -1
  52. package/dist/task/FaceLandmarkerTask.d.ts +4 -4
  53. package/dist/task/FaceLandmarkerTask.d.ts.map +1 -1
  54. package/dist/task/GestureRecognizerTask.d.ts +4 -4
  55. package/dist/task/GestureRecognizerTask.d.ts.map +1 -1
  56. package/dist/task/HandLandmarkerTask.d.ts +4 -4
  57. package/dist/task/HandLandmarkerTask.d.ts.map +1 -1
  58. package/dist/task/HierarchicalChunkerTask.d.ts +4 -4
  59. package/dist/task/HierarchicalChunkerTask.d.ts.map +1 -1
  60. package/dist/task/HierarchyJoinTask.d.ts +4 -4
  61. package/dist/task/HierarchyJoinTask.d.ts.map +1 -1
  62. package/dist/task/ImageClassificationTask.d.ts +4 -4
  63. package/dist/task/ImageClassificationTask.d.ts.map +1 -1
  64. package/dist/task/ImageEmbeddingTask.d.ts +203 -89
  65. package/dist/task/ImageEmbeddingTask.d.ts.map +1 -1
  66. package/dist/task/ImageSegmentationTask.d.ts +4 -4
  67. package/dist/task/ImageSegmentationTask.d.ts.map +1 -1
  68. package/dist/task/ImageToTextTask.d.ts +4 -4
  69. package/dist/task/ImageToTextTask.d.ts.map +1 -1
  70. package/dist/task/ModelInfoTask.d.ts +5 -5
  71. package/dist/task/ModelInfoTask.d.ts.map +1 -1
  72. package/dist/task/ModelSearchTask.d.ts +3 -3
  73. package/dist/task/ModelSearchTask.d.ts.map +1 -1
  74. package/dist/task/ObjectDetectionTask.d.ts +4 -4
  75. package/dist/task/ObjectDetectionTask.d.ts.map +1 -1
  76. package/dist/task/PoseLandmarkerTask.d.ts +4 -4
  77. package/dist/task/PoseLandmarkerTask.d.ts.map +1 -1
  78. package/dist/task/QueryExpanderTask.d.ts +4 -4
  79. package/dist/task/QueryExpanderTask.d.ts.map +1 -1
  80. package/dist/task/RerankerTask.d.ts +4 -4
  81. package/dist/task/RerankerTask.d.ts.map +1 -1
  82. package/dist/task/StructuralParserTask.d.ts +4 -4
  83. package/dist/task/StructuralParserTask.d.ts.map +1 -1
  84. package/dist/task/StructuredGenerationTask.d.ts +4 -4
  85. package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
  86. package/dist/task/TextChunkerTask.d.ts +4 -4
  87. package/dist/task/TextChunkerTask.d.ts.map +1 -1
  88. package/dist/task/TextClassificationTask.d.ts +24 -62
  89. package/dist/task/TextClassificationTask.d.ts.map +1 -1
  90. package/dist/task/TextEmbeddingTask.d.ts +3 -3
  91. package/dist/task/TextEmbeddingTask.d.ts.map +1 -1
  92. package/dist/task/TextFillMaskTask.d.ts +29 -73
  93. package/dist/task/TextFillMaskTask.d.ts.map +1 -1
  94. package/dist/task/TextGenerationTask.d.ts +13 -32
  95. package/dist/task/TextGenerationTask.d.ts.map +1 -1
  96. package/dist/task/TextLanguageDetectionTask.d.ts +24 -62
  97. package/dist/task/TextLanguageDetectionTask.d.ts.map +1 -1
  98. package/dist/task/TextNamedEntityRecognitionTask.d.ts +29 -73
  99. package/dist/task/TextNamedEntityRecognitionTask.d.ts.map +1 -1
  100. package/dist/task/TextQuestionAnswerTask.d.ts +17 -45
  101. package/dist/task/TextQuestionAnswerTask.d.ts.map +1 -1
  102. package/dist/task/TextRewriterTask.d.ts +12 -31
  103. package/dist/task/TextRewriterTask.d.ts.map +1 -1
  104. package/dist/task/TextSummaryTask.d.ts +12 -31
  105. package/dist/task/TextSummaryTask.d.ts.map +1 -1
  106. package/dist/task/TextTranslationTask.d.ts +12 -31
  107. package/dist/task/TextTranslationTask.d.ts.map +1 -1
  108. package/dist/task/TopicSegmenterTask.d.ts +4 -4
  109. package/dist/task/TopicSegmenterTask.d.ts.map +1 -1
  110. package/dist/task/UnloadModelTask.d.ts +4 -4
  111. package/dist/task/UnloadModelTask.d.ts.map +1 -1
  112. package/dist/task/VectorQuantizeTask.d.ts +4 -4
  113. package/dist/task/VectorQuantizeTask.d.ts.map +1 -1
  114. package/dist/task/VectorSimilarityTask.d.ts +4 -4
  115. package/dist/task/VectorSimilarityTask.d.ts.map +1 -1
  116. package/dist/task/base/AiTask.d.ts +12 -31
  117. package/dist/task/base/AiTask.d.ts.map +1 -1
  118. package/dist/task/base/AiVisionTask.d.ts +7 -12
  119. package/dist/task/base/AiVisionTask.d.ts.map +1 -1
  120. package/dist/task/base/StreamingAiTask.d.ts +7 -4
  121. package/dist/task/base/StreamingAiTask.d.ts.map +1 -1
  122. package/dist/task/index.d.ts +1 -13
  123. package/dist/task/index.d.ts.map +1 -1
  124. package/dist/worker.d.ts +0 -2
  125. package/dist/worker.d.ts.map +1 -1
  126. package/dist/worker.js +217 -233
  127. package/dist/worker.js.map +7 -7
  128. package/package.json +24 -15
  129. package/dist/queue/createDefaultQueue.d.ts +0 -17
  130. package/dist/queue/createDefaultQueue.d.ts.map +0 -1
  131. package/dist/task/AgentTask.d.ts +0 -524
  132. package/dist/task/AgentTask.d.ts.map +0 -1
  133. package/dist/task/AgentTypes.d.ts +0 -181
  134. package/dist/task/AgentTypes.d.ts.map +0 -1
  135. package/dist/task/AgentUtils.d.ts +0 -50
  136. package/dist/task/AgentUtils.d.ts.map +0 -1
  137. package/dist/task/MessageConversion.d.ts +0 -52
  138. package/dist/task/MessageConversion.d.ts.map +0 -1
  139. package/dist/task/ToolCallingTask.d.ts +0 -385
  140. package/dist/task/ToolCallingTask.d.ts.map +0 -1
  141. package/dist/task/ToolCallingUtils.d.ts +0 -65
  142. package/dist/task/ToolCallingUtils.d.ts.map +0 -1
  143. package/dist/types.d.ts.map +0 -1
@@ -1,385 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2026 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { CreateWorkflow, JobQueueTaskConfig } from "@workglow/task-graph";
7
- import { DataPortSchema, FromSchema } from "@workglow/util/schema";
8
- import { ServiceRegistry } from "@workglow/util";
9
- import { StreamingAiTask } from "./base/StreamingAiTask";
10
- import type { ToolDefinition } from "./ToolCallingUtils";
11
- export interface ToolDefinitionWithTaskType extends ToolDefinition {
12
- /** The task type name this definition was generated from. */
13
- readonly taskType: string;
14
- }
15
- /**
16
- * Converts an allow-list of task type names into {@link ToolDefinitionWithTaskType} objects
17
- * suitable for the ToolCallingTask input. Each entry carries the originating
18
- * `taskType` so callers don't need to rely on index correspondence.
19
- *
20
- * Each task's `type`, `description`, `inputSchema()`, and `outputSchema()`
21
- * are used to build the tool definition.
22
- *
23
- * @param taskNames - Array of task type names registered in the task constructors
24
- * @param registry - Optional service registry for DI-based lookups
25
- * @returns Array of ToolDefinitionWithTaskType objects
26
- * @throws Error if a task name is not found in the registry
27
- */
28
- export declare function taskTypesToTools(taskNames: ReadonlyArray<string>, registry?: ServiceRegistry): ToolDefinitionWithTaskType[];
29
- export declare const ToolDefinitionSchema: {
30
- readonly type: "object";
31
- readonly properties: {
32
- readonly name: {
33
- readonly type: "string";
34
- readonly title: "Name";
35
- readonly description: "The tool name";
36
- };
37
- readonly description: {
38
- readonly type: "string";
39
- readonly title: "Description";
40
- readonly description: "A description of what the tool does";
41
- };
42
- readonly inputSchema: {
43
- readonly type: "object";
44
- readonly title: "Input Schema";
45
- readonly description: "JSON Schema describing the tool's input parameters";
46
- readonly additionalProperties: true;
47
- };
48
- readonly outputSchema: {
49
- readonly type: "object";
50
- readonly title: "Output Schema";
51
- readonly description: "JSON Schema describing what the tool returns";
52
- readonly additionalProperties: true;
53
- };
54
- readonly configSchema: {
55
- readonly type: "object";
56
- readonly title: "Config Schema";
57
- readonly description: "JSON Schema describing the task's configuration options (not sent to the LLM)";
58
- readonly additionalProperties: true;
59
- };
60
- readonly config: {
61
- readonly type: "object";
62
- readonly title: "Config";
63
- readonly description: "Concrete configuration values for the backing task (not sent to the LLM)";
64
- readonly additionalProperties: true;
65
- };
66
- };
67
- readonly required: readonly ["name", "description", "inputSchema"];
68
- readonly additionalProperties: true;
69
- };
70
- export declare const ToolCallingInputSchema: {
71
- readonly type: "object";
72
- readonly properties: {
73
- readonly model: {
74
- readonly oneOf: readonly [{
75
- readonly title: "Model";
76
- readonly description: `The model ${string}`;
77
- } & {
78
- readonly format: import(".").TypeModelSemantic;
79
- readonly type: "string";
80
- }, {
81
- readonly type: "object";
82
- readonly properties: {
83
- readonly model_id: {
84
- readonly type: "string";
85
- };
86
- readonly tasks: {
87
- readonly type: "array";
88
- readonly items: {
89
- readonly type: "string";
90
- };
91
- readonly "x-ui-editor": "multiselect";
92
- };
93
- readonly title: {
94
- readonly type: "string";
95
- };
96
- readonly description: {
97
- readonly type: "string";
98
- readonly "x-ui-editor": "textarea";
99
- };
100
- readonly provider: {
101
- readonly type: "string";
102
- };
103
- readonly provider_config: {
104
- readonly type: "object";
105
- readonly properties: {
106
- readonly credential_key: {
107
- readonly type: "string";
108
- readonly format: "credential";
109
- readonly "x-ui-hidden": true;
110
- };
111
- };
112
- readonly additionalProperties: true;
113
- readonly default: {};
114
- };
115
- readonly metadata: {
116
- readonly type: "object";
117
- readonly default: {};
118
- readonly "x-ui-hidden": true;
119
- };
120
- };
121
- readonly required: readonly ["provider", "provider_config"];
122
- readonly format: "model";
123
- readonly additionalProperties: true;
124
- } & {
125
- readonly format: import(".").TypeModelSemantic;
126
- }];
127
- } & {
128
- readonly format: import(".").TypeModelSemantic;
129
- };
130
- readonly prompt: {
131
- readonly oneOf: readonly [{
132
- readonly type: "string";
133
- readonly title: "Prompt";
134
- readonly description: "The prompt to send to the model";
135
- }, {
136
- readonly type: "array";
137
- readonly title: "Prompt";
138
- readonly description: "The prompt as an array of strings or content blocks";
139
- readonly items: {
140
- readonly oneOf: readonly [{
141
- readonly type: "string";
142
- }, {
143
- readonly type: "object";
144
- readonly properties: {
145
- readonly type: {
146
- readonly type: "string";
147
- readonly enum: readonly ["text", "image", "audio"];
148
- };
149
- };
150
- readonly required: readonly ["type"];
151
- readonly additionalProperties: true;
152
- }];
153
- };
154
- }];
155
- readonly title: "Prompt";
156
- readonly description: "The prompt to send to the model";
157
- };
158
- readonly systemPrompt: {
159
- readonly type: "string";
160
- readonly title: "System Prompt";
161
- readonly description: "Optional system instructions for the model";
162
- };
163
- readonly messages: {
164
- readonly type: "array";
165
- readonly title: "Messages";
166
- readonly description: "Full conversation history for multi-turn interactions. When provided, used instead of prompt to construct the messages array sent to the provider.";
167
- readonly items: {
168
- readonly type: "object";
169
- readonly properties: {
170
- readonly role: {
171
- readonly type: "string";
172
- readonly enum: readonly ["user", "assistant", "tool"];
173
- };
174
- readonly content: {};
175
- };
176
- readonly required: readonly ["role", "content"];
177
- readonly additionalProperties: true;
178
- };
179
- };
180
- readonly tools: {
181
- readonly type: "array";
182
- readonly format: "tasks";
183
- readonly title: "Tools";
184
- readonly description: "Tool definitions available for the model to call";
185
- readonly items: {
186
- readonly oneOf: readonly [{
187
- readonly type: "string";
188
- readonly format: "tasks";
189
- readonly description: "Task type name";
190
- }, {
191
- readonly type: "object";
192
- readonly properties: {
193
- readonly name: {
194
- readonly type: "string";
195
- readonly title: "Name";
196
- readonly description: "The tool name";
197
- };
198
- readonly description: {
199
- readonly type: "string";
200
- readonly title: "Description";
201
- readonly description: "A description of what the tool does";
202
- };
203
- readonly inputSchema: {
204
- readonly type: "object";
205
- readonly title: "Input Schema";
206
- readonly description: "JSON Schema describing the tool's input parameters";
207
- readonly additionalProperties: true;
208
- };
209
- readonly outputSchema: {
210
- readonly type: "object";
211
- readonly title: "Output Schema";
212
- readonly description: "JSON Schema describing what the tool returns";
213
- readonly additionalProperties: true;
214
- };
215
- readonly configSchema: {
216
- readonly type: "object";
217
- readonly title: "Config Schema";
218
- readonly description: "JSON Schema describing the task's configuration options (not sent to the LLM)";
219
- readonly additionalProperties: true;
220
- };
221
- readonly config: {
222
- readonly type: "object";
223
- readonly title: "Config";
224
- readonly description: "Concrete configuration values for the backing task (not sent to the LLM)";
225
- readonly additionalProperties: true;
226
- };
227
- };
228
- readonly required: readonly ["name", "description", "inputSchema"];
229
- readonly additionalProperties: true;
230
- }];
231
- };
232
- };
233
- readonly toolChoice: {
234
- readonly type: "string";
235
- readonly title: "Tool Choice";
236
- readonly description: "Controls tool selection: \"auto\" (model decides), \"none\" (no tools), \"required\" (must call a tool), or a specific tool name";
237
- readonly "x-ui-group": "Configuration";
238
- };
239
- readonly maxTokens: {
240
- readonly type: "number";
241
- readonly title: "Max Tokens";
242
- readonly description: "The maximum number of tokens to generate";
243
- readonly minimum: 1;
244
- readonly "x-ui-group": "Configuration";
245
- };
246
- readonly temperature: {
247
- readonly type: "number";
248
- readonly title: "Temperature";
249
- readonly description: "The temperature to use for sampling";
250
- readonly minimum: 0;
251
- readonly maximum: 2;
252
- readonly "x-ui-group": "Configuration";
253
- };
254
- };
255
- readonly required: readonly ["model", "prompt", "tools"];
256
- readonly additionalProperties: false;
257
- };
258
- export declare const ToolCallingOutputSchema: {
259
- readonly type: "object";
260
- readonly properties: {
261
- readonly text: {
262
- readonly anyOf: readonly [{
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 type: "array";
269
- readonly items: {
270
- readonly type: "string";
271
- readonly title: "Text";
272
- readonly description: "Any text content generated by the model";
273
- readonly "x-stream": "append";
274
- };
275
- }];
276
- };
277
- readonly toolCalls: {
278
- readonly anyOf: readonly [{
279
- readonly type: "object";
280
- readonly properties: {
281
- readonly id: {
282
- readonly type: "string";
283
- readonly title: "ID";
284
- readonly description: "Unique identifier for this tool call";
285
- };
286
- readonly name: {
287
- readonly type: "string";
288
- readonly title: "Name";
289
- readonly description: "The name of the tool to invoke";
290
- };
291
- readonly input: {
292
- readonly type: "object";
293
- readonly title: "Input";
294
- readonly description: "The input arguments for the tool call";
295
- readonly additionalProperties: true;
296
- };
297
- };
298
- readonly required: readonly ["id", "name", "input"];
299
- readonly additionalProperties: false;
300
- readonly "x-stream": "object";
301
- }, {
302
- readonly type: "array";
303
- readonly items: {
304
- readonly type: "object";
305
- readonly properties: {
306
- readonly id: {
307
- readonly type: "string";
308
- readonly title: "ID";
309
- readonly description: "Unique identifier for this tool call";
310
- };
311
- readonly name: {
312
- readonly type: "string";
313
- readonly title: "Name";
314
- readonly description: "The name of the tool to invoke";
315
- };
316
- readonly input: {
317
- readonly type: "object";
318
- readonly title: "Input";
319
- readonly description: "The input arguments for the tool call";
320
- readonly additionalProperties: true;
321
- };
322
- };
323
- readonly required: readonly ["id", "name", "input"];
324
- readonly additionalProperties: false;
325
- readonly "x-stream": "object";
326
- };
327
- }];
328
- };
329
- };
330
- readonly required: readonly ["text", "toolCalls"];
331
- readonly additionalProperties: false;
332
- };
333
- /**
334
- * Runtime input type for ToolCallingTask.
335
- *
336
- * The schema uses `oneOf: [string, object]` so the UI can accept both task-name
337
- * references and inline tool definitions, but the input resolver converts all
338
- * strings to {@link ToolDefinition} objects before execution. The `tools` field
339
- * is therefore narrowed to `ToolDefinition[]` here.
340
- *
341
- * Extends the schema-derived base with the
342
- * `messages` field typed explicitly (the loose `content: {}` in the
343
- * schema prevents `FromSchema` from producing a useful type).
344
- */
345
- export type ToolCallingTaskInput = Omit<FromSchema<typeof ToolCallingInputSchema>, "tools"> & {
346
- readonly tools: ToolDefinition[];
347
- readonly messages?: ReadonlyArray<{
348
- readonly role: "user" | "assistant" | "tool";
349
- readonly content: unknown;
350
- }>;
351
- };
352
- export type ToolCallingTaskOutput = FromSchema<typeof ToolCallingOutputSchema>;
353
- export declare class ToolCallingTask extends StreamingAiTask<ToolCallingTaskInput, ToolCallingTaskOutput, JobQueueTaskConfig> {
354
- static type: string;
355
- static category: string;
356
- static title: string;
357
- static description: string;
358
- static inputSchema(): DataPortSchema;
359
- static outputSchema(): DataPortSchema;
360
- }
361
- /**
362
- * Convenience function to run a tool calling task.
363
- */
364
- export declare const toolCalling: (input: ToolCallingTaskInput, config?: JobQueueTaskConfig | undefined) => Promise<{
365
- text: string | string[];
366
- toolCalls: {
367
- id: string;
368
- input: {
369
- [x: string]: unknown;
370
- };
371
- name: string;
372
- }[] | {
373
- id: string;
374
- input: {
375
- [x: string]: unknown;
376
- };
377
- name: string;
378
- };
379
- }>;
380
- declare module "@workglow/task-graph" {
381
- interface Workflow {
382
- toolCalling: CreateWorkflow<ToolCallingTaskInput, ToolCallingTaskOutput, JobQueueTaskConfig>;
383
- }
384
- }
385
- //# sourceMappingURL=ToolCallingTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolCallingTask.d.ts","sourceRoot":"","sources":["../../src/task/ToolCallingTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EAEd,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,MAAM,WAAW,0BAA2B,SAAQ,cAAc;IAChE,6DAA6D;IAC7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,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAkB;IACrC,OAAc,WAAW,SACkG;IAC3H,OAAc,WAAW,IAAI,cAAc,CAE1C;IACD,OAAc,YAAY,IAAI,cAAc,CAE3C;CACF;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAEvB,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC,CAAC;IACrC,UAAU,QAAQ;QAChB,WAAW,EAAE,cAAc,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;KAC9F;CACF"}
@@ -1,65 +0,0 @@
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
- /** JSON Schema describing the task's configuration options. */
24
- configSchema?: JsonSchema;
25
- /** Concrete configuration values matching {@link configSchema}. */
26
- config?: Record<string, unknown>;
27
- /**
28
- * Optional custom executor function. When provided, the tool is executed
29
- * by calling this function directly instead of instantiating a Task.
30
- */
31
- execute?: (input: Record<string, unknown>) => Promise<Record<string, unknown>>;
32
- }
33
- /**
34
- * A tool call returned by the LLM, requesting invocation of a specific tool.
35
- */
36
- export interface ToolCall {
37
- id: string;
38
- name: string;
39
- input: Record<string, unknown>;
40
- }
41
- export type ToolCalls = Array<ToolCall>;
42
- /**
43
- * Controls which tools the model may call.
44
- * - `"auto"` — model decides whether to call tools
45
- * - `"none"` — model must not call any tools
46
- * - `"required"` — model must call at least one tool
47
- * - any other string — model must call the tool with that name
48
- */
49
- export type ToolChoiceOption = "auto" | "none" | "required" | (string & {});
50
- /**
51
- * Builds a tool description string for provider APIs, appending the output
52
- * schema when present. Shared across all provider implementations.
53
- */
54
- export declare function buildToolDescription(tool: ToolDefinition): string;
55
- /**
56
- * Validates that a tool call name returned by the LLM matches one of the
57
- * allowed tool definitions. Returns true if valid, false otherwise.
58
- */
59
- export declare function isAllowedToolName(name: string, allowedTools: ReadonlyArray<ToolDefinition>): boolean;
60
- /**
61
- * Filters an array of tool calls, removing any whose name does not appear
62
- * in the provided tools list. Returns the filtered array.
63
- */
64
- export declare function filterValidToolCalls(toolCalls: ToolCalls, allowedTools: ReadonlyArray<ToolDefinition>): ToolCalls;
65
- //# sourceMappingURL=ToolCallingUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ToolCallingUtils.d.ts","sourceRoot":"","sources":["../../src/task/ToolCallingUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;;;;;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,+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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