@positronic/client-vercel 0.0.63 → 0.0.64
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/src/index.js +399 -580
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/src/index.js
CHANGED
|
@@ -70,13 +70,6 @@ function _define_property(obj, key, value) {
|
|
|
70
70
|
}
|
|
71
71
|
return obj;
|
|
72
72
|
}
|
|
73
|
-
function _instanceof(left, right) {
|
|
74
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
75
|
-
return !!right[Symbol.hasInstance](left);
|
|
76
|
-
} else {
|
|
77
|
-
return left instanceof right;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
73
|
function _iterable_to_array(iter) {
|
|
81
74
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
82
75
|
}
|
|
@@ -110,31 +103,12 @@ function _non_iterable_rest() {
|
|
|
110
103
|
function _non_iterable_spread() {
|
|
111
104
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
112
105
|
}
|
|
113
|
-
function _object_spread(target) {
|
|
114
|
-
for(var i = 1; i < arguments.length; i++){
|
|
115
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
116
|
-
var ownKeys = Object.keys(source);
|
|
117
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
118
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
119
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
ownKeys.forEach(function(key) {
|
|
123
|
-
_define_property(target, key, source[key]);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
return target;
|
|
127
|
-
}
|
|
128
106
|
function _sliced_to_array(arr, i) {
|
|
129
107
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
130
108
|
}
|
|
131
109
|
function _to_consumable_array(arr) {
|
|
132
110
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
133
111
|
}
|
|
134
|
-
function _type_of(obj) {
|
|
135
|
-
"@swc/helpers - typeof";
|
|
136
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
137
|
-
}
|
|
138
112
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
139
113
|
if (!o) return;
|
|
140
114
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -234,127 +208,7 @@ function _ts_generator(thisArg, body) {
|
|
|
234
208
|
};
|
|
235
209
|
}
|
|
236
210
|
}
|
|
237
|
-
function _ts_values(o) {
|
|
238
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
239
|
-
if (m) return m.call(o);
|
|
240
|
-
if (o && typeof o.length === "number") return {
|
|
241
|
-
next: function() {
|
|
242
|
-
if (o && i >= o.length) o = void 0;
|
|
243
|
-
return {
|
|
244
|
-
value: o && o[i++],
|
|
245
|
-
done: !o
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
250
|
-
}
|
|
251
211
|
import { generateText, streamText as vercelStreamText, stepCountIs, Output } from 'ai';
|
|
252
|
-
var MAX_RATE_LIMIT_RETRIES = 4;
|
|
253
|
-
var INITIAL_RETRY_DELAY_MS = 5000;
|
|
254
|
-
var RETRY_BACKOFF_FACTOR = 2;
|
|
255
|
-
function isErrorWithStatusCode(error, codes) {
|
|
256
|
-
return (typeof error === "undefined" ? "undefined" : _type_of(error)) === 'object' && error !== null && 'statusCode' in error && typeof error.statusCode === 'number' && codes.includes(error.statusCode);
|
|
257
|
-
}
|
|
258
|
-
function isRateLimitError(error) {
|
|
259
|
-
var rateLimitCodes = [
|
|
260
|
-
429,
|
|
261
|
-
529
|
|
262
|
-
];
|
|
263
|
-
if (isErrorWithStatusCode(error, rateLimitCodes)) {
|
|
264
|
-
return true;
|
|
265
|
-
}
|
|
266
|
-
// RetryError wrapping rate limit errors (SDK exhausted its retries)
|
|
267
|
-
if (_instanceof(error, Error) && 'errors' in error && Array.isArray(error.errors)) {
|
|
268
|
-
return error.errors.some(function(e) {
|
|
269
|
-
return isErrorWithStatusCode(e, rateLimitCodes);
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return false;
|
|
273
|
-
}
|
|
274
|
-
function retryWithBackoff(fn) {
|
|
275
|
-
return _async_to_generator(function() {
|
|
276
|
-
var _loop, attempt, _ret;
|
|
277
|
-
return _ts_generator(this, function(_state) {
|
|
278
|
-
switch(_state.label){
|
|
279
|
-
case 0:
|
|
280
|
-
_loop = function(attempt) {
|
|
281
|
-
var _tmp, error, baseDelay, jitter, delay;
|
|
282
|
-
return _ts_generator(this, function(_state) {
|
|
283
|
-
switch(_state.label){
|
|
284
|
-
case 0:
|
|
285
|
-
_state.trys.push([
|
|
286
|
-
0,
|
|
287
|
-
2,
|
|
288
|
-
,
|
|
289
|
-
4
|
|
290
|
-
]);
|
|
291
|
-
_tmp = {};
|
|
292
|
-
return [
|
|
293
|
-
4,
|
|
294
|
-
fn()
|
|
295
|
-
];
|
|
296
|
-
case 1:
|
|
297
|
-
return [
|
|
298
|
-
2,
|
|
299
|
-
(_tmp.v = _state.sent(), _tmp)
|
|
300
|
-
];
|
|
301
|
-
case 2:
|
|
302
|
-
error = _state.sent();
|
|
303
|
-
if (attempt === MAX_RATE_LIMIT_RETRIES || !isRateLimitError(error)) {
|
|
304
|
-
throw error;
|
|
305
|
-
}
|
|
306
|
-
baseDelay = INITIAL_RETRY_DELAY_MS * Math.pow(RETRY_BACKOFF_FACTOR, attempt);
|
|
307
|
-
jitter = 0.5 + Math.random();
|
|
308
|
-
delay = baseDelay * jitter;
|
|
309
|
-
return [
|
|
310
|
-
4,
|
|
311
|
-
new Promise(function(resolve) {
|
|
312
|
-
return setTimeout(resolve, delay);
|
|
313
|
-
})
|
|
314
|
-
];
|
|
315
|
-
case 3:
|
|
316
|
-
_state.sent();
|
|
317
|
-
return [
|
|
318
|
-
3,
|
|
319
|
-
4
|
|
320
|
-
];
|
|
321
|
-
case 4:
|
|
322
|
-
return [
|
|
323
|
-
2
|
|
324
|
-
];
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
};
|
|
328
|
-
attempt = 0;
|
|
329
|
-
_state.label = 1;
|
|
330
|
-
case 1:
|
|
331
|
-
if (!(attempt <= MAX_RATE_LIMIT_RETRIES)) return [
|
|
332
|
-
3,
|
|
333
|
-
4
|
|
334
|
-
];
|
|
335
|
-
return [
|
|
336
|
-
5,
|
|
337
|
-
_ts_values(_loop(attempt))
|
|
338
|
-
];
|
|
339
|
-
case 2:
|
|
340
|
-
_ret = _state.sent();
|
|
341
|
-
if (_type_of(_ret) === "object") return [
|
|
342
|
-
2,
|
|
343
|
-
_ret.v
|
|
344
|
-
];
|
|
345
|
-
_state.label = 3;
|
|
346
|
-
case 3:
|
|
347
|
-
attempt++;
|
|
348
|
-
return [
|
|
349
|
-
3,
|
|
350
|
-
1
|
|
351
|
-
];
|
|
352
|
-
case 4:
|
|
353
|
-
throw new Error('unreachable');
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
})();
|
|
357
|
-
}
|
|
358
212
|
/**
|
|
359
213
|
* Creates a tool result message in SDK-native format.
|
|
360
214
|
* Use this to append tool results to responseMessages before the next generateText call.
|
|
@@ -398,95 +252,80 @@ export var VercelClient = /*#__PURE__*/ function() {
|
|
|
398
252
|
key: "generateObject",
|
|
399
253
|
value: function generateObject(params) {
|
|
400
254
|
return _async_to_generator(function() {
|
|
401
|
-
var
|
|
255
|
+
var schema, schemaName, schemaDescription, prompt, messages, system, coreMessages, output, output1;
|
|
402
256
|
return _ts_generator(this, function(_state) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
if (messages) {
|
|
413
|
-
messages.forEach(function(msg) {
|
|
414
|
-
coreMessages.push({
|
|
415
|
-
role: msg.role,
|
|
416
|
-
content: msg.content
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
if (prompt) {
|
|
421
|
-
coreMessages.push({
|
|
422
|
-
role: 'user',
|
|
423
|
-
content: prompt
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
// AI SDK v5 requires either messages or prompt, but not both as undefined
|
|
427
|
-
// If we have messages built up, use them; otherwise use the prompt directly
|
|
428
|
-
return [
|
|
429
|
-
2,
|
|
430
|
-
retryWithBackoff(function() {
|
|
431
|
-
return _async_to_generator(function() {
|
|
432
|
-
var output, output1;
|
|
433
|
-
return _ts_generator(this, function(_state) {
|
|
434
|
-
switch(_state.label){
|
|
435
|
-
case 0:
|
|
436
|
-
if (!(coreMessages.length > 0)) return [
|
|
437
|
-
3,
|
|
438
|
-
2
|
|
439
|
-
];
|
|
440
|
-
return [
|
|
441
|
-
4,
|
|
442
|
-
generateText(_object_spread({
|
|
443
|
-
model: this.model,
|
|
444
|
-
output: Output.object({
|
|
445
|
-
schema: schema,
|
|
446
|
-
name: schemaName,
|
|
447
|
-
description: schemaDescription
|
|
448
|
-
}),
|
|
449
|
-
messages: coreMessages
|
|
450
|
-
}, maxRetries !== undefined && {
|
|
451
|
-
maxRetries: maxRetries
|
|
452
|
-
}))
|
|
453
|
-
];
|
|
454
|
-
case 1:
|
|
455
|
-
output = _state.sent().output;
|
|
456
|
-
return [
|
|
457
|
-
2,
|
|
458
|
-
output
|
|
459
|
-
];
|
|
460
|
-
case 2:
|
|
461
|
-
return [
|
|
462
|
-
4,
|
|
463
|
-
generateText(_object_spread({
|
|
464
|
-
model: this.model,
|
|
465
|
-
output: Output.object({
|
|
466
|
-
schema: schema,
|
|
467
|
-
name: schemaName,
|
|
468
|
-
description: schemaDescription
|
|
469
|
-
}),
|
|
470
|
-
prompt: prompt || ''
|
|
471
|
-
}, maxRetries !== undefined && {
|
|
472
|
-
maxRetries: maxRetries
|
|
473
|
-
}))
|
|
474
|
-
];
|
|
475
|
-
case 3:
|
|
476
|
-
output1 = _state.sent().output;
|
|
477
|
-
return [
|
|
478
|
-
2,
|
|
479
|
-
output1
|
|
480
|
-
];
|
|
481
|
-
case 4:
|
|
482
|
-
return [
|
|
483
|
-
2
|
|
484
|
-
];
|
|
485
|
-
}
|
|
257
|
+
switch(_state.label){
|
|
258
|
+
case 0:
|
|
259
|
+
schema = params.schema, schemaName = params.schemaName, schemaDescription = params.schemaDescription, prompt = params.prompt, messages = params.messages, system = params.system;
|
|
260
|
+
coreMessages = [];
|
|
261
|
+
if (system) {
|
|
262
|
+
coreMessages.push({
|
|
263
|
+
role: 'system',
|
|
264
|
+
content: system
|
|
486
265
|
});
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
|
|
266
|
+
}
|
|
267
|
+
if (messages) {
|
|
268
|
+
messages.forEach(function(msg) {
|
|
269
|
+
coreMessages.push({
|
|
270
|
+
role: msg.role,
|
|
271
|
+
content: msg.content
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
if (prompt) {
|
|
276
|
+
coreMessages.push({
|
|
277
|
+
role: 'user',
|
|
278
|
+
content: prompt
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (!(coreMessages.length > 0)) return [
|
|
282
|
+
3,
|
|
283
|
+
2
|
|
284
|
+
];
|
|
285
|
+
return [
|
|
286
|
+
4,
|
|
287
|
+
generateText({
|
|
288
|
+
model: this.model,
|
|
289
|
+
output: Output.object({
|
|
290
|
+
schema: schema,
|
|
291
|
+
name: schemaName,
|
|
292
|
+
description: schemaDescription
|
|
293
|
+
}),
|
|
294
|
+
messages: coreMessages,
|
|
295
|
+
maxRetries: 5
|
|
296
|
+
})
|
|
297
|
+
];
|
|
298
|
+
case 1:
|
|
299
|
+
output = _state.sent().output;
|
|
300
|
+
return [
|
|
301
|
+
2,
|
|
302
|
+
output
|
|
303
|
+
];
|
|
304
|
+
case 2:
|
|
305
|
+
return [
|
|
306
|
+
4,
|
|
307
|
+
generateText({
|
|
308
|
+
model: this.model,
|
|
309
|
+
output: Output.object({
|
|
310
|
+
schema: schema,
|
|
311
|
+
name: schemaName,
|
|
312
|
+
description: schemaDescription
|
|
313
|
+
}),
|
|
314
|
+
prompt: prompt || '',
|
|
315
|
+
maxRetries: 5
|
|
316
|
+
})
|
|
317
|
+
];
|
|
318
|
+
case 3:
|
|
319
|
+
output1 = _state.sent().output;
|
|
320
|
+
return [
|
|
321
|
+
2,
|
|
322
|
+
output1
|
|
323
|
+
];
|
|
324
|
+
case 4:
|
|
325
|
+
return [
|
|
326
|
+
2
|
|
327
|
+
];
|
|
328
|
+
}
|
|
490
329
|
});
|
|
491
330
|
}).call(this);
|
|
492
331
|
}
|
|
@@ -495,166 +334,156 @@ export var VercelClient = /*#__PURE__*/ function() {
|
|
|
495
334
|
key: "generateText",
|
|
496
335
|
value: function generateText1(params) {
|
|
497
336
|
return _async_to_generator(function() {
|
|
498
|
-
var
|
|
337
|
+
var _result_toolCalls, _result_usage, system, messages, responseMessages, tools, _params_toolChoice, toolChoice, modelMessages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, msg, contentParts, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tc, aiTools, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step_value, name, tool, result, updatedMessages, _result_usage_totalTokens;
|
|
499
338
|
return _ts_generator(this, function(_state) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
type: 'text',
|
|
522
|
-
text: msg.content
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
if (msg.toolCalls && msg.toolCalls.length > 0) {
|
|
526
|
-
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
527
|
-
try {
|
|
528
|
-
for(_iterator1 = msg.toolCalls[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
529
|
-
tc = _step1.value;
|
|
339
|
+
switch(_state.label){
|
|
340
|
+
case 0:
|
|
341
|
+
system = params.system, messages = params.messages, responseMessages = params.responseMessages, tools = params.tools, _params_toolChoice = params.toolChoice, toolChoice = _params_toolChoice === void 0 ? 'required' : _params_toolChoice;
|
|
342
|
+
if (responseMessages && responseMessages.length > 0) {
|
|
343
|
+
// Use the SDK-native messages directly (preserves providerOptions/thoughtSignature)
|
|
344
|
+
modelMessages = responseMessages;
|
|
345
|
+
} else {
|
|
346
|
+
// First call - convert our ToolMessage format to SDK format
|
|
347
|
+
modelMessages = [];
|
|
348
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
349
|
+
try {
|
|
350
|
+
for(_iterator = messages[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
351
|
+
msg = _step.value;
|
|
352
|
+
if (msg.role === 'user') {
|
|
353
|
+
modelMessages.push({
|
|
354
|
+
role: 'user',
|
|
355
|
+
content: msg.content
|
|
356
|
+
});
|
|
357
|
+
} else if (msg.role === 'assistant') {
|
|
358
|
+
contentParts = [];
|
|
359
|
+
if (msg.content) {
|
|
530
360
|
contentParts.push({
|
|
531
|
-
type: '
|
|
532
|
-
|
|
533
|
-
toolName: tc.toolName,
|
|
534
|
-
input: tc.args
|
|
361
|
+
type: 'text',
|
|
362
|
+
text: msg.content
|
|
535
363
|
});
|
|
536
364
|
}
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
365
|
+
if (msg.toolCalls && msg.toolCalls.length > 0) {
|
|
366
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
367
|
+
try {
|
|
368
|
+
for(_iterator1 = msg.toolCalls[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
369
|
+
tc = _step1.value;
|
|
370
|
+
contentParts.push({
|
|
371
|
+
type: 'tool-call',
|
|
372
|
+
toolCallId: tc.toolCallId,
|
|
373
|
+
toolName: tc.toolName,
|
|
374
|
+
input: tc.args
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
} catch (err) {
|
|
378
|
+
_didIteratorError1 = true;
|
|
379
|
+
_iteratorError1 = err;
|
|
380
|
+
} finally{
|
|
381
|
+
try {
|
|
382
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
383
|
+
_iterator1.return();
|
|
384
|
+
}
|
|
385
|
+
} finally{
|
|
386
|
+
if (_didIteratorError1) {
|
|
387
|
+
throw _iteratorError1;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
548
390
|
}
|
|
549
391
|
}
|
|
392
|
+
if (contentParts.length > 0) {
|
|
393
|
+
modelMessages.push({
|
|
394
|
+
role: 'assistant',
|
|
395
|
+
content: contentParts
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
} else if (msg.role === 'tool') {
|
|
399
|
+
modelMessages.push({
|
|
400
|
+
role: 'tool',
|
|
401
|
+
content: [
|
|
402
|
+
{
|
|
403
|
+
type: 'tool-result',
|
|
404
|
+
toolCallId: msg.toolCallId,
|
|
405
|
+
toolName: msg.toolName,
|
|
406
|
+
output: {
|
|
407
|
+
type: 'text',
|
|
408
|
+
value: msg.content
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
});
|
|
550
413
|
}
|
|
551
414
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
415
|
+
} catch (err) {
|
|
416
|
+
_didIteratorError = true;
|
|
417
|
+
_iteratorError = err;
|
|
418
|
+
} finally{
|
|
419
|
+
try {
|
|
420
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
421
|
+
_iterator.return();
|
|
422
|
+
}
|
|
423
|
+
} finally{
|
|
424
|
+
if (_didIteratorError) {
|
|
425
|
+
throw _iteratorError;
|
|
426
|
+
}
|
|
557
427
|
}
|
|
558
|
-
} else if (msg.role === 'tool') {
|
|
559
|
-
modelMessages.push({
|
|
560
|
-
role: 'tool',
|
|
561
|
-
content: [
|
|
562
|
-
{
|
|
563
|
-
type: 'tool-result',
|
|
564
|
-
toolCallId: msg.toolCallId,
|
|
565
|
-
toolName: msg.toolName,
|
|
566
|
-
output: {
|
|
567
|
-
type: 'text',
|
|
568
|
-
value: msg.content
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
]
|
|
572
|
-
});
|
|
573
428
|
}
|
|
574
429
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
} finally{
|
|
430
|
+
// Convert our tool format to Vercel AI SDK format
|
|
431
|
+
aiTools = {};
|
|
432
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
579
433
|
try {
|
|
580
|
-
|
|
581
|
-
|
|
434
|
+
for(_iterator2 = Object.entries(tools)[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
435
|
+
_step_value = _sliced_to_array(_step2.value, 2), name = _step_value[0], tool = _step_value[1];
|
|
436
|
+
aiTools[name] = {
|
|
437
|
+
description: tool.description,
|
|
438
|
+
inputSchema: tool.inputSchema
|
|
439
|
+
};
|
|
582
440
|
}
|
|
441
|
+
} catch (err) {
|
|
442
|
+
_didIteratorError2 = true;
|
|
443
|
+
_iteratorError2 = err;
|
|
583
444
|
} finally{
|
|
584
|
-
|
|
585
|
-
|
|
445
|
+
try {
|
|
446
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
447
|
+
_iterator2.return();
|
|
448
|
+
}
|
|
449
|
+
} finally{
|
|
450
|
+
if (_didIteratorError2) {
|
|
451
|
+
throw _iteratorError2;
|
|
452
|
+
}
|
|
586
453
|
}
|
|
587
454
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
455
|
+
return [
|
|
456
|
+
4,
|
|
457
|
+
generateText({
|
|
458
|
+
model: this.model,
|
|
459
|
+
system: system,
|
|
460
|
+
toolChoice: toolChoice,
|
|
461
|
+
messages: modelMessages,
|
|
462
|
+
tools: aiTools,
|
|
463
|
+
maxRetries: 5
|
|
464
|
+
})
|
|
465
|
+
];
|
|
466
|
+
case 1:
|
|
467
|
+
result = _state.sent();
|
|
468
|
+
updatedMessages = _to_consumable_array(modelMessages).concat(_to_consumable_array(result.response.messages));
|
|
469
|
+
return [
|
|
470
|
+
2,
|
|
471
|
+
{
|
|
472
|
+
text: result.text || undefined,
|
|
473
|
+
toolCalls: (_result_toolCalls = result.toolCalls) === null || _result_toolCalls === void 0 ? void 0 : _result_toolCalls.map(function(tc) {
|
|
474
|
+
return {
|
|
475
|
+
toolCallId: tc.toolCallId,
|
|
476
|
+
toolName: tc.toolName,
|
|
477
|
+
args: tc.input
|
|
478
|
+
};
|
|
479
|
+
}),
|
|
480
|
+
usage: {
|
|
481
|
+
totalTokens: (_result_usage_totalTokens = (_result_usage = result.usage) === null || _result_usage === void 0 ? void 0 : _result_usage.totalTokens) !== null && _result_usage_totalTokens !== void 0 ? _result_usage_totalTokens : 0
|
|
482
|
+
},
|
|
483
|
+
responseMessages: updatedMessages
|
|
484
|
+
}
|
|
485
|
+
];
|
|
614
486
|
}
|
|
615
|
-
return [
|
|
616
|
-
2,
|
|
617
|
-
retryWithBackoff(function() {
|
|
618
|
-
return _async_to_generator(function() {
|
|
619
|
-
var _result_toolCalls, _result_usage, result, updatedMessages, _result_usage_totalTokens;
|
|
620
|
-
return _ts_generator(this, function(_state) {
|
|
621
|
-
switch(_state.label){
|
|
622
|
-
case 0:
|
|
623
|
-
return [
|
|
624
|
-
4,
|
|
625
|
-
generateText({
|
|
626
|
-
model: this.model,
|
|
627
|
-
system: system,
|
|
628
|
-
toolChoice: toolChoice,
|
|
629
|
-
messages: modelMessages,
|
|
630
|
-
tools: aiTools
|
|
631
|
-
})
|
|
632
|
-
];
|
|
633
|
-
case 1:
|
|
634
|
-
result = _state.sent();
|
|
635
|
-
updatedMessages = _to_consumable_array(modelMessages).concat(_to_consumable_array(result.response.messages));
|
|
636
|
-
return [
|
|
637
|
-
2,
|
|
638
|
-
{
|
|
639
|
-
text: result.text || undefined,
|
|
640
|
-
toolCalls: (_result_toolCalls = result.toolCalls) === null || _result_toolCalls === void 0 ? void 0 : _result_toolCalls.map(function(tc) {
|
|
641
|
-
return {
|
|
642
|
-
toolCallId: tc.toolCallId,
|
|
643
|
-
toolName: tc.toolName,
|
|
644
|
-
args: tc.input
|
|
645
|
-
};
|
|
646
|
-
}),
|
|
647
|
-
usage: {
|
|
648
|
-
totalTokens: (_result_usage_totalTokens = (_result_usage = result.usage) === null || _result_usage === void 0 ? void 0 : _result_usage.totalTokens) !== null && _result_usage_totalTokens !== void 0 ? _result_usage_totalTokens : 0
|
|
649
|
-
},
|
|
650
|
-
responseMessages: updatedMessages
|
|
651
|
-
}
|
|
652
|
-
];
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
}).call(_this);
|
|
656
|
-
})
|
|
657
|
-
];
|
|
658
487
|
});
|
|
659
488
|
}).call(this);
|
|
660
489
|
}
|
|
@@ -663,229 +492,219 @@ export var VercelClient = /*#__PURE__*/ function() {
|
|
|
663
492
|
key: "streamText",
|
|
664
493
|
value: function streamText(params) {
|
|
665
494
|
return _async_to_generator(function() {
|
|
666
|
-
var
|
|
495
|
+
var system, prompt, messages, tools, _params_maxSteps, maxSteps, _params_toolChoice, toolChoice, modelMessages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, msg, contentParts, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tc, aiTools, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _step_value, name, tool, stream, _ref, steps, text, usage, allToolCalls, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, step, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _loop, _iterator4, _step4, _usage_totalTokens;
|
|
667
496
|
return _ts_generator(this, function(_state) {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
type: 'text',
|
|
696
|
-
text: msg.content
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
// Add tool calls if present (using 'input' as Vercel SDK expects)
|
|
700
|
-
if (msg.toolCalls && msg.toolCalls.length > 0) {
|
|
701
|
-
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
702
|
-
try {
|
|
703
|
-
for(_iterator1 = msg.toolCalls[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
704
|
-
tc = _step1.value;
|
|
497
|
+
switch(_state.label){
|
|
498
|
+
case 0:
|
|
499
|
+
system = params.system, prompt = params.prompt, messages = params.messages, tools = params.tools, _params_maxSteps = params.maxSteps, maxSteps = _params_maxSteps === void 0 ? 10 : _params_maxSteps, _params_toolChoice = params.toolChoice, toolChoice = _params_toolChoice === void 0 ? 'required' : _params_toolChoice;
|
|
500
|
+
// Build messages array
|
|
501
|
+
modelMessages = [];
|
|
502
|
+
if (system) {
|
|
503
|
+
modelMessages.push({
|
|
504
|
+
role: 'system',
|
|
505
|
+
content: system
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
// Add any context messages
|
|
509
|
+
if (messages) {
|
|
510
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
511
|
+
try {
|
|
512
|
+
for(_iterator = messages[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
513
|
+
msg = _step.value;
|
|
514
|
+
if (msg.role === 'user') {
|
|
515
|
+
modelMessages.push({
|
|
516
|
+
role: 'user',
|
|
517
|
+
content: msg.content
|
|
518
|
+
});
|
|
519
|
+
} else if (msg.role === 'assistant') {
|
|
520
|
+
// Build content array for assistant message
|
|
521
|
+
contentParts = [];
|
|
522
|
+
// Add text if present
|
|
523
|
+
if (msg.content) {
|
|
705
524
|
contentParts.push({
|
|
706
|
-
type: '
|
|
707
|
-
|
|
708
|
-
toolName: tc.toolName,
|
|
709
|
-
input: tc.args
|
|
525
|
+
type: 'text',
|
|
526
|
+
text: msg.content
|
|
710
527
|
});
|
|
711
528
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
529
|
+
// Add tool calls if present (using 'input' as Vercel SDK expects)
|
|
530
|
+
if (msg.toolCalls && msg.toolCalls.length > 0) {
|
|
531
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
532
|
+
try {
|
|
533
|
+
for(_iterator1 = msg.toolCalls[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
534
|
+
tc = _step1.value;
|
|
535
|
+
contentParts.push({
|
|
536
|
+
type: 'tool-call',
|
|
537
|
+
toolCallId: tc.toolCallId,
|
|
538
|
+
toolName: tc.toolName,
|
|
539
|
+
input: tc.args
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
} catch (err) {
|
|
543
|
+
_didIteratorError1 = true;
|
|
544
|
+
_iteratorError1 = err;
|
|
545
|
+
} finally{
|
|
546
|
+
try {
|
|
547
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
548
|
+
_iterator1.return();
|
|
549
|
+
}
|
|
550
|
+
} finally{
|
|
551
|
+
if (_didIteratorError1) {
|
|
552
|
+
throw _iteratorError1;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
723
555
|
}
|
|
724
556
|
}
|
|
557
|
+
// Push message with content array or string
|
|
558
|
+
if (contentParts.length > 0) {
|
|
559
|
+
modelMessages.push({
|
|
560
|
+
role: 'assistant',
|
|
561
|
+
content: contentParts
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
} else if (msg.role === 'tool') {
|
|
565
|
+
modelMessages.push({
|
|
566
|
+
role: 'tool',
|
|
567
|
+
content: [
|
|
568
|
+
{
|
|
569
|
+
type: 'tool-result',
|
|
570
|
+
toolCallId: msg.toolCallId,
|
|
571
|
+
toolName: msg.toolName,
|
|
572
|
+
output: {
|
|
573
|
+
type: 'text',
|
|
574
|
+
value: msg.content
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
]
|
|
578
|
+
});
|
|
725
579
|
}
|
|
726
580
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
581
|
+
} catch (err) {
|
|
582
|
+
_didIteratorError = true;
|
|
583
|
+
_iteratorError = err;
|
|
584
|
+
} finally{
|
|
585
|
+
try {
|
|
586
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
587
|
+
_iterator.return();
|
|
588
|
+
}
|
|
589
|
+
} finally{
|
|
590
|
+
if (_didIteratorError) {
|
|
591
|
+
throw _iteratorError;
|
|
592
|
+
}
|
|
733
593
|
}
|
|
734
|
-
} else if (msg.role === 'tool') {
|
|
735
|
-
modelMessages.push({
|
|
736
|
-
role: 'tool',
|
|
737
|
-
content: [
|
|
738
|
-
{
|
|
739
|
-
type: 'tool-result',
|
|
740
|
-
toolCallId: msg.toolCallId,
|
|
741
|
-
toolName: msg.toolName,
|
|
742
|
-
output: {
|
|
743
|
-
type: 'text',
|
|
744
|
-
value: msg.content
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
]
|
|
748
|
-
});
|
|
749
594
|
}
|
|
750
595
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
596
|
+
// Add the initial prompt
|
|
597
|
+
modelMessages.push({
|
|
598
|
+
role: 'user',
|
|
599
|
+
content: prompt
|
|
600
|
+
});
|
|
601
|
+
// Convert tools to Vercel AI SDK format (with execute functions)
|
|
602
|
+
aiTools = {};
|
|
603
|
+
_iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
755
604
|
try {
|
|
756
|
-
|
|
757
|
-
|
|
605
|
+
for(_iterator2 = Object.entries(tools)[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
606
|
+
_step_value = _sliced_to_array(_step2.value, 2), name = _step_value[0], tool = _step_value[1];
|
|
607
|
+
aiTools[name] = {
|
|
608
|
+
description: tool.description,
|
|
609
|
+
inputSchema: tool.inputSchema,
|
|
610
|
+
execute: tool.execute
|
|
611
|
+
};
|
|
758
612
|
}
|
|
613
|
+
} catch (err) {
|
|
614
|
+
_didIteratorError2 = true;
|
|
615
|
+
_iteratorError2 = err;
|
|
759
616
|
} finally{
|
|
760
|
-
|
|
761
|
-
|
|
617
|
+
try {
|
|
618
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
619
|
+
_iterator2.return();
|
|
620
|
+
}
|
|
621
|
+
} finally{
|
|
622
|
+
if (_didIteratorError2) {
|
|
623
|
+
throw _iteratorError2;
|
|
624
|
+
}
|
|
762
625
|
}
|
|
763
626
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
}
|
|
797
|
-
return [
|
|
798
|
-
2,
|
|
799
|
-
retryWithBackoff(function() {
|
|
800
|
-
return _async_to_generator(function() {
|
|
801
|
-
var stream, _ref, steps, text, usage, allToolCalls, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, step, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _loop, _iterator1, _step1, _usage_totalTokens;
|
|
802
|
-
return _ts_generator(this, function(_state) {
|
|
803
|
-
switch(_state.label){
|
|
804
|
-
case 0:
|
|
805
|
-
stream = vercelStreamText({
|
|
806
|
-
model: this.model,
|
|
807
|
-
messages: modelMessages,
|
|
808
|
-
tools: aiTools,
|
|
809
|
-
toolChoice: toolChoice,
|
|
810
|
-
stopWhen: stepCountIs(maxSteps)
|
|
627
|
+
stream = vercelStreamText({
|
|
628
|
+
model: this.model,
|
|
629
|
+
messages: modelMessages,
|
|
630
|
+
tools: aiTools,
|
|
631
|
+
toolChoice: toolChoice,
|
|
632
|
+
maxRetries: 5,
|
|
633
|
+
stopWhen: stepCountIs(maxSteps)
|
|
634
|
+
});
|
|
635
|
+
return [
|
|
636
|
+
4,
|
|
637
|
+
Promise.all([
|
|
638
|
+
stream.steps,
|
|
639
|
+
stream.text,
|
|
640
|
+
stream.totalUsage
|
|
641
|
+
])
|
|
642
|
+
];
|
|
643
|
+
case 1:
|
|
644
|
+
_ref = _sliced_to_array.apply(void 0, [
|
|
645
|
+
_state.sent(),
|
|
646
|
+
3
|
|
647
|
+
]), steps = _ref[0], text = _ref[1], usage = _ref[2];
|
|
648
|
+
allToolCalls = [];
|
|
649
|
+
_iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
|
|
650
|
+
try {
|
|
651
|
+
for(_iterator3 = steps[Symbol.iterator](); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
|
|
652
|
+
step = _step3.value;
|
|
653
|
+
_iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined;
|
|
654
|
+
try {
|
|
655
|
+
_loop = function() {
|
|
656
|
+
var toolCall = _step4.value;
|
|
657
|
+
var toolResult = step.toolResults.find(function(tr) {
|
|
658
|
+
return tr.toolCallId === toolCall.toolCallId;
|
|
811
659
|
});
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
try {
|
|
828
|
-
for(_iterator = steps[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
829
|
-
step = _step.value;
|
|
830
|
-
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
831
|
-
try {
|
|
832
|
-
_loop = function() {
|
|
833
|
-
var toolCall = _step1.value;
|
|
834
|
-
var toolResult = step.toolResults.find(function(tr) {
|
|
835
|
-
return tr.toolCallId === toolCall.toolCallId;
|
|
836
|
-
});
|
|
837
|
-
allToolCalls.push({
|
|
838
|
-
toolCallId: toolCall.toolCallId,
|
|
839
|
-
toolName: toolCall.toolName,
|
|
840
|
-
args: toolCall.input,
|
|
841
|
-
result: toolResult === null || toolResult === void 0 ? void 0 : toolResult.output
|
|
842
|
-
});
|
|
843
|
-
};
|
|
844
|
-
for(_iterator1 = step.toolCalls[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true)_loop();
|
|
845
|
-
} catch (err) {
|
|
846
|
-
_didIteratorError1 = true;
|
|
847
|
-
_iteratorError1 = err;
|
|
848
|
-
} finally{
|
|
849
|
-
try {
|
|
850
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
851
|
-
_iterator1.return();
|
|
852
|
-
}
|
|
853
|
-
} finally{
|
|
854
|
-
if (_didIteratorError1) {
|
|
855
|
-
throw _iteratorError1;
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
} catch (err) {
|
|
861
|
-
_didIteratorError = true;
|
|
862
|
-
_iteratorError = err;
|
|
863
|
-
} finally{
|
|
864
|
-
try {
|
|
865
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
866
|
-
_iterator.return();
|
|
867
|
-
}
|
|
868
|
-
} finally{
|
|
869
|
-
if (_didIteratorError) {
|
|
870
|
-
throw _iteratorError;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
660
|
+
allToolCalls.push({
|
|
661
|
+
toolCallId: toolCall.toolCallId,
|
|
662
|
+
toolName: toolCall.toolName,
|
|
663
|
+
args: toolCall.input,
|
|
664
|
+
result: toolResult === null || toolResult === void 0 ? void 0 : toolResult.output
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
for(_iterator4 = step.toolCalls[Symbol.iterator](); !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true)_loop();
|
|
668
|
+
} catch (err) {
|
|
669
|
+
_didIteratorError4 = true;
|
|
670
|
+
_iteratorError4 = err;
|
|
671
|
+
} finally{
|
|
672
|
+
try {
|
|
673
|
+
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
674
|
+
_iterator4.return();
|
|
873
675
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
usage: {
|
|
880
|
-
totalTokens: (_usage_totalTokens = usage === null || usage === void 0 ? void 0 : usage.totalTokens) !== null && _usage_totalTokens !== void 0 ? _usage_totalTokens : 0
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
];
|
|
676
|
+
} finally{
|
|
677
|
+
if (_didIteratorError4) {
|
|
678
|
+
throw _iteratorError4;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
884
681
|
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
|
|
682
|
+
}
|
|
683
|
+
} catch (err) {
|
|
684
|
+
_didIteratorError3 = true;
|
|
685
|
+
_iteratorError3 = err;
|
|
686
|
+
} finally{
|
|
687
|
+
try {
|
|
688
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
689
|
+
_iterator3.return();
|
|
690
|
+
}
|
|
691
|
+
} finally{
|
|
692
|
+
if (_didIteratorError3) {
|
|
693
|
+
throw _iteratorError3;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return [
|
|
698
|
+
2,
|
|
699
|
+
{
|
|
700
|
+
toolCalls: allToolCalls,
|
|
701
|
+
text: text || undefined,
|
|
702
|
+
usage: {
|
|
703
|
+
totalTokens: (_usage_totalTokens = usage === null || usage === void 0 ? void 0 : usage.totalTokens) !== null && _usage_totalTokens !== void 0 ? _usage_totalTokens : 0
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
];
|
|
707
|
+
}
|
|
889
708
|
});
|
|
890
709
|
}).call(this);
|
|
891
710
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAO3G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAO3G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,IAAI,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,eAAe,CAgBjB;AAED,qBAAa,YAAa,YAAW,eAAe;IAClD,OAAO,CAAC,KAAK,CAAgB;gBAEjB,KAAK,EAAE,aAAa;IAIhC,uBAAuB,CACrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,eAAe;IAIZ,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE;QACrD,MAAM,EAAE,CAAC,CAAC;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAiDjB,YAAY,CAAC,MAAM,EAAE;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;QACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,CAAC,CAAC,SAAS,CAAA;SAAE,CAAC,CAAC;QACzE,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB,GAAG,OAAO,CAAC;QACV,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,KAAK,CAAC;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;QAC3E,KAAK,EAAE;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;QAC/B,gBAAgB,EAAE,eAAe,EAAE,CAAC;KACrC,CAAC;IA4FI,UAAU,CAAC,MAAM,EAAE;QACvB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;QACzB,KAAK,EAAE,MAAM,CACX,MAAM,EACN;YACE,WAAW,EAAE,MAAM,CAAC;YACpB,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC;YACzB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;SACzD,CACF,CAAC;QACF,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB,GAAG,OAAO,CAAC;QACV,SAAS,EAAE,KAAK,CAAC;YACf,UAAU,EAAE,MAAM,CAAC;YACnB,QAAQ,EAAE,MAAM,CAAC;YACjB,IAAI,EAAE,OAAO,CAAC;YACd,MAAM,EAAE,OAAO,CAAC;SACjB,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC;KAChC,CAAC;CA2HH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/client-vercel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.64",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"ai": "^6.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@positronic/core": "^0.0.
|
|
26
|
+
"@positronic/core": "^0.0.64",
|
|
27
27
|
"zod": "^3.24.1"
|
|
28
28
|
}
|
|
29
29
|
}
|