@builder.io/ai-utils 0.3.21 → 0.3.23
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/README.md +3 -0
- package/package.json +1 -1
- package/src/codegen.ts +725 -0
- package/src/completion.ts +174 -0
- package/src/events.ts +485 -0
- package/src/mapping.ts +98 -0
- package/src/messages.ts +393 -0
- package/src/settings.ts +59 -0
- package/src/codegen.d.ts +0 -533
- package/src/codegen.js +0 -1
- package/src/completion.d.ts +0 -154
- package/src/completion.js +0 -1
- package/src/events.d.ts +0 -378
- package/src/events.js +0 -1
- package/src/index.js +0 -6
- package/src/mapping.d.ts +0 -86
- package/src/mapping.js +0 -1
- package/src/messages.d.ts +0 -261
- package/src/messages.js +0 -16
- package/src/settings.d.ts +0 -20
- package/src/settings.js +0 -30
- /package/src/{index.d.ts → index.ts} +0 -0
package/src/codegen.d.ts
DELETED
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
import type { Attachment, ContentMessageItemToolResult, UserMessageParam } from "./messages";
|
|
2
|
-
import type { BuilderContent } from "./completion";
|
|
3
|
-
import type { Options as PrettierOptions } from "prettier";
|
|
4
|
-
import type { UserContext } from "./mapping";
|
|
5
|
-
import type { AssistantMessageParam } from "./messages";
|
|
6
|
-
export type ImportType = "named" | "default";
|
|
7
|
-
export interface ESMImport {
|
|
8
|
-
importName: string;
|
|
9
|
-
importPath: string;
|
|
10
|
-
importType: ImportType;
|
|
11
|
-
}
|
|
12
|
-
export interface ProjectFile {
|
|
13
|
-
filePath: string;
|
|
14
|
-
content?: string;
|
|
15
|
-
importance?: number;
|
|
16
|
-
dropReason?: string;
|
|
17
|
-
wasIncluded?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface CustomInstruction {
|
|
20
|
-
id: string;
|
|
21
|
-
name: string;
|
|
22
|
-
content: string;
|
|
23
|
-
type?: "always" | "agent-mode";
|
|
24
|
-
filePath?: string;
|
|
25
|
-
glob?: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
}
|
|
28
|
-
export type CodeGenFramework = "react" | "html" | "mitosis" | "react-native" | "angular" | "vue" | "svelte" | "qwik" | "solid" | "marko" | "swiftui" | "jetpack-compose" | "flutter";
|
|
29
|
-
export type CodeGenStyleLibrary = "tailwind" | "tailwind-precise" | "emotion" | "styled-components" | "styled-jsx" | "react-native" | undefined;
|
|
30
|
-
export type CompletionStopReason = "max_tokens" | "stop_sequence" | "tool_use" | "end_turn" | "content_filter" | "error" | "aborted" | "pause_turn" | "refusal" | null;
|
|
31
|
-
export interface ViewPathToolInput {
|
|
32
|
-
file_path: string;
|
|
33
|
-
view_range?: [number, number];
|
|
34
|
-
}
|
|
35
|
-
export interface GlobSearchToolInput {
|
|
36
|
-
pattern: string;
|
|
37
|
-
}
|
|
38
|
-
export interface GrepSearchToolInput {
|
|
39
|
-
query: string;
|
|
40
|
-
include_glob?: string;
|
|
41
|
-
exclude_glob?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface GetRuleToolInput {
|
|
44
|
-
name: string;
|
|
45
|
-
}
|
|
46
|
-
export interface GetStyleInspirationToolInput {
|
|
47
|
-
url: string;
|
|
48
|
-
}
|
|
49
|
-
export interface GetBuildOutputToolInput {
|
|
50
|
-
}
|
|
51
|
-
export interface DevServerControlInput {
|
|
52
|
-
restart?: boolean;
|
|
53
|
-
get_logs?: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface BashToolInput {
|
|
56
|
-
command?: string;
|
|
57
|
-
restart?: boolean;
|
|
58
|
-
}
|
|
59
|
-
export interface WebSearchToolInput {
|
|
60
|
-
query: string;
|
|
61
|
-
}
|
|
62
|
-
export interface WriteFileInput {
|
|
63
|
-
title: string;
|
|
64
|
-
file_path: string;
|
|
65
|
-
content: string;
|
|
66
|
-
}
|
|
67
|
-
export interface SearchReplaceInput {
|
|
68
|
-
title: string;
|
|
69
|
-
file_path: string;
|
|
70
|
-
old_str: string;
|
|
71
|
-
new_str: string;
|
|
72
|
-
}
|
|
73
|
-
export interface CodeGenToolMap {
|
|
74
|
-
view_path: ViewPathToolInput;
|
|
75
|
-
glob_search: GlobSearchToolInput;
|
|
76
|
-
grep_search: GrepSearchToolInput;
|
|
77
|
-
get_rule: GetRuleToolInput;
|
|
78
|
-
get_style_inspiration: GetStyleInspirationToolInput;
|
|
79
|
-
get_build_output: GetBuildOutputToolInput;
|
|
80
|
-
dev_server_control: DevServerControlInput;
|
|
81
|
-
bash: BashToolInput;
|
|
82
|
-
web_search: WebSearchToolInput;
|
|
83
|
-
write_file: WriteFileInput;
|
|
84
|
-
search_replace_file: SearchReplaceInput;
|
|
85
|
-
}
|
|
86
|
-
export type CodeGenTools = keyof CodeGenToolMap;
|
|
87
|
-
export type AllCodeGenTools = CodeGenTools | "web_search";
|
|
88
|
-
export type CodeGenMode = "exact" | "precise" | "precise_vision" | "creative" | "creative_vision" | "creative_only_vision";
|
|
89
|
-
export interface CodeGenInputOptions {
|
|
90
|
-
position: string;
|
|
91
|
-
eventName?: string;
|
|
92
|
-
sessionId: string;
|
|
93
|
-
codeGenMode?: "fast" | "quality" | "quality-v3";
|
|
94
|
-
url?: string;
|
|
95
|
-
diffActions?: boolean;
|
|
96
|
-
planningPrompt?: boolean;
|
|
97
|
-
customInstructions?: CustomInstruction[];
|
|
98
|
-
userPrompt?: string;
|
|
99
|
-
ephemeralUserPrompt?: string;
|
|
100
|
-
displayUserPrompt?: string;
|
|
101
|
-
files?: ProjectFile[];
|
|
102
|
-
rerankFiles?: number;
|
|
103
|
-
toolResults?: ContentMessageItemToolResult[];
|
|
104
|
-
attachments?: Attachment[];
|
|
105
|
-
beforeCommit?: string;
|
|
106
|
-
workingDirectory?: string;
|
|
107
|
-
builderContent?: BuilderContent;
|
|
108
|
-
framework?: CodeGenFramework;
|
|
109
|
-
styleLibrary?: CodeGenStyleLibrary;
|
|
110
|
-
typescript?: boolean;
|
|
111
|
-
userContext?: UserContext;
|
|
112
|
-
enabledTools?: CodeGenTools[];
|
|
113
|
-
maxTokens?: number;
|
|
114
|
-
maxPages?: number;
|
|
115
|
-
autoContinue?: number;
|
|
116
|
-
promptCaching?: boolean;
|
|
117
|
-
llmSuggestions?: boolean;
|
|
118
|
-
conclusionText?: boolean;
|
|
119
|
-
mcpServers?: boolean;
|
|
120
|
-
pingEvents?: boolean;
|
|
121
|
-
searchResponse?: any | null;
|
|
122
|
-
prettierConfig?: PrettierOptions;
|
|
123
|
-
role?: "user" | "agent";
|
|
124
|
-
user?: UserSource;
|
|
125
|
-
/** @deprecated */
|
|
126
|
-
history?: (UserMessageParam | AssistantMessageParam)[];
|
|
127
|
-
/** @deprecated */
|
|
128
|
-
prevId?: string;
|
|
129
|
-
/** @deprecated */
|
|
130
|
-
vcpId?: string;
|
|
131
|
-
}
|
|
132
|
-
export type Feature = "component-mapping";
|
|
133
|
-
export interface CodegenUsage {
|
|
134
|
-
total: number;
|
|
135
|
-
fast: number;
|
|
136
|
-
quality: number;
|
|
137
|
-
features: Feature[];
|
|
138
|
-
limits: {
|
|
139
|
-
aiGeneration: number;
|
|
140
|
-
aiGenerationContextWindow: number;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
export interface PromptSuggestion {
|
|
144
|
-
type: "missing-imports" | "lazy-code" | "no-file-for-diff" | "syntax-error" | "llm-suggested" | "diff-apply";
|
|
145
|
-
filePath?: string;
|
|
146
|
-
line?: number;
|
|
147
|
-
importance: "high" | "medium" | "low";
|
|
148
|
-
column?: number;
|
|
149
|
-
summary: string;
|
|
150
|
-
prompt: string;
|
|
151
|
-
}
|
|
152
|
-
export interface ActionItem {
|
|
153
|
-
type: "file" | "text" | "diff" | "thinking" | "tool" | "suggestion" | "tool_result" | "server_tool_result";
|
|
154
|
-
id?: string;
|
|
155
|
-
content: string;
|
|
156
|
-
filePath?: string;
|
|
157
|
-
artifactTitle?: string;
|
|
158
|
-
actionTitle?: string;
|
|
159
|
-
synthetic?: boolean;
|
|
160
|
-
incomplete?: boolean;
|
|
161
|
-
suggestions?: PromptSuggestion[];
|
|
162
|
-
errors?: string[];
|
|
163
|
-
}
|
|
164
|
-
export interface RepoInfo {
|
|
165
|
-
remoteUrl: string;
|
|
166
|
-
defaultBranch: string;
|
|
167
|
-
currentBranch: string;
|
|
168
|
-
commit: string;
|
|
169
|
-
}
|
|
170
|
-
export interface CodebaseSearchOptions {
|
|
171
|
-
repoInfo?: RepoInfo;
|
|
172
|
-
query: string;
|
|
173
|
-
selectedFiles?: string[];
|
|
174
|
-
sessionId: string;
|
|
175
|
-
files?: string[];
|
|
176
|
-
packageJson?: string;
|
|
177
|
-
limit?: number;
|
|
178
|
-
includeContent?: boolean;
|
|
179
|
-
}
|
|
180
|
-
export interface CodebaseSearchResponse {
|
|
181
|
-
id: string;
|
|
182
|
-
relevantPaths: string[];
|
|
183
|
-
grepQueries: string[];
|
|
184
|
-
streamMeta: any;
|
|
185
|
-
ranked: RankedResult[];
|
|
186
|
-
}
|
|
187
|
-
export interface RankedResult {
|
|
188
|
-
index: number;
|
|
189
|
-
filePath: string;
|
|
190
|
-
startIndex: number;
|
|
191
|
-
endIndex: number;
|
|
192
|
-
score: number;
|
|
193
|
-
id: string;
|
|
194
|
-
content?: string;
|
|
195
|
-
}
|
|
196
|
-
export interface GenerateCompletionStepThinking {
|
|
197
|
-
type: "thinking";
|
|
198
|
-
}
|
|
199
|
-
export interface FileInfo {
|
|
200
|
-
filePath: string;
|
|
201
|
-
size: number;
|
|
202
|
-
isCustomInstruction: boolean;
|
|
203
|
-
}
|
|
204
|
-
export interface GenerateCompletionStepUserInput {
|
|
205
|
-
type: "user-input";
|
|
206
|
-
prompt: string;
|
|
207
|
-
files: FileInfo[];
|
|
208
|
-
}
|
|
209
|
-
export interface GenerateCompletionStepToolResult {
|
|
210
|
-
type: "agent-input";
|
|
211
|
-
toolResults: ContentMessageItemToolResult[];
|
|
212
|
-
}
|
|
213
|
-
export interface GenerateCompletionStepPlanning {
|
|
214
|
-
type: "planning";
|
|
215
|
-
content: string;
|
|
216
|
-
}
|
|
217
|
-
export interface GenerateCompletionStepUser {
|
|
218
|
-
type: "user";
|
|
219
|
-
displayPrompt: string | undefined;
|
|
220
|
-
attachments?: Array<Attachment>;
|
|
221
|
-
id: string;
|
|
222
|
-
user: UserSource;
|
|
223
|
-
role: "user" | "agent";
|
|
224
|
-
}
|
|
225
|
-
export interface GenerateCompletionStepFile {
|
|
226
|
-
type: "file";
|
|
227
|
-
filePath: string;
|
|
228
|
-
content: string;
|
|
229
|
-
title: string;
|
|
230
|
-
id: string;
|
|
231
|
-
}
|
|
232
|
-
export interface GenerateCompletionStepDiff {
|
|
233
|
-
type: "diff";
|
|
234
|
-
filePath: string;
|
|
235
|
-
content: string;
|
|
236
|
-
title: string;
|
|
237
|
-
id: string;
|
|
238
|
-
}
|
|
239
|
-
export interface GenerateCompletionStepTool {
|
|
240
|
-
type: "tool";
|
|
241
|
-
name: string;
|
|
242
|
-
id: string;
|
|
243
|
-
content: string;
|
|
244
|
-
}
|
|
245
|
-
export interface GenerateCompletionStepText {
|
|
246
|
-
type: "text";
|
|
247
|
-
content: string;
|
|
248
|
-
}
|
|
249
|
-
export interface GenerateCompletionStepDone {
|
|
250
|
-
type: "done";
|
|
251
|
-
id: string;
|
|
252
|
-
applyResults: ApplyActionsResult[];
|
|
253
|
-
actions: ActionItem[];
|
|
254
|
-
usage: CodegenUsage | undefined;
|
|
255
|
-
url?: string;
|
|
256
|
-
stopReason: CompletionStopReason;
|
|
257
|
-
hasChanges: boolean;
|
|
258
|
-
}
|
|
259
|
-
export interface GenerateCompletionStepStart {
|
|
260
|
-
type: "start";
|
|
261
|
-
name: string;
|
|
262
|
-
id: string | undefined;
|
|
263
|
-
title: string;
|
|
264
|
-
content: string;
|
|
265
|
-
filePath?: string;
|
|
266
|
-
}
|
|
267
|
-
export interface GenerateCompletionStepDelta {
|
|
268
|
-
type: "delta";
|
|
269
|
-
name: string;
|
|
270
|
-
delta: string;
|
|
271
|
-
}
|
|
272
|
-
export interface GenerateCompletionStepError {
|
|
273
|
-
type: "error";
|
|
274
|
-
id?: string;
|
|
275
|
-
stopReason?: "error" | "limit";
|
|
276
|
-
metadata?: any;
|
|
277
|
-
message: string;
|
|
278
|
-
usage?: CodegenUsage;
|
|
279
|
-
contextPrompt?: string;
|
|
280
|
-
}
|
|
281
|
-
export interface GenerateCompletionStepContinue {
|
|
282
|
-
type: "continue";
|
|
283
|
-
id: string;
|
|
284
|
-
url: string;
|
|
285
|
-
}
|
|
286
|
-
export interface CodeGenHealthStatus {
|
|
287
|
-
devServerRunning: boolean;
|
|
288
|
-
devServerResponding: boolean;
|
|
289
|
-
logs: string | undefined;
|
|
290
|
-
lastInstallFailed: boolean;
|
|
291
|
-
checkLogs: string;
|
|
292
|
-
checkPassed: boolean;
|
|
293
|
-
prompt: string;
|
|
294
|
-
message: string;
|
|
295
|
-
}
|
|
296
|
-
export interface SuggestedActionBase {
|
|
297
|
-
level: "info" | "warning" | "error";
|
|
298
|
-
canAutoApply: boolean;
|
|
299
|
-
actionButtonText: string;
|
|
300
|
-
message: string;
|
|
301
|
-
userMessage: GenerateUserMessage;
|
|
302
|
-
}
|
|
303
|
-
export interface SuggestedActionBuildError extends SuggestedActionBase {
|
|
304
|
-
type: "build-error";
|
|
305
|
-
healthStatus: CodeGenHealthStatus;
|
|
306
|
-
}
|
|
307
|
-
export type SuggestedAction = SuggestedActionBuildError;
|
|
308
|
-
export interface GenerateCompletionStepWaitForInput {
|
|
309
|
-
type: "wait-for-input";
|
|
310
|
-
state: GenerateCompletionState;
|
|
311
|
-
suggestion?: SuggestedAction;
|
|
312
|
-
}
|
|
313
|
-
export interface GenerateCompletionStepAbort {
|
|
314
|
-
type: "user-abort";
|
|
315
|
-
}
|
|
316
|
-
export interface GenerateCompletionStepRestore {
|
|
317
|
-
type: "restore";
|
|
318
|
-
location: "before" | "after";
|
|
319
|
-
files: string[];
|
|
320
|
-
lastCompletionId: string | undefined;
|
|
321
|
-
commitHash: string | undefined;
|
|
322
|
-
}
|
|
323
|
-
export type GenerateCompletionState = "unknown" | "initial-with-url" | "initial-without-url" | "generating" | "success" | "abort" | "error" | "close" | "replay";
|
|
324
|
-
export interface GenerateCompletionStepState {
|
|
325
|
-
type: "state";
|
|
326
|
-
previousState: GenerateCompletionState;
|
|
327
|
-
newState: GenerateCompletionState;
|
|
328
|
-
}
|
|
329
|
-
export interface GenerateCompletionStepGit {
|
|
330
|
-
type: "git";
|
|
331
|
-
isSessionDirty: boolean;
|
|
332
|
-
remoteBranchExists: boolean;
|
|
333
|
-
canPush: boolean;
|
|
334
|
-
canPull: boolean;
|
|
335
|
-
canSync: boolean;
|
|
336
|
-
ahead: number;
|
|
337
|
-
behind: number;
|
|
338
|
-
currentCommit: string;
|
|
339
|
-
currentBranch: string;
|
|
340
|
-
remoteBranch: string;
|
|
341
|
-
}
|
|
342
|
-
export interface GenerateCompletionStepClose {
|
|
343
|
-
type: "close";
|
|
344
|
-
}
|
|
345
|
-
export interface GenerateCompletionStepStdio {
|
|
346
|
-
type: "stdio";
|
|
347
|
-
command: string;
|
|
348
|
-
stream: "stdout" | "stderr";
|
|
349
|
-
source: "run-command" | "tool-command";
|
|
350
|
-
content: string;
|
|
351
|
-
}
|
|
352
|
-
export interface GenerateCompletionStepSession {
|
|
353
|
-
type: "session";
|
|
354
|
-
title: string | undefined;
|
|
355
|
-
beforeCommit: string | undefined;
|
|
356
|
-
createdUnixTime: number;
|
|
357
|
-
updatedUnixTime: number;
|
|
358
|
-
id: string;
|
|
359
|
-
hasChanges: boolean;
|
|
360
|
-
}
|
|
361
|
-
export interface GenerateCompletionStepServerToolResult {
|
|
362
|
-
type: "server_tool_result";
|
|
363
|
-
content: any;
|
|
364
|
-
title: string;
|
|
365
|
-
id: string;
|
|
366
|
-
}
|
|
367
|
-
export type GenerateCompletionStep = {
|
|
368
|
-
timestamp?: number;
|
|
369
|
-
} & (GenerateCompletionStepPlanning | GenerateCompletionStepStart | GenerateCompletionStepDelta | GenerateCompletionStepUser | GenerateCompletionStepFile | GenerateCompletionStepDiff | GenerateCompletionStepTool | GenerateCompletionStepError | GenerateCompletionStepContinue | GenerateCompletionStepWaitForInput | GenerateCompletionStepAbort | GenerateCompletionStepDone | GenerateCompletionStepUserInput | GenerateCompletionStepText | GenerateCompletionStepRestore | GenerateCompletionStepState | GenerateCompletionStepStdio | GenerateCompletionStepSession | GenerateCompletionStepServerToolResult | GenerateCompletionStepGit | GenerateCompletionStepToolResult);
|
|
370
|
-
export interface ApplyActionsResult {
|
|
371
|
-
filePath: string;
|
|
372
|
-
addedLines: number;
|
|
373
|
-
removedLines: number;
|
|
374
|
-
action: "create" | "update" | "delete";
|
|
375
|
-
content?: string;
|
|
376
|
-
oldContent?: string;
|
|
377
|
-
}
|
|
378
|
-
export interface UserSourceBuilder {
|
|
379
|
-
source: "builder.io";
|
|
380
|
-
userId?: string;
|
|
381
|
-
userName?: string;
|
|
382
|
-
userEmail?: string;
|
|
383
|
-
role: "user";
|
|
384
|
-
}
|
|
385
|
-
export interface UserSourceGithub {
|
|
386
|
-
source: "github";
|
|
387
|
-
userName: string;
|
|
388
|
-
link?: string;
|
|
389
|
-
role: "user" | "agent";
|
|
390
|
-
}
|
|
391
|
-
export interface UserSourceAgent {
|
|
392
|
-
source: "agent";
|
|
393
|
-
role: "agent";
|
|
394
|
-
}
|
|
395
|
-
export type UserSource = UserSourceBuilder | UserSourceGithub | UserSourceAgent;
|
|
396
|
-
export interface GenerateUserMessage {
|
|
397
|
-
user?: UserSource;
|
|
398
|
-
userPrompt: string;
|
|
399
|
-
ephemeralUserPrompt?: string;
|
|
400
|
-
displayPrompt?: string;
|
|
401
|
-
files?: string[];
|
|
402
|
-
includeBaseFiles?: boolean;
|
|
403
|
-
skipSearch?: boolean;
|
|
404
|
-
attachments?: Attachment[];
|
|
405
|
-
debugMode?: boolean;
|
|
406
|
-
logsCheckpoint?: boolean;
|
|
407
|
-
dropAbortedPrompt?: boolean;
|
|
408
|
-
}
|
|
409
|
-
export interface UserInput {
|
|
410
|
-
userMessage: GenerateUserMessage | undefined;
|
|
411
|
-
userPrompt: string;
|
|
412
|
-
attachments: Attachment[];
|
|
413
|
-
files: ProjectFile[];
|
|
414
|
-
searchResponse: CodebaseSearchResponse | null;
|
|
415
|
-
rerankFiles?: number;
|
|
416
|
-
mostRelevantFile: string | null;
|
|
417
|
-
toolResults: ContentMessageItemToolResult[];
|
|
418
|
-
role: "user" | "agent";
|
|
419
|
-
}
|
|
420
|
-
export interface CodegenTurn {
|
|
421
|
-
state: "running" | "done" | "error" | "aborted" | "reverted";
|
|
422
|
-
unixTime: number;
|
|
423
|
-
completionId: string;
|
|
424
|
-
title: string;
|
|
425
|
-
nextUrl: string | undefined;
|
|
426
|
-
user: UserSource;
|
|
427
|
-
actions: ActionItem[];
|
|
428
|
-
sentiment: "positive" | "negative" | "undo" | undefined;
|
|
429
|
-
applyResults: ApplyActionsResult[];
|
|
430
|
-
userMessage: GenerateUserMessage | undefined;
|
|
431
|
-
beforeCommit: string | undefined;
|
|
432
|
-
afterCommit: string | undefined;
|
|
433
|
-
}
|
|
434
|
-
export interface GetSessionTurnsResult {
|
|
435
|
-
turns: CodegenTurn[];
|
|
436
|
-
sessionId: string;
|
|
437
|
-
initialUrl: string | undefined;
|
|
438
|
-
beforeCommit: string | undefined;
|
|
439
|
-
title: string | undefined;
|
|
440
|
-
createdUnixTime: number | undefined;
|
|
441
|
-
updatedUnixTime: number | undefined;
|
|
442
|
-
}
|
|
443
|
-
export interface CodegenFeedback {
|
|
444
|
-
id: string;
|
|
445
|
-
feedbackText?: string;
|
|
446
|
-
feedbackSentiment?: string;
|
|
447
|
-
framework?: string;
|
|
448
|
-
acceptedLines?: number;
|
|
449
|
-
afterCommit?: string;
|
|
450
|
-
}
|
|
451
|
-
export interface CodegenSetLastCompletion {
|
|
452
|
-
sessionId: string;
|
|
453
|
-
lastCompletionId: string | undefined;
|
|
454
|
-
}
|
|
455
|
-
export interface GenerateCodeEventDone {
|
|
456
|
-
type: "done";
|
|
457
|
-
unixTime: number;
|
|
458
|
-
stopReason: CompletionStopReason;
|
|
459
|
-
id: string;
|
|
460
|
-
actionTitle: string;
|
|
461
|
-
content?: string;
|
|
462
|
-
needsPagination: boolean;
|
|
463
|
-
actions?: ActionItem[];
|
|
464
|
-
suggestions: PromptSuggestion[];
|
|
465
|
-
usage?: CodegenUsage;
|
|
466
|
-
messageIndex: number;
|
|
467
|
-
sessionUsage: number;
|
|
468
|
-
nextUrl: string;
|
|
469
|
-
}
|
|
470
|
-
export interface GenerateCodeEventError {
|
|
471
|
-
type: "error";
|
|
472
|
-
stopReason: "error" | "limit";
|
|
473
|
-
id: string;
|
|
474
|
-
message: string;
|
|
475
|
-
usage?: CodegenUsage;
|
|
476
|
-
}
|
|
477
|
-
export interface GenerateCodeEventPagination {
|
|
478
|
-
type: "pagination";
|
|
479
|
-
pop: number;
|
|
480
|
-
page: number;
|
|
481
|
-
id: string;
|
|
482
|
-
}
|
|
483
|
-
export interface GenerateCodeEventContinue {
|
|
484
|
-
type: "continue";
|
|
485
|
-
id: string;
|
|
486
|
-
nextUrl: string;
|
|
487
|
-
}
|
|
488
|
-
export interface GenerateCodeEventDelta {
|
|
489
|
-
type: "delta";
|
|
490
|
-
content: string;
|
|
491
|
-
}
|
|
492
|
-
export interface GenerateCodeEventPing {
|
|
493
|
-
type: "ping";
|
|
494
|
-
}
|
|
495
|
-
export interface GenerateCodeEventUser {
|
|
496
|
-
type: "user";
|
|
497
|
-
id: string;
|
|
498
|
-
displayPrompt: string | undefined;
|
|
499
|
-
user: UserSource;
|
|
500
|
-
/** @deprecated */
|
|
501
|
-
role: "user" | "agent";
|
|
502
|
-
}
|
|
503
|
-
export type GenerateCodeEvent = ActionItem | GenerateCodeEventDone | GenerateCodeEventContinue | GenerateCodeEventPagination | GenerateCodeEventDelta | GenerateCodeEventError | GenerateCodeEventPing | GenerateCodeEventUser;
|
|
504
|
-
export type CommitMode = "commits" | "draft-prs" | "prs";
|
|
505
|
-
export interface WorkspaceFolder {
|
|
506
|
-
path: string;
|
|
507
|
-
name?: string;
|
|
508
|
-
repoUrl?: string;
|
|
509
|
-
repoName?: string;
|
|
510
|
-
branchName?: string;
|
|
511
|
-
}
|
|
512
|
-
export interface WorkspaceConfiguration {
|
|
513
|
-
folders: WorkspaceFolder[];
|
|
514
|
-
}
|
|
515
|
-
export interface FusionConfig {
|
|
516
|
-
devCommand: string;
|
|
517
|
-
checkCommand?: string;
|
|
518
|
-
setupCommand?: string;
|
|
519
|
-
projectId?: string;
|
|
520
|
-
workingDirectory: string;
|
|
521
|
-
workspace?: WorkspaceConfiguration;
|
|
522
|
-
authenticateProxy?: boolean;
|
|
523
|
-
allowedCommands?: string[];
|
|
524
|
-
commitMode: CommitMode;
|
|
525
|
-
serverUrl: string;
|
|
526
|
-
/** @deprecated use devCommand */
|
|
527
|
-
command?: string;
|
|
528
|
-
}
|
|
529
|
-
export interface FusionConfigInit extends FusionConfig {
|
|
530
|
-
workspace: {
|
|
531
|
-
folders: Required<WorkspaceFolder>[];
|
|
532
|
-
};
|
|
533
|
-
}
|
package/src/codegen.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/completion.d.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { BuilderContent, BuilderElement, Component } from "@builder.io/sdk";
|
|
2
|
-
import type { Message, MessageParam, Attachment } from "./messages.js";
|
|
3
|
-
import type { BuilderModel } from "./events.js";
|
|
4
|
-
export type { BuilderContent, BuilderElement, Component };
|
|
5
|
-
export interface CompletionOptions {
|
|
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[];
|
|
87
|
-
}
|
|
88
|
-
export interface BuilderEditorState {
|
|
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>;
|
|
154
|
-
}
|
package/src/completion.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|