ai 5.0.0-canary.15 → 5.0.0-canary.16

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.
@@ -277,7 +277,7 @@ function convertToCoreMessages(messages, options) {
277
277
  case "reasoning": {
278
278
  content2.push({
279
279
  type: "reasoning",
280
- text: part.reasoning,
280
+ text: part.text,
281
281
  providerOptions: part.providerMetadata
282
282
  });
283
283
  break;
@@ -367,73 +367,11 @@ function convertToCoreMessages(messages, options) {
367
367
  processBlock2();
368
368
  break;
369
369
  }
370
- const toolInvocations = message.toolInvocations;
371
- if (toolInvocations == null || toolInvocations.length === 0) {
372
- coreMessages.push({ role: "assistant", content });
373
- break;
374
- }
375
- const maxStep = toolInvocations.reduce((max, toolInvocation) => {
376
- var _a8;
377
- return Math.max(max, (_a8 = toolInvocation.step) != null ? _a8 : 0);
378
- }, 0);
379
- for (let i2 = 0; i2 <= maxStep; i2++) {
380
- const stepInvocations = toolInvocations.filter(
381
- (toolInvocation) => {
382
- var _a8;
383
- return ((_a8 = toolInvocation.step) != null ? _a8 : 0) === i2;
384
- }
385
- );
386
- if (stepInvocations.length === 0) {
387
- continue;
388
- }
389
- coreMessages.push({
390
- role: "assistant",
391
- content: [
392
- ...isLastMessage && content && i2 === 0 ? [{ type: "text", text: content }] : [],
393
- ...stepInvocations.map(
394
- ({ toolCallId, toolName, args }) => ({
395
- type: "tool-call",
396
- toolCallId,
397
- toolName,
398
- args
399
- })
400
- )
401
- ]
402
- });
403
- coreMessages.push({
404
- role: "tool",
405
- content: stepInvocations.map((toolInvocation) => {
406
- if (!("result" in toolInvocation)) {
407
- throw new MessageConversionError({
408
- originalMessage: message,
409
- message: "ToolInvocation must have a result: " + JSON.stringify(toolInvocation)
410
- });
411
- }
412
- const { toolCallId, toolName, result } = toolInvocation;
413
- const tool = tools[toolName];
414
- return (tool == null ? void 0 : tool.experimental_toToolResultContent) != null ? {
415
- type: "tool-result",
416
- toolCallId,
417
- toolName,
418
- result: tool.experimental_toToolResultContent(result),
419
- experimental_content: tool.experimental_toToolResultContent(result)
420
- } : {
421
- type: "tool-result",
422
- toolCallId,
423
- toolName,
424
- result
425
- };
426
- })
427
- });
428
- }
429
370
  if (content && !isLastMessage) {
430
371
  coreMessages.push({ role: "assistant", content });
431
372
  }
432
373
  break;
433
374
  }
434
- case "data": {
435
- break;
436
- }
437
375
  default: {
438
376
  const _exhaustiveCheck = role;
439
377
  throw new MessageConversionError({