@builder.io/ai-utils 0.0.17 → 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.
Files changed (2) hide show
  1. package/dist/events.d.ts +19 -22
  2. package/package.json +1 -1
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,24 +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;
98
94
  ts: number;
99
95
  }
100
- export interface ContentStyleUpdatePatch {
96
+ export interface ContentInsertAdjacentPatch extends ContentPatchBase {
97
+ type: "insert_adjacent";
98
+ }
99
+ export interface ContentPropsUpdatePatch extends ContentPatchBase {
100
+ type: "props";
101
+ }
102
+ export interface ContentStyleUpdatePatch extends ContentPatchBase {
101
103
  type: "style";
102
- id: string;
103
- value: Record<string, any>;
104
- ts: number;
105
104
  }
106
- export interface ContentTextUpdatePatch {
107
- type: "content";
108
- id: string;
109
- value: string;
110
- ts: number;
105
+ export interface ContentSetChildrenPatch extends ContentPatchBase {
106
+ type: "children";
111
107
  }
112
108
  export interface ContentCompleteEvent {
113
109
  type: "assistant.content.complete";
@@ -210,3 +206,4 @@ export interface ThreadRunStepCreatedEvent {
210
206
  export type DeepPartial<T> = T extends object ? {
211
207
  [P in keyof T]?: DeepPartial<T[P]>;
212
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.17",
3
+ "version": "0.0.18",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",