@builder.io/ai-utils 0.0.21 → 0.0.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.
@@ -9,6 +9,12 @@ export interface CompletionOptions {
9
9
  * is used when the assistant is being used in the Builder.io content editor.
10
10
  */
11
11
  assistantType?: string;
12
+ /**
13
+ * LLM Model identifier to lookup which sdk and model to use.
14
+ * If not provided the default model will be used.
15
+ * Note: This is not the Builder.io data model.
16
+ */
17
+ modelId?: string;
12
18
  /**
13
19
  * The unique LOCAL identifier of the thread to submit the user message to.
14
20
  * This is used to identify the thread with our own id (openai assistant id is different)
@@ -33,47 +39,53 @@ export interface CompletionOptions {
33
39
  * User id is stored in localStorage for this domain, its not the builder user id.
34
40
  */
35
41
  userId: string;
42
+ /**
43
+ * The state of the builder editor.
44
+ */
45
+ builderState?: BuiderEditorState;
46
+ /**
47
+ * Additional console logs
48
+ */
49
+ debug?: boolean;
50
+ /**
51
+ * Date.now() timestamp of when the assistant was started.
52
+ * This is used to calculate the time taken between all events.
53
+ */
54
+ startMs?: number;
55
+ }
56
+ export interface BuiderEditorState {
36
57
  /**
37
58
  * The active locale of the builder editor.
38
59
  */
39
- builderActiveLocale?: string;
60
+ activeLocale?: string;
40
61
  /**
41
62
  * The locale of the provided builder content.
42
63
  */
43
- builderContentLocale?: string;
64
+ contentLocale?: string;
44
65
  /**
45
66
  * Top level Builder content. The data.blocks array contains the BuilderElement.
46
67
  */
47
- builderContent?: BuilderContent;
68
+ content?: BuilderContent;
48
69
  /**
49
70
  * Builder custom components.
50
71
  */
51
- builderComponents?: Component[];
72
+ components?: Component[];
52
73
  /**
53
74
  * Builder design tokens.
54
75
  */
55
- builderDesignTokens?: Record<string, string>;
76
+ designTokens?: Record<string, string>;
56
77
  /**
57
- * Builder model.
78
+ * Builder model. (not the LLM model)
58
79
  */
59
- builderModel?: BuilderModel;
80
+ model?: BuilderModel;
60
81
  /**
61
82
  * Selected ids in the builder.
62
83
  */
63
- builderSelectedIds?: string[];
84
+ selectedIds?: string[];
64
85
  /**
65
86
  * Builder space id.
66
87
  */
67
- builderSpaceId?: string;
68
- /**
69
- * Additional console logs
70
- */
71
- debug?: boolean;
72
- /**
73
- * Date.now() timestamp of when the assistant was started.
74
- * This is used to calculate the time taken between all
75
- */
76
- start: number;
88
+ spaceId?: string;
77
89
  }
78
90
  export type OnPromptSubmit = (opts: {
79
91
  prompt?: string;
package/dist/events.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import type { BuilderContent, BuilderElement, Component } from "@builder.io/sdk";
1
+ import type { BuilderContent, BuilderElement } from "@builder.io/sdk";
2
2
  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 | BuiderEditorStateEvent | ContentUpdateEvent | ContentApplySnapshotEvent | ContentCompleteEvent | ModelCreateEvent | ModelUpdateEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageCompletedEvent | ThreadMessageFeedbackEvent | ThreadRunRequiresActionEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent;
6
+ export type BuilderAssistantEvent = AssistantErrorEvent | AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent | BuiderEditorStateEvent | 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;
@@ -67,16 +67,6 @@ export interface ResultEvent {
67
67
  resolveId: string;
68
68
  data: any;
69
69
  }
70
- export interface BuiderEditorState {
71
- activeLocale?: string;
72
- contentLocale?: string;
73
- content?: BuilderContent;
74
- components?: Component[];
75
- designTokens?: Record<string, string>;
76
- model?: BuilderModel;
77
- selectedIds?: string[];
78
- spaceId?: string;
79
- }
80
70
  export interface ContentCreatePatch {
81
71
  parentId: string;
82
72
  insertBeforeId: string;
@@ -142,6 +132,9 @@ export interface ModelUpdateEvent {
142
132
  type: "assistant.model.update";
143
133
  data: ModelUpdate;
144
134
  }
135
+ export interface ModelUndoEvent {
136
+ type: "assistant.model.undo";
137
+ }
145
138
  export interface ModelUpdate {
146
139
  patches: ModelPatch[];
147
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",