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

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": {
@@ -461,6 +462,15 @@ export const data = {
461
462
  }
462
463
  }
463
464
  },
465
+ "pushwoosh.aibuilder.v1.Placeholder": {
466
+ "type": "I",
467
+ "fields": {
468
+ "prompt": {
469
+ "type": "string",
470
+ "optional": true
471
+ }
472
+ }
473
+ },
464
474
  "pushwoosh.aibuilder.v1.AiBuilderBlock": {
465
475
  "type": "I",
466
476
  "fields": {
@@ -479,6 +489,9 @@ export const data = {
479
489
  "group": {
480
490
  "type": "pushwoosh.aibuilder.v1.AiBuilderGroup"
481
491
  },
492
+ "placeholder": {
493
+ "type": "pushwoosh.aibuilder.v1.Placeholder"
494
+ },
482
495
  "styles": {
483
496
  "type": "pushwoosh.aibuilder.v1.BlockStyles",
484
497
  "optional": true
@@ -493,7 +506,8 @@ export const data = {
493
506
  "card",
494
507
  "columns",
495
508
  "content",
496
- "group"
509
+ "group",
510
+ "placeholder"
497
511
  ]
498
512
  }
499
513
  }
@@ -636,7 +650,8 @@ export const data = {
636
650
  "AI_GEN_BLOCK_TYPE_HINT_CARD",
637
651
  "AI_GEN_BLOCK_TYPE_HINT_COLUMNS",
638
652
  "AI_GEN_BLOCK_TYPE_HINT_CONTENT",
639
- "AI_GEN_BLOCK_TYPE_HINT_GROUP"
653
+ "AI_GEN_BLOCK_TYPE_HINT_GROUP",
654
+ "AI_GEN_BLOCK_TYPE_HINT_PLACEHOLDER"
640
655
  ]
641
656
  },
642
657
  "pushwoosh.aigen.v1.AiGenMode": {
@@ -705,10 +720,6 @@ export const data = {
705
720
  "type": "string",
706
721
  "array": true
707
722
  },
708
- "afterPath": {
709
- "type": "string",
710
- "array": true
711
- },
712
723
  "typeHint": {
713
724
  "type": "pushwoosh.aigen.v1.AiGenBlockTypeHint"
714
725
  },
@@ -757,10 +768,6 @@ export const data = {
757
768
  "prompt": {
758
769
  "type": "string"
759
770
  },
760
- "afterPath": {
761
- "type": "string",
762
- "array": true
763
- },
764
771
  "parentId": {
765
772
  "type": "string"
766
773
  }
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.137",
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
  /**
@@ -261,13 +296,30 @@ export type AiBuilderColumn = {
261
296
  * this block's id; the group itself has no copy and no image slot.
262
297
  * Allowed in EMAIL and WEB_POPUP.
263
298
  *
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.
299
+ * Wire contract:
300
+ * - All fields (direction, align, margin, padding, gap) are
301
+ * client-managed. The backend preserves whatever the client sent
302
+ * verbatim across edits and emits proto-zero / unset for them on
303
+ * freshly generated groups.
304
+ * - UNSPECIFIED enums and unset optionals mean "inherit / use the
305
+ * document default" see GroupDirection / GroupAlign for the
306
+ * render-time fallback. UNSPECIFIED is NOT wire-equivalent to the
307
+ * concrete default value; downstream consumers that diff documents
308
+ * see them as different states.
309
+ * - The LLM never sees these fields and never sets them; they round-
310
+ * trip through the backend untouched.
311
+ *
312
+ * Recommended client flow:
313
+ * - Default rendering (vertical stack, START alignment, document
314
+ * defaults for margin/padding/gap): leave UNSPECIFIED / unset.
315
+ * Don't normalise to a concrete enum just because that's what the
316
+ * user currently sees.
317
+ * - Send a concrete enum (VERTICAL, START, HORIZONTAL, CENTER, END)
318
+ * only when the user explicitly chose a non-default value, or when
319
+ * the user wants to pin the value against a future default change.
320
+ * - On reset, write back UNSPECIFIED / unset rather than the concrete
321
+ * default — that way the document still diffs cleanly against a
322
+ * freshly generated group.
271
323
  */
272
324
  export type AiBuilderGroup = {
273
325
  direction: GroupDirection;
@@ -286,6 +338,23 @@ export type AiBuilderGroup = {
286
338
  */
287
339
  align: GroupAlign;
288
340
  };
341
+ /**
342
+ * Placeholder is a client-created empty slot meant to be replaced by
343
+ * the AI on a follow-up edit. The frontend builder inserts a
344
+ * Placeholder when the user adds a new block to the canvas without
345
+ * yet describing what it should be; on the next AI-edit the model
346
+ * replaces it with a real block kind (card / columns / content /
347
+ * group). Carries no rendered content of its own.
348
+ */
349
+ export type Placeholder = {
350
+ /**
351
+ * Optional user-supplied hint about what the slot should become,
352
+ * e.g. "CTA section with a button" or "product card". The AI uses
353
+ * it as an instruction on the next edit; empty string lets the
354
+ * model pick freely from surrounding context.
355
+ */
356
+ prompt?: string;
357
+ };
289
358
  export type AiBuilderBlock_block_card = {
290
359
  type: 'card';
291
360
  data: AiBuilderCard;
@@ -302,7 +371,11 @@ export type AiBuilderBlock_block_group = {
302
371
  type: 'group';
303
372
  data: AiBuilderGroup;
304
373
  };
305
- export type AiBuilderBlock_block = AiBuilderBlock_block_card | AiBuilderBlock_block_columns | AiBuilderBlock_block_content | AiBuilderBlock_block_group;
374
+ export type AiBuilderBlock_block_placeholder = {
375
+ type: 'placeholder';
376
+ data: Placeholder;
377
+ };
378
+ export type AiBuilderBlock_block = AiBuilderBlock_block_card | AiBuilderBlock_block_columns | AiBuilderBlock_block_content | AiBuilderBlock_block_group | AiBuilderBlock_block_placeholder;
306
379
  export type AiBuilderBlock = {
307
380
  id: string;
308
381
  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[];