@builder.io/ai-utils 0.0.76 → 0.1.0
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.d.ts +34 -2
- package/src/completion.d.ts +1 -0
- package/src/events.d.ts +1 -38
- package/src/messages.d.ts +7 -1
- package/src/settings.d.ts +0 -3
- package/src/settings.js +0 -1
package/package.json
CHANGED
package/src/codegen.d.ts
CHANGED
|
@@ -25,13 +25,33 @@ export type CodeGenFramework = "react" | "html" | "mitosis" | "react-native" | "
|
|
|
25
25
|
export type CodeGenStyleLibrary = "tailwind" | "tailwind-precise" | "emotion" | "styled-components" | "styled-jsx" | "react-native" | undefined;
|
|
26
26
|
export type CompletionStopReason = "max_tokens" | "stop_sequence" | "tool_use" | "end_turn" | "content_filter" | null;
|
|
27
27
|
export type CodeGenStopReason = "error" | "limit" | CompletionStopReason;
|
|
28
|
-
export
|
|
28
|
+
export interface ViewPathToolInput {
|
|
29
|
+
filePath: string;
|
|
30
|
+
}
|
|
31
|
+
export interface GlobSearchToolInput {
|
|
32
|
+
pattern: string;
|
|
33
|
+
}
|
|
34
|
+
export interface GrepSearchToolInput {
|
|
35
|
+
query: string;
|
|
36
|
+
includeGlob?: string;
|
|
37
|
+
excludeGlob?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AskUserToolInput {
|
|
40
|
+
question: string;
|
|
41
|
+
}
|
|
42
|
+
export interface CodeGenToolMap {
|
|
43
|
+
view_path: ViewPathToolInput;
|
|
44
|
+
glob_search: GlobSearchToolInput;
|
|
45
|
+
grep_search: GrepSearchToolInput;
|
|
46
|
+
ask_user: AskUserToolInput;
|
|
47
|
+
}
|
|
48
|
+
export type CodeGenTools = keyof CodeGenToolMap;
|
|
29
49
|
export type CodeGenMode = "exact" | "precise" | "precise_vision" | "creative" | "creative_vision" | "creative_only_vision";
|
|
30
50
|
export interface CodeGenInputOptions {
|
|
31
51
|
position: string;
|
|
32
52
|
eventName?: string;
|
|
33
53
|
sessionId: string;
|
|
34
|
-
codeGenMode?: "fast" | "quality
|
|
54
|
+
codeGenMode?: "fast" | "quality" | "quality-v3";
|
|
35
55
|
url?: string;
|
|
36
56
|
diffActions?: boolean;
|
|
37
57
|
planningPrompt?: boolean;
|
|
@@ -75,6 +95,15 @@ export interface CodegenUsage {
|
|
|
75
95
|
aiGenerationContextWindow: number;
|
|
76
96
|
};
|
|
77
97
|
}
|
|
98
|
+
export interface PromptSuggestion {
|
|
99
|
+
type: "missing-imports" | "lazy-code" | "syntax-error" | "llm-suggested" | "diff-apply";
|
|
100
|
+
filePath?: string;
|
|
101
|
+
line?: number;
|
|
102
|
+
importance: "high" | "medium" | "low";
|
|
103
|
+
column?: number;
|
|
104
|
+
summary: string;
|
|
105
|
+
prompt: string;
|
|
106
|
+
}
|
|
78
107
|
export interface ActionItem {
|
|
79
108
|
type: "file" | "text" | "delta" | "done" | "diff" | "thinking" | "user" | "tool" | "suggestion" | "continue";
|
|
80
109
|
id?: string;
|
|
@@ -87,6 +116,9 @@ export interface ActionItem {
|
|
|
87
116
|
nextUrl?: string;
|
|
88
117
|
actions?: ActionItem[];
|
|
89
118
|
stopReason?: CodeGenStopReason;
|
|
119
|
+
suggestions?: PromptSuggestion[];
|
|
120
|
+
messageIndex?: number;
|
|
90
121
|
usage?: CodegenUsage;
|
|
91
122
|
errors?: string[];
|
|
123
|
+
sessionUsage?: number;
|
|
92
124
|
}
|
package/src/completion.d.ts
CHANGED
package/src/events.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { BuilderContent, BuilderElement } from "@builder.io/sdk";
|
|
|
2
2
|
import type { AssistantMessage } from "./messages.js";
|
|
3
3
|
import type { AssistantSettings } from "./settings.js";
|
|
4
4
|
export type BuilderAssistantEventHandler = (ev: BuilderAssistantEvent) => void;
|
|
5
|
-
export type BuilderAssistantEvent = AssistantCompletionResultEvent | AssistantErrorEvent | AssistantStreamErrorEvent | AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppMessageEditCustomInstructionsEvent | AppPromptAbortEvent | AppPromptFocusEvent |
|
|
5
|
+
export type BuilderAssistantEvent = AssistantCompletionResultEvent | AssistantErrorEvent | AssistantStreamErrorEvent | AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppMessageEditCustomInstructionsEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppReadyEvent | AppSettingsSetEvent | AppThreadNewEvent | AssistantStatsEvent | AssistantThemeEvent | BuilderEditorAuthEvent | BuilderEditorStateEvent | ContentUpdateEvent | ContentApplySnapshotEvent | ModelUndoEvent | ModelRedoEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageCompletedEvent | ThreadMessageCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageFeedbackEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent | AppAcceptChangeEvent | AppAcceptRejectEvent | AssistantTrackEvent | AssistantEditorAuthMessage | AppAttachmentTemplateEvent | ThreadMessageRetryEvent;
|
|
6
6
|
export interface AssistantCompletionResultEvent {
|
|
7
7
|
type: "assistant.result";
|
|
8
8
|
data: {
|
|
@@ -78,18 +78,9 @@ export interface AppPromptAbortEvent {
|
|
|
78
78
|
export interface AppPromptFocusEvent {
|
|
79
79
|
type: "assistant.app.prompt.focus";
|
|
80
80
|
}
|
|
81
|
-
export interface AppPromptTextEvent {
|
|
82
|
-
type: "assistant.app.prompt.text";
|
|
83
|
-
data: {
|
|
84
|
-
text: string;
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
81
|
export interface AppReadyEvent {
|
|
88
82
|
type: "assistant.app.ready";
|
|
89
83
|
}
|
|
90
|
-
export interface AppSettingsResetEvent {
|
|
91
|
-
type: "assistant.app.settings.reset";
|
|
92
|
-
}
|
|
93
84
|
export interface AppSettingsSetEvent {
|
|
94
85
|
type: "assistant.app.settings.set";
|
|
95
86
|
data: Partial<AssistantSettings>;
|
|
@@ -253,23 +244,12 @@ export interface AssistantStats {
|
|
|
253
244
|
*/
|
|
254
245
|
cacheCreatedTokens?: number;
|
|
255
246
|
}
|
|
256
|
-
export interface ModelCreateEvent {
|
|
257
|
-
type: "assistant.model.create";
|
|
258
|
-
data: BuilderModel;
|
|
259
|
-
}
|
|
260
|
-
export interface ModelUpdateEvent {
|
|
261
|
-
type: "assistant.model.update";
|
|
262
|
-
data: ModelUpdate;
|
|
263
|
-
}
|
|
264
247
|
export interface ModelUndoEvent {
|
|
265
248
|
type: "assistant.model.undo";
|
|
266
249
|
}
|
|
267
250
|
export interface ModelRedoEvent {
|
|
268
251
|
type: "assistant.model.redo";
|
|
269
252
|
}
|
|
270
|
-
export interface ModelUpdate {
|
|
271
|
-
patches: ModelPatch[];
|
|
272
|
-
}
|
|
273
253
|
export interface BuilderModel {
|
|
274
254
|
name?: string;
|
|
275
255
|
friendlyName?: string;
|
|
@@ -282,11 +262,6 @@ export interface BuilderModelField {
|
|
|
282
262
|
type?: string;
|
|
283
263
|
description?: string;
|
|
284
264
|
}
|
|
285
|
-
export type ModelPatch = {
|
|
286
|
-
op: "add" | "remove" | "replace";
|
|
287
|
-
path: string;
|
|
288
|
-
value?: any;
|
|
289
|
-
};
|
|
290
265
|
export interface ThreadMessageFeedbackEvent {
|
|
291
266
|
type: "assistant.thread.message.feedback";
|
|
292
267
|
data: CompletionResponseFeedback;
|
|
@@ -341,18 +316,6 @@ export interface ThreadMessageCompleted extends AssistantMessage {
|
|
|
341
316
|
threadId: string;
|
|
342
317
|
commitId?: string;
|
|
343
318
|
}
|
|
344
|
-
export interface ThreadRunRequiresActionEvent {
|
|
345
|
-
type: "assistant.thread.run.requires_action";
|
|
346
|
-
data: ThreadRunRequiredAction;
|
|
347
|
-
}
|
|
348
|
-
export interface ThreadRunRequiredAction {
|
|
349
|
-
platformId: string;
|
|
350
|
-
threadId: string;
|
|
351
|
-
action: {
|
|
352
|
-
name: string;
|
|
353
|
-
arguments: string;
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
319
|
export interface ThreadRunStepDeltaEvent {
|
|
357
320
|
type: "assistant.thread.run.step.delta";
|
|
358
321
|
data: ThreadMessageStepDelta;
|
package/src/messages.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface ContentMessageItemImage {
|
|
|
17
17
|
export interface ContentMessageItemToolResult {
|
|
18
18
|
type: "tool_result";
|
|
19
19
|
tool_use_id: string;
|
|
20
|
+
tool_name?: string;
|
|
21
|
+
tool_input?: string;
|
|
20
22
|
content: string;
|
|
21
23
|
is_error: boolean;
|
|
22
24
|
cache?: boolean;
|
|
@@ -128,7 +130,11 @@ export type Message = SystemMessage | UserMessage | AssistantMessage;
|
|
|
128
130
|
export type GeneratingMessage = null | Partial<AssistantActionMessage | AssistantMessage>;
|
|
129
131
|
export declare function getContentText(message: string | ContentMessage): string;
|
|
130
132
|
export declare function getContentAttachments(message: string | ContentMessage): (ImageBase64Source | ImageUrlSource)[];
|
|
131
|
-
export type Attachment = FileUpload | Template;
|
|
133
|
+
export type Attachment = FileUpload | Template | URL;
|
|
134
|
+
export interface URL {
|
|
135
|
+
type: "url";
|
|
136
|
+
value: string;
|
|
137
|
+
}
|
|
132
138
|
export interface FileUpload {
|
|
133
139
|
type: "upload";
|
|
134
140
|
contentType: string;
|
package/src/settings.d.ts
CHANGED