@builder.io/ai-utils 0.0.16 → 0.0.18

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.
@@ -69,6 +69,11 @@ export interface CompletionOptions {
69
69
  * Additional console logs
70
70
  */
71
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;
72
77
  }
73
78
  export type OnPromptSubmit = (opts: {
74
79
  prompt?: 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 = AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent | BuiderEditorStateEvent | ContentCreateEvent | ContentUpdateEvent | ContentApplySnapshotEvent | ContentCompleteEvent | ModelCreateEvent | ModelUpdateEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageCompletedEvent | ThreadMessageFeedbackEvent | ThreadRunRequiresActionEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent;
6
+ export type BuilderAssistantEvent = AppCloseEvent | AppMessagesClickEvent | AppMessagesGenerationEvent | AppPromptAbortEvent | AppPromptFocusEvent | AppPromptTextEvent | AppReadyEvent | AppSettingsResetEvent | AppSettingsSetEvent | AppThreadNewEvent | BuiderEditorStateEvent | ContentUpdateEvent | ContentApplySnapshotEvent | ContentCompleteEvent | ModelCreateEvent | ModelUpdateEvent | ResultEvent | ThreadCreatedEvent | ThreadMessageDeltaEvent | ThreadMessageCompletedEvent | ThreadMessageFeedbackEvent | ThreadRunRequiresActionEvent | ThreadRunStepCreatedEvent | ThreadRunStepDeltaEvent;
7
7
  export interface AppCloseEvent {
8
8
  type: "assistant.app.close";
9
9
  }
@@ -68,19 +68,11 @@ export interface BuiderEditorState {
68
68
  selectedIds?: string[];
69
69
  spaceId?: string;
70
70
  }
71
- export interface ContentCreateEvent {
72
- type: "assistant.content.create";
73
- data: ContentCreatePatch[];
74
- }
75
71
  export interface ContentCreatePatch {
76
72
  parentId: string;
77
73
  insertBeforeId: string;
78
74
  element: BuilderElement;
79
75
  }
80
- export interface ContentUpdateEvent {
81
- type: "assistant.content.update";
82
- data: ContentUpdatePatch[];
83
- }
84
76
  export interface ContentApplySnapshot {
85
77
  id: string;
86
78
  blocks?: BuilderElement[];
@@ -90,21 +82,28 @@ export interface ContentApplySnapshotEvent {
90
82
  type: "assistant.content.applysnapshot";
91
83
  data: ContentApplySnapshot;
92
84
  }
93
- export type ContentUpdatePatch = ContentPropsUpdatePatch | ContentStyleUpdatePatch | ContentTextUpdatePatch;
94
- export interface ContentPropsUpdatePatch {
95
- type: "props";
85
+ export interface ContentUpdateEvent {
86
+ type: "assistant.content.update";
87
+ data: ContentUpdatePatch[];
88
+ }
89
+ export type ContentUpdatePatch = ContentInsertAdjacentPatch | ContentPropsUpdatePatch | ContentSetChildrenPatch | ContentStyleUpdatePatch;
90
+ interface ContentPatchBase {
96
91
  id: string;
97
- value: Record<string, any>;
92
+ patchId: string;
93
+ value: string;
94
+ ts: number;
95
+ }
96
+ export interface ContentInsertAdjacentPatch extends ContentPatchBase {
97
+ type: "insert_adjacent";
98
+ }
99
+ export interface ContentPropsUpdatePatch extends ContentPatchBase {
100
+ type: "props";
98
101
  }
99
- export interface ContentStyleUpdatePatch {
102
+ export interface ContentStyleUpdatePatch extends ContentPatchBase {
100
103
  type: "style";
101
- id: string;
102
- value: Record<string, any>;
103
104
  }
104
- export interface ContentTextUpdatePatch {
105
- type: "content";
106
- id: string;
107
- value: string;
105
+ export interface ContentSetChildrenPatch extends ContentPatchBase {
106
+ type: "children";
108
107
  }
109
108
  export interface ContentCompleteEvent {
110
109
  type: "assistant.content.complete";
@@ -113,6 +112,7 @@ export interface ContentCompleteEvent {
113
112
  export interface ContentComplete {
114
113
  threadId: string;
115
114
  message: AssistantMessage;
115
+ ts: number;
116
116
  }
117
117
  export interface ModelCreateEvent {
118
118
  type: "assistant.model.create";
@@ -206,3 +206,4 @@ export interface ThreadRunStepCreatedEvent {
206
206
  export type DeepPartial<T> = T extends object ? {
207
207
  [P in keyof T]?: DeepPartial<T[P]>;
208
208
  } : T;
209
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",