@workglow/ai 0.2.8 → 0.2.9
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.
- package/dist/browser.js +652 -209
- package/dist/browser.js.map +14 -12
- package/dist/bun.js +652 -209
- package/dist/bun.js.map +14 -12
- package/dist/execution/QueuedExecutionStrategy.d.ts +14 -5
- package/dist/execution/QueuedExecutionStrategy.d.ts.map +1 -1
- package/dist/node.js +652 -209
- package/dist/node.js.map +14 -12
- package/dist/task/AiChatTask.d.ts +666 -0
- package/dist/task/AiChatTask.d.ts.map +1 -0
- package/dist/task/ChatMessage.d.ts +356 -0
- package/dist/task/ChatMessage.d.ts.map +1 -0
- package/dist/task/MessageConversion.d.ts +1 -9
- package/dist/task/MessageConversion.d.ts.map +1 -1
- package/dist/task/StructuredGenerationTask.d.ts +50 -3
- package/dist/task/StructuredGenerationTask.d.ts.map +1 -1
- package/dist/task/ToolCallingTask.d.ts +162 -8
- package/dist/task/ToolCallingTask.d.ts.map +1 -1
- package/dist/task/index.d.ts +6 -3
- package/dist/task/index.d.ts.map +1 -1
- package/dist/worker.js +42 -91
- package/dist/worker.js.map +3 -3
- package/package.json +11 -11
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { IExecuteContext, StreamEvent } from "@workglow/task-graph";
|
|
7
|
+
import type { DataPortSchema, FromSchema } from "@workglow/util/schema";
|
|
8
|
+
import type { AiJobInput } from "../job/AiJob";
|
|
9
|
+
import { StreamingAiTask } from "./base/StreamingAiTask";
|
|
10
|
+
import type { ChatMessage } from "./ChatMessage";
|
|
11
|
+
export declare const AiChatInputSchema: {
|
|
12
|
+
readonly type: "object";
|
|
13
|
+
readonly properties: {
|
|
14
|
+
readonly model: {
|
|
15
|
+
readonly oneOf: readonly [{
|
|
16
|
+
readonly title: "Model";
|
|
17
|
+
readonly description: `The model ${string}`;
|
|
18
|
+
} & {
|
|
19
|
+
readonly format: import(".").TypeModelSemantic;
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
}, {
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly properties: {
|
|
24
|
+
readonly model_id: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
};
|
|
27
|
+
readonly tasks: {
|
|
28
|
+
readonly type: "array";
|
|
29
|
+
readonly items: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
};
|
|
32
|
+
readonly "x-ui-editor": "multiselect";
|
|
33
|
+
};
|
|
34
|
+
readonly title: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
};
|
|
37
|
+
readonly description: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly "x-ui-editor": "textarea";
|
|
40
|
+
};
|
|
41
|
+
readonly provider: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
};
|
|
44
|
+
readonly provider_config: {
|
|
45
|
+
readonly type: "object";
|
|
46
|
+
readonly properties: {
|
|
47
|
+
readonly credential_key: {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
readonly format: "credential";
|
|
50
|
+
readonly "x-ui-hidden": true;
|
|
51
|
+
};
|
|
52
|
+
readonly native_dimensions: {
|
|
53
|
+
readonly type: "integer";
|
|
54
|
+
readonly description: "Native output vector dimensions for embedding models";
|
|
55
|
+
};
|
|
56
|
+
readonly mrl: {
|
|
57
|
+
readonly type: "boolean";
|
|
58
|
+
readonly description: "Whether the model supports Matryoshka Representation Learning";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly additionalProperties: true;
|
|
62
|
+
readonly default: {};
|
|
63
|
+
};
|
|
64
|
+
readonly metadata: {
|
|
65
|
+
readonly type: "object";
|
|
66
|
+
readonly default: {};
|
|
67
|
+
readonly "x-ui-hidden": true;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
readonly required: readonly ["provider", "provider_config"];
|
|
71
|
+
readonly format: "model";
|
|
72
|
+
readonly additionalProperties: true;
|
|
73
|
+
} & {
|
|
74
|
+
readonly format: import(".").TypeModelSemantic;
|
|
75
|
+
}];
|
|
76
|
+
} & {
|
|
77
|
+
readonly format: import(".").TypeModelSemantic;
|
|
78
|
+
};
|
|
79
|
+
readonly prompt: {
|
|
80
|
+
readonly oneOf: readonly [{
|
|
81
|
+
readonly type: "string";
|
|
82
|
+
readonly title: "Prompt";
|
|
83
|
+
readonly description: "The initial user message";
|
|
84
|
+
}, {
|
|
85
|
+
readonly type: "array";
|
|
86
|
+
readonly title: "Prompt";
|
|
87
|
+
readonly description: "The initial user message as structured content blocks";
|
|
88
|
+
readonly items: {
|
|
89
|
+
readonly oneOf: readonly [{
|
|
90
|
+
readonly type: "object";
|
|
91
|
+
readonly properties: {
|
|
92
|
+
readonly type: {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly enum: readonly ["text"];
|
|
95
|
+
};
|
|
96
|
+
readonly text: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
readonly required: readonly ["type", "text"];
|
|
101
|
+
readonly additionalProperties: false;
|
|
102
|
+
}, {
|
|
103
|
+
readonly type: "object";
|
|
104
|
+
readonly properties: {
|
|
105
|
+
readonly type: {
|
|
106
|
+
readonly type: "string";
|
|
107
|
+
readonly enum: readonly ["image"];
|
|
108
|
+
};
|
|
109
|
+
readonly mimeType: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
};
|
|
112
|
+
readonly data: {
|
|
113
|
+
readonly type: "string";
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
readonly required: readonly ["type", "mimeType", "data"];
|
|
117
|
+
readonly additionalProperties: false;
|
|
118
|
+
}, {
|
|
119
|
+
readonly type: "object";
|
|
120
|
+
readonly properties: {
|
|
121
|
+
readonly type: {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
readonly enum: readonly ["tool_use"];
|
|
124
|
+
};
|
|
125
|
+
readonly id: {
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
};
|
|
128
|
+
readonly name: {
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
};
|
|
131
|
+
readonly input: {
|
|
132
|
+
readonly type: "object";
|
|
133
|
+
readonly additionalProperties: true;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
readonly required: readonly ["type", "id", "name", "input"];
|
|
137
|
+
readonly additionalProperties: false;
|
|
138
|
+
}, {
|
|
139
|
+
readonly type: "object";
|
|
140
|
+
readonly properties: {
|
|
141
|
+
readonly type: {
|
|
142
|
+
readonly type: "string";
|
|
143
|
+
readonly enum: readonly ["tool_result"];
|
|
144
|
+
};
|
|
145
|
+
readonly tool_use_id: {
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
};
|
|
148
|
+
readonly content: {
|
|
149
|
+
readonly type: "array";
|
|
150
|
+
readonly items: {
|
|
151
|
+
readonly $ref: "#/definitions/ContentBlock";
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
readonly is_error: {
|
|
155
|
+
readonly type: "boolean";
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
readonly required: readonly ["type", "tool_use_id", "content"];
|
|
159
|
+
readonly additionalProperties: false;
|
|
160
|
+
}];
|
|
161
|
+
readonly definitions: {
|
|
162
|
+
readonly ContentBlock: {
|
|
163
|
+
readonly oneOf: readonly [{
|
|
164
|
+
readonly type: "object";
|
|
165
|
+
readonly properties: {
|
|
166
|
+
readonly type: {
|
|
167
|
+
readonly type: "string";
|
|
168
|
+
readonly enum: readonly ["text"];
|
|
169
|
+
};
|
|
170
|
+
readonly text: {
|
|
171
|
+
readonly type: "string";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly required: readonly ["type", "text"];
|
|
175
|
+
readonly additionalProperties: false;
|
|
176
|
+
}, {
|
|
177
|
+
readonly type: "object";
|
|
178
|
+
readonly properties: {
|
|
179
|
+
readonly type: {
|
|
180
|
+
readonly type: "string";
|
|
181
|
+
readonly enum: readonly ["image"];
|
|
182
|
+
};
|
|
183
|
+
readonly mimeType: {
|
|
184
|
+
readonly type: "string";
|
|
185
|
+
};
|
|
186
|
+
readonly data: {
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly required: readonly ["type", "mimeType", "data"];
|
|
191
|
+
readonly additionalProperties: false;
|
|
192
|
+
}, {
|
|
193
|
+
readonly type: "object";
|
|
194
|
+
readonly properties: {
|
|
195
|
+
readonly type: {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
readonly enum: readonly ["tool_use"];
|
|
198
|
+
};
|
|
199
|
+
readonly id: {
|
|
200
|
+
readonly type: "string";
|
|
201
|
+
};
|
|
202
|
+
readonly name: {
|
|
203
|
+
readonly type: "string";
|
|
204
|
+
};
|
|
205
|
+
readonly input: {
|
|
206
|
+
readonly type: "object";
|
|
207
|
+
readonly additionalProperties: true;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
readonly required: readonly ["type", "id", "name", "input"];
|
|
211
|
+
readonly additionalProperties: false;
|
|
212
|
+
}, {
|
|
213
|
+
readonly type: "object";
|
|
214
|
+
readonly properties: {
|
|
215
|
+
readonly type: {
|
|
216
|
+
readonly type: "string";
|
|
217
|
+
readonly enum: readonly ["tool_result"];
|
|
218
|
+
};
|
|
219
|
+
readonly tool_use_id: {
|
|
220
|
+
readonly type: "string";
|
|
221
|
+
};
|
|
222
|
+
readonly content: {
|
|
223
|
+
readonly type: "array";
|
|
224
|
+
readonly items: {
|
|
225
|
+
readonly $ref: "#/definitions/ContentBlock";
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
readonly is_error: {
|
|
229
|
+
readonly type: "boolean";
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
readonly required: readonly ["type", "tool_use_id", "content"];
|
|
233
|
+
readonly additionalProperties: false;
|
|
234
|
+
}];
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
readonly title: "ContentBlock";
|
|
238
|
+
readonly description: "A single content block within a chat message";
|
|
239
|
+
};
|
|
240
|
+
}];
|
|
241
|
+
readonly title: "Prompt";
|
|
242
|
+
readonly description: "The first user message to start the conversation";
|
|
243
|
+
};
|
|
244
|
+
readonly messages: {
|
|
245
|
+
readonly type: "array";
|
|
246
|
+
readonly title: "Messages";
|
|
247
|
+
readonly description: "Conversation history (managed internally by the chat loop; not a user-facing input)";
|
|
248
|
+
readonly items: {
|
|
249
|
+
readonly type: "object";
|
|
250
|
+
readonly properties: {
|
|
251
|
+
readonly role: {
|
|
252
|
+
readonly type: "string";
|
|
253
|
+
readonly enum: readonly ["user", "assistant", "tool", "system"];
|
|
254
|
+
};
|
|
255
|
+
readonly content: {
|
|
256
|
+
readonly type: "array";
|
|
257
|
+
readonly items: {
|
|
258
|
+
readonly oneOf: readonly [{
|
|
259
|
+
readonly type: "object";
|
|
260
|
+
readonly properties: {
|
|
261
|
+
readonly type: {
|
|
262
|
+
readonly type: "string";
|
|
263
|
+
readonly enum: readonly ["text"];
|
|
264
|
+
};
|
|
265
|
+
readonly text: {
|
|
266
|
+
readonly type: "string";
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
readonly required: readonly ["type", "text"];
|
|
270
|
+
readonly additionalProperties: false;
|
|
271
|
+
}, {
|
|
272
|
+
readonly type: "object";
|
|
273
|
+
readonly properties: {
|
|
274
|
+
readonly type: {
|
|
275
|
+
readonly type: "string";
|
|
276
|
+
readonly enum: readonly ["image"];
|
|
277
|
+
};
|
|
278
|
+
readonly mimeType: {
|
|
279
|
+
readonly type: "string";
|
|
280
|
+
};
|
|
281
|
+
readonly data: {
|
|
282
|
+
readonly type: "string";
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
readonly required: readonly ["type", "mimeType", "data"];
|
|
286
|
+
readonly additionalProperties: false;
|
|
287
|
+
}, {
|
|
288
|
+
readonly type: "object";
|
|
289
|
+
readonly properties: {
|
|
290
|
+
readonly type: {
|
|
291
|
+
readonly type: "string";
|
|
292
|
+
readonly enum: readonly ["tool_use"];
|
|
293
|
+
};
|
|
294
|
+
readonly id: {
|
|
295
|
+
readonly type: "string";
|
|
296
|
+
};
|
|
297
|
+
readonly name: {
|
|
298
|
+
readonly type: "string";
|
|
299
|
+
};
|
|
300
|
+
readonly input: {
|
|
301
|
+
readonly type: "object";
|
|
302
|
+
readonly additionalProperties: true;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
readonly required: readonly ["type", "id", "name", "input"];
|
|
306
|
+
readonly additionalProperties: false;
|
|
307
|
+
}, {
|
|
308
|
+
readonly type: "object";
|
|
309
|
+
readonly properties: {
|
|
310
|
+
readonly type: {
|
|
311
|
+
readonly type: "string";
|
|
312
|
+
readonly enum: readonly ["tool_result"];
|
|
313
|
+
};
|
|
314
|
+
readonly tool_use_id: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
};
|
|
317
|
+
readonly content: {
|
|
318
|
+
readonly type: "array";
|
|
319
|
+
readonly items: {
|
|
320
|
+
readonly $ref: "#/definitions/ContentBlock";
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
readonly is_error: {
|
|
324
|
+
readonly type: "boolean";
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
readonly required: readonly ["type", "tool_use_id", "content"];
|
|
328
|
+
readonly additionalProperties: false;
|
|
329
|
+
}];
|
|
330
|
+
readonly definitions: {
|
|
331
|
+
readonly ContentBlock: {
|
|
332
|
+
readonly oneOf: readonly [{
|
|
333
|
+
readonly type: "object";
|
|
334
|
+
readonly properties: {
|
|
335
|
+
readonly type: {
|
|
336
|
+
readonly type: "string";
|
|
337
|
+
readonly enum: readonly ["text"];
|
|
338
|
+
};
|
|
339
|
+
readonly text: {
|
|
340
|
+
readonly type: "string";
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
readonly required: readonly ["type", "text"];
|
|
344
|
+
readonly additionalProperties: false;
|
|
345
|
+
}, {
|
|
346
|
+
readonly type: "object";
|
|
347
|
+
readonly properties: {
|
|
348
|
+
readonly type: {
|
|
349
|
+
readonly type: "string";
|
|
350
|
+
readonly enum: readonly ["image"];
|
|
351
|
+
};
|
|
352
|
+
readonly mimeType: {
|
|
353
|
+
readonly type: "string";
|
|
354
|
+
};
|
|
355
|
+
readonly data: {
|
|
356
|
+
readonly type: "string";
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
readonly required: readonly ["type", "mimeType", "data"];
|
|
360
|
+
readonly additionalProperties: false;
|
|
361
|
+
}, {
|
|
362
|
+
readonly type: "object";
|
|
363
|
+
readonly properties: {
|
|
364
|
+
readonly type: {
|
|
365
|
+
readonly type: "string";
|
|
366
|
+
readonly enum: readonly ["tool_use"];
|
|
367
|
+
};
|
|
368
|
+
readonly id: {
|
|
369
|
+
readonly type: "string";
|
|
370
|
+
};
|
|
371
|
+
readonly name: {
|
|
372
|
+
readonly type: "string";
|
|
373
|
+
};
|
|
374
|
+
readonly input: {
|
|
375
|
+
readonly type: "object";
|
|
376
|
+
readonly additionalProperties: true;
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
readonly required: readonly ["type", "id", "name", "input"];
|
|
380
|
+
readonly additionalProperties: false;
|
|
381
|
+
}, {
|
|
382
|
+
readonly type: "object";
|
|
383
|
+
readonly properties: {
|
|
384
|
+
readonly type: {
|
|
385
|
+
readonly type: "string";
|
|
386
|
+
readonly enum: readonly ["tool_result"];
|
|
387
|
+
};
|
|
388
|
+
readonly tool_use_id: {
|
|
389
|
+
readonly type: "string";
|
|
390
|
+
};
|
|
391
|
+
readonly content: {
|
|
392
|
+
readonly type: "array";
|
|
393
|
+
readonly items: {
|
|
394
|
+
readonly $ref: "#/definitions/ContentBlock";
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
readonly is_error: {
|
|
398
|
+
readonly type: "boolean";
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
readonly required: readonly ["type", "tool_use_id", "content"];
|
|
402
|
+
readonly additionalProperties: false;
|
|
403
|
+
}];
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
readonly title: "ContentBlock";
|
|
407
|
+
readonly description: "A single content block within a chat message";
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
readonly required: readonly ["role", "content"];
|
|
412
|
+
readonly additionalProperties: false;
|
|
413
|
+
readonly title: "ChatMessage";
|
|
414
|
+
readonly description: "A single chat message with role and structured content blocks";
|
|
415
|
+
};
|
|
416
|
+
readonly "x-ui-hidden": true;
|
|
417
|
+
};
|
|
418
|
+
readonly systemPrompt: {
|
|
419
|
+
readonly type: "string";
|
|
420
|
+
readonly title: "System Prompt";
|
|
421
|
+
readonly description: "Optional system instructions for the model";
|
|
422
|
+
};
|
|
423
|
+
readonly maxTokens: {
|
|
424
|
+
readonly type: "number";
|
|
425
|
+
readonly title: "Max Tokens";
|
|
426
|
+
readonly description: "Per-turn token limit";
|
|
427
|
+
readonly minimum: 1;
|
|
428
|
+
readonly "x-ui-group": "Configuration";
|
|
429
|
+
};
|
|
430
|
+
readonly temperature: {
|
|
431
|
+
readonly type: "number";
|
|
432
|
+
readonly title: "Temperature";
|
|
433
|
+
readonly description: "Sampling temperature";
|
|
434
|
+
readonly minimum: 0;
|
|
435
|
+
readonly maximum: 2;
|
|
436
|
+
readonly "x-ui-group": "Configuration";
|
|
437
|
+
};
|
|
438
|
+
readonly maxIterations: {
|
|
439
|
+
readonly type: "number";
|
|
440
|
+
readonly title: "Max Iterations";
|
|
441
|
+
readonly description: "Safety cap on conversation turns";
|
|
442
|
+
readonly minimum: 1;
|
|
443
|
+
readonly default: 100;
|
|
444
|
+
readonly "x-ui-group": "Configuration";
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
readonly required: readonly ["model", "prompt"];
|
|
448
|
+
readonly additionalProperties: false;
|
|
449
|
+
};
|
|
450
|
+
export declare const AiChatOutputSchema: {
|
|
451
|
+
readonly type: "object";
|
|
452
|
+
readonly properties: {
|
|
453
|
+
readonly text: {
|
|
454
|
+
readonly type: "string";
|
|
455
|
+
readonly title: "Text";
|
|
456
|
+
readonly description: "Last assistant response";
|
|
457
|
+
readonly "x-stream": "append";
|
|
458
|
+
};
|
|
459
|
+
readonly messages: {
|
|
460
|
+
readonly type: "array";
|
|
461
|
+
readonly title: "Messages";
|
|
462
|
+
readonly description: "Full conversation history";
|
|
463
|
+
readonly items: {
|
|
464
|
+
readonly type: "object";
|
|
465
|
+
readonly properties: {
|
|
466
|
+
readonly role: {
|
|
467
|
+
readonly type: "string";
|
|
468
|
+
readonly enum: readonly ["user", "assistant", "tool", "system"];
|
|
469
|
+
};
|
|
470
|
+
readonly content: {
|
|
471
|
+
readonly type: "array";
|
|
472
|
+
readonly items: {
|
|
473
|
+
readonly oneOf: readonly [{
|
|
474
|
+
readonly type: "object";
|
|
475
|
+
readonly properties: {
|
|
476
|
+
readonly type: {
|
|
477
|
+
readonly type: "string";
|
|
478
|
+
readonly enum: readonly ["text"];
|
|
479
|
+
};
|
|
480
|
+
readonly text: {
|
|
481
|
+
readonly type: "string";
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
readonly required: readonly ["type", "text"];
|
|
485
|
+
readonly additionalProperties: false;
|
|
486
|
+
}, {
|
|
487
|
+
readonly type: "object";
|
|
488
|
+
readonly properties: {
|
|
489
|
+
readonly type: {
|
|
490
|
+
readonly type: "string";
|
|
491
|
+
readonly enum: readonly ["image"];
|
|
492
|
+
};
|
|
493
|
+
readonly mimeType: {
|
|
494
|
+
readonly type: "string";
|
|
495
|
+
};
|
|
496
|
+
readonly data: {
|
|
497
|
+
readonly type: "string";
|
|
498
|
+
};
|
|
499
|
+
};
|
|
500
|
+
readonly required: readonly ["type", "mimeType", "data"];
|
|
501
|
+
readonly additionalProperties: false;
|
|
502
|
+
}, {
|
|
503
|
+
readonly type: "object";
|
|
504
|
+
readonly properties: {
|
|
505
|
+
readonly type: {
|
|
506
|
+
readonly type: "string";
|
|
507
|
+
readonly enum: readonly ["tool_use"];
|
|
508
|
+
};
|
|
509
|
+
readonly id: {
|
|
510
|
+
readonly type: "string";
|
|
511
|
+
};
|
|
512
|
+
readonly name: {
|
|
513
|
+
readonly type: "string";
|
|
514
|
+
};
|
|
515
|
+
readonly input: {
|
|
516
|
+
readonly type: "object";
|
|
517
|
+
readonly additionalProperties: true;
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
readonly required: readonly ["type", "id", "name", "input"];
|
|
521
|
+
readonly additionalProperties: false;
|
|
522
|
+
}, {
|
|
523
|
+
readonly type: "object";
|
|
524
|
+
readonly properties: {
|
|
525
|
+
readonly type: {
|
|
526
|
+
readonly type: "string";
|
|
527
|
+
readonly enum: readonly ["tool_result"];
|
|
528
|
+
};
|
|
529
|
+
readonly tool_use_id: {
|
|
530
|
+
readonly type: "string";
|
|
531
|
+
};
|
|
532
|
+
readonly content: {
|
|
533
|
+
readonly type: "array";
|
|
534
|
+
readonly items: {
|
|
535
|
+
readonly $ref: "#/definitions/ContentBlock";
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
readonly is_error: {
|
|
539
|
+
readonly type: "boolean";
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
readonly required: readonly ["type", "tool_use_id", "content"];
|
|
543
|
+
readonly additionalProperties: false;
|
|
544
|
+
}];
|
|
545
|
+
readonly definitions: {
|
|
546
|
+
readonly ContentBlock: {
|
|
547
|
+
readonly oneOf: readonly [{
|
|
548
|
+
readonly type: "object";
|
|
549
|
+
readonly properties: {
|
|
550
|
+
readonly type: {
|
|
551
|
+
readonly type: "string";
|
|
552
|
+
readonly enum: readonly ["text"];
|
|
553
|
+
};
|
|
554
|
+
readonly text: {
|
|
555
|
+
readonly type: "string";
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
readonly required: readonly ["type", "text"];
|
|
559
|
+
readonly additionalProperties: false;
|
|
560
|
+
}, {
|
|
561
|
+
readonly type: "object";
|
|
562
|
+
readonly properties: {
|
|
563
|
+
readonly type: {
|
|
564
|
+
readonly type: "string";
|
|
565
|
+
readonly enum: readonly ["image"];
|
|
566
|
+
};
|
|
567
|
+
readonly mimeType: {
|
|
568
|
+
readonly type: "string";
|
|
569
|
+
};
|
|
570
|
+
readonly data: {
|
|
571
|
+
readonly type: "string";
|
|
572
|
+
};
|
|
573
|
+
};
|
|
574
|
+
readonly required: readonly ["type", "mimeType", "data"];
|
|
575
|
+
readonly additionalProperties: false;
|
|
576
|
+
}, {
|
|
577
|
+
readonly type: "object";
|
|
578
|
+
readonly properties: {
|
|
579
|
+
readonly type: {
|
|
580
|
+
readonly type: "string";
|
|
581
|
+
readonly enum: readonly ["tool_use"];
|
|
582
|
+
};
|
|
583
|
+
readonly id: {
|
|
584
|
+
readonly type: "string";
|
|
585
|
+
};
|
|
586
|
+
readonly name: {
|
|
587
|
+
readonly type: "string";
|
|
588
|
+
};
|
|
589
|
+
readonly input: {
|
|
590
|
+
readonly type: "object";
|
|
591
|
+
readonly additionalProperties: true;
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
readonly required: readonly ["type", "id", "name", "input"];
|
|
595
|
+
readonly additionalProperties: false;
|
|
596
|
+
}, {
|
|
597
|
+
readonly type: "object";
|
|
598
|
+
readonly properties: {
|
|
599
|
+
readonly type: {
|
|
600
|
+
readonly type: "string";
|
|
601
|
+
readonly enum: readonly ["tool_result"];
|
|
602
|
+
};
|
|
603
|
+
readonly tool_use_id: {
|
|
604
|
+
readonly type: "string";
|
|
605
|
+
};
|
|
606
|
+
readonly content: {
|
|
607
|
+
readonly type: "array";
|
|
608
|
+
readonly items: {
|
|
609
|
+
readonly $ref: "#/definitions/ContentBlock";
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
readonly is_error: {
|
|
613
|
+
readonly type: "boolean";
|
|
614
|
+
};
|
|
615
|
+
};
|
|
616
|
+
readonly required: readonly ["type", "tool_use_id", "content"];
|
|
617
|
+
readonly additionalProperties: false;
|
|
618
|
+
}];
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
readonly title: "ContentBlock";
|
|
622
|
+
readonly description: "A single content block within a chat message";
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
readonly required: readonly ["role", "content"];
|
|
627
|
+
readonly additionalProperties: false;
|
|
628
|
+
readonly title: "ChatMessage";
|
|
629
|
+
readonly description: "A single chat message with role and structured content blocks";
|
|
630
|
+
};
|
|
631
|
+
readonly "x-stream": "object";
|
|
632
|
+
};
|
|
633
|
+
readonly iterations: {
|
|
634
|
+
readonly type: "number";
|
|
635
|
+
readonly title: "Iterations";
|
|
636
|
+
readonly description: "Number of completed turns";
|
|
637
|
+
};
|
|
638
|
+
};
|
|
639
|
+
readonly required: readonly ["text", "messages", "iterations"];
|
|
640
|
+
readonly additionalProperties: false;
|
|
641
|
+
};
|
|
642
|
+
export type AiChatTaskInput = Omit<FromSchema<typeof AiChatInputSchema>, "messages"> & {
|
|
643
|
+
readonly messages?: ReadonlyArray<ChatMessage>;
|
|
644
|
+
};
|
|
645
|
+
export type AiChatTaskOutput = FromSchema<typeof AiChatOutputSchema>;
|
|
646
|
+
/** Provider-facing input: same structural type as AiChatTaskInput, named separately for intent. */
|
|
647
|
+
export type AiChatProviderInput = AiChatTaskInput;
|
|
648
|
+
export interface AiChatProviderOutput {
|
|
649
|
+
readonly text: string;
|
|
650
|
+
[key: string]: unknown;
|
|
651
|
+
}
|
|
652
|
+
export declare class AiChatTask extends StreamingAiTask<AiChatTaskInput, AiChatTaskOutput> {
|
|
653
|
+
static type: string;
|
|
654
|
+
static category: string;
|
|
655
|
+
static title: string;
|
|
656
|
+
static description: string;
|
|
657
|
+
static cacheable: boolean;
|
|
658
|
+
static configSchema(): DataPortSchema;
|
|
659
|
+
static inputSchema(): DataPortSchema;
|
|
660
|
+
static outputSchema(): DataPortSchema;
|
|
661
|
+
private _sessionId;
|
|
662
|
+
protected getJobInput(input: AiChatTaskInput): Promise<AiJobInput<AiChatTaskInput>>;
|
|
663
|
+
executeStream(input: AiChatTaskInput, context: IExecuteContext): AsyncIterable<StreamEvent<AiChatTaskOutput>>;
|
|
664
|
+
execute(input: AiChatTaskInput, context: IExecuteContext): Promise<AiChatTaskOutput | undefined>;
|
|
665
|
+
}
|
|
666
|
+
//# sourceMappingURL=AiChatTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AiChatTask.d.ts","sourceRoot":"","sources":["../../src/task/AiChatTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,eAAe,CAAC;AAmC/D,eAAO,MAAM,iBAAiB;mBACtB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAKA,QAAQ;gCAAS,QAAQ;sCAAe,0BAA0B;;+BAElE,OAAO;gCACN,QAAQ;sCACF,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAIjE,QAAQ;kCACF,kDAAkD;;;qBAG/D,IAAI,EAAE,OAAO;qBACb,KAAK,EAAE,UAAU;qBACjB,WAAW,EACT,qFAAqF;qBACvF,KAAK;;;;;;;;;;;;;;;;;;;;;;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