@builder.io/ai-utils 0.0.26 → 0.0.28
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/dist/completion.d.ts +6 -2
- package/dist/events.d.ts +20 -2
- package/dist/settings.d.ts +5 -0
- package/dist/settings.js +2 -0
- package/dist/thread.d.ts +10 -0
- package/package.json +1 -1
package/dist/completion.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export interface CompletionOptions {
|
|
|
42
42
|
/**
|
|
43
43
|
* The state of the builder editor.
|
|
44
44
|
*/
|
|
45
|
-
builderState?:
|
|
45
|
+
builderState?: BuilderEditorState;
|
|
46
46
|
/**
|
|
47
47
|
* Persist the thread conversation context.
|
|
48
48
|
* Defaults to `true`.
|
|
@@ -58,7 +58,7 @@ export interface CompletionOptions {
|
|
|
58
58
|
*/
|
|
59
59
|
startMs?: number;
|
|
60
60
|
}
|
|
61
|
-
export interface
|
|
61
|
+
export interface BuilderEditorState {
|
|
62
62
|
/**
|
|
63
63
|
* The active locale of the builder editor.
|
|
64
64
|
*/
|
|
@@ -108,6 +108,10 @@ export interface BuiderEditorState {
|
|
|
108
108
|
*/
|
|
109
109
|
sessionId?: string;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* @deprecated Uggh, spelling is hard. Use `BuilderEditorState` instead.
|
|
113
|
+
*/
|
|
114
|
+
export type BuiderEditorState = BuilderEditorState;
|
|
111
115
|
export type OnPromptSubmit = (opts: {
|
|
112
116
|
prompt?: string;
|
|
113
117
|
snippetId?: string;
|
package/dist/events.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Thread } from "./thread";
|
|
|
3
3
|
import type { AssistantMessage } from "./messages";
|
|
4
4
|
import { AssistantSettings } from "./settings";
|
|
5
5
|
export type BuilderAssistantEventHandler = (ev: BuilderAssistantEvent) => void;
|
|
6
|
-
export type BuilderAssistantEvent = AssistantErrorEvent | AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent |
|
|
6
|
+
export type BuilderAssistantEvent = AssistantErrorEvent | AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent | BuilderEditorStateEvent | ContentUpdateEvent | ContentApplySnapshotEvent | ContentCompleteEvent | ModelCreateEvent | ModelUpdateEvent | ModelUndoEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageCompletedEvent | ThreadMessageFeedbackEvent | ThreadRunRequiresActionEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent;
|
|
7
7
|
export interface AssistantError {
|
|
8
8
|
message: string;
|
|
9
9
|
status?: number;
|
|
@@ -56,9 +56,13 @@ export interface AppSettingsSetEvent {
|
|
|
56
56
|
export interface AppThreadNewEvent {
|
|
57
57
|
type: "assistant.app.thread.new";
|
|
58
58
|
}
|
|
59
|
-
export interface
|
|
59
|
+
export interface BuilderEditorStateEvent extends AwaitResultEvent {
|
|
60
60
|
type: "assistant.editor.state";
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use BuilderEditorStateEvent
|
|
64
|
+
*/
|
|
65
|
+
export type BuiderEditorStateEvent = BuilderEditorStateEvent;
|
|
62
66
|
export interface AwaitResultEvent {
|
|
63
67
|
resolveId?: string;
|
|
64
68
|
}
|
|
@@ -94,11 +98,23 @@ export interface ContentUpdateEvent {
|
|
|
94
98
|
data: ContentUpdatePatch[];
|
|
95
99
|
}
|
|
96
100
|
export type ContentUpdatePatch = ContentInsertBeforePatch | ContentInsertAfterPatch | ContentPropsUpdatePatch | ContentSetChildrenPatch | ContentStyleUpdatePatch;
|
|
101
|
+
export interface NodeData {
|
|
102
|
+
/**
|
|
103
|
+
* When dealing with column nodes we need to store the column index so
|
|
104
|
+
* we can properly add nodes inside of a column if needed.
|
|
105
|
+
*/
|
|
106
|
+
columnIndex?: number;
|
|
107
|
+
}
|
|
97
108
|
interface ContentPatchBase {
|
|
98
109
|
id: string;
|
|
99
110
|
index: number;
|
|
100
111
|
value: string;
|
|
101
112
|
ts: number;
|
|
113
|
+
/**
|
|
114
|
+
* Any additional data about the patch. For example, this payload could contain the
|
|
115
|
+
* column index to update when dealing with a Columns component.
|
|
116
|
+
*/
|
|
117
|
+
data?: NodeData;
|
|
102
118
|
}
|
|
103
119
|
export interface ContentInsertBeforePatch extends ContentPatchBase {
|
|
104
120
|
type: "insert_before";
|
|
@@ -171,6 +187,8 @@ export interface ThreadMessageFeedback {
|
|
|
171
187
|
thread: Thread;
|
|
172
188
|
platformId: string;
|
|
173
189
|
sentiment?: "positive" | "negative";
|
|
190
|
+
builderUserId?: string;
|
|
191
|
+
builderEmail?: string;
|
|
174
192
|
}
|
|
175
193
|
export interface ThreadCreatedEvent {
|
|
176
194
|
type: "assistant.thread.created";
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SnippetParams } from "./messages";
|
|
2
2
|
export interface AssistantSettings {
|
|
3
3
|
assistantType?: string;
|
|
4
|
+
viewId?: string;
|
|
4
5
|
cssOverrides?: string;
|
|
5
6
|
headingText: string;
|
|
6
7
|
hideFrameworkPicker?: boolean;
|
|
@@ -12,6 +13,10 @@ export interface AssistantSettings {
|
|
|
12
13
|
showHeaderButton?: boolean;
|
|
13
14
|
showPrompt?: boolean;
|
|
14
15
|
showSparklesInInputBar?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Show the undo button under the assistant's message.
|
|
18
|
+
*/
|
|
19
|
+
showUndoButton?: boolean;
|
|
15
20
|
suggestedItems: Snippet[];
|
|
16
21
|
theme?: "dark" | "light";
|
|
17
22
|
transparentBackground?: boolean;
|
package/dist/settings.js
CHANGED
|
@@ -7,9 +7,11 @@ const urlParamSettings = [
|
|
|
7
7
|
"showHeaderButton",
|
|
8
8
|
"showPrompt",
|
|
9
9
|
"showSparklesInInputBar",
|
|
10
|
+
"showUndoButton",
|
|
10
11
|
"requestState",
|
|
11
12
|
"theme",
|
|
12
13
|
"transparentBackground",
|
|
14
|
+
"viewId",
|
|
13
15
|
];
|
|
14
16
|
export function getAssistantUrl(opts = {}) {
|
|
15
17
|
const url = new URL(opts.local
|
package/dist/thread.d.ts
CHANGED
|
@@ -11,7 +11,17 @@ export interface Thread {
|
|
|
11
11
|
threadId?: string;
|
|
12
12
|
platformId?: string;
|
|
13
13
|
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The type of assistant that the thread is associated with.
|
|
16
|
+
* For example, "content-editor" or "docs".
|
|
17
|
+
*/
|
|
14
18
|
assistantType?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The unique identifier of the view that the thread is associated with.
|
|
21
|
+
* For example, the "content-editor" assistant would use the
|
|
22
|
+
* builder content id as the viewId.
|
|
23
|
+
*/
|
|
24
|
+
viewId?: string;
|
|
15
25
|
created: number;
|
|
16
26
|
messages: Message[];
|
|
17
27
|
}
|