@tdesign-react/chat 1.1.0-alpha.3 → 1.1.0-alpha.5

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 (110) hide show
  1. package/es/_chunks/dep-24472232.js +839 -0
  2. package/es/_chunks/dep-24472232.js.map +1 -0
  3. package/es/_chunks/dep-bcb234a1.js +839 -0
  4. package/es/_chunks/dep-bcb234a1.js.map +1 -0
  5. package/es/_util/reactify.js +1 -1
  6. package/es/_util/useDynamicStyle.js +1 -1
  7. package/es/attachments/index.js +1 -1
  8. package/es/chat-actionbar/index.js +1 -1
  9. package/es/chat-engine/components/activity/index.js +1 -1
  10. package/es/chat-engine/components/activity/registry.js +1 -1
  11. package/es/chat-engine/components/activity/render.js +1 -1
  12. package/es/chat-engine/components/activity/types.js +1 -1
  13. package/es/chat-engine/components/index.js +4 -2
  14. package/es/chat-engine/components/index.js.map +1 -1
  15. package/es/chat-engine/components/json-render/A2UIJsonRenderActivityRenderer.js +2 -2
  16. package/es/chat-engine/components/json-render/JsonRenderActivityRenderer.js +2 -2
  17. package/es/chat-engine/components/json-render/SurfaceStateManager.js +1 -1
  18. package/es/chat-engine/components/json-render/adapters/a2ui-to-jsonrender.js +1 -1
  19. package/es/chat-engine/components/json-render/adapters/a2ui-types.js +1 -1
  20. package/es/chat-engine/components/json-render/adapters/index.js +1 -1
  21. package/es/chat-engine/components/json-render/catalog/a2ui-binding.js +2 -2
  22. package/es/chat-engine/components/json-render/catalog/a2ui-registry.js +2 -2
  23. package/es/chat-engine/components/json-render/catalog/button.js +1 -1
  24. package/es/chat-engine/components/json-render/catalog/card.js +1 -1
  25. package/es/chat-engine/components/json-render/catalog/index.js +2 -2
  26. package/es/chat-engine/components/json-render/catalog/input.js +2 -2
  27. package/es/chat-engine/components/json-render/catalog/layout.js +1 -1
  28. package/es/chat-engine/components/json-render/catalog/text.js +1 -1
  29. package/es/chat-engine/components/json-render/catalog.js +248 -28
  30. package/es/chat-engine/components/json-render/catalog.js.map +1 -1
  31. package/es/chat-engine/components/json-render/config.js +2 -2
  32. package/es/chat-engine/components/json-render/contexts/actions.js +1 -1
  33. package/es/chat-engine/components/json-render/contexts/data.js +1 -1
  34. package/es/chat-engine/components/json-render/contexts/validation.js +1 -1
  35. package/es/chat-engine/components/json-render/contexts/visibility.js +1 -1
  36. package/es/chat-engine/components/json-render/engine.js +1 -1
  37. package/es/chat-engine/components/json-render/index.js +2 -2
  38. package/es/chat-engine/components/json-render/performance.js +1 -1
  39. package/es/chat-engine/components/json-render/renderer.js +1 -1
  40. package/es/chat-engine/components/json-render/types.js +1 -1
  41. package/es/chat-engine/components/provider/agent-state.js +3 -1
  42. package/es/chat-engine/components/provider/agent-state.js.map +1 -1
  43. package/es/chat-engine/components/toolcall/index.js +3 -1
  44. package/es/chat-engine/components/toolcall/index.js.map +1 -1
  45. package/es/chat-engine/components/toolcall/registry.js +1 -1
  46. package/es/chat-engine/components/toolcall/render.js +4 -2
  47. package/es/chat-engine/components/toolcall/render.js.map +1 -1
  48. package/es/chat-engine/components/toolcall/types.js +1 -1
  49. package/es/chat-engine/core/adapters/agui/activity-manager.js +7 -1
  50. package/es/chat-engine/core/adapters/agui/activity-manager.js.map +1 -1
  51. package/es/chat-engine/core/adapters/agui/event-mapper.js +3 -1
  52. package/es/chat-engine/core/adapters/agui/event-mapper.js.map +1 -1
  53. package/es/chat-engine/core/adapters/agui/events.js +1 -1
  54. package/es/chat-engine/core/adapters/agui/index.js +5 -3
  55. package/es/chat-engine/core/adapters/agui/index.js.map +1 -1
  56. package/es/chat-engine/core/adapters/agui/state-manager.js +7 -1
  57. package/es/chat-engine/core/adapters/agui/state-manager.js.map +1 -1
  58. package/es/chat-engine/core/adapters/agui/types.js +1 -1
  59. package/es/chat-engine/core/adapters/agui/utils.js +1 -1
  60. package/es/chat-engine/core/event-bus/ChatEventBus.js +1 -1
  61. package/es/chat-engine/core/event-bus/index.js +1 -1
  62. package/es/chat-engine/core/event-bus/types.js +1 -1
  63. package/es/chat-engine/core/index.js +5 -3
  64. package/es/chat-engine/core/index.js.map +1 -1
  65. package/es/chat-engine/core/processor/index.js +1 -1
  66. package/es/chat-engine/core/server/batch-client.js +1 -1
  67. package/es/chat-engine/core/server/connection-manager.js +1 -1
  68. package/es/chat-engine/core/server/errors.js +1 -1
  69. package/es/chat-engine/core/server/index.js +1 -1
  70. package/es/chat-engine/core/server/llm-service.js +1 -1
  71. package/es/chat-engine/core/server/sse-client.js +1 -1
  72. package/es/chat-engine/core/server/sse-parser.js +1 -1
  73. package/es/chat-engine/core/server/types.js +1 -1
  74. package/es/chat-engine/core/store/message.js +4 -2
  75. package/es/chat-engine/core/store/message.js.map +1 -1
  76. package/es/chat-engine/core/store/model.js +1 -1
  77. package/es/chat-engine/core/store/reactiveState.js +1 -1
  78. package/es/chat-engine/core/type.js +1 -1
  79. package/es/chat-engine/core/utils/eventEmitter.js +1 -1
  80. package/es/chat-engine/core/utils/index.js +10 -880
  81. package/es/chat-engine/core/utils/index.js.map +1 -1
  82. package/es/chat-engine/core/utils/json-patch/helpers.d.ts +41 -0
  83. package/es/chat-engine/core/utils/json-patch/helpers.js +164 -0
  84. package/es/chat-engine/core/utils/json-patch/helpers.js.map +1 -0
  85. package/es/chat-engine/core/utils/json-patch/index.d.ts +115 -0
  86. package/es/chat-engine/core/utils/json-patch/index.js +387 -0
  87. package/es/chat-engine/core/utils/json-patch/index.js.map +1 -0
  88. package/es/chat-engine/core/utils/logger.js +1 -1
  89. package/es/chat-engine/hooks/index.js +3 -1
  90. package/es/chat-engine/hooks/index.js.map +1 -1
  91. package/es/chat-engine/hooks/useAgentActivity.js +1 -1
  92. package/es/chat-engine/hooks/useAgentState.js +3 -1
  93. package/es/chat-engine/hooks/useAgentState.js.map +1 -1
  94. package/es/chat-engine/hooks/useAgentToolcall.js +1 -1
  95. package/es/chat-engine/hooks/useChat.js +3 -1
  96. package/es/chat-engine/hooks/useChat.js.map +1 -1
  97. package/es/chat-engine/hooks/useJsonRenderActivity.js +2 -2
  98. package/es/chat-engine/index.js +4 -2
  99. package/es/chat-engine/index.js.map +1 -1
  100. package/es/chat-filecard/index.js +1 -1
  101. package/es/chat-loading/index.js +1 -1
  102. package/es/chat-markdown/index.js +1 -1
  103. package/es/chat-message/index.js +1 -1
  104. package/es/chat-sender/index.js +1 -1
  105. package/es/chat-thinking/index.js +1 -1
  106. package/es/chatbot/index.js +1 -1
  107. package/es/index.js +4 -2
  108. package/es/index.js.map +1 -1
  109. package/es/style/index.js +1 -1
  110. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * tdesign v1.1.0-alpha.2
2
+ * tdesign v1.1.0-alpha.4
3
3
  * (c) 2026 tdesign
4
4
  * @license MIT
5
5
  */
@@ -344,7 +344,7 @@ function generateCatalogPrompt() {
344
344
  includeExample: includeExample
345
345
  });
346
346
  }
347
- var lines = ["# ".concat(name, " UI Component Catalog"), "", "You can generate dynamic UI using the following components and JSON schema format.", "", "## Output Format", "", "Generate a JSON object with this structure:", "```json", "{", ' "root": "element_id", // ID of the root element', ' "elements": {', ' "element_id": {', ' "key": "element_id", // Same as the key in elements object', ' "type": "ComponentName", // One of the available components', ' "props": { ... }, // Component-specific props', ' "children": ["child_id_1", "child_id_2"] // Optional: IDs of child elements', " }", " },", ' "data": { // Optional: Initial data model for data binding', ' "fieldName": "value"', " }", "}", "```", "", "## Available Components", ""];
347
+ var lines = ["# ".concat(name, " UI Component Catalog"), "", "You can generate dynamic UI using the following components and JSON schema format.", "", "## Output Format", "", "Generate a JSON object with this structure:", "```json", "{", ' "root": "element_id", // ID of the root element', ' "elements": {', ' "element_id": {', ' "key": "element_id", // Same as the key in elements object', ' "type": "ComponentName", // One of the available components', ' "props": { ... }, // Component-specific props', ' "children": ["child_id_1", "child_id_2"] // Optional: IDs of child elements', " }", " },", ' "data": { // Optional: Initial data model for data binding', ' "fieldName": "value"', " }", "}", "```", "", "## AG-UI ACTIVITY_DELTA Format (for Incremental Updates)", "", "For updating existing UI, you can also generate AG-UI ACTIVITY_DELTA messages:", "```json", "{", ' "type": "ACTIVITY_DELTA",', ' "messageId": "unique_message_id",', ' "activityType": "json-render-main-card",', ' "patch": [', ' {"op": "add", "path": "/elements/new-element", "value": {...}},', ' {"op": "replace", "path": "/elements/parent/children", "value": [...]}', " ]", "}", "```", "", "### JSON Patch Operations for ACTIVITY_DELTA", "", "**Add New Element:**", "```json", '{"op": "add", "path": "/elements/new-button", "value": {', ' "key": "new-button",', ' "type": "Button",', ' "props": {"children": "Click Me", "theme": "primary"}', "}}", "```", "", "**Update Element Properties:**", "```json", '{"op": "replace", "path": "/elements/my-card/props/title", "value": "Updated Title"}', "```", "", "**Replace Children Array:**", "```json", '{"op": "replace", "path": "/elements/container/children", "value": ["child1", "child2", "new-child"]}', "```", "", "**Add Child to Parent:**", "```json", '{"op": "add", "path": "/elements/parent/children/-", "value": "new-child-id"}', "```", "", "**Update Data Model:**", "```json", '{"op": "replace", "path": "/data/user/name", "value": "John Doe"}', "```", "", "**Complete ACTIVITY_DELTA Example:**", "```json", "{", ' "type": "ACTIVITY_DELTA",', ' "messageId": "update_123456",', ' "activityType": "json-render-main-card",', ' "patch": [', " {", ' "op": "add",', ' "path": "/elements/success-message",', ' "value": {', ' "key": "success-message",', ' "type": "Text",', ' "props": {', ' "content": "Operation completed successfully!",', ' "color": "success"', " }", " }", " },", " {", ' "op": "add",', ' "path": "/elements/main-container/children/-",', ' "value": "success-message"', " }", " ]", "}", "```", "", "## JSON-Render Data Structure Details", "", "Understanding the structure is crucial for generating valid UI:", "", "### Root Level Properties", "- `root`: String - ID of the root element (must exist in elements)", "- `elements`: Object - Contains all UI elements indexed by their IDs", "- `data`: Object - Optional data model for form bindings and dynamic content", "", "### Element Structure", "Each element in the `elements` object has:", "- `key`: String - Unique identifier (should match the object key)", "- `type`: String - Component type name (must be from available components)", "- `props`: Object - Component-specific properties", "- `children`: Array<String> - Optional array of child element IDs", "", "### Element Hierarchy Rules", "1. **Root Element**: Must be specified in `root` and exist in `elements`", "2. **Parent-Child Relationship**: Parent elements reference children by ID in `children` array", "3. **Child Order**: Order in `children` array determines rendering order", "4. **Unique IDs**: Each element must have a unique ID across the entire structure", '5. **Container Components**: Only components marked with "can have children" support `children`', "", "### Data Binding Paths", "Form components can bind to data using dot notation:", "- `\"valuePath\": \"user.name\"` \u2192 binds to `data.user.name`", "- `\"valuePath\": \"settings.theme\"` \u2192 binds to `data.settings.theme`", "- `\"disabledPath\": \"form.disabled\"` \u2192 controls disabled state from `data.form.disabled`", "", "### Element ID Best Practices", '- Use descriptive names: `"user_name_field"` instead of `"field1"`', "- Use consistent naming: `snake_case` or `kebab-case`", '- Include purpose: `"submit_button"`, `"main_container"`, `"status_card"`', "", "## Available Components", ""];
348
348
  for (var _i3 = 0, _Object$entries3 = Object.entries(allComponents); _i3 < _Object$entries3.length; _i3++) {
349
349
  var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
350
350
  name2 = _Object$entries3$_i[0],
@@ -384,36 +384,38 @@ function generateCatalogPrompt() {
384
384
  lines.push('- `"disabledPath": "formDisabled"` controls disabled state from `data.formDisabled`');
385
385
  lines.push("");
386
386
  if (includeExample) {
387
- lines.push("## Example");
387
+ lines.push("## Examples");
388
388
  lines.push("");
389
- lines.push("A simple form with two text fields and a submit button:");
389
+ lines.push("### 1. Simple Form Structure");
390
+ lines.push("A basic form with validation and data binding:");
390
391
  lines.push("```json");
391
392
  lines.push(JSON.stringify({
392
- root: "card1",
393
+ root: "main_card",
393
394
  elements: {
394
- card1: {
395
- key: "card1",
395
+ main_card: {
396
+ key: "main_card",
396
397
  type: "Card",
397
398
  props: {
398
- title: "User Information"
399
+ title: "User Registration",
400
+ bordered: true
399
401
  },
400
- children: ["form_column"]
402
+ children: ["form_layout"]
401
403
  },
402
- form_column: {
403
- key: "form_column",
404
+ form_layout: {
405
+ key: "form_layout",
404
406
  type: "Column",
405
407
  props: {
406
408
  gap: 16
407
409
  },
408
- children: ["name_field", "email_field", "button_row"]
410
+ children: ["name_field", "email_field", "button_group"]
409
411
  },
410
412
  name_field: {
411
413
  key: "name_field",
412
414
  type: "TextField",
413
415
  props: {
414
- label: "Name",
416
+ label: "Full Name",
415
417
  valuePath: "user.name",
416
- placeholder: "Enter your name",
418
+ placeholder: "Enter your full name",
417
419
  required: true
418
420
  }
419
421
  },
@@ -421,42 +423,43 @@ function generateCatalogPrompt() {
421
423
  key: "email_field",
422
424
  type: "TextField",
423
425
  props: {
424
- label: "Email",
426
+ label: "Email Address",
425
427
  valuePath: "user.email",
426
428
  placeholder: "Enter your email",
427
- type: "email"
429
+ type: "email",
430
+ required: true
428
431
  }
429
432
  },
430
- button_row: {
431
- key: "button_row",
433
+ button_group: {
434
+ key: "button_group",
432
435
  type: "Space",
433
436
  props: {
434
437
  direction: "horizontal",
435
438
  size: "medium"
436
439
  },
437
- children: ["submit_btn", "cancel_btn"]
440
+ children: ["submit_btn", "reset_btn"]
438
441
  },
439
442
  submit_btn: {
440
443
  key: "submit_btn",
441
444
  type: "Button",
442
445
  props: {
443
- children: "Submit",
446
+ children: "Register",
444
447
  theme: "primary",
445
448
  action: {
446
449
  name: "submit",
447
450
  params: {
448
- source: "form"
451
+ form: "registration"
449
452
  }
450
453
  }
451
454
  }
452
455
  },
453
- cancel_btn: {
454
- key: "cancel_btn",
456
+ reset_btn: {
457
+ key: "reset_btn",
455
458
  type: "Button",
456
459
  props: {
457
- children: "Cancel",
460
+ children: "Reset",
458
461
  variant: "outline",
459
- action: "cancel"
462
+ action: "reset"
460
463
  }
461
464
  }
462
465
  },
@@ -468,6 +471,180 @@ function generateCatalogPrompt() {
468
471
  }
469
472
  }, null, 2));
470
473
  lines.push("```");
474
+ lines.push("");
475
+ lines.push("### 2. Dashboard Layout");
476
+ lines.push("A more complex layout with grid system and multiple components:");
477
+ lines.push("```json");
478
+ lines.push(JSON.stringify({
479
+ root: "dashboard",
480
+ elements: {
481
+ dashboard: {
482
+ key: "dashboard",
483
+ type: "Column",
484
+ props: {
485
+ gap: 24
486
+ },
487
+ children: ["header", "content_row"]
488
+ },
489
+ header: {
490
+ key: "header",
491
+ type: "Card",
492
+ props: {
493
+ title: "Dashboard Overview"
494
+ },
495
+ children: ["status_text"]
496
+ },
497
+ status_text: {
498
+ key: "status_text",
499
+ type: "Text",
500
+ props: {
501
+ content: "System is running normally",
502
+ color: "success",
503
+ weight: "medium"
504
+ }
505
+ },
506
+ content_row: {
507
+ key: "content_row",
508
+ type: "Row",
509
+ props: {
510
+ gutter: 16
511
+ },
512
+ children: ["left_col", "right_col"]
513
+ },
514
+ left_col: {
515
+ key: "left_col",
516
+ type: "Col",
517
+ props: {
518
+ span: 16
519
+ },
520
+ children: ["main_content"]
521
+ },
522
+ right_col: {
523
+ key: "right_col",
524
+ type: "Col",
525
+ props: {
526
+ span: 8
527
+ },
528
+ children: ["sidebar_card"]
529
+ },
530
+ main_content: {
531
+ key: "main_content",
532
+ type: "Card",
533
+ props: {
534
+ title: "Main Content",
535
+ shadow: true
536
+ },
537
+ children: ["content_text"]
538
+ },
539
+ content_text: {
540
+ key: "content_text",
541
+ type: "Text",
542
+ props: {
543
+ content: "This is the main content area."
544
+ }
545
+ },
546
+ sidebar_card: {
547
+ key: "sidebar_card",
548
+ type: "Card",
549
+ props: {
550
+ title: "Quick Actions"
551
+ },
552
+ children: ["action_buttons"]
553
+ },
554
+ action_buttons: {
555
+ key: "action_buttons",
556
+ type: "Column",
557
+ props: {
558
+ gap: 8
559
+ },
560
+ children: ["refresh_btn", "export_btn"]
561
+ },
562
+ refresh_btn: {
563
+ key: "refresh_btn",
564
+ type: "Button",
565
+ props: {
566
+ children: "Refresh Data",
567
+ block: true,
568
+ action: "refresh"
569
+ }
570
+ },
571
+ export_btn: {
572
+ key: "export_btn",
573
+ type: "Button",
574
+ props: {
575
+ children: "Export Report",
576
+ variant: "outline",
577
+ block: true,
578
+ action: "export"
579
+ }
580
+ }
581
+ },
582
+ data: {
583
+ lastUpdated: new Date().toISOString()
584
+ }
585
+ }, null, 2));
586
+ lines.push("```");
587
+ lines.push("");
588
+ lines.push("### 3. Dynamic Content with Data Binding");
589
+ lines.push("Form with conditional disabled states:");
590
+ lines.push("```json");
591
+ lines.push(JSON.stringify({
592
+ root: "settings_form",
593
+ elements: {
594
+ settings_form: {
595
+ key: "settings_form",
596
+ type: "Card",
597
+ props: {
598
+ title: "Settings"
599
+ },
600
+ children: ["form_fields"]
601
+ },
602
+ form_fields: {
603
+ key: "form_fields",
604
+ type: "Column",
605
+ props: {
606
+ gap: 16
607
+ },
608
+ children: ["enable_notifications", "email_field", "save_btn"]
609
+ },
610
+ enable_notifications: {
611
+ key: "enable_notifications",
612
+ type: "TextField",
613
+ props: {
614
+ label: "Enable Notifications",
615
+ valuePath: "settings.notifications",
616
+ type: "text"
617
+ }
618
+ },
619
+ email_field: {
620
+ key: "email_field",
621
+ type: "TextField",
622
+ props: {
623
+ label: "Notification Email",
624
+ valuePath: "settings.email",
625
+ disabledPath: "settings.emailDisabled",
626
+ placeholder: "Enter email for notifications"
627
+ }
628
+ },
629
+ save_btn: {
630
+ key: "save_btn",
631
+ type: "Button",
632
+ props: {
633
+ children: "Save Settings",
634
+ theme: "primary",
635
+ action: "submit"
636
+ }
637
+ }
638
+ },
639
+ data: {
640
+ settings: {
641
+ notifications: "enabled",
642
+ email: "",
643
+ emailDisabled: false
644
+ }
645
+ }
646
+ }, null, 2));
647
+ lines.push("```");
471
648
  }
472
649
  return lines.join("\n");
473
650
  }
@@ -477,7 +654,7 @@ function generateA2UIPrompt(context) {
477
654
  actions = context.actions,
478
655
  _context$includeExamp = context.includeExample,
479
656
  includeExample = _context$includeExamp === void 0 ? true : _context$includeExamp;
480
- var lines = ["# ".concat(name, " A2UI Component Catalog"), "", "You can generate dynamic UI using A2UI protocol messages.", "", "## A2UI Message Types", "", "### createSurface", "Create a new UI surface with initial elements:", "```json", "{", ' "type": "createSurface",', ' "surfaceId": "unique_surface_id",', ' "ui": {', ' "root": "element_id",', ' "elements": { ... }', " },", ' "data": { ... }', "}", "```", "", "### updateComponents", "Update existing UI elements:", "```json", "{", ' "type": "updateComponents",', ' "surfaceId": "existing_surface_id",', ' "elements": { ... }', "}", "```", "", "### updateDataModel", "Update data model without changing UI:", "```json", "{", ' "type": "updateDataModel",', ' "surfaceId": "existing_surface_id",', ' "data": { ... }', "}", "```", "", "### deleteSurface", "Remove a UI surface:", "```json", "{", ' "type": "deleteSurface",', ' "surfaceId": "surface_to_delete"', "}", "```", "", "## Available Components", ""];
657
+ var lines = ["# ".concat(name, " A2UI Component Catalog"), "", "You can generate dynamic UI using A2UI protocol messages.", "", "## AG-UI ACTIVITY_DELTA Format", "", "When generating UI updates, use the AG-UI ACTIVITY_DELTA message format:", "```json", "{", ' "type": "ACTIVITY_DELTA",', ' "messageId": "unique_message_id",', ' "activityType": "json-render-main-card",', ' "patch": [', ' {"op": "add", "path": "/elements/element-id", "value": {...}},', ' {"op": "replace", "path": "/elements/parent/children", "value": [...]}', " ]", "}", "```", "", "## JSON Patch Operations for AG-UI ACTIVITY_DELTA", "", "The `patch` array contains JSON Patch operations that modify the UI structure:", "", "### Add New Element", "Create a new UI element in the elements object:", "```json", '{"op": "add", "path": "/elements/new-element-id", "value": {', ' "key": "new-element-id",', ' "type": "ComponentName",', ' "props": {...},', ' "children": ["child1", "child2"] // optional', "}}", "```", "", "### Update Element Properties", "Modify specific properties of an existing element:", "```json", '{"op": "replace", "path": "/elements/element-id/props/title", "value": "New Title"}', "```", "", "### Replace Children Array", "Update the children of a container element:", "```json", '{"op": "replace", "path": "/elements/parent-id/children", "value": ["child1", "child2", "new-child"]}', "```", "", "### Add Child to Parent", "Append a child to the end of parent's children array:", "```json", '{"op": "add", "path": "/elements/parent-id/children/-", "value": "new-child-id"}', "```", "", "### Remove Element", "Delete an element (ensure it's removed from parent's children first):", "```json", '{"op": "remove", "path": "/elements/element-id"}', "```", "", "### Update Data Model", "Modify the data model for form bindings:", "```json", '{"op": "replace", "path": "/data/user/name", "value": "John Doe"}', "```", "", "### Complete AG-UI ACTIVITY_DELTA Example", "Adding a status card and updating container children:", "```json", "{", ' "type": "ACTIVITY_DELTA",', ' "messageId": "update_1234567890",', ' "activityType": "json-render-main-card",', ' "patch": [', " {", ' "op": "add",', ' "path": "/elements/status-card",', ' "value": {', ' "key": "status-card",', ' "type": "Card",', ' "props": {', ' "title": "Status Update",', ' "description": "Operation completed successfully"', " }", " }", " },", " {", ' "op": "replace",', ' "path": "/elements/main-container/children",', ' "value": ["existing-element", "status-card"]', " }", " ]", "}", "```", "", "## A2UI Message Types (Alternative Formats)", "", "Besides AG-UI ACTIVITY_DELTA, A2UI also supports these message types:", "", "### createSurface", "Create a new UI surface with initial elements:", "```json", "{", ' "type": "createSurface",', ' "surfaceId": "unique_surface_id",', ' "ui": {', ' "root": "element_id",', ' "elements": { ... }', " },", ' "data": { ... }', "}", "```", "", "### updateComponents", "Update existing UI elements (similar to ACTIVITY_DELTA but different format):", "```json", "{", ' "type": "updateComponents",', ' "surfaceId": "existing_surface_id",', ' "patch": [', ' {"op": "add", "path": "/elements/new-element", "value": {...}}', " ]", "}", "```", "", "### updateDataModel", "Update data model without changing UI:", "```json", "{", ' "type": "updateDataModel",', ' "surfaceId": "existing_surface_id",', ' "data": { ... }', "}", "```", "", "### deleteSurface", "Remove a UI surface:", "```json", "{", ' "type": "deleteSurface",', ' "surfaceId": "surface_to_delete"', "}", "```", "", "## Available Components", ""];
481
658
  for (var _i6 = 0, _Object$entries6 = Object.entries(components); _i6 < _Object$entries6.length; _i6++) {
482
659
  var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
483
660
  compName = _Object$entries6$_i[0],
@@ -507,9 +684,9 @@ function generateA2UIPrompt(context) {
507
684
  }
508
685
  lines.push("");
509
686
  if (includeExample) {
510
- lines.push("## Example");
687
+ lines.push("## Examples");
511
688
  lines.push("");
512
- lines.push("Create a form surface:");
689
+ lines.push("### 1. Create a form surface:");
513
690
  lines.push("```json");
514
691
  lines.push(JSON.stringify({
515
692
  type: "createSurface",
@@ -551,6 +728,49 @@ function generateA2UIPrompt(context) {
551
728
  }
552
729
  }, null, 2));
553
730
  lines.push("```");
731
+ lines.push("");
732
+ lines.push("### 2. Update existing surface with JSON Patch:");
733
+ lines.push("Add a status card and update the form title:");
734
+ lines.push("```json");
735
+ lines.push(JSON.stringify({
736
+ type: "updateComponents",
737
+ surfaceId: "user_form_1",
738
+ patch: [{
739
+ op: "replace",
740
+ path: "/elements/form_card/props/title",
741
+ value: "Updated User Form"
742
+ }, {
743
+ op: "add",
744
+ path: "/elements/status_card",
745
+ value: {
746
+ key: "status_card",
747
+ type: "Card",
748
+ props: {
749
+ title: "Status",
750
+ description: "Form is ready for submission"
751
+ }
752
+ }
753
+ }, {
754
+ op: "add",
755
+ path: "/elements/form_card/children/0",
756
+ value: "status_card"
757
+ }]
758
+ }, null, 2));
759
+ lines.push("```");
760
+ lines.push("");
761
+ lines.push("### 3. Update data model:");
762
+ lines.push("```json");
763
+ lines.push(JSON.stringify({
764
+ type: "updateDataModel",
765
+ surfaceId: "user_form_1",
766
+ data: {
767
+ user: {
768
+ name: "John Doe"
769
+ },
770
+ formStatus: "ready"
771
+ }
772
+ }, null, 2));
773
+ lines.push("```");
554
774
  }
555
775
  return lines.join("\n");
556
776
  }