@pushwoosh/rpc-gateway-ai-assistant 0.1.136 → 0.1.138

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/data.js CHANGED
@@ -8,7 +8,8 @@ export const data = {
8
8
  "DOCUMENT_BLOCK_TYPE_CARD",
9
9
  "DOCUMENT_BLOCK_TYPE_COLUMNS",
10
10
  "DOCUMENT_BLOCK_TYPE_CONTENT",
11
- "DOCUMENT_BLOCK_TYPE_GROUP"
11
+ "DOCUMENT_BLOCK_TYPE_GROUP",
12
+ "DOCUMENT_BLOCK_TYPE_PLACEHOLDER"
12
13
  ]
13
14
  },
14
15
  "pushwoosh.aibuilder.v1.GroupDirection": {
@@ -68,6 +69,10 @@ export const data = {
68
69
  },
69
70
  "lineHeight": {
70
71
  "type": "number"
72
+ },
73
+ "fontFamily": {
74
+ "type": "string",
75
+ "optional": true
71
76
  }
72
77
  }
73
78
  },
@@ -190,6 +195,10 @@ export const data = {
190
195
  },
191
196
  "defaultStyles": {
192
197
  "type": "pushwoosh.aibuilder.v1.DefaultStyles"
198
+ },
199
+ "fontFamily": {
200
+ "type": "string",
201
+ "optional": true
193
202
  }
194
203
  }
195
204
  },
@@ -268,6 +277,10 @@ export const data = {
268
277
  "fontSize": {
269
278
  "type": "number",
270
279
  "optional": true
280
+ },
281
+ "fontFamily": {
282
+ "type": "string",
283
+ "optional": true
271
284
  }
272
285
  }
273
286
  },
@@ -461,6 +474,15 @@ export const data = {
461
474
  }
462
475
  }
463
476
  },
477
+ "pushwoosh.aibuilder.v1.Placeholder": {
478
+ "type": "I",
479
+ "fields": {
480
+ "prompt": {
481
+ "type": "string",
482
+ "optional": true
483
+ }
484
+ }
485
+ },
464
486
  "pushwoosh.aibuilder.v1.AiBuilderBlock": {
465
487
  "type": "I",
466
488
  "fields": {
@@ -479,6 +501,9 @@ export const data = {
479
501
  "group": {
480
502
  "type": "pushwoosh.aibuilder.v1.AiBuilderGroup"
481
503
  },
504
+ "placeholder": {
505
+ "type": "pushwoosh.aibuilder.v1.Placeholder"
506
+ },
482
507
  "styles": {
483
508
  "type": "pushwoosh.aibuilder.v1.BlockStyles",
484
509
  "optional": true
@@ -493,7 +518,8 @@ export const data = {
493
518
  "card",
494
519
  "columns",
495
520
  "content",
496
- "group"
521
+ "group",
522
+ "placeholder"
497
523
  ]
498
524
  }
499
525
  }
@@ -636,7 +662,8 @@ export const data = {
636
662
  "AI_GEN_BLOCK_TYPE_HINT_CARD",
637
663
  "AI_GEN_BLOCK_TYPE_HINT_COLUMNS",
638
664
  "AI_GEN_BLOCK_TYPE_HINT_CONTENT",
639
- "AI_GEN_BLOCK_TYPE_HINT_GROUP"
665
+ "AI_GEN_BLOCK_TYPE_HINT_GROUP",
666
+ "AI_GEN_BLOCK_TYPE_HINT_PLACEHOLDER"
640
667
  ]
641
668
  },
642
669
  "pushwoosh.aigen.v1.AiGenMode": {
@@ -705,10 +732,6 @@ export const data = {
705
732
  "type": "string",
706
733
  "array": true
707
734
  },
708
- "afterPath": {
709
- "type": "string",
710
- "array": true
711
- },
712
735
  "typeHint": {
713
736
  "type": "pushwoosh.aigen.v1.AiGenBlockTypeHint"
714
737
  },
@@ -757,10 +780,6 @@ export const data = {
757
780
  "prompt": {
758
781
  "type": "string"
759
782
  },
760
- "afterPath": {
761
- "type": "string",
762
- "array": true
763
- },
764
783
  "parentId": {
765
784
  "type": "string"
766
785
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/rpc-gateway-ai-assistant",
3
- "version": "0.1.136",
3
+ "version": "0.1.138",
4
4
  "description": "AI Assistant api gateway HTTP API Types and Data",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -8,16 +8,39 @@ export type DocumentBlockType = 'DOCUMENT_BLOCK_TYPE_UNSPECIFIED' | 'DOCUMENT_BL
8
8
  * Structural stack container — a "group" block in the kind registry.
9
9
  * Wire-shape is AiBuilderBlock.group. Allowed in EMAIL and WEB_POPUP.
10
10
  */
11
- | 'DOCUMENT_BLOCK_TYPE_GROUP';
11
+ | 'DOCUMENT_BLOCK_TYPE_GROUP'
12
+ /**
13
+ * Client-created empty slot meant to be materialised into a real
14
+ * block by the AI on a follow-up edit. Wire-shape is
15
+ * AiBuilderBlock.placeholder.
16
+ */
17
+ | 'DOCUMENT_BLOCK_TYPE_PLACEHOLDER';
12
18
  /**
13
19
  * GroupDirection picks which axis an AiBuilderGroup lays its children
14
- * along. The planner emits UNSPECIFIED (proto zero) on freshly
15
- * generated groups — clients should treat UNSPECIFIED and VERTICAL
16
- * identically as a vertical stack. HORIZONTAL is only ever set by the
17
- * client (post-generation) when it wants a side-by-side layout; the
18
- * backend preserves the client's choice across edits. The enum lives
19
- * at file scope so the same shape is shared between the document
20
- * model and the AiGen wire types.
20
+ * along.
21
+ *
22
+ * Wire contract:
23
+ * UNSPECIFIED "inherit / use the document default" (currently
24
+ * rendered as a vertical stack). Render-time fallback
25
+ * only; NOT wire-equivalent to VERTICAL downstream
26
+ * consumers that diff documents see them as different
27
+ * values.
28
+ * VERTICAL — explicit vertical stack. Reserved for an "Explicit
29
+ * override" UX where the client wants to pin the value
30
+ * against a future default change. The backend never
31
+ * emits this on freshly generated groups; that case
32
+ * stays UNSPECIFIED.
33
+ * HORIZONTAL — explicit side-by-side layout. Emitted only by the
34
+ * client (the LLM never picks a direction).
35
+ *
36
+ * Recommended client flow: send UNSPECIFIED for the default and switch
37
+ * to a concrete value only when the user explicitly chose a non-default
38
+ * direction; revert to UNSPECIFIED when the user resets it.
39
+ *
40
+ * Server contract: the backend preserves whatever value the client
41
+ * sent across edits — direction is in the client-managed set on
42
+ * AiBuilderGroup. The enum lives at file scope so the same shape is
43
+ * shared between the document model and the AiGen wire types.
21
44
  */
22
45
  export type GroupDirection = 'GROUP_DIRECTION_UNSPECIFIED' | 'GROUP_DIRECTION_VERTICAL' | 'GROUP_DIRECTION_HORIZONTAL';
23
46
  export type CardLayout = 'CARD_LAYOUT_UNSPECIFIED' | 'CARD_LAYOUT_RIGHT' | 'CARD_LAYOUT_LEFT' | 'CARD_LAYOUT_TOP' | 'CARD_LAYOUT_NO' | 'CARD_LAYOUT_BACKGROUND';
@@ -26,10 +49,22 @@ export type ButtonGroupAlign = 'BUTTON_GROUP_ALIGN_UNSPECIFIED' | 'BUTTON_GROUP_
26
49
  * GroupAlign controls alignment of an AiBuilderGroup's children along
27
50
  * the perpendicular axis (for direction=VERTICAL → horizontal
28
51
  * alignment of children; for direction=HORIZONTAL → vertical
29
- * alignment). UNSPECIFIED is the proto zero value and clients should
30
- * render it as START same client-managed pattern as GroupDirection.
31
- * Named in start/center/end terms (not left/right) because the
32
- * concrete axis depends on direction.
52
+ * alignment). Named in start/center/end terms (not left/right)
53
+ * because the concrete axis depends on direction.
54
+ *
55
+ * Wire contract:
56
+ * UNSPECIFIED — "inherit / use the document default" (currently
57
+ * rendered as START). Render-time fallback only; NOT
58
+ * wire-equivalent to START.
59
+ * START — explicit start alignment. Reserved for the same
60
+ * "Explicit override" UX as GroupDirection.VERTICAL.
61
+ * The backend never emits this on freshly generated
62
+ * groups; that case stays UNSPECIFIED.
63
+ * CENTER/END — explicit center / end alignment.
64
+ *
65
+ * Recommended client flow: same as GroupDirection — UNSPECIFIED for the
66
+ * default, a concrete value only when the user explicitly chose one,
67
+ * back to UNSPECIFIED on reset.
33
68
  */
34
69
  export type GroupAlign = 'GROUP_ALIGN_UNSPECIFIED' | 'GROUP_ALIGN_START' | 'GROUP_ALIGN_CENTER' | 'GROUP_ALIGN_END';
35
70
  /**
@@ -54,6 +89,18 @@ export type TextVariantStyle = {
54
89
  fontSize: number;
55
90
  fontWeight: number;
56
91
  lineHeight: number;
92
+ /**
93
+ * Font-family override for this text variant (e.g. "headings in Inter,
94
+ * body in Roboto").
95
+ *
96
+ * Wire contract:
97
+ * - CSS font-family syntax; see DocumentSettings.font_family.
98
+ * - Unset (or empty string) = inherit from
99
+ * DocumentSettings.font_family, which itself falls back to the
100
+ * renderer default. Backend should emit unset rather than "".
101
+ * - Client-managed: the LLM never selects fonts.
102
+ */
103
+ fontFamily?: string;
57
104
  };
58
105
  export type ColorSchemeItem = {
59
106
  color: string;
@@ -144,6 +191,23 @@ export type DocumentSettings = {
144
191
  backgroundColor: string;
145
192
  textColor: string;
146
193
  defaultStyles: DefaultStyles;
194
+ /**
195
+ * Document-wide font-family override.
196
+ *
197
+ * Wire contract:
198
+ * - CSS font-family syntax: a comma-separated fallback chain, e.g.
199
+ * "Inter, system-ui, sans-serif". The backend stores it verbatim
200
+ * and never parses or rewrites it.
201
+ * - Unset (or empty string) = "no override" — the client falls
202
+ * back to its renderer default. Backend should emit unset rather
203
+ * than ""; do not rely on "" as an "explicit reset" state.
204
+ * - Client-managed: the LLM never sees this field and never
205
+ * selects fonts.
206
+ * - Overridden per-variant by TextVariantStyle.font_family and
207
+ * per-button by ButtonStyles.font_family. Cascade resolves
208
+ * button → variant → document → renderer default.
209
+ */
210
+ fontFamily?: string;
147
211
  };
148
212
  export type TextBlock = {
149
213
  variant: string;
@@ -172,6 +236,20 @@ export type ButtonStyles = {
172
236
  borderColor?: string;
173
237
  borderWidth?: number;
174
238
  fontSize?: number;
239
+ /**
240
+ * Font-family override for button labels.
241
+ *
242
+ * Wire contract:
243
+ * - CSS font-family syntax; see DocumentSettings.font_family.
244
+ * - Unset (or empty string) = inherit. Cascade: this field →
245
+ * TextVariantStyle.font_family of the button's variant (if any) →
246
+ * DocumentSettings.font_family → renderer default. Backend
247
+ * should emit unset rather than "".
248
+ * - Client-managed: the LLM never emits this field. Button styles
249
+ * aren't part of the block generator's JSON schema, so this is
250
+ * enforced by construction.
251
+ */
252
+ fontFamily?: string;
175
253
  };
176
254
  export type ButtonGroup = {
177
255
  buttons: Button[];
@@ -261,13 +339,30 @@ export type AiBuilderColumn = {
261
339
  * this block's id; the group itself has no copy and no image slot.
262
340
  * Allowed in EMAIL and WEB_POPUP.
263
341
  *
264
- * direction / align / margin / padding / gap are client-managed: the
265
- * LLM never sees them, the backend preserves them across edits. On
266
- * freshly generated groups the backend emits proto-zero values
267
- * (direction = UNSPECIFIED, align = UNSPECIFIED, optional fields
268
- * unset); clients are expected to render UNSPECIFIED direction as a
269
- * vertical stack, UNSPECIFIED align as START, and set non-default
270
- * values themselves when needed.
342
+ * Wire contract:
343
+ * - All fields (direction, align, margin, padding, gap) are
344
+ * client-managed. The backend preserves whatever the client sent
345
+ * verbatim across edits and emits proto-zero / unset for them on
346
+ * freshly generated groups.
347
+ * - UNSPECIFIED enums and unset optionals mean "inherit / use the
348
+ * document default" see GroupDirection / GroupAlign for the
349
+ * render-time fallback. UNSPECIFIED is NOT wire-equivalent to the
350
+ * concrete default value; downstream consumers that diff documents
351
+ * see them as different states.
352
+ * - The LLM never sees these fields and never sets them; they round-
353
+ * trip through the backend untouched.
354
+ *
355
+ * Recommended client flow:
356
+ * - Default rendering (vertical stack, START alignment, document
357
+ * defaults for margin/padding/gap): leave UNSPECIFIED / unset.
358
+ * Don't normalise to a concrete enum just because that's what the
359
+ * user currently sees.
360
+ * - Send a concrete enum (VERTICAL, START, HORIZONTAL, CENTER, END)
361
+ * only when the user explicitly chose a non-default value, or when
362
+ * the user wants to pin the value against a future default change.
363
+ * - On reset, write back UNSPECIFIED / unset rather than the concrete
364
+ * default — that way the document still diffs cleanly against a
365
+ * freshly generated group.
271
366
  */
272
367
  export type AiBuilderGroup = {
273
368
  direction: GroupDirection;
@@ -286,6 +381,23 @@ export type AiBuilderGroup = {
286
381
  */
287
382
  align: GroupAlign;
288
383
  };
384
+ /**
385
+ * Placeholder is a client-created empty slot meant to be replaced by
386
+ * the AI on a follow-up edit. The frontend builder inserts a
387
+ * Placeholder when the user adds a new block to the canvas without
388
+ * yet describing what it should be; on the next AI-edit the model
389
+ * replaces it with a real block kind (card / columns / content /
390
+ * group). Carries no rendered content of its own.
391
+ */
392
+ export type Placeholder = {
393
+ /**
394
+ * Optional user-supplied hint about what the slot should become,
395
+ * e.g. "CTA section with a button" or "product card". The AI uses
396
+ * it as an instruction on the next edit; empty string lets the
397
+ * model pick freely from surrounding context.
398
+ */
399
+ prompt?: string;
400
+ };
289
401
  export type AiBuilderBlock_block_card = {
290
402
  type: 'card';
291
403
  data: AiBuilderCard;
@@ -302,7 +414,11 @@ export type AiBuilderBlock_block_group = {
302
414
  type: 'group';
303
415
  data: AiBuilderGroup;
304
416
  };
305
- export type AiBuilderBlock_block = AiBuilderBlock_block_card | AiBuilderBlock_block_columns | AiBuilderBlock_block_content | AiBuilderBlock_block_group;
417
+ export type AiBuilderBlock_block_placeholder = {
418
+ type: 'placeholder';
419
+ data: Placeholder;
420
+ };
421
+ export type AiBuilderBlock_block = AiBuilderBlock_block_card | AiBuilderBlock_block_columns | AiBuilderBlock_block_content | AiBuilderBlock_block_group | AiBuilderBlock_block_placeholder;
306
422
  export type AiBuilderBlock = {
307
423
  id: string;
308
424
  styles?: BlockStyles;
@@ -36,7 +36,15 @@ export type AiGenBlockTypeHint = 'AI_GEN_BLOCK_TYPE_HINT_UNSPECIFIED' | 'AI_GEN_
36
36
  * skipped — groups carry no copy, just children referenced via
37
37
  * parent_id. Allowed in EMAIL and WEB_POPUP.
38
38
  */
39
- | 'AI_GEN_BLOCK_TYPE_HINT_GROUP';
39
+ | 'AI_GEN_BLOCK_TYPE_HINT_GROUP'
40
+ /**
41
+ * Client-created empty slot meant to be materialised into a real
42
+ * block by the AI on a follow-up edit. The block generator is
43
+ * skipped — the planner emits a `replace` for each placeholder it
44
+ * sees in <current_document> and the pipeline retargets the replace
45
+ * to a real content kind before invoking the block generator.
46
+ */
47
+ | 'AI_GEN_BLOCK_TYPE_HINT_PLACEHOLDER';
40
48
  /**
41
49
  * AiGenMode selects the document-domain profile the generation pipeline
42
50
  * runs under: which block kinds are allowed, which Meta fields are
@@ -101,6 +109,13 @@ export type AiGenRequest = {
101
109
  * single-entry structure_diff echoing these fields so the UI can match an
102
110
  * optimistically-rendered placeholder, followed by the block_delta and any
103
111
  * image_deltas for the new block.
112
+ *
113
+ * Positioning: the new block lands at the end of the target parent
114
+ * scope (end of the page when parent_id is empty, end of that
115
+ * container's children otherwise). Fine-grained positioning is the
116
+ * client's job: drop an empty `Placeholder` block on the canvas where
117
+ * you want it and ask the AI to materialise it on the next edit (see
118
+ * the placeholder flow in the document).
104
119
  */
105
120
  export type AiGenAddBlock = {
106
121
  /**
@@ -109,13 +124,6 @@ export type AiGenAddBlock = {
109
124
  * block_id must not collide with any existing block id in that page.
110
125
  */
111
126
  blockPath: string[];
112
- /**
113
- * Path of the block this one should be inserted after:
114
- * `[page_id, existing_block_id]`. Must share `page_id` with
115
- * `block_path`. Empty = insert at the beginning of the page referenced
116
- * by `block_path[0]`.
117
- */
118
- afterPath: string[];
119
127
  /**
120
128
  * Optional. UNSPECIFIED = the block generator decides card vs columns
121
129
  * based on the prompt and surrounding blocks.
@@ -152,17 +160,26 @@ export type AiGenStructureAdd = {
152
160
  typeHint: AiGenBlockTypeHint;
153
161
  prompt: string;
154
162
  /**
155
- * Path of the block this one should be inserted after. Empty → insert
156
- * at the beginning of the page referenced by `block_path[0]`. May
157
- * reference an existing block path or another add.block_path from the
158
- * same diff (must share `page_id`).
159
- */
160
- afterPath: string[];
161
- /**
162
- * Id of the parent container block. Empty string = top-level. May
163
- * reference an existing container or another add from the same diff.
164
- * The new block becomes a child of that container (still a sibling in
165
- * page.blocks; the tree is rebuilt by group-by-parent on the client).
163
+ * Id of the parent container block.
164
+ *
165
+ * Wire contract:
166
+ * - Empty string = top-level (the add lands at the end of the
167
+ * page).
168
+ * - Non-empty must resolve to a container block: either an
169
+ * existing one in `document`, or an add appearing earlier in
170
+ * AiGenStructureDiff.add. Back-references only the parent
171
+ * must be either already in the document or appear before this
172
+ * entry in the same `add` list. Forward-references are rejected
173
+ * by the server (parent_id reset to empty with a warning in the
174
+ * logs).
175
+ * - The add lands at the end of its parent scope; fine-grained
176
+ * positioning is done by the client via placeholder slots
177
+ * before the edit (see Placeholder in ai_builder_document.proto).
178
+ *
179
+ * Recommended client flow: process AiGenStructureDiff.add entries
180
+ * left-to-right; each entry's parent_id is guaranteed resolvable
181
+ * against the entries the client has already processed plus the
182
+ * pre-edit document.
166
183
  */
167
184
  parentId: string;
168
185
  };
@@ -181,6 +198,13 @@ export type AiGenStructureReplace = {
181
198
  /**
182
199
  * Emitted once for edit (when the planner ran), before any block_delta.
183
200
  * Not emitted on the block_path bypass path.
201
+ *
202
+ * Wire contract: the `add` list is ordered. Each entry's parent_id may
203
+ * reference an earlier entry in the same list (back-reference); the
204
+ * server rejects forward-references on sanitisation. Clients should
205
+ * apply `add` entries left-to-right so a pending parent is in place
206
+ * before any of its children. `remove` and `replace` are commutative
207
+ * and may be applied in any order.
184
208
  */
185
209
  export type AiGenStructureDiff = {
186
210
  add: AiGenStructureAdd[];