@xsai/stream-text 0.3.5 → 0.4.0-beta.1

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/index.d.ts CHANGED
@@ -16,6 +16,9 @@ type StreamTextEvent = (CompletionToolCall & {
16
16
  finishReason: FinishReason;
17
17
  type: 'finish';
18
18
  usage?: Usage;
19
+ } | {
20
+ text: string;
21
+ type: 'reasoning-delta';
19
22
  } | {
20
23
  text: string;
21
24
  type: 'text-delta';
package/dist/index.js CHANGED
@@ -129,12 +129,15 @@ const streamText = async (options) => {
129
129
  },
130
130
  close: () => {
131
131
  },
132
+ // eslint-disable-next-line sonarjs/cognitive-complexity
132
133
  write: (chunk) => {
133
134
  if (chunk.usage)
134
135
  pushUsage(chunk.usage);
135
136
  if (chunk.choices == null || chunk.choices.length === 0)
136
137
  return;
137
138
  const choice = chunk.choices[0];
139
+ if (choice.delta.reasoning_content != null)
140
+ pushEvent({ text: choice.delta.reasoning_content, type: "reasoning-delta" });
138
141
  if (choice.finish_reason != null)
139
142
  finishReason = choice.finish_reason;
140
143
  if (choice.delta.tool_calls?.length === 0 || choice.delta.tool_calls == null) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/stream-text",
3
3
  "type": "module",
4
- "version": "0.3.5",
4
+ "version": "0.4.0-beta.1",
5
5
  "description": "extra-small AI SDK.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -29,12 +29,12 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@xsai/shared-chat": "~0.3.5"
32
+ "@xsai/shared-chat": "~0.4.0-beta.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "valibot": "^1.0.0",
36
- "@xsai/shared": "~0.3.5",
37
- "@xsai/tool": "~0.3.5"
36
+ "@xsai/tool": "~0.4.0-beta.1",
37
+ "@xsai/shared": "~0.4.0-beta.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "pkgroll",