@builder.io/ai-utils 0.18.0 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.18.0",
3
+ "version": "0.18.2",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/codegen.d.ts CHANGED
@@ -211,6 +211,24 @@ export interface RecordFrameToolInput {
211
211
  title: string;
212
212
  frame: "last-image";
213
213
  }
214
+ export interface AddQAReviewComment {
215
+ file_path: string;
216
+ line: number;
217
+ title: string;
218
+ body: string;
219
+ severity: "critical" | "warning" | "info";
220
+ debugInfo?: string;
221
+ }
222
+ export interface AddQAReviewToolInput {
223
+ summary: string;
224
+ comments?: AddQAReviewComment[];
225
+ gif_id: string;
226
+ }
227
+ export interface ReportUIIssueToolInput {
228
+ title: string;
229
+ description: string;
230
+ debugInfo?: string;
231
+ }
214
232
  export interface CodeGenToolMap {
215
233
  view_path: ReadToolInput;
216
234
  glob_search: GlobSearchToolInput;
@@ -254,6 +272,8 @@ export interface CodeGenToolMap {
254
272
  ExitPlanMode: ExitPlanModeToolInput;
255
273
  ReadMcpResource: ReadMcpResourceToolInput;
256
274
  RecordFrame: RecordFrameToolInput;
275
+ AddQAReview: AddQAReviewToolInput;
276
+ ReportUIIssue: ReportUIIssueToolInput;
257
277
  }
258
278
  export type CodeGenTools = keyof CodeGenToolMap;
259
279
  export type AllCodeGenTools = CodeGenTools | "web_search";
@@ -656,6 +676,7 @@ export interface GenerateCompletionStepDevServerState {
656
676
  }
657
677
  export interface GenerateCompletionStepGit {
658
678
  type: "git";
679
+ folderName?: string;
659
680
  isSessionDirty: boolean;
660
681
  hasGeneratingPlaceholder: boolean;
661
682
  remoteBranchExists: boolean;
@@ -818,6 +839,8 @@ export interface GenerateUserMessage {
818
839
  enabledMCPs?: string[];
819
840
  sessionMode?: SessionMode;
820
841
  queue?: boolean;
842
+ /** Enable AddQAReview tool for QA PR review branches */
843
+ enableQAReviewTool?: boolean;
821
844
  /** @deprecated */
822
845
  repair?: boolean;
823
846
  }
@@ -1058,6 +1081,43 @@ export interface WorkspaceConfiguration {
1058
1081
  agentsMD?: string;
1059
1082
  folders: WorkspaceFolder[];
1060
1083
  }
1084
+ /**
1085
+ * Runtime context for a git-enabled repository.
1086
+ * Used to track multiple git working directories in codegen.
1087
+ */
1088
+ export interface GitRepoContext {
1089
+ /** Folder name from WorkspaceFolder */
1090
+ folderName: string;
1091
+ /** Absolute path to the repository */
1092
+ path: string;
1093
+ /** Feature branch name */
1094
+ branchName: string;
1095
+ /** Original repo URL */
1096
+ repoUrl?: string;
1097
+ /** Repo name (e.g., owner/repo) */
1098
+ repoName?: string;
1099
+ /**
1100
+ * Initial commit when first checked
1101
+ */
1102
+ initialCommit?: string;
1103
+ }
1104
+ /**
1105
+ * Result from a multi-repo git operation.
1106
+ */
1107
+ export interface MultiRepoOperationResult<T = unknown> {
1108
+ /** True if all repos succeeded */
1109
+ success: boolean;
1110
+ /** True if some succeeded and some failed */
1111
+ partialSuccess: boolean;
1112
+ /** Per-repo results */
1113
+ results: Array<{
1114
+ folderName: string;
1115
+ success: boolean;
1116
+ result?: T;
1117
+ error?: Error;
1118
+ message?: string;
1119
+ }>;
1120
+ }
1061
1121
  export type Permission = "read" | "write" | "list";
1062
1122
  export interface AclEntry {
1063
1123
  action: "allow" | "deny";
@@ -1402,6 +1462,8 @@ export interface PushChangesOptions {
1402
1462
  repoFullName: string;
1403
1463
  repoUrl: string;
1404
1464
  };
1465
+ /** If specified, only push changes for this folder (multi-repo support) */
1466
+ folderName?: string;
1405
1467
  }
1406
1468
  export interface SyncChangesFromRemote {
1407
1469
  remoteBranches?: "both" | "main" | "ai";
@@ -1,158 +1,154 @@
1
- import type {
2
- BuilderContent,
3
- BuilderElement,
4
- Component,
5
- } from "@builder.io/sdk";
1
+ import type { BuilderContent, BuilderElement, Component } from "@builder.io/sdk";
6
2
  import type { Message, MessageParam, Attachment } from "./messages.js";
7
3
  import type { BuilderModel } from "./events.js";
8
4
  export type { BuilderContent, BuilderElement, Component };
9
5
  export interface CompletionOptions {
10
- /**
11
- * How this assistant is being used. For example, "content-editor"
12
- * is used when the assistant is being used in the Builder.io content editor.
13
- */
14
- assistantType?: string;
15
- /**
16
- * LLM Model identifier to lookup which sdk and model to use.
17
- * If not provided the default model will be used.
18
- * Note: This is not the Builder.io data model.
19
- */
20
- modelId?: string;
21
- /**
22
- * The unique LOCAL identifier of the thread to submit the user message to.
23
- * This is used to identify the thread with our own id (openai assistant id is different)
24
- */
25
- id: string;
26
- /**
27
- * The unique OPENAI assistant id of the thread to submit the user message to.
28
- * If the assistantThreadId is not provided, a new thread will be created.
29
- */
30
- assistantThreadId?: string;
31
- /**
32
- * The message history of the conversation, user prompt then assistant response.
33
- * The messages are ordered from oldest to newest. The last message in the array
34
- * is the message that the user has just sent.
35
- */
36
- messages: (MessageParam | Message)[];
37
- /**
38
- * Which platform (framework) the the user has choosen to get help with.
39
- */
40
- platformId?: string;
41
- /**
42
- * The user id of the user sending the message.
43
- * This is used to track the user's progress in the conversation.
44
- * User id is stored in localStorage for this domain, its not the builder user id.
45
- */
46
- userId: string;
47
- /**
48
- * The state of the builder editor.
49
- */
50
- builderState?: BuilderEditorState;
51
- /**
52
- * Additional console logs
53
- */
54
- debug?: boolean;
55
- /**
56
- * Date.now() timestamp of when the assistant was started.
57
- * This is used to calculate the time taken between all events.
58
- */
59
- startMs?: number;
60
- /**
61
- * If events should be streamed back throughout the process.
62
- *
63
- * Setting to `false` will skip any intermediate processing and emitting
64
- * events while collecting LLM deltas, but will only emit the final result.
65
- *
66
- * Defaults to `true`.
67
- */
68
- stream?: boolean;
69
- /**
70
- * Provide a system prompt id to lookup a pre-defined system prompt
71
- * text sent to the LLM. Must be a pre-defined system prompt id!
72
- */
73
- systemPromptIds?: {
74
- "content-edit"?: string;
75
- };
76
- /**
77
- * Option on how this call should handle the conversation thread.
78
- *
79
- * `persist`:
80
- * - When there is no CompletionOptions `id`, it'll create a new thread id
81
- * - When given an existing `id`, it'll look up the past thread messages and prefix the messages
82
- *
83
- * `ephemeral`:
84
- * - Creates a new conversation each time, ignoring any existing thread history
85
- * - Will not save the conversation for future use
86
- *
87
- * Defaults to `persist`
88
- */
89
- thread?: "persist" | "ephemeral";
90
- attachments?: Attachment[];
6
+ /**
7
+ * How this assistant is being used. For example, "content-editor"
8
+ * is used when the assistant is being used in the Builder.io content editor.
9
+ */
10
+ assistantType?: string;
11
+ /**
12
+ * LLM Model identifier to lookup which sdk and model to use.
13
+ * If not provided the default model will be used.
14
+ * Note: This is not the Builder.io data model.
15
+ */
16
+ modelId?: string;
17
+ /**
18
+ * The unique LOCAL identifier of the thread to submit the user message to.
19
+ * This is used to identify the thread with our own id (openai assistant id is different)
20
+ */
21
+ id: string;
22
+ /**
23
+ * The unique OPENAI assistant id of the thread to submit the user message to.
24
+ * If the assistantThreadId is not provided, a new thread will be created.
25
+ */
26
+ assistantThreadId?: string;
27
+ /**
28
+ * The message history of the conversation, user prompt then assistant response.
29
+ * The messages are ordered from oldest to newest. The last message in the array
30
+ * is the message that the user has just sent.
31
+ */
32
+ messages: (MessageParam | Message)[];
33
+ /**
34
+ * Which platform (framework) the the user has choosen to get help with.
35
+ */
36
+ platformId?: string;
37
+ /**
38
+ * The user id of the user sending the message.
39
+ * This is used to track the user's progress in the conversation.
40
+ * User id is stored in localStorage for this domain, its not the builder user id.
41
+ */
42
+ userId: string;
43
+ /**
44
+ * The state of the builder editor.
45
+ */
46
+ builderState?: BuilderEditorState;
47
+ /**
48
+ * Additional console logs
49
+ */
50
+ debug?: boolean;
51
+ /**
52
+ * Date.now() timestamp of when the assistant was started.
53
+ * This is used to calculate the time taken between all events.
54
+ */
55
+ startMs?: number;
56
+ /**
57
+ * If events should be streamed back throughout the process.
58
+ *
59
+ * Setting to `false` will skip any intermediate processing and emitting
60
+ * events while collecting LLM deltas, but will only emit the final result.
61
+ *
62
+ * Defaults to `true`.
63
+ */
64
+ stream?: boolean;
65
+ /**
66
+ * Provide a system prompt id to lookup a pre-defined system prompt
67
+ * text sent to the LLM. Must be a pre-defined system prompt id!
68
+ */
69
+ systemPromptIds?: {
70
+ "content-edit"?: string;
71
+ };
72
+ /**
73
+ * Option on how this call should handle the conversation thread.
74
+ *
75
+ * `persist`:
76
+ * - When there is no CompletionOptions `id`, it'll create a new thread id
77
+ * - When given an existing `id`, it'll look up the past thread messages and prefix the messages
78
+ *
79
+ * `ephemeral`:
80
+ * - Creates a new conversation each time, ignoring any existing thread history
81
+ * - Will not save the conversation for future use
82
+ *
83
+ * Defaults to `persist`
84
+ */
85
+ thread?: "persist" | "ephemeral";
86
+ attachments?: Attachment[];
91
87
  }
92
88
  export interface BuilderEditorState {
93
- /**
94
- * The active locale of the builder editor.
95
- */
96
- activeLocale?: string;
97
- /**
98
- * The locale of the provided builder content.
99
- */
100
- contentLocale?: string;
101
- /**
102
- * Top level Builder content. The data.blocks array contains the BuilderElement.
103
- */
104
- content?: BuilderContent;
105
- /**
106
- * Builder custom components.
107
- */
108
- components?: Component[];
109
- /**
110
- * Builder design tokens.
111
- */
112
- designTokens?: Record<string, string>;
113
- /**
114
- * Builder model. (not the LLM model)
115
- */
116
- model?: BuilderModel;
117
- /**
118
- * Other models in the Builder account
119
- */
120
- otherModels?: BuilderModel[];
121
- /**
122
- * The URL that the Builder content preview is pointing to.
123
- */
124
- previewUrl?: string;
125
- /**
126
- * Selected ids in the builder.
127
- */
128
- selectedIds?: string[];
129
- /**
130
- * Builder space id.
131
- */
132
- spaceId?: string;
133
- /**
134
- * Builder user id.
135
- */
136
- userId?: string;
137
- /**
138
- * Email of the user in the builder.
139
- */
140
- userEmail?: string;
141
- /**
142
- * User's jobs
143
- */
144
- userJobs?: string[];
145
- /**
146
- * Builder session id.
147
- */
148
- sessionId?: string;
149
- /**
150
- * Custom instructions that could be add into the prompt.
151
- */
152
- customInstructions?: Record<string, string>;
153
- styleInspirationURL?: string;
154
- /**
155
- * All targeting attributes of the content.
156
- */
157
- allTargetingAttributes?: Record<string, any>;
89
+ /**
90
+ * The active locale of the builder editor.
91
+ */
92
+ activeLocale?: string;
93
+ /**
94
+ * The locale of the provided builder content.
95
+ */
96
+ contentLocale?: string;
97
+ /**
98
+ * Top level Builder content. The data.blocks array contains the BuilderElement.
99
+ */
100
+ content?: BuilderContent;
101
+ /**
102
+ * Builder custom components.
103
+ */
104
+ components?: Component[];
105
+ /**
106
+ * Builder design tokens.
107
+ */
108
+ designTokens?: Record<string, string>;
109
+ /**
110
+ * Builder model. (not the LLM model)
111
+ */
112
+ model?: BuilderModel;
113
+ /**
114
+ * Other models in the Builder account
115
+ */
116
+ otherModels?: BuilderModel[];
117
+ /**
118
+ * The URL that the Builder content preview is pointing to.
119
+ */
120
+ previewUrl?: string;
121
+ /**
122
+ * Selected ids in the builder.
123
+ */
124
+ selectedIds?: string[];
125
+ /**
126
+ * Builder space id.
127
+ */
128
+ spaceId?: string;
129
+ /**
130
+ * Builder user id.
131
+ */
132
+ userId?: string;
133
+ /**
134
+ * Email of the user in the builder.
135
+ */
136
+ userEmail?: string;
137
+ /**
138
+ * User's jobs
139
+ */
140
+ userJobs?: string[];
141
+ /**
142
+ * Builder session id.
143
+ */
144
+ sessionId?: string;
145
+ /**
146
+ * Custom instructions that could be add into the prompt.
147
+ */
148
+ customInstructions?: Record<string, string>;
149
+ styleInspirationURL?: string;
150
+ /**
151
+ * All targeting attributes of the content.
152
+ */
153
+ allTargetingAttributes?: Record<string, any>;
158
154
  }