@pushwoosh/rpc-gateway-ai-assistant 0.1.113 → 0.1.115

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { BuilderService as pushwoosh_aibuilder_v1_BuilderService } from './pushwoosh_aibuilder_v1';
1
+ import { AiGenService as pushwoosh_aigen_v1_AiGenService } from './pushwoosh_aigen_v1';
2
2
  import { AssistantService as pushwoosh_accounts_assistant_v1_AssistantService } from './pushwoosh_accounts_assistant_v1';
3
3
  export type API = {
4
- builder: pushwoosh_aibuilder_v1_BuilderService;
4
+ aiGen: pushwoosh_aigen_v1_AiGenService;
5
5
  assistant: pushwoosh_accounts_assistant_v1_AssistantService;
6
6
  };
7
7
  export { data } from './data';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/rpc-gateway-ai-assistant",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "description": "AI Assistant api gateway HTTP API Types and Data",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,196 +1,3 @@
1
- import { RpcMethod } from './commonTypes';
2
- export type BuilderService_GenerateDescription = RpcMethod<BuilderGenerateDescriptionRequest, BuilderGenerateDescriptionResponse>;
3
- export interface BuilderService {
4
- Create(request: BuilderCreateRequest, options?: {
5
- signal?: AbortSignal;
6
- }): Promise<AsyncIterable<BuilderCreateStreamEvent>>;
7
- Update(request: BuilderUpdateRequest, options?: {
8
- signal?: AbortSignal;
9
- }): Promise<AsyncIterable<BuilderUpdateEvent>>;
10
- GenerateBlock(request: BuilderGenerateBlockRequest, options?: {
11
- signal?: AbortSignal;
12
- }): Promise<AsyncIterable<BuilderCreateStreamEvent>>;
13
- GenerateDescription: BuilderService_GenerateDescription;
14
- }
15
- export type BuilderDescriptionField = 'BUILDER_DESCRIPTION_FIELD_UNSPECIFIED' | 'BUILDER_DESCRIPTION_FIELD_TEMPLATE_NAME' | 'BUILDER_DESCRIPTION_FIELD_SUBJECT' | 'BUILDER_DESCRIPTION_FIELD_PREHEADER';
16
- export type BuilderGenerateDescriptionRequest = {
17
- document: AiBuilderDocument;
18
- field: BuilderDescriptionField;
19
- application: string;
20
- textModel: LLMProvider;
21
- };
22
- export type BuilderGenerateDescriptionResponse = {
23
- text: string;
24
- };
25
- export type LLMProvider = 'LLM_PROVIDER_UNSPECIFIED' | 'LLM_PROVIDER_QWEN' | 'LLM_PROVIDER_GEMINI';
26
- export type BuilderCreateRequest = {
27
- prompt: string;
28
- application: string;
29
- structureModel: LLMProvider;
30
- textModel: LLMProvider;
31
- generateImages: boolean;
32
- settings: DocumentSettings;
33
- textVariants: Record<string, TextVariantStyle>;
34
- colorScheme: Record<string, ColorSchemeItem>;
35
- };
36
- export type BuilderUpdateRequest = {
37
- document: AiBuilderDocument;
38
- prompt: string;
39
- blockId?: string;
40
- application: string;
41
- textVariants: Record<string, TextVariantStyle>;
42
- colorScheme: Record<string, ColorSchemeItem>;
43
- model: LLMProvider;
44
- };
45
- export type BuilderGenerateBlockRequest = {
46
- prompt: string;
47
- application: string;
48
- blockType: DocumentBlockType;
49
- document: AiBuilderDocument;
50
- prevBlockId: string;
51
- generateImages: boolean;
52
- blockId: string;
53
- structureModel: LLMProvider;
54
- textModel: LLMProvider;
55
- };
56
- export type BuilderDoneEvent = {
57
- summary: string;
58
- };
59
- export type BuilderUpdateEvent_event_updateBlock = {
60
- type: 'updateBlock';
61
- data: BuilderCreateDocumentBlock;
62
- };
63
- export type BuilderUpdateEvent_event_deleteBlock = {
64
- type: 'deleteBlock';
65
- data: string;
66
- };
67
- export type BuilderUpdateEvent_event_done = {
68
- type: 'done';
69
- data: BuilderDoneEvent;
70
- };
71
- export type BuilderUpdateEvent_event_error = {
72
- type: 'error';
73
- data: string;
74
- };
75
- export type BuilderUpdateEvent_event_updateSettings = {
76
- type: 'updateSettings';
77
- data: DocumentSettings;
78
- };
79
- export type BuilderUpdateEvent_event = BuilderUpdateEvent_event_updateBlock | BuilderUpdateEvent_event_deleteBlock | BuilderUpdateEvent_event_done | BuilderUpdateEvent_event_error | BuilderUpdateEvent_event_updateSettings;
80
- export type BuilderUpdateEvent = {
81
- event: BuilderUpdateEvent_event;
82
- };
83
- export type BuilderCreateColorSettings = {
84
- backgroundColor: string;
85
- textColor: string;
86
- };
87
- export type BuilderCreateBlockColors = {
88
- backgroundColor: string;
89
- borderColor: string;
90
- };
91
- export type BuilderCreateDocument = {
92
- blocks: BuilderCreateDocumentBlock[];
93
- settings: BuilderCreateColorSettings;
94
- textVariants: Record<string, TextVariantStyle>;
95
- colorScheme: Record<string, ColorSchemeItem>;
96
- emailMeta: EmailMeta;
97
- };
98
- export type BuilderCreateDocumentBlock_block_card = {
99
- type: 'card';
100
- data: BuilderCreateCard;
101
- };
102
- export type BuilderCreateDocumentBlock_block_columns = {
103
- type: 'columns';
104
- data: BuilderCreateColumns;
105
- };
106
- export type BuilderCreateDocumentBlock_block = BuilderCreateDocumentBlock_block_card | BuilderCreateDocumentBlock_block_columns;
107
- export type BuilderCreateDocumentBlock = {
108
- id: string;
109
- styles?: BuilderCreateBlockColors;
110
- block: BuilderCreateDocumentBlock_block;
111
- };
112
- export type BuilderCreateCard = {
113
- layout: CardLayout;
114
- image?: Image;
115
- content: Content;
116
- /** Mirrors AiBuilderCard.image_fit for the streamed Create/Update output. */
117
- imageFit: CardImageFit;
118
- /** Mirrors AiBuilderCard.accent_fit; only meaningful for LEFT / RIGHT layouts. */
119
- accentFit: boolean;
120
- };
121
- export type BuilderCreateColumns = {
122
- withImages: boolean;
123
- columns: BuilderCreateColumn[];
124
- /** Content rendered above the columns row. */
125
- contentBefore?: Content;
126
- /** Content rendered below the columns row. */
127
- contentAfter?: Content;
128
- };
129
- export type BuilderCreateColumn = {
130
- image?: Image;
131
- content: Content;
132
- width?: string;
133
- };
134
- export type BuilderCreateStreamEvent_event_structure = {
135
- type: 'structure';
136
- data: BuilderCreateDocument;
137
- };
138
- export type BuilderCreateStreamEvent_event_textDelta = {
139
- type: 'textDelta';
140
- data: BuilderCreateTextDelta;
141
- };
142
- export type BuilderCreateStreamEvent_event_imageDelta = {
143
- type: 'imageDelta';
144
- data: BuilderCreateImageDelta;
145
- };
146
- export type BuilderCreateStreamEvent_event_done = {
147
- type: 'done';
148
- data: BuilderDoneEvent;
149
- };
150
- export type BuilderCreateStreamEvent_event_error = {
151
- type: 'error';
152
- data: string;
153
- };
154
- export type BuilderCreateStreamEvent_event_progress = {
155
- type: 'progress';
156
- data: string;
157
- };
158
- export type BuilderCreateStreamEvent_event_buttonGroupDelta = {
159
- type: 'buttonGroupDelta';
160
- data: BuilderCreateButtonGroupDelta;
161
- };
162
- export type BuilderCreateStreamEvent_event_contentError = {
163
- type: 'contentError';
164
- data: BuilderContentError;
165
- };
166
- export type BuilderCreateStreamEvent_event = BuilderCreateStreamEvent_event_structure | BuilderCreateStreamEvent_event_textDelta | BuilderCreateStreamEvent_event_imageDelta | BuilderCreateStreamEvent_event_done | BuilderCreateStreamEvent_event_error | BuilderCreateStreamEvent_event_progress | BuilderCreateStreamEvent_event_buttonGroupDelta | BuilderCreateStreamEvent_event_contentError;
167
- export type BuilderCreateStreamEvent = {
168
- event: BuilderCreateStreamEvent_event;
169
- };
170
- export type BuilderContentError = {
171
- blockId: string;
172
- field: string;
173
- error: string;
174
- };
175
- export type BuilderCreateTextDelta = {
176
- blockId: string;
177
- field: string;
178
- textBlock: TextBlock;
179
- };
180
- export type BuilderCreateImageDelta = {
181
- blockId: string;
182
- field: string;
183
- src: string;
184
- alt: string;
185
- width: number;
186
- height: number;
187
- mediaUuid: string;
188
- };
189
- export type BuilderCreateButtonGroupDelta = {
190
- blockId: string;
191
- field: string;
192
- buttonGroup: ButtonGroup;
193
- };
194
1
  export type DocumentBlockType = 'DOCUMENT_BLOCK_TYPE_UNSPECIFIED' | 'DOCUMENT_BLOCK_TYPE_CARD' | 'DOCUMENT_BLOCK_TYPE_COLUMNS';
195
2
  export type CardLayout = 'CARD_LAYOUT_UNSPECIFIED' | 'CARD_LAYOUT_RIGHT' | 'CARD_LAYOUT_LEFT' | 'CARD_LAYOUT_TOP' | 'CARD_LAYOUT_NO' | 'CARD_LAYOUT_BACKGROUND';
196
3
  export type ButtonGroupAlign = 'BUTTON_GROUP_ALIGN_UNSPECIFIED' | 'BUTTON_GROUP_ALIGN_LEFT' | 'BUTTON_GROUP_ALIGN_CENTER' | 'BUTTON_GROUP_ALIGN_RIGHT';
@@ -395,9 +202,21 @@ export type AiBuilderBlock = {
395
202
  export type EmailMeta = {
396
203
  subject: string;
397
204
  preheader: string;
205
+ templateName: string;
398
206
  };
399
- export type AiBuilderDocument = {
207
+ /**
208
+ * AiBuilderPage groups a list of blocks under a single logical page. For
209
+ * now every document has exactly one page; the structure is in place so
210
+ * multi-page documents (landing pages with several screens, email digests
211
+ * with tabs, etc.) can be added without a further schema break.
212
+ */
213
+ export type AiBuilderPage = {
214
+ id: string;
400
215
  blocks: AiBuilderBlock[];
216
+ };
217
+ export type AiBuilderDocument = {
218
+ /** MVP: always one page. Consumers may assume pages[0] exists. */
219
+ pages: AiBuilderPage[];
401
220
  settings: DocumentSettings;
402
221
  textVariants: Record<string, TextVariantStyle>;
403
222
  colorScheme: Record<string, ColorSchemeItem>;
@@ -0,0 +1,256 @@
1
+ import { AiBuilderDocument as pushwoosh_aibuilder_v1_AiBuilderDocument } from './pushwoosh_aibuilder_v1';
2
+ import { DocumentSettings as pushwoosh_aibuilder_v1_DocumentSettings } from './pushwoosh_aibuilder_v1';
3
+ import { TextVariantStyle as pushwoosh_aibuilder_v1_TextVariantStyle } from './pushwoosh_aibuilder_v1';
4
+ import { ColorSchemeItem as pushwoosh_aibuilder_v1_ColorSchemeItem } from './pushwoosh_aibuilder_v1';
5
+ import { CardLayout as pushwoosh_aibuilder_v1_CardLayout } from './pushwoosh_aibuilder_v1';
6
+ import { Image as pushwoosh_aibuilder_v1_Image } from './pushwoosh_aibuilder_v1';
7
+ import { Content as pushwoosh_aibuilder_v1_Content } from './pushwoosh_aibuilder_v1';
8
+ import { CardImageFit as pushwoosh_aibuilder_v1_CardImageFit } from './pushwoosh_aibuilder_v1';
9
+ /**
10
+ * AiGenService unifies document create / edit / per-block regeneration and
11
+ * targeted block insertion into a single streaming RPC. Dispatch rules:
12
+ * - document empty → create a new document
13
+ * - document set → edit existing document (diff planner)
14
+ * - document set + block_path → regenerate only that block; planner
15
+ * skipped, structure_diff NOT emitted
16
+ * - document set + add_block → insert one new block at a given
17
+ * position; planner skipped, a
18
+ * single-entry structure_diff is
19
+ * synthesised so the client applies
20
+ * it like any other edit
21
+ * block_path and add_block are mutually exclusive.
22
+ *
23
+ * Addressing: every block reference on the wire is a path of ids. For MVP
24
+ * single-page documents the path is always `[page_id, block_id]`. The path
25
+ * form is in place so multi-page documents (email digests with tabs,
26
+ * multi-screen landing pages) can be addressed deeper without a further
27
+ * schema break.
28
+ */
29
+ export interface AiGenService {
30
+ Generate(request: AiGenRequest, options?: {
31
+ signal?: AbortSignal;
32
+ }): Promise<AsyncIterable<AiGenEvent>>;
33
+ }
34
+ export type AiGenBlockTypeHint = 'AI_GEN_BLOCK_TYPE_HINT_UNSPECIFIED' | 'AI_GEN_BLOCK_TYPE_HINT_CARD' | 'AI_GEN_BLOCK_TYPE_HINT_COLUMNS';
35
+ /**
36
+ * AiGenBlockPath wraps a block-addressing path so it can appear inside
37
+ * repeated fields — proto3 disallows `repeated repeated`. Path is
38
+ * `[page_id, block_id]` for MVP; additional segments may appear when
39
+ * multi-page or nested containers land.
40
+ */
41
+ export type AiGenBlockPath = {
42
+ path: string[];
43
+ };
44
+ export type AiGenRequest = {
45
+ prompt: string;
46
+ /** Empty → create a new document. Set → edit. */
47
+ document?: pushwoosh_aibuilder_v1_AiBuilderDocument;
48
+ /**
49
+ * Bypass mode: path `[page_id, block_id]` of the block to regenerate.
50
+ * Requires `document`. Mutually exclusive with `add_block`. Empty =
51
+ * no bypass.
52
+ */
53
+ blockPath: string[];
54
+ application: string;
55
+ generateImages: boolean;
56
+ /** Used on create; in edit taken from document. */
57
+ settings?: pushwoosh_aibuilder_v1_DocumentSettings;
58
+ textVariants: Record<string, pushwoosh_aibuilder_v1_TextVariantStyle>;
59
+ colorScheme: Record<string, pushwoosh_aibuilder_v1_ColorSchemeItem>;
60
+ /**
61
+ * Set → add-block mode: insert a single new block into `document` at a
62
+ * client-specified position, skipping the planner. Mutually exclusive
63
+ * with `block_path`. Requires `document`.
64
+ */
65
+ addBlock?: AiGenAddBlock;
66
+ };
67
+ /**
68
+ * AiGenAddBlock triggers add-block mode on Generate. The server emits a
69
+ * single-entry structure_diff echoing these fields so the UI can match an
70
+ * optimistically-rendered placeholder, followed by the block_delta and any
71
+ * image_deltas for the new block.
72
+ */
73
+ export type AiGenAddBlock = {
74
+ /**
75
+ * Client-provided path for the new block: `[page_id, new_block_id]`.
76
+ * `page_id` must reference an existing page in `document`; the new
77
+ * block_id must not collide with any existing block id in that page.
78
+ */
79
+ blockPath: string[];
80
+ /**
81
+ * Path of the block this one should be inserted after:
82
+ * `[page_id, existing_block_id]`. Must share `page_id` with
83
+ * `block_path`. Empty = insert at the beginning of the page referenced
84
+ * by `block_path[0]`.
85
+ */
86
+ afterPath: string[];
87
+ /**
88
+ * Optional. UNSPECIFIED = the block generator decides card vs columns
89
+ * based on the prompt and surrounding blocks.
90
+ */
91
+ typeHint: AiGenBlockTypeHint;
92
+ };
93
+ export type AiGenStructureBlock = {
94
+ /** [page_id, block_id] */
95
+ blockPath: string[];
96
+ typeHint: AiGenBlockTypeHint;
97
+ /** per-block prompt for the block generator */
98
+ prompt: string;
99
+ };
100
+ /** Emitted once for create, before any block_delta. */
101
+ export type AiGenStructure = {
102
+ blocks: AiGenStructureBlock[];
103
+ };
104
+ export type AiGenStructureAdd = {
105
+ /** [page_id, new_block_id] — disjoint from existing ids in that page */
106
+ blockPath: string[];
107
+ typeHint: AiGenBlockTypeHint;
108
+ prompt: string;
109
+ /**
110
+ * Path of the block this one should be inserted after. Empty → insert
111
+ * at the beginning of the page referenced by `block_path[0]`. May
112
+ * reference an existing block path or another add.block_path from the
113
+ * same diff (must share `page_id`).
114
+ */
115
+ afterPath: string[];
116
+ };
117
+ export type AiGenStructureReplace = {
118
+ /** existing block path, preserved */
119
+ blockPath: string[];
120
+ typeHint: AiGenBlockTypeHint;
121
+ prompt: string;
122
+ };
123
+ /**
124
+ * Emitted once for edit (when the planner ran), before any block_delta.
125
+ * Not emitted on the block_path bypass path.
126
+ */
127
+ export type AiGenStructureDiff = {
128
+ add: AiGenStructureAdd[];
129
+ remove: AiGenBlockPath[];
130
+ replace: AiGenStructureReplace[];
131
+ updateSettings?: pushwoosh_aibuilder_v1_DocumentSettings;
132
+ updateTextVariants: Record<string, pushwoosh_aibuilder_v1_TextVariantStyle>;
133
+ updateColorScheme: Record<string, pushwoosh_aibuilder_v1_ColorSchemeItem>;
134
+ };
135
+ export type AiGenBlockColors = {
136
+ backgroundColor: string;
137
+ borderColor: string;
138
+ };
139
+ export type AiGenCard = {
140
+ layout: pushwoosh_aibuilder_v1_CardLayout;
141
+ image?: pushwoosh_aibuilder_v1_Image;
142
+ content: pushwoosh_aibuilder_v1_Content;
143
+ imageFit: pushwoosh_aibuilder_v1_CardImageFit;
144
+ accentFit: boolean;
145
+ };
146
+ export type AiGenColumn = {
147
+ image?: pushwoosh_aibuilder_v1_Image;
148
+ content: pushwoosh_aibuilder_v1_Content;
149
+ width?: string;
150
+ };
151
+ export type AiGenColumns = {
152
+ withImages: boolean;
153
+ columns: AiGenColumn[];
154
+ contentBefore?: pushwoosh_aibuilder_v1_Content;
155
+ contentAfter?: pushwoosh_aibuilder_v1_Content;
156
+ };
157
+ export type AiGenBlock_block_card = {
158
+ type: 'card';
159
+ data: AiGenCard;
160
+ };
161
+ export type AiGenBlock_block_columns = {
162
+ type: 'columns';
163
+ data: AiGenColumns;
164
+ };
165
+ export type AiGenBlock_block = AiGenBlock_block_card | AiGenBlock_block_columns;
166
+ /**
167
+ * AiGenBlock is the payload carried by block_delta. The block's own id
168
+ * lives in the enclosing event's `block_path`; the payload is id-less.
169
+ */
170
+ export type AiGenBlock = {
171
+ styles?: AiGenBlockColors;
172
+ block: AiGenBlock_block;
173
+ };
174
+ /**
175
+ * Full block delivered after generation. Images (if any) arrive separately
176
+ * via image_delta events referencing the same block_path.
177
+ */
178
+ export type AiGenBlockDelta = {
179
+ blockPath: string[];
180
+ block: AiGenBlock;
181
+ };
182
+ export type AiGenImageDelta = {
183
+ blockPath: string[];
184
+ /**
185
+ * Field path inside the block ("image", "columns[0].image", ...),
186
+ * matching the content-addressing scheme used by the old Create API.
187
+ */
188
+ field: string;
189
+ src: string;
190
+ alt: string;
191
+ width: number;
192
+ height: number;
193
+ mediaUuid: string;
194
+ };
195
+ export type AiGenBlockError = {
196
+ blockPath: string[];
197
+ /**
198
+ * Optional field path for granular errors (e.g. a specific image inside a
199
+ * block). Empty → the block itself failed.
200
+ */
201
+ field: string;
202
+ error: string;
203
+ };
204
+ export type AiGenDoneEvent = {
205
+ summary: string;
206
+ };
207
+ /**
208
+ * AiGenTextDescription carries a generated short text for a document-level
209
+ * description field (template name, email subject, preheader, ...) so the
210
+ * client can render it as it arrives instead of waiting for done.
211
+ */
212
+ export type AiGenTextDescription = {
213
+ /** "template_name" | "subject" | "preheader" */
214
+ type: string;
215
+ description: string;
216
+ };
217
+ export type AiGenEvent_event_progress = {
218
+ type: 'progress';
219
+ data: string;
220
+ };
221
+ export type AiGenEvent_event_structure = {
222
+ type: 'structure';
223
+ data: AiGenStructure;
224
+ };
225
+ export type AiGenEvent_event_structureDiff = {
226
+ type: 'structureDiff';
227
+ data: AiGenStructureDiff;
228
+ };
229
+ export type AiGenEvent_event_blockDelta = {
230
+ type: 'blockDelta';
231
+ data: AiGenBlockDelta;
232
+ };
233
+ export type AiGenEvent_event_imageDelta = {
234
+ type: 'imageDelta';
235
+ data: AiGenImageDelta;
236
+ };
237
+ export type AiGenEvent_event_blockError = {
238
+ type: 'blockError';
239
+ data: AiGenBlockError;
240
+ };
241
+ export type AiGenEvent_event_done = {
242
+ type: 'done';
243
+ data: AiGenDoneEvent;
244
+ };
245
+ export type AiGenEvent_event_fatal = {
246
+ type: 'fatal';
247
+ data: string;
248
+ };
249
+ export type AiGenEvent_event_textDescription = {
250
+ type: 'textDescription';
251
+ data: AiGenTextDescription;
252
+ };
253
+ export type AiGenEvent_event = AiGenEvent_event_progress | AiGenEvent_event_structure | AiGenEvent_event_structureDiff | AiGenEvent_event_blockDelta | AiGenEvent_event_imageDelta | AiGenEvent_event_blockError | AiGenEvent_event_done | AiGenEvent_event_fatal | AiGenEvent_event_textDescription;
254
+ export type AiGenEvent = {
255
+ event: AiGenEvent_event;
256
+ };
@@ -0,0 +1,3 @@
1
+ /* eslint-disable */
2
+ /* Autogenerated code */
3
+ export {};