@builder.io/ai-utils 0.3.12 → 0.3.14
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 +6 -3
- package/src/events.ts +3 -1
- package/src/messages.ts +7 -12
package/package.json
CHANGED
package/src/codegen.ts
CHANGED
|
@@ -94,7 +94,7 @@ export interface GetRuleToolInput {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export interface GetStyleInspirationToolInput {
|
|
97
|
-
|
|
97
|
+
url: string;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export interface GetBuildOutputToolInput {}
|
|
@@ -327,6 +327,7 @@ export interface GenerateCompletionStepUser {
|
|
|
327
327
|
type: "user";
|
|
328
328
|
displayPrompt: string | undefined;
|
|
329
329
|
id: string;
|
|
330
|
+
user: UserSource;
|
|
330
331
|
role: "user" | "agent";
|
|
331
332
|
}
|
|
332
333
|
|
|
@@ -452,7 +453,8 @@ export type GenerateCompletionState =
|
|
|
452
453
|
| "success"
|
|
453
454
|
| "abort"
|
|
454
455
|
| "error"
|
|
455
|
-
| "close"
|
|
456
|
+
| "close"
|
|
457
|
+
| "replay";
|
|
456
458
|
|
|
457
459
|
export interface GenerateCompletionStepState {
|
|
458
460
|
type: "state";
|
|
@@ -554,6 +556,7 @@ export interface GenerateUserMessage {
|
|
|
554
556
|
attachments?: Attachment[];
|
|
555
557
|
debugMode?: boolean;
|
|
556
558
|
logsCheckpoint?: boolean;
|
|
559
|
+
dropAbortedPrompt?: boolean;
|
|
557
560
|
}
|
|
558
561
|
|
|
559
562
|
export interface UserInput {
|
|
@@ -574,7 +577,7 @@ export interface CodegenTurn {
|
|
|
574
577
|
completionId: string;
|
|
575
578
|
title: string;
|
|
576
579
|
nextUrl: string | undefined;
|
|
577
|
-
|
|
580
|
+
user: UserSource;
|
|
578
581
|
actions: ActionItem[];
|
|
579
582
|
sentiment: "positive" | "negative" | "undo" | undefined;
|
|
580
583
|
applyResults: ApplyActionsResult[];
|
package/src/events.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuilderContent, BuilderElement } from "@builder.io/sdk";
|
|
2
|
-
import type { AssistantMessage } from "./messages.js";
|
|
2
|
+
import type { AssistantMessage, AssistantMessageAction } from "./messages.js";
|
|
3
3
|
import type { AssistantSettings } from "./settings.js";
|
|
4
4
|
|
|
5
5
|
export type BuilderAssistantEventHandler = (ev: BuilderAssistantEvent) => void;
|
|
@@ -60,6 +60,8 @@ export interface AssistantCompletionResultEvent {
|
|
|
60
60
|
export interface AssistantError {
|
|
61
61
|
message: string;
|
|
62
62
|
status?: number;
|
|
63
|
+
// any actions associated with the error such as a "new chat" button
|
|
64
|
+
actions?: AssistantMessageAction[];
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
export interface AssistantErrorEvent {
|
package/src/messages.ts
CHANGED
|
@@ -235,6 +235,8 @@ export interface UserMessageParam {
|
|
|
235
235
|
id?: string;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
export type AssistantMessageAction = "new-chat";
|
|
239
|
+
|
|
238
240
|
export interface AssistantMessageParam {
|
|
239
241
|
/**
|
|
240
242
|
* The contents of the assistant message.
|
|
@@ -247,18 +249,6 @@ export interface AssistantMessageParam {
|
|
|
247
249
|
|
|
248
250
|
// an id to track messages across a response including multiple retries
|
|
249
251
|
responseId?: string;
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* The function call name and arguments
|
|
253
|
-
*/
|
|
254
|
-
action?: {
|
|
255
|
-
/**
|
|
256
|
-
* The specific function name
|
|
257
|
-
*/
|
|
258
|
-
name: string;
|
|
259
|
-
/** This is arbitrary JSON */
|
|
260
|
-
arguments: any;
|
|
261
|
-
};
|
|
262
252
|
id?: string;
|
|
263
253
|
skipDelta?: boolean;
|
|
264
254
|
/**
|
|
@@ -267,6 +257,11 @@ export interface AssistantMessageParam {
|
|
|
267
257
|
*/
|
|
268
258
|
patches?: ContentUpdatePatch[];
|
|
269
259
|
state?: "error";
|
|
260
|
+
/**
|
|
261
|
+
* Any actions associated with the error such as a "new chat" button.
|
|
262
|
+
* typically used when there is an error.
|
|
263
|
+
*/
|
|
264
|
+
actions?: AssistantMessageAction[];
|
|
270
265
|
}
|
|
271
266
|
|
|
272
267
|
export interface SystemMessage extends SystemMessageParam {
|