@builder.io/ai-utils 0.3.17 → 0.3.19
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/package.json +1 -1
- package/src/codegen.ts +8 -6
- package/src/messages.ts +58 -5
package/package.json
CHANGED
package/src/codegen.ts
CHANGED
|
@@ -141,10 +141,7 @@ export interface CodeGenToolMap {
|
|
|
141
141
|
|
|
142
142
|
export type CodeGenTools = keyof CodeGenToolMap;
|
|
143
143
|
|
|
144
|
-
export type AllCodeGenTools =
|
|
145
|
-
| CodeGenTools
|
|
146
|
-
| "str_replace_editor"
|
|
147
|
-
| "web_search";
|
|
144
|
+
export type AllCodeGenTools = CodeGenTools | "web_search";
|
|
148
145
|
|
|
149
146
|
export type CodeGenMode =
|
|
150
147
|
| "exact" // @deprecated
|
|
@@ -190,6 +187,8 @@ export interface CodeGenInputOptions {
|
|
|
190
187
|
promptCaching?: boolean;
|
|
191
188
|
llmSuggestions?: boolean;
|
|
192
189
|
conclusionText?: boolean;
|
|
190
|
+
mcpServers?: boolean;
|
|
191
|
+
pingEvents?: boolean;
|
|
193
192
|
|
|
194
193
|
searchResponse?: any | null;
|
|
195
194
|
|
|
@@ -205,8 +204,6 @@ export interface CodeGenInputOptions {
|
|
|
205
204
|
/** @deprecated */
|
|
206
205
|
prevId?: string;
|
|
207
206
|
/** @deprecated */
|
|
208
|
-
nextPage?: boolean;
|
|
209
|
-
/** @deprecated */
|
|
210
207
|
vcpId?: string;
|
|
211
208
|
}
|
|
212
209
|
|
|
@@ -667,6 +664,10 @@ export interface GenerateCodeEventDelta {
|
|
|
667
664
|
content: string;
|
|
668
665
|
}
|
|
669
666
|
|
|
667
|
+
export interface GenerateCodeEventPing {
|
|
668
|
+
type: "ping";
|
|
669
|
+
}
|
|
670
|
+
|
|
670
671
|
export interface GenerateCodeEventUser {
|
|
671
672
|
type: "user";
|
|
672
673
|
id: string;
|
|
@@ -683,4 +684,5 @@ export type GenerateCodeEvent =
|
|
|
683
684
|
| GenerateCodeEventPagination
|
|
684
685
|
| GenerateCodeEventDelta
|
|
685
686
|
| GenerateCodeEventError
|
|
687
|
+
| GenerateCodeEventPing
|
|
686
688
|
| GenerateCodeEventUser;
|
package/src/messages.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface ContentMessageItemToolResult {
|
|
|
48
48
|
tool_name?: string;
|
|
49
49
|
tool_input?: string;
|
|
50
50
|
title?: string;
|
|
51
|
-
content: string;
|
|
51
|
+
content: string | (ContentMessageItemText | ContentMessageItemImage)[];
|
|
52
52
|
is_error?: boolean;
|
|
53
53
|
cache?: boolean;
|
|
54
54
|
ephemeral?: boolean;
|
|
@@ -56,7 +56,7 @@ export interface ContentMessageItemToolResult {
|
|
|
56
56
|
|
|
57
57
|
export interface ImageBase64Source {
|
|
58
58
|
type: "base64";
|
|
59
|
-
media_type: "image/webp" | "image/png" | "image/jpeg";
|
|
59
|
+
media_type: "image/webp" | "image/png" | "image/jpeg" | "image/gif";
|
|
60
60
|
data: string;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -170,16 +170,65 @@ export type ServerToolUseContentUnion =
|
|
|
170
170
|
export interface ContentMessageItemServerToolUse {
|
|
171
171
|
type: "server_tool_use";
|
|
172
172
|
id: string;
|
|
173
|
-
name: "web_search";
|
|
173
|
+
name: "web_search" | "code_execution";
|
|
174
174
|
input: unknown;
|
|
175
175
|
completion?: string;
|
|
176
|
-
content?:
|
|
176
|
+
content?: any;
|
|
177
|
+
cache?: boolean;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export interface MCPServerURLDefinition {
|
|
181
|
+
name: string;
|
|
182
|
+
|
|
183
|
+
type: "url";
|
|
184
|
+
|
|
185
|
+
url: string;
|
|
186
|
+
|
|
187
|
+
authorization_token?: string | null;
|
|
188
|
+
|
|
189
|
+
tool_configuration?: MCPServerToolConfiguration | null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface MCPServerToolConfiguration {
|
|
193
|
+
allowed_tools?: Array<string> | null;
|
|
194
|
+
|
|
195
|
+
enabled?: boolean | null;
|
|
177
196
|
}
|
|
178
197
|
|
|
179
198
|
export interface ContentMessageItemWebSearchToolResult {
|
|
180
199
|
content: ServerToolUseContent[] | ServerToolUseContentError;
|
|
181
200
|
tool_use_id: string;
|
|
182
201
|
type: "web_search_tool_result";
|
|
202
|
+
cache?: boolean;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface ContentMessageItemMCPToolUse {
|
|
206
|
+
type: "mcp_tool_use";
|
|
207
|
+
id: string;
|
|
208
|
+
name: string;
|
|
209
|
+
input: unknown;
|
|
210
|
+
server_name: string;
|
|
211
|
+
cache?: boolean;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface ContentMessageItemContainerUpload {
|
|
215
|
+
type: "container_upload";
|
|
216
|
+
file_id: string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface ContentMessageItemMCPToolResult {
|
|
220
|
+
type: "mcp_tool_result";
|
|
221
|
+
tool_use_id: string;
|
|
222
|
+
content: string | ContentMessageItemText[];
|
|
223
|
+
is_error: boolean;
|
|
224
|
+
cache?: boolean;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface ContentMessageItemCodeExecutionToolResult {
|
|
228
|
+
type: "code_execution_tool_result";
|
|
229
|
+
tool_use_id: string;
|
|
230
|
+
content: any;
|
|
231
|
+
cache?: boolean;
|
|
183
232
|
}
|
|
184
233
|
|
|
185
234
|
export type ContentMessageItem =
|
|
@@ -191,7 +240,11 @@ export type ContentMessageItem =
|
|
|
191
240
|
| ContentMessageItemToolUse
|
|
192
241
|
| ContentMessageItemToolResult
|
|
193
242
|
| ContentMessageItemWebSearchToolResult
|
|
194
|
-
| ContentMessageItemServerToolUse
|
|
243
|
+
| ContentMessageItemServerToolUse
|
|
244
|
+
| ContentMessageItemMCPToolUse
|
|
245
|
+
| ContentMessageItemMCPToolResult
|
|
246
|
+
| ContentMessageItemContainerUpload
|
|
247
|
+
| ContentMessageItemCodeExecutionToolResult;
|
|
195
248
|
|
|
196
249
|
export type ContentMessage = ContentMessageItem[];
|
|
197
250
|
|