ai 3.1.0-canary.1 → 3.1.0-canary.2

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 (61) hide show
  1. package/ai-model-specification/dist/index.d.mts +539 -0
  2. package/ai-model-specification/dist/index.d.ts +539 -0
  3. package/ai-model-specification/dist/index.js +581 -0
  4. package/ai-model-specification/dist/index.js.map +1 -0
  5. package/ai-model-specification/dist/index.mjs +526 -0
  6. package/ai-model-specification/dist/index.mjs.map +1 -0
  7. package/core/dist/index.d.mts +120 -75
  8. package/core/dist/index.d.ts +120 -75
  9. package/core/dist/index.js +261 -173
  10. package/core/dist/index.js.map +1 -1
  11. package/core/dist/index.mjs +261 -172
  12. package/core/dist/index.mjs.map +1 -1
  13. package/dist/index.d.mts +3 -1
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.js +39 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +39 -1
  18. package/dist/index.mjs.map +1 -1
  19. package/package.json +13 -4
  20. package/prompts/dist/index.d.mts +32 -19
  21. package/prompts/dist/index.d.ts +32 -19
  22. package/prompts/dist/index.js +0 -1
  23. package/prompts/dist/index.js.map +1 -1
  24. package/prompts/dist/index.mjs +0 -1
  25. package/prompts/dist/index.mjs.map +1 -1
  26. package/provider/dist/index.d.mts +154 -191
  27. package/provider/dist/index.d.ts +154 -191
  28. package/provider/dist/index.js +795 -26126
  29. package/provider/dist/index.js.map +1 -1
  30. package/provider/dist/index.mjs +763 -7729
  31. package/provider/dist/index.mjs.map +1 -1
  32. package/react/dist/index.js +16 -1
  33. package/react/dist/index.js.map +1 -1
  34. package/react/dist/index.mjs +16 -1
  35. package/react/dist/index.mjs.map +1 -1
  36. package/rsc/dist/index.d.ts +11 -0
  37. package/rsc/dist/rsc-server.d.mts +11 -0
  38. package/rsc/dist/rsc-server.mjs +21 -21
  39. package/rsc/dist/rsc-server.mjs.map +1 -1
  40. package/rsc/dist/rsc-shared.mjs +21 -1
  41. package/rsc/dist/rsc-shared.mjs.map +1 -1
  42. package/provider/dist/chunk-3DTRVHCT.mjs +0 -5046
  43. package/provider/dist/chunk-3DTRVHCT.mjs.map +0 -1
  44. package/provider/dist/chunk-4OUDS3CP.mjs +0 -30
  45. package/provider/dist/chunk-4OUDS3CP.mjs.map +0 -1
  46. package/provider/dist/chunk-5IYCPJBV.mjs +0 -56
  47. package/provider/dist/chunk-5IYCPJBV.mjs.map +0 -1
  48. package/provider/dist/chunk-VB2TCVQ4.mjs +0 -6746
  49. package/provider/dist/chunk-VB2TCVQ4.mjs.map +0 -1
  50. package/provider/dist/chunk-VYIXVZ6L.mjs +0 -317
  51. package/provider/dist/chunk-VYIXVZ6L.mjs.map +0 -1
  52. package/provider/dist/chunk-WTOUHN6A.mjs +0 -2251
  53. package/provider/dist/chunk-WTOUHN6A.mjs.map +0 -1
  54. package/provider/dist/client-22WAAXR7.mjs +0 -10
  55. package/provider/dist/client-22WAAXR7.mjs.map +0 -1
  56. package/provider/dist/fileFromPath-23RINPB2.mjs +0 -115
  57. package/provider/dist/fileFromPath-23RINPB2.mjs.map +0 -1
  58. package/provider/dist/lib-BZMMM4HX.mjs +0 -20
  59. package/provider/dist/lib-BZMMM4HX.mjs.map +0 -1
  60. package/provider/dist/openai-3YL4AWLI.mjs +0 -3451
  61. package/provider/dist/openai-3YL4AWLI.mjs.map +0 -1
package/dist/index.mjs CHANGED
@@ -499,6 +499,43 @@ function experimental_AssistantResponse({ threadId, messageId }, process2) {
499
499
  textEncoder.encode(formatStreamPart("error", errorMessage))
500
500
  );
501
501
  };
502
+ const forwardStream = async (stream2) => {
503
+ var _a2, _b;
504
+ let result = void 0;
505
+ for await (const value of stream2) {
506
+ switch (value.event) {
507
+ case "thread.message.created": {
508
+ controller.enqueue(
509
+ textEncoder.encode(
510
+ formatStreamPart("assistant_message", {
511
+ id: value.data.id,
512
+ role: "assistant",
513
+ content: [{ type: "text", text: { value: "" } }]
514
+ })
515
+ )
516
+ );
517
+ break;
518
+ }
519
+ case "thread.message.delta": {
520
+ const content = (_a2 = value.data.delta.content) == null ? void 0 : _a2[0];
521
+ if ((content == null ? void 0 : content.type) === "text" && ((_b = content.text) == null ? void 0 : _b.value) != null) {
522
+ controller.enqueue(
523
+ textEncoder.encode(
524
+ formatStreamPart("text", content.text.value)
525
+ )
526
+ );
527
+ }
528
+ break;
529
+ }
530
+ case "thread.run.completed":
531
+ case "thread.run.requires_action": {
532
+ result = value.data;
533
+ break;
534
+ }
535
+ }
536
+ }
537
+ return result;
538
+ };
502
539
  controller.enqueue(
503
540
  textEncoder.encode(
504
541
  formatStreamPart("assistant_control_data", {
@@ -512,7 +549,8 @@ function experimental_AssistantResponse({ threadId, messageId }, process2) {
512
549
  threadId,
513
550
  messageId,
514
551
  sendMessage,
515
- sendDataMessage
552
+ sendDataMessage,
553
+ forwardStream
516
554
  });
517
555
  } catch (error) {
518
556
  sendError((_a = error.message) != null ? _a : `${error}`);