@xsai/stream-text 0.2.0-beta.1 → 0.2.0-beta.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ToolCall, FinishReason, Usage, ChatOptions, Tool, Message, StepType, CompletionToolCall, CompletionToolResult, AssistantMessage } from '@xsai/shared-chat';
1
+ import { ToolCall, FinishReason, Usage, ChatOptions, AssistantMessage, Message, StepType, CompletionToolCall, CompletionToolResult, Tool } from '@xsai/shared-chat';
2
2
 
3
3
  interface StreamTextChunkResult {
4
4
  choices: {
package/dist/index.js CHANGED
@@ -1,19 +1,16 @@
1
- // ../shared/src/error/index.ts
2
- var XSAIError = class extends Error {
1
+ import { chat, executeTool, determineStepType } from '@xsai/shared-chat';
2
+
3
+ class XSAIError extends Error {
3
4
  response;
4
5
  constructor(message, response) {
5
6
  super(message);
6
7
  this.name = "XSAIError";
7
8
  this.response = response;
8
9
  }
9
- };
10
-
11
- // src/index.ts
12
- import { chat, determineStepType, executeTool } from "@xsai/shared-chat";
10
+ }
13
11
 
14
- // src/helper.ts
15
- var CHUNK_HEADER_PREFIX = "data:";
16
- var parseChunk = (text) => {
12
+ const CHUNK_HEADER_PREFIX = "data:";
13
+ const parseChunk = (text) => {
17
14
  if (!text || !text.startsWith(CHUNK_HEADER_PREFIX))
18
15
  return [void 0, false];
19
16
  const content = text.slice(CHUNK_HEADER_PREFIX.length);
@@ -28,8 +25,7 @@ var parseChunk = (text) => {
28
25
  return [chunk, false];
29
26
  };
30
27
 
31
- // src/index.ts
32
- var streamText = async (options) => {
28
+ const streamText = async (options) => {
33
29
  let chunkCtrl;
34
30
  let stepCtrl;
35
31
  let textCtrl;
@@ -251,6 +247,5 @@ var streamText = async (options) => {
251
247
  textStream
252
248
  });
253
249
  };
254
- export {
255
- streamText
256
- };
250
+
251
+ export { streamText };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/stream-text",
3
3
  "type": "module",
4
- "version": "0.2.0-beta.1",
4
+ "version": "0.2.0-beta.2",
5
5
  "description": "extra-small AI SDK for Browser, Node.js, Deno, Bun or Edge Runtime.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -37,7 +37,7 @@
37
37
  "valibot": "^1.0.0"
38
38
  },
39
39
  "scripts": {
40
- "build": "tsup",
40
+ "build": "pkgroll",
41
41
  "test": "vitest run",
42
42
  "test:watch": "vitest"
43
43
  },