@vettvangur/ai-sdk 0.4.1 → 0.5.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/LICENSE +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +4 -12
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -4,7 +4,7 @@ All original code in this repository is licensed under the terms below:
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
Copyright (c) 2025 Vettvangur
|
|
7
|
+
Copyright (c) 2025-2026 Vettvangur ehf
|
|
8
8
|
|
|
9
9
|
This software is provided for personal or internal non-commercial use only. You may not modify, distribute, sublicense, or use this software in commercial products or services without explicit written permission from Vettvangur.
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ type AiChatRequest = {
|
|
|
11
11
|
type AiChatContext = Record<string, string>;
|
|
12
12
|
type AiChatSessionStatus = 'idle' | 'sending' | 'disposed';
|
|
13
13
|
type AiChatSessionResult = {
|
|
14
|
-
provider: string | null;
|
|
15
14
|
turn: string | null;
|
|
16
15
|
canceled: boolean;
|
|
17
16
|
error: Error | null;
|
|
@@ -111,7 +110,6 @@ type AiChatStreamEvent = {
|
|
|
111
110
|
} | {
|
|
112
111
|
name: 'done';
|
|
113
112
|
data: {
|
|
114
|
-
provider: string;
|
|
115
113
|
turn: string | null;
|
|
116
114
|
};
|
|
117
115
|
} | {
|
package/dist/index.js
CHANGED
|
@@ -689,14 +689,10 @@ function parseStreamEvent(name, data) {
|
|
|
689
689
|
};
|
|
690
690
|
}
|
|
691
691
|
case "done": {
|
|
692
|
-
const provider = stringValue(data, "provider");
|
|
693
692
|
const turn = stringValue(data, "turn");
|
|
694
|
-
return
|
|
693
|
+
return {
|
|
695
694
|
name,
|
|
696
|
-
data: {
|
|
697
|
-
provider,
|
|
698
|
-
turn: turn && turn.length <= MAX_TURN_TOKEN_LENGTH ? turn : null
|
|
699
|
-
}
|
|
695
|
+
data: { turn: turn && turn.length <= MAX_TURN_TOKEN_LENGTH ? turn : null }
|
|
700
696
|
};
|
|
701
697
|
}
|
|
702
698
|
case "error": {
|
|
@@ -831,7 +827,6 @@ function createChatSession(options) {
|
|
|
831
827
|
role: "user",
|
|
832
828
|
content
|
|
833
829
|
}];
|
|
834
|
-
let provider = null;
|
|
835
830
|
let turn = null;
|
|
836
831
|
let error = null;
|
|
837
832
|
let canceled = false;
|
|
@@ -856,10 +851,8 @@ function createChatSession(options) {
|
|
|
856
851
|
if (event.name === "tool") await afterNextPaint();
|
|
857
852
|
if (event.name === "delta") answer += event.data.text;
|
|
858
853
|
else if (event.name === "tool_result" && event.data.reply) replies.push(event.data.reply);
|
|
859
|
-
else if (event.name === "done")
|
|
860
|
-
|
|
861
|
-
turn = event.data.turn;
|
|
862
|
-
} else if (event.name === "error") throw new Error(event.data.message);
|
|
854
|
+
else if (event.name === "done") turn = event.data.turn;
|
|
855
|
+
else if (event.name === "error") throw new Error(event.data.message);
|
|
863
856
|
}
|
|
864
857
|
if (answer.trim()) replies = [...replies, answer.trim()];
|
|
865
858
|
history.push({
|
|
@@ -880,7 +873,6 @@ function createChatSession(options) {
|
|
|
880
873
|
if (session.status !== "disposed") status = "idle";
|
|
881
874
|
}
|
|
882
875
|
return {
|
|
883
|
-
provider,
|
|
884
876
|
turn,
|
|
885
877
|
canceled,
|
|
886
878
|
error
|