@builder.io/ai-utils 0.11.4 → 0.11.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/codegen.d.ts CHANGED
@@ -30,7 +30,7 @@ export interface CustomInstruction {
30
30
  }
31
31
  export type CodeGenFramework = "react" | "html" | "mitosis" | "react-native" | "angular" | "vue" | "svelte" | "qwik" | "solid" | "marko" | "swiftui" | "jetpack-compose" | "flutter";
32
32
  export type CodeGenStyleLibrary = "tailwind" | "tailwind-precise" | "emotion" | "styled-components" | "styled-jsx" | "react-native" | undefined;
33
- export type CompletionStopReason = "max_tokens" | "stop_sequence" | "tool_use" | "end_turn" | "content_filter" | "error" | "aborted" | "pause_turn" | "refusal" | null;
33
+ export type CompletionStopReason = "max_tokens" | "stop_sequence" | "tool_use" | "end_turn" | "content_filter" | "error" | "aborted" | "pause_turn" | "refusal" | "model_context_window_exceeded" | null;
34
34
  export interface ViewPathToolInput {
35
35
  file_path: string;
36
36
  view_range?: [number, number];
@@ -167,6 +167,9 @@ export interface SetImportantFilesToolInput {
167
167
  limit?: number;
168
168
  }[];
169
169
  }
170
+ export interface ExitPlanModeToolInput {
171
+ plan: string;
172
+ }
170
173
  export interface CodeGenToolMap {
171
174
  view_path: ViewPathToolInput;
172
175
  glob_search: GlobSearchToolInput;
@@ -205,21 +208,30 @@ export interface CodeGenToolMap {
205
208
  LS: ListDirToolInput;
206
209
  WebFetch: WebFetchToolInput;
207
210
  SetImportantFiles: SetImportantFilesToolInput;
211
+ ExitPlanMode: ExitPlanModeToolInput;
208
212
  }
209
213
  export type CodeGenTools = keyof CodeGenToolMap;
210
214
  export type AllCodeGenTools = CodeGenTools | "web_search";
215
+ export type SessionMode = "planning" | "normal";
211
216
  export type CodeGenMode = "quality" | "quality-v3" | "quality-v4" | "quality-v4-agent";
212
217
  export type BaseCodeGenPosition = "fusion" | "editor-ai" | "repo-indexing" | "cli" | "create-app-firebase" | "create-app-lovable" | "builder-code-panel";
213
218
  export type CodeGenPosition = BaseCodeGenPosition | `${BaseCodeGenPosition}-agent`;
214
219
  export interface RepoIndexingConfig {
215
220
  designSystems: string[];
216
221
  }
222
+ export interface LocalMCPTools {
223
+ name: string;
224
+ description?: string;
225
+ inputSchema?: any;
226
+ serverName: string;
227
+ }
217
228
  export type CodeGenCategory = `repair-${string}` | `user-normal` | `user-figma` | `user-pdf` | `user-image` | `background-${string}` | `indexing-${string}`;
218
229
  export interface CodeGenInputOptions {
219
230
  position: string;
220
231
  eventName?: string;
221
232
  sessionId: string;
222
233
  codeGenMode?: CodeGenMode;
234
+ sessionMode?: SessionMode;
223
235
  url?: string;
224
236
  diffActions?: boolean;
225
237
  planningPrompt?: boolean;
@@ -253,12 +265,7 @@ export interface CodeGenInputOptions {
253
265
  * Local MCP tool definitions from stdio servers (CLI-side only)
254
266
  * These tools will be executed on the client side and passed through from the server
255
267
  */
256
- localMCPTools?: Array<{
257
- name: string;
258
- description?: string;
259
- inputSchema?: any;
260
- serverName: string;
261
- }>;
268
+ localMCPTools?: LocalMCPTools[];
262
269
  maxAgentLoops?: number;
263
270
  maxAgentTiming?: number;
264
271
  /**
@@ -488,6 +495,7 @@ export interface GenerateCompletionStepWaitForInput {
488
495
  type: "wait-for-input";
489
496
  state: GenerateCompletionState;
490
497
  suggestion?: SuggestedAction;
498
+ sessionMode: SessionMode;
491
499
  }
492
500
  export type GenerateCompletionStepBuilderAction = GenerateCompletionStepBuilderActionRefresh | GenerateCompletionStepBuilderActionOpenPath | GenerateCompletionStepBuilderActionMCPConnect;
493
501
  export interface GenerateCompletionStepBuilderActionRefresh {
@@ -575,6 +583,7 @@ export interface GenerateCompletionStepSession {
575
583
  id: string;
576
584
  turns: number;
577
585
  lastCompletionId: string | undefined;
586
+ sessionMode: SessionMode;
578
587
  }
579
588
  export interface GenerateCompletionStepServerToolResult {
580
589
  type: "server_tool_result";
@@ -608,48 +617,42 @@ export interface ApplyActionsResult {
608
617
  content?: string;
609
618
  oldContent?: string;
610
619
  }
611
- export interface UserSourceBuilder {
620
+ export type UserSourcePermission = "editCode" | "modifyMcpServers" | "modifyProjectSettings" | "createBranches" | "sendPullRequests" | "view";
621
+ export interface UserSourceBase {
622
+ role: "user" | "agent";
623
+ principals?: string[];
624
+ permissions?: UserSourcePermission[];
625
+ }
626
+ export interface UserSourceBuilder extends UserSourceBase {
612
627
  source: "builder.io";
613
628
  userId?: string;
614
629
  userName?: string;
615
630
  userEmail?: string;
616
- role: "user" | "agent";
617
631
  photoURL?: string;
618
- principals?: string[];
619
632
  }
620
- export interface UserSourceGithub {
633
+ export interface UserSourceGithub extends UserSourceBase {
621
634
  source: "github";
622
635
  userName: string;
623
636
  userEmail?: string;
624
637
  link?: string;
625
- role: "user" | "agent";
626
- principals?: string[];
627
638
  }
628
- export interface UserSourceGitlab {
639
+ export interface UserSourceGitlab extends UserSourceBase {
629
640
  source: "gitlab";
630
641
  userName: string;
631
642
  link?: string;
632
- role: "user" | "agent";
633
- principals?: string[];
634
643
  }
635
- export interface UserSourceAzure {
644
+ export interface UserSourceAzure extends UserSourceBase {
636
645
  source: "azure";
637
646
  userName: string;
638
647
  link?: string;
639
- role: "user" | "agent";
640
- principals?: string[];
641
648
  }
642
- export interface UserSourceBitbucket {
649
+ export interface UserSourceBitbucket extends UserSourceBase {
643
650
  source: "bitbucket";
644
651
  userName: string;
645
652
  link?: string;
646
- role: "user" | "agent";
647
- principals?: string[];
648
653
  }
649
- export interface UserSourceAgent {
654
+ export interface UserSourceAgent extends UserSourceBase {
650
655
  source: "agent";
651
- role: "agent" | "user";
652
- principals?: string[];
653
656
  }
654
657
  export type UserSource = UserSourceBuilder | UserSourceGithub | UserSourceGitlab | UserSourceAzure | UserSourceBitbucket | UserSourceAgent;
655
658
  export interface GenerateUserMessage {
@@ -671,6 +674,7 @@ export interface GenerateUserMessage {
671
674
  metadata?: Record<string, any>;
672
675
  autoPush?: "force-push" | "merge-push" | "ff-push" | "none";
673
676
  enabledMCPs?: string[];
677
+ sessionMode?: SessionMode;
674
678
  /** @deprecated */
675
679
  repair?: boolean;
676
680
  }
@@ -720,6 +724,7 @@ export interface GetSessionTurnsResult {
720
724
  createdUnixTime: number | undefined;
721
725
  updatedUnixTime: number | undefined;
722
726
  canLoadMore: boolean;
727
+ sessionMode?: SessionMode;
723
728
  }
724
729
  export interface CodegenFeedback {
725
730
  id: string;
package/src/messages.d.ts CHANGED
@@ -25,6 +25,12 @@ export interface ContentMessageItemDocument {
25
25
  ephemeral?: boolean;
26
26
  title?: string;
27
27
  }
28
+ export interface ContentMessageItemVideo {
29
+ type: "video";
30
+ source: VideoUrlSource;
31
+ cache?: boolean;
32
+ ephemeral?: boolean;
33
+ }
28
34
  export interface DocumentBase64Source {
29
35
  type: "base64";
30
36
  media_type: "application/pdf";
@@ -61,6 +67,11 @@ export interface ImageUrlSource {
61
67
  type: "url";
62
68
  url: string;
63
69
  }
70
+ export interface VideoUrlSource {
71
+ type: "url";
72
+ url: string;
73
+ media_type?: "video/mp4" | "video/mov" | "video/mpeg" | "video/mpg" | "video/avi" | "video/wmv" | "video/webm" | "video/flv";
74
+ }
64
75
  export interface ContentMessageItemThinking {
65
76
  type: "thinking";
66
77
  thinking: string;
@@ -130,7 +141,7 @@ export type ServerToolUseContentUnion = ServerToolUseContent[] | ServerToolUseCo
130
141
  export interface ContentMessageItemServerToolUse {
131
142
  type: "server_tool_use";
132
143
  id: string;
133
- name: "web_search" | "code_execution";
144
+ name: "web_search" | "code_execution" | "web_fetch" | "bash_code_execution" | "text_editor_code_execution";
134
145
  input: unknown;
135
146
  completion?: string;
136
147
  content?: any;
@@ -180,7 +191,7 @@ export interface ContentMessageItemCodeExecutionToolResult {
180
191
  content: any;
181
192
  cache?: boolean;
182
193
  }
183
- export type ContentMessageItem = ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemThinking | ContentMessageItemRedactedThinking | ContentMessageItemToolUse | ContentMessageItemToolResult | ContentMessageItemWebSearchToolResult | ContentMessageItemServerToolUse | ContentMessageItemMCPToolUse | ContentMessageItemMCPToolResult | ContentMessageItemContainerUpload | ContentMessageItemCodeExecutionToolResult;
194
+ export type ContentMessageItem = ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemVideo | ContentMessageItemThinking | ContentMessageItemRedactedThinking | ContentMessageItemToolUse | ContentMessageItemToolResult | ContentMessageItemWebSearchToolResult | ContentMessageItemServerToolUse | ContentMessageItemMCPToolUse | ContentMessageItemMCPToolResult | ContentMessageItemContainerUpload | ContentMessageItemCodeExecutionToolResult;
184
195
  export type ContentMessage = ContentMessageItem[];
185
196
  export interface SystemMessageParam {
186
197
  /**
@@ -198,7 +209,7 @@ export interface UserMessageParam {
198
209
  /**
199
210
  * The contents of the user message.
200
211
  */
201
- content: string | (ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemToolResult)[];
212
+ content: string | (ContentMessageItemText | ContentMessageItemImage | ContentMessageItemDocument | ContentMessageItemVideo | ContentMessageItemToolResult)[];
202
213
  responseId?: string;
203
214
  /**
204
215
  * The role of the messages author, in this case `user`.