@kernl-sdk/protocol 0.5.0 → 0.5.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +11 -0
- package/dist/language-model/model.d.ts +80 -25
- package/dist/language-model/model.d.ts.map +1 -1
- package/dist/language-model/stream.d.ts +2 -2
- package/dist/language-model/stream.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/language-model/model.ts +98 -35
- package/src/language-model/stream.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @kernl/protocol
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 884e513: Align with @ai-sdk/provider v3 stable release
|
|
8
|
+
- Update LanguageModelUsage to nested structure (inputTokens.total, outputTokens.total, etc.)
|
|
9
|
+
- Update LanguageModelFinishReason to object with unified and raw properties
|
|
10
|
+
- Rename LanguageModelWarning to SharedWarning with updated structure
|
|
11
|
+
- Update tool type from "provider-defined" to "provider"
|
|
12
|
+
- Bump @ai-sdk peer dependencies from beta to stable (^3.0.3)
|
|
13
|
+
|
|
3
14
|
## 0.5.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -2,7 +2,6 @@ import { SharedProviderMetadata } from "../provider/index.js";
|
|
|
2
2
|
import { LanguageModelResponseItem } from "./item.js";
|
|
3
3
|
import { LanguageModelRequest } from "./request.js";
|
|
4
4
|
import { LanguageModelStreamEvent } from "./stream.js";
|
|
5
|
-
import { LanguageModelFunctionTool, LanguageModelProviderTool } from "./tool.js";
|
|
6
5
|
/**
|
|
7
6
|
* Defines the standard interface for language model providers in kernl.
|
|
8
7
|
*/
|
|
@@ -51,7 +50,7 @@ export interface LanguageModelResponse {
|
|
|
51
50
|
/**
|
|
52
51
|
* Warnings for the call, e.g. unsupported settings.
|
|
53
52
|
*/
|
|
54
|
-
warnings:
|
|
53
|
+
warnings: SharedWarning[];
|
|
55
54
|
/**
|
|
56
55
|
* Raw response data from the underlying model provider.
|
|
57
56
|
*/
|
|
@@ -60,7 +59,23 @@ export interface LanguageModelResponse {
|
|
|
60
59
|
/**
|
|
61
60
|
* Reason why a language model finished generating a response.
|
|
62
61
|
*/
|
|
63
|
-
export
|
|
62
|
+
export interface LanguageModelFinishReason {
|
|
63
|
+
/**
|
|
64
|
+
* Unified finish reason across providers.
|
|
65
|
+
*
|
|
66
|
+
* - `stop`: model generated stop sequence
|
|
67
|
+
* - `length`: model generated maximum number of tokens
|
|
68
|
+
* - `content-filter`: content filter violation stopped the model
|
|
69
|
+
* - `tool-calls`: model triggered tool calls
|
|
70
|
+
* - `error`: model stopped because of an error
|
|
71
|
+
* - `other`: model stopped for other reasons
|
|
72
|
+
*/
|
|
73
|
+
unified: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other";
|
|
74
|
+
/**
|
|
75
|
+
* Raw finish reason from the provider.
|
|
76
|
+
*/
|
|
77
|
+
raw: string | undefined;
|
|
78
|
+
}
|
|
64
79
|
/**
|
|
65
80
|
* Usage information for a language model call.
|
|
66
81
|
*
|
|
@@ -69,42 +84,82 @@ export type LanguageModelFinishReason = "stop" | "length" | "content-filter" | "
|
|
|
69
84
|
*/
|
|
70
85
|
export interface LanguageModelUsage {
|
|
71
86
|
/**
|
|
72
|
-
*
|
|
87
|
+
* Input token usage breakdown.
|
|
73
88
|
*/
|
|
74
|
-
inputTokens:
|
|
89
|
+
inputTokens: {
|
|
90
|
+
/**
|
|
91
|
+
* Total input tokens used.
|
|
92
|
+
*/
|
|
93
|
+
total: number | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Input tokens that were not cached.
|
|
96
|
+
*/
|
|
97
|
+
noCache: number | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Input tokens read from cache.
|
|
100
|
+
*/
|
|
101
|
+
cacheRead: number | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Input tokens written to cache.
|
|
104
|
+
*/
|
|
105
|
+
cacheWrite: number | undefined;
|
|
106
|
+
};
|
|
75
107
|
/**
|
|
76
|
-
*
|
|
108
|
+
* Output token usage breakdown.
|
|
77
109
|
*/
|
|
78
|
-
outputTokens:
|
|
110
|
+
outputTokens: {
|
|
111
|
+
/**
|
|
112
|
+
* Total output tokens used.
|
|
113
|
+
*/
|
|
114
|
+
total: number | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Text generation tokens.
|
|
117
|
+
*/
|
|
118
|
+
text: number | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Reasoning/thinking tokens.
|
|
121
|
+
*/
|
|
122
|
+
reasoning: number | undefined;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
127
|
+
* some settings might not be supported, which can lead to suboptimal results.
|
|
128
|
+
*/
|
|
129
|
+
export type SharedWarning = {
|
|
79
130
|
/**
|
|
80
|
-
*
|
|
81
|
-
* This number might be different from the sum of `inputTokens` and `outputTokens`
|
|
82
|
-
* and e.g. include reasoning tokens or other overhead.
|
|
131
|
+
* A feature is not supported by the model.
|
|
83
132
|
*/
|
|
84
|
-
|
|
133
|
+
type: "unsupported";
|
|
85
134
|
/**
|
|
86
|
-
* The
|
|
135
|
+
* The feature that is not supported.
|
|
87
136
|
*/
|
|
88
|
-
|
|
137
|
+
feature: string;
|
|
89
138
|
/**
|
|
90
|
-
*
|
|
139
|
+
* Additional details about the warning.
|
|
91
140
|
*/
|
|
92
|
-
cachedInputTokens?: number | undefined;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
96
|
-
* some settings might not be supported, which can lead to suboptimal results.
|
|
97
|
-
*/
|
|
98
|
-
export type LanguageModelWarning = {
|
|
99
|
-
type: "unsupported-setting";
|
|
100
|
-
setting: Omit<keyof LanguageModelRequest, "input">;
|
|
101
141
|
details?: string;
|
|
102
142
|
} | {
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
/**
|
|
144
|
+
* A compatibility feature is used that might lead to suboptimal results.
|
|
145
|
+
*/
|
|
146
|
+
type: "compatibility";
|
|
147
|
+
/**
|
|
148
|
+
* The feature that is used in compatibility mode.
|
|
149
|
+
*/
|
|
150
|
+
feature: string;
|
|
151
|
+
/**
|
|
152
|
+
* Additional details about the warning.
|
|
153
|
+
*/
|
|
105
154
|
details?: string;
|
|
106
155
|
} | {
|
|
156
|
+
/**
|
|
157
|
+
* Other warning.
|
|
158
|
+
*/
|
|
107
159
|
type: "other";
|
|
160
|
+
/**
|
|
161
|
+
* The message of the warning.
|
|
162
|
+
*/
|
|
108
163
|
message: string;
|
|
109
164
|
};
|
|
110
165
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/language-model/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/language-model/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGpD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IA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SAAS,CAAC;QAEzB;;WAEG;QACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GACrB;IACE;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACD;IACE;;OAEG;IACH,IAAI,EAAE,eAAe,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GACD;IACE;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SharedProviderMetadata } from "../provider/index.js";
|
|
2
|
-
import type { LanguageModelFinishReason, LanguageModelUsage,
|
|
2
|
+
import type { LanguageModelFinishReason, LanguageModelUsage, SharedWarning } from "./model.js";
|
|
3
3
|
import type { Message, Reasoning, ToolCall, ToolResult } from "./item.js";
|
|
4
4
|
/**
|
|
5
5
|
* Union of all language model stream events.
|
|
@@ -109,7 +109,7 @@ export interface StartEvent extends StreamEventBase {
|
|
|
109
109
|
/**
|
|
110
110
|
* Warnings for the call (e.g., unsupported settings).
|
|
111
111
|
*/
|
|
112
|
-
warnings?:
|
|
112
|
+
warnings?: SharedWarning[];
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Stream event indicating the completion of agent execution.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/language-model/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,KAAK,EACV,yBAAyB,EACzB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3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,WAAW,UAAW,SAAQ,eAAe;IACjD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,eAAe;IAC/C,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -85,7 +85,7 @@ export interface LanguageModelResponse {
|
|
|
85
85
|
/**
|
|
86
86
|
* Warnings for the call, e.g. unsupported settings.
|
|
87
87
|
*/
|
|
88
|
-
warnings:
|
|
88
|
+
warnings: SharedWarning[];
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
91
|
* Raw response data from the underlying model provider.
|
|
@@ -96,14 +96,30 @@ export interface LanguageModelResponse {
|
|
|
96
96
|
/**
|
|
97
97
|
* Reason why a language model finished generating a response.
|
|
98
98
|
*/
|
|
99
|
-
export
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
99
|
+
export interface LanguageModelFinishReason {
|
|
100
|
+
/**
|
|
101
|
+
* Unified finish reason across providers.
|
|
102
|
+
*
|
|
103
|
+
* - `stop`: model generated stop sequence
|
|
104
|
+
* - `length`: model generated maximum number of tokens
|
|
105
|
+
* - `content-filter`: content filter violation stopped the model
|
|
106
|
+
* - `tool-calls`: model triggered tool calls
|
|
107
|
+
* - `error`: model stopped because of an error
|
|
108
|
+
* - `other`: model stopped for other reasons
|
|
109
|
+
*/
|
|
110
|
+
unified:
|
|
111
|
+
| "stop"
|
|
112
|
+
| "length"
|
|
113
|
+
| "content-filter"
|
|
114
|
+
| "tool-calls"
|
|
115
|
+
| "error"
|
|
116
|
+
| "other";
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Raw finish reason from the provider.
|
|
120
|
+
*/
|
|
121
|
+
raw: string | undefined;
|
|
122
|
+
}
|
|
107
123
|
|
|
108
124
|
/**
|
|
109
125
|
* Usage information for a language model call.
|
|
@@ -113,49 +129,96 @@ export type LanguageModelFinishReason =
|
|
|
113
129
|
*/
|
|
114
130
|
export interface LanguageModelUsage {
|
|
115
131
|
/**
|
|
116
|
-
*
|
|
132
|
+
* Input token usage breakdown.
|
|
117
133
|
*/
|
|
118
|
-
inputTokens:
|
|
134
|
+
inputTokens: {
|
|
135
|
+
/**
|
|
136
|
+
* Total input tokens used.
|
|
137
|
+
*/
|
|
138
|
+
total: number | undefined;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Input tokens that were not cached.
|
|
142
|
+
*/
|
|
143
|
+
noCache: number | undefined;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Input tokens read from cache.
|
|
147
|
+
*/
|
|
148
|
+
cacheRead: number | undefined;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Input tokens written to cache.
|
|
152
|
+
*/
|
|
153
|
+
cacheWrite: number | undefined;
|
|
154
|
+
};
|
|
119
155
|
|
|
120
156
|
/**
|
|
121
|
-
*
|
|
157
|
+
* Output token usage breakdown.
|
|
122
158
|
*/
|
|
123
|
-
outputTokens:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
*/
|
|
140
|
-
cachedInputTokens?: number | undefined;
|
|
159
|
+
outputTokens: {
|
|
160
|
+
/**
|
|
161
|
+
* Total output tokens used.
|
|
162
|
+
*/
|
|
163
|
+
total: number | undefined;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Text generation tokens.
|
|
167
|
+
*/
|
|
168
|
+
text: number | undefined;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Reasoning/thinking tokens.
|
|
172
|
+
*/
|
|
173
|
+
reasoning: number | undefined;
|
|
174
|
+
};
|
|
141
175
|
}
|
|
142
176
|
|
|
143
177
|
/**
|
|
144
178
|
* Warning from the model provider for this call. The call will proceed, but e.g.
|
|
145
179
|
* some settings might not be supported, which can lead to suboptimal results.
|
|
146
180
|
*/
|
|
147
|
-
export type
|
|
181
|
+
export type SharedWarning =
|
|
148
182
|
| {
|
|
149
|
-
|
|
150
|
-
|
|
183
|
+
/**
|
|
184
|
+
* A feature is not supported by the model.
|
|
185
|
+
*/
|
|
186
|
+
type: "unsupported";
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* The feature that is not supported.
|
|
190
|
+
*/
|
|
191
|
+
feature: string;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Additional details about the warning.
|
|
195
|
+
*/
|
|
151
196
|
details?: string;
|
|
152
197
|
}
|
|
153
198
|
| {
|
|
154
|
-
|
|
155
|
-
|
|
199
|
+
/**
|
|
200
|
+
* A compatibility feature is used that might lead to suboptimal results.
|
|
201
|
+
*/
|
|
202
|
+
type: "compatibility";
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The feature that is used in compatibility mode.
|
|
206
|
+
*/
|
|
207
|
+
feature: string;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Additional details about the warning.
|
|
211
|
+
*/
|
|
156
212
|
details?: string;
|
|
157
213
|
}
|
|
158
214
|
| {
|
|
215
|
+
/**
|
|
216
|
+
* Other warning.
|
|
217
|
+
*/
|
|
159
218
|
type: "other";
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* The message of the warning.
|
|
222
|
+
*/
|
|
160
223
|
message: string;
|
|
161
224
|
};
|
|
@@ -3,7 +3,7 @@ import { SharedProviderMetadata } from "@/provider";
|
|
|
3
3
|
import type {
|
|
4
4
|
LanguageModelFinishReason,
|
|
5
5
|
LanguageModelUsage,
|
|
6
|
-
|
|
6
|
+
SharedWarning,
|
|
7
7
|
} from "./model";
|
|
8
8
|
import type { Message, Reasoning, ToolCall, ToolResult } from "./item";
|
|
9
9
|
|
|
@@ -151,7 +151,7 @@ export interface StartEvent extends StreamEventBase {
|
|
|
151
151
|
/**
|
|
152
152
|
* Warnings for the call (e.g., unsupported settings).
|
|
153
153
|
*/
|
|
154
|
-
warnings?:
|
|
154
|
+
warnings?: SharedWarning[];
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|