@adecore/agents-react 0.20.1 → 0.21.1

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 (113) hide show
  1. package/dist/chat/logic/generated-image.d.ts +27 -0
  2. package/dist/chat/logic/generated-image.js +32 -0
  3. package/dist/chat/logic/timeline-target.d.ts +13 -1
  4. package/dist/chat/logic/timeline-target.js +26 -0
  5. package/dist/chat/logic/timeline.js +16 -10
  6. package/dist/chat/subagent-conversation.d.ts +2 -1
  7. package/dist/chat/subagent-conversation.js +7 -1
  8. package/dist/chat/timeline-flash.d.ts +3 -1
  9. package/dist/chat/timeline-flash.js +2 -2
  10. package/dist/chat/ui/ImageView.d.ts +8 -2
  11. package/dist/chat/ui/ImageView.js +12 -6
  12. package/dist/chat/ui/SubagentTimeline.js +6 -2
  13. package/dist/chat/ui/Timeline.js +67 -7
  14. package/dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts +23 -0
  15. package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +103 -0
  16. package/dist/chat/ui/intelligent-ui/UiFallbackPart.d.ts +10 -0
  17. package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +11 -0
  18. package/dist/chat/ui/intelligent-ui/UiReply.d.ts +15 -0
  19. package/dist/chat/ui/intelligent-ui/UiReply.js +329 -0
  20. package/dist/chat/ui/intelligent-ui/block-local.d.ts +11 -0
  21. package/dist/chat/ui/intelligent-ui/block-local.js +42 -0
  22. package/dist/chat/ui/intelligent-ui/chart-data.d.ts +16 -0
  23. package/dist/chat/ui/intelligent-ui/chart-data.js +46 -0
  24. package/dist/chat/ui/intelligent-ui/node-text.d.ts +15 -0
  25. package/dist/chat/ui/intelligent-ui/node-text.js +106 -0
  26. package/dist/chat/ui/intelligent-ui/registry.d.ts +2 -0
  27. package/dist/chat/ui/intelligent-ui/registry.js +51 -0
  28. package/dist/chat/ui/intelligent-ui/render-context.d.ts +53 -0
  29. package/dist/chat/ui/intelligent-ui/render-context.js +3 -0
  30. package/dist/chat/ui/intelligent-ui/renderers/chart.d.ts +3 -0
  31. package/dist/chat/ui/intelligent-ui/renderers/chart.js +123 -0
  32. package/dist/chat/ui/intelligent-ui/renderers/choices.d.ts +4 -0
  33. package/dist/chat/ui/intelligent-ui/renderers/choices.js +45 -0
  34. package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +14 -0
  35. package/dist/chat/ui/intelligent-ui/renderers/content.js +59 -0
  36. package/dist/chat/ui/intelligent-ui/renderers/data.d.ts +7 -0
  37. package/dist/chat/ui/intelligent-ui/renderers/data.js +80 -0
  38. package/dist/chat/ui/intelligent-ui/renderers/inputs.d.ts +8 -0
  39. package/dist/chat/ui/intelligent-ui/renderers/inputs.js +72 -0
  40. package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +10 -0
  41. package/dist/chat/ui/intelligent-ui/renderers/links.js +87 -0
  42. package/dist/chat/ui/intelligent-ui/renderers/structure.d.ts +6 -0
  43. package/dist/chat/ui/intelligent-ui/renderers/structure.js +32 -0
  44. package/dist/chat/ui/intelligent-ui/renderers/text.d.ts +8 -0
  45. package/dist/chat/ui/intelligent-ui/renderers/text.js +61 -0
  46. package/dist/chat/ui/intelligent-ui/reply-parts.d.ts +9 -0
  47. package/dist/chat/ui/intelligent-ui/reply-parts.js +18 -0
  48. package/dist/chat/ui/intelligent-ui/table-data.d.ts +31 -0
  49. package/dist/chat/ui/intelligent-ui/table-data.js +79 -0
  50. package/dist/chat/ui/intelligent-ui/tones.d.ts +7 -0
  51. package/dist/chat/ui/intelligent-ui/tones.js +31 -0
  52. package/dist/chat/ui/intelligent-ui/use-later.d.ts +1 -0
  53. package/dist/chat/ui/intelligent-ui/use-later.js +16 -0
  54. package/dist/chat/ui/intelligent-ui/use-ui-links.d.ts +9 -0
  55. package/dist/chat/ui/intelligent-ui/use-ui-links.js +126 -0
  56. package/dist/chat/ui/intelligent-ui/use-ui-queries.d.ts +21 -0
  57. package/dist/chat/ui/intelligent-ui/use-ui-queries.js +272 -0
  58. package/dist/chat/ui/reply-context.d.ts +8 -0
  59. package/dist/chat/ui/reply-context.js +1 -0
  60. package/dist/chat/ui/rows/GeneratedImageRow.d.ts +5 -0
  61. package/dist/chat/ui/rows/GeneratedImageRow.js +121 -0
  62. package/dist/chat/ui/rows/MessageRows.js +21 -4
  63. package/dist/chat/ui/rows/Rows.js +4 -2
  64. package/dist/chat/ui/rows/SubagentRow.js +5 -0
  65. package/dist/chat/ui/rows/WorkRows.d.ts +4 -1
  66. package/dist/chat/ui/rows/WorkRows.js +4 -3
  67. package/dist/host.d.ts +11 -1
  68. package/dist/locales/en/agent-chat.json +101 -0
  69. package/dist/locales/nl/agent-chat.json +101 -0
  70. package/dist/state/chats.js +13 -0
  71. package/dist/theme.css +19 -0
  72. package/package.json +128 -7
  73. package/src/chat/logic/generated-image.ts +48 -0
  74. package/src/chat/logic/timeline-target.ts +41 -1
  75. package/src/chat/logic/timeline.ts +19 -10
  76. package/src/chat/subagent-conversation.ts +13 -2
  77. package/src/chat/timeline-flash.ts +5 -3
  78. package/src/chat/ui/ImageView.tsx +51 -8
  79. package/src/chat/ui/SubagentTimeline.tsx +24 -1
  80. package/src/chat/ui/Timeline.tsx +97 -21
  81. package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +219 -0
  82. package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +21 -0
  83. package/src/chat/ui/intelligent-ui/UiReply.tsx +541 -0
  84. package/src/chat/ui/intelligent-ui/block-local.ts +51 -0
  85. package/src/chat/ui/intelligent-ui/chart-data.ts +67 -0
  86. package/src/chat/ui/intelligent-ui/node-text.ts +119 -0
  87. package/src/chat/ui/intelligent-ui/registry.ts +53 -0
  88. package/src/chat/ui/intelligent-ui/render-context.ts +84 -0
  89. package/src/chat/ui/intelligent-ui/renderers/chart.tsx +319 -0
  90. package/src/chat/ui/intelligent-ui/renderers/choices.tsx +102 -0
  91. package/src/chat/ui/intelligent-ui/renderers/content.tsx +140 -0
  92. package/src/chat/ui/intelligent-ui/renderers/data.tsx +181 -0
  93. package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +144 -0
  94. package/src/chat/ui/intelligent-ui/renderers/links.tsx +158 -0
  95. package/src/chat/ui/intelligent-ui/renderers/structure.tsx +84 -0
  96. package/src/chat/ui/intelligent-ui/renderers/text.tsx +124 -0
  97. package/src/chat/ui/intelligent-ui/reply-parts.ts +22 -0
  98. package/src/chat/ui/intelligent-ui/table-data.ts +104 -0
  99. package/src/chat/ui/intelligent-ui/tones.ts +37 -0
  100. package/src/chat/ui/intelligent-ui/use-later.ts +17 -0
  101. package/src/chat/ui/intelligent-ui/use-ui-links.ts +143 -0
  102. package/src/chat/ui/intelligent-ui/use-ui-queries.ts +308 -0
  103. package/src/chat/ui/reply-context.ts +7 -0
  104. package/src/chat/ui/rows/GeneratedImageRow.tsx +244 -0
  105. package/src/chat/ui/rows/MessageRows.tsx +60 -4
  106. package/src/chat/ui/rows/Rows.tsx +4 -2
  107. package/src/chat/ui/rows/SubagentRow.tsx +5 -0
  108. package/src/chat/ui/rows/WorkRows.tsx +20 -5
  109. package/src/host.ts +27 -1
  110. package/src/locales/en/agent-chat.json +101 -0
  111. package/src/locales/nl/agent-chat.json +101 -0
  112. package/src/state/chats.ts +13 -0
  113. package/src/theme.css +19 -0
@@ -435,6 +435,25 @@
435
435
  "zoomOut": "Zoom out",
436
436
  "reset": "Reset"
437
437
  },
438
+ "generatedImage": {
439
+ "label": "Generated image",
440
+ "generating": "Generating image",
441
+ "failed": "Image generation failed",
442
+ "empty": "The image came back empty",
443
+ "notImage": "The result is not an image",
444
+ "tooLarge": "The image is larger than {{size}}",
445
+ "dimensions": "{{width}} × {{height}}",
446
+ "transparent": "transparent",
447
+ "actions": "Image actions",
448
+ "more": "More actions",
449
+ "copyPrompt": "Copy prompt",
450
+ "open": "Open",
451
+ "openLarge": "Open large",
452
+ "save": "Save to project…",
453
+ "saved": "Saved",
454
+ "savedTo": "Saved to <file>{{path}}</file>",
455
+ "renderFailed": "This image failed to render"
456
+ },
438
457
  "account": {
439
458
  "pill": "{{provider}} account {{account}}"
440
459
  },
@@ -460,5 +479,87 @@
460
479
  "code": {
461
480
  "actions": "Code actions",
462
481
  "copyFailed": "Could not copy the code. Try again."
482
+ },
483
+ "blocks": {
484
+ "label": "Interactive block",
485
+ "progress": {
486
+ "label": "Progress",
487
+ "of": "{{value}} of {{max}}"
488
+ },
489
+ "step": {
490
+ "done": "Done",
491
+ "running": "Running",
492
+ "pending": "Waiting",
493
+ "failed": "Failed",
494
+ "skipped": "Skipped"
495
+ },
496
+ "stat": {
497
+ "change": "{{change}} from {{previous}}",
498
+ "from": "from {{previous}}"
499
+ },
500
+ "table": {
501
+ "label": "Table of {{columns}}",
502
+ "showAll": "Show all {{total}} rows"
503
+ },
504
+ "chart": {
505
+ "values": "Values",
506
+ "summary": "{{count}} values, highest {{label}} at {{value}}",
507
+ "summarySeries": "{{count}} categories, highest {{series}} for {{label}} at {{value}}"
508
+ },
509
+ "image": {
510
+ "label": "Image",
511
+ "unavailable": "The image is not available"
512
+ },
513
+ "sources": "Sources",
514
+ "citation": "Source {{number}}: {{title}}",
515
+ "outsideProject": "Outside the project, shown as text",
516
+ "options": "Options",
517
+ "choices": "Choices",
518
+ "checklist": "Checklist",
519
+ "choice": {
520
+ "waiting": "Available when the reply is done",
521
+ "reading": "Available once the live data is read",
522
+ "unavailable": "Not available",
523
+ "sent": "Sent",
524
+ "queued": "Queued",
525
+ "failed": "Could not send. Try again.",
526
+ "ready": "Choices are ready"
527
+ },
528
+ "answered": "Answered with “{{label}}”",
529
+ "chose": "Chose “{{label}}”",
530
+ "choseOlder": "Chose “{{label}}” on the reply of {{time}}",
531
+ "fixes_one": "{{count}} fix",
532
+ "fixes_other": "{{count}} fixes",
533
+ "shownAsText": "Shown as text",
534
+ "unknownComponent": "This version cannot draw {{component}}",
535
+ "renderFailed": "Could not draw this part",
536
+ "unreadable": "The block could not be read",
537
+ "live": {
538
+ "label": "Live",
539
+ "read": "read {{time}}",
540
+ "sources": "Reads {{sources}}",
541
+ "failed": "Could not read {{source}}",
542
+ "refused": "Not allowed to read {{source}}",
543
+ "notRead": "Not read",
544
+ "reasons": {
545
+ "access-unavailable": "The access of the chat that wrote this is no longer available.",
546
+ "block-stale": "This block changed since it was drawn.",
547
+ "busy": "Too many live blocks are reading right now.",
548
+ "link-unchecked": "This link has to be checked again.",
549
+ "link-unsupported": "This is not a link the machine can open.",
550
+ "links-unsupported": "The machine does not open links from blocks.",
551
+ "no-unique-match": "The source found no single match for that name.",
552
+ "outside-project": "This is outside the project the agent wrote this in.",
553
+ "query-undeclared": "This block does not read that source.",
554
+ "refresh-limit": "This source reads at most once every ten seconds.",
555
+ "result-too-large": "What the source returned is too large.",
556
+ "snapshot-too-large": "The first readings were too large to keep.",
557
+ "source-unregistered": "The machine does not know this source.",
558
+ "stale-read": "Read the source again before you choose.",
559
+ "target-unavailable": "What this points to is no longer available.",
560
+ "timed-out": "The source took too long to answer.",
561
+ "unreadable": "The source could not be read."
562
+ }
563
+ }
463
564
  }
464
565
  }
@@ -435,6 +435,25 @@
435
435
  "zoomOut": "Uitzoomen",
436
436
  "reset": "Herstellen"
437
437
  },
438
+ "generatedImage": {
439
+ "label": "Gegenereerde afbeelding",
440
+ "generating": "Afbeelding wordt gemaakt",
441
+ "failed": "Afbeelding maken mislukt",
442
+ "empty": "De afbeelding kwam leeg terug",
443
+ "notImage": "Het resultaat is geen afbeelding",
444
+ "tooLarge": "De afbeelding is groter dan {{size}}",
445
+ "dimensions": "{{width}} × {{height}}",
446
+ "transparent": "transparant",
447
+ "actions": "Acties voor de afbeelding",
448
+ "more": "Meer acties",
449
+ "copyPrompt": "Prompt kopiëren",
450
+ "open": "Openen",
451
+ "openLarge": "Groot openen",
452
+ "save": "Opslaan in project…",
453
+ "saved": "Opgeslagen",
454
+ "savedTo": "Opgeslagen in <file>{{path}}</file>",
455
+ "renderFailed": "Deze afbeelding kon niet worden getoond"
456
+ },
438
457
  "account": {
439
458
  "pill": "{{provider}}-account {{account}}"
440
459
  },
@@ -460,5 +479,87 @@
460
479
  "code": {
461
480
  "actions": "Codeacties",
462
481
  "copyFailed": "De code kon niet worden gekopieerd. Probeer het opnieuw."
482
+ },
483
+ "blocks": {
484
+ "label": "Interactief blok",
485
+ "progress": {
486
+ "label": "Voortgang",
487
+ "of": "{{value}} van {{max}}"
488
+ },
489
+ "step": {
490
+ "done": "Klaar",
491
+ "running": "Bezig",
492
+ "pending": "Wacht",
493
+ "failed": "Mislukt",
494
+ "skipped": "Overgeslagen"
495
+ },
496
+ "stat": {
497
+ "change": "{{change}} vanaf {{previous}}",
498
+ "from": "vanaf {{previous}}"
499
+ },
500
+ "table": {
501
+ "label": "Tabel van {{columns}}",
502
+ "showAll": "Alle {{total}} rijen tonen"
503
+ },
504
+ "chart": {
505
+ "values": "Waarden",
506
+ "summary": "{{count}} waarden, hoogste {{label}} met {{value}}",
507
+ "summarySeries": "{{count}} categorieën, hoogste {{series}} bij {{label}} met {{value}}"
508
+ },
509
+ "image": {
510
+ "label": "Afbeelding",
511
+ "unavailable": "De afbeelding is niet beschikbaar"
512
+ },
513
+ "sources": "Bronnen",
514
+ "citation": "Bron {{number}}: {{title}}",
515
+ "outsideProject": "Buiten het project, als tekst getoond",
516
+ "options": "Opties",
517
+ "choices": "Keuzes",
518
+ "checklist": "Checklijst",
519
+ "choice": {
520
+ "waiting": "Beschikbaar zodra het antwoord klaar is",
521
+ "reading": "Beschikbaar zodra de live gegevens gelezen zijn",
522
+ "unavailable": "Niet beschikbaar",
523
+ "sent": "Verstuurd",
524
+ "queued": "In de wachtrij",
525
+ "failed": "Versturen lukte niet. Probeer het opnieuw.",
526
+ "ready": "De keuzes staan klaar"
527
+ },
528
+ "answered": "Beantwoord met “{{label}}”",
529
+ "chose": "Gekozen: “{{label}}”",
530
+ "choseOlder": "Gekozen: “{{label}}”, bij het antwoord van {{time}}",
531
+ "fixes_one": "{{count}} correctie",
532
+ "fixes_other": "{{count}} correcties",
533
+ "shownAsText": "Als tekst getoond",
534
+ "unknownComponent": "Deze versie kan {{component}} niet tekenen",
535
+ "renderFailed": "Dit deel kon niet getekend worden",
536
+ "unreadable": "Het blok kon niet gelezen worden",
537
+ "live": {
538
+ "label": "Live",
539
+ "read": "gelezen {{time}}",
540
+ "sources": "Leest {{sources}}",
541
+ "failed": "{{source}} lezen lukte niet",
542
+ "refused": "Geen toegang tot {{source}}",
543
+ "notRead": "Niet gelezen",
544
+ "reasons": {
545
+ "access-unavailable": "De toegang van de chat die dit schreef is niet meer beschikbaar.",
546
+ "block-stale": "Dit blok is veranderd sinds het getekend werd.",
547
+ "busy": "Er lezen nu te veel live blokken tegelijk.",
548
+ "link-unchecked": "Deze link moet opnieuw gecontroleerd worden.",
549
+ "link-unsupported": "Dit is geen link die de machine kan openen.",
550
+ "links-unsupported": "De machine opent geen links uit blokken.",
551
+ "no-unique-match": "De bron vond voor die naam niet precies één overeenkomst.",
552
+ "outside-project": "Dit valt buiten het project waarin de agent dit schreef.",
553
+ "query-undeclared": "Dit blok leest die bron niet.",
554
+ "refresh-limit": "Deze bron leest hooguit eens per tien seconden.",
555
+ "result-too-large": "Wat de bron teruggaf is te groot.",
556
+ "snapshot-too-large": "De eerste metingen waren te groot om te bewaren.",
557
+ "source-unregistered": "De machine kent deze bron niet.",
558
+ "stale-read": "Lees de bron opnieuw voordat je kiest.",
559
+ "target-unavailable": "Waar dit naar verwijst is niet meer beschikbaar.",
560
+ "timed-out": "De bron deed er te lang over om te antwoorden.",
561
+ "unreadable": "De bron kon niet gelezen worden."
562
+ }
563
+ }
463
564
  }
464
565
  }
@@ -79,6 +79,19 @@ export function applyEvent(state, event) {
79
79
  }
80
80
  case 'delta': {
81
81
  const item = state.items[event.itemId];
82
+ if (event.uiQueries && item?.kind === 'assistant') {
83
+ // The text first, as the daemon's thread applies it, then the metadata on what it grew into.
84
+ const { uiQueries, ...text } = event;
85
+ const grown = event.text === '' ? state : applyEvent(state, text);
86
+ const reply = grown.items[event.itemId] ?? item;
87
+ return { ...grown, items: { ...grown.items, [event.itemId]: { ...reply, uiQueries } } };
88
+ }
89
+ if (event.ui !== undefined && event.text === '') {
90
+ if (item?.kind === 'assistant' && item.streaming && event.textLength === item.text.length) {
91
+ return { ...state, items: { ...state.items, [event.itemId]: { ...item, ui: event.ui } } };
92
+ }
93
+ return state;
94
+ }
82
95
  if (item?.kind === 'assistant' || item?.kind === 'thinking') {
83
96
  const grown = { ...item, text: item.text + event.text };
84
97
  // The first text is structure after all, since an empty reply that is not streaming has no row.
package/dist/theme.css CHANGED
@@ -117,6 +117,11 @@
117
117
  }
118
118
  @keyframes chat-shine { from { background-position: 200% 0; } to { background-position: -200% 0; } }
119
119
 
120
+ /* What shows through a transparent image: a checkerboard of two grounds, so its edges read in both themes. */
121
+ .chat-checkerboard {
122
+ background: repeating-conic-gradient(var(--surface-sunken) 0 25%, var(--surface-raised) 0 50%) 0 0 / 16px 16px;
123
+ }
124
+
120
125
  /* A word of a reply that just arrived. The duration is REVEAL_FADE_MS in chat/ui/reveal.ts, which
121
126
  keeps the spans until it is over; ease-in-out, because ease-out jumps up and then trails. */
122
127
  .chat-fade { animation: chat-fade 300ms ease-in-out both; }
@@ -129,6 +134,20 @@
129
134
  @starting-style { opacity: 0; }
130
135
  }
131
136
  @keyframes chat-fade { from { opacity: 0; } to { opacity: 1; } }
137
+ /* A node of an intelligent UI block that lands inside another, such as a step or a row: 160ms like
138
+ the card's own children, but only a fade, so a parent arriving with its children rises once. */
139
+ .chat-ui-nodes > * {
140
+ transition: opacity 160ms ease-out;
141
+ @starting-style { opacity: 0; }
142
+ }
143
+ /* A value a live reading changed lights up in the accent once and settles back in 800ms. */
144
+ .chat-ui-changed { animation: chat-ui-changed 800ms ease-out; }
145
+ @keyframes chat-ui-changed { from { color: var(--accent); } }
146
+ @media (prefers-reduced-motion: reduce) {
147
+ .chat-ui-changed { animation: none; }
148
+ }
149
+ /* A source row a citation revealed. The row only takes focus from code, since its own button takes a click. */
150
+ .chat-ui-source:focus { animation: chat-flash 1600ms ease-out both; }
132
151
  /* A visual still on its way says so only once it takes long enough to be noticed. */
133
152
  .chat-visual-wait { animation: chat-fade 200ms ease-out 600ms both; }
134
153
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.20.1",
3
+ "version": "0.21.1",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -129,6 +129,11 @@
129
129
  "types": "./dist/chat/logic/fork.d.ts",
130
130
  "default": "./dist/chat/logic/fork.js"
131
131
  },
132
+ "./chat/logic/generated-image": {
133
+ "source": "./src/chat/logic/generated-image.ts",
134
+ "types": "./dist/chat/logic/generated-image.d.ts",
135
+ "default": "./dist/chat/logic/generated-image.js"
136
+ },
132
137
  "./chat/logic/handback": {
133
138
  "source": "./src/chat/logic/handback.ts",
134
139
  "types": "./dist/chat/logic/handback.d.ts",
@@ -514,6 +519,116 @@
514
519
  "types": "./dist/chat/ui/icons.d.ts",
515
520
  "default": "./dist/chat/ui/icons.js"
516
521
  },
522
+ "./chat/ui/intelligent-ui/UiBlockFrame": {
523
+ "source": "./src/chat/ui/intelligent-ui/UiBlockFrame.tsx",
524
+ "types": "./dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts",
525
+ "default": "./dist/chat/ui/intelligent-ui/UiBlockFrame.js"
526
+ },
527
+ "./chat/ui/intelligent-ui/UiFallbackPart": {
528
+ "source": "./src/chat/ui/intelligent-ui/UiFallbackPart.tsx",
529
+ "types": "./dist/chat/ui/intelligent-ui/UiFallbackPart.d.ts",
530
+ "default": "./dist/chat/ui/intelligent-ui/UiFallbackPart.js"
531
+ },
532
+ "./chat/ui/intelligent-ui/UiReply": {
533
+ "source": "./src/chat/ui/intelligent-ui/UiReply.tsx",
534
+ "types": "./dist/chat/ui/intelligent-ui/UiReply.d.ts",
535
+ "default": "./dist/chat/ui/intelligent-ui/UiReply.js"
536
+ },
537
+ "./chat/ui/intelligent-ui/block-local": {
538
+ "source": "./src/chat/ui/intelligent-ui/block-local.ts",
539
+ "types": "./dist/chat/ui/intelligent-ui/block-local.d.ts",
540
+ "default": "./dist/chat/ui/intelligent-ui/block-local.js"
541
+ },
542
+ "./chat/ui/intelligent-ui/chart-data": {
543
+ "source": "./src/chat/ui/intelligent-ui/chart-data.ts",
544
+ "types": "./dist/chat/ui/intelligent-ui/chart-data.d.ts",
545
+ "default": "./dist/chat/ui/intelligent-ui/chart-data.js"
546
+ },
547
+ "./chat/ui/intelligent-ui/node-text": {
548
+ "source": "./src/chat/ui/intelligent-ui/node-text.ts",
549
+ "types": "./dist/chat/ui/intelligent-ui/node-text.d.ts",
550
+ "default": "./dist/chat/ui/intelligent-ui/node-text.js"
551
+ },
552
+ "./chat/ui/intelligent-ui/registry": {
553
+ "source": "./src/chat/ui/intelligent-ui/registry.ts",
554
+ "types": "./dist/chat/ui/intelligent-ui/registry.d.ts",
555
+ "default": "./dist/chat/ui/intelligent-ui/registry.js"
556
+ },
557
+ "./chat/ui/intelligent-ui/render-context": {
558
+ "source": "./src/chat/ui/intelligent-ui/render-context.ts",
559
+ "types": "./dist/chat/ui/intelligent-ui/render-context.d.ts",
560
+ "default": "./dist/chat/ui/intelligent-ui/render-context.js"
561
+ },
562
+ "./chat/ui/intelligent-ui/renderers/chart": {
563
+ "source": "./src/chat/ui/intelligent-ui/renderers/chart.tsx",
564
+ "types": "./dist/chat/ui/intelligent-ui/renderers/chart.d.ts",
565
+ "default": "./dist/chat/ui/intelligent-ui/renderers/chart.js"
566
+ },
567
+ "./chat/ui/intelligent-ui/renderers/choices": {
568
+ "source": "./src/chat/ui/intelligent-ui/renderers/choices.tsx",
569
+ "types": "./dist/chat/ui/intelligent-ui/renderers/choices.d.ts",
570
+ "default": "./dist/chat/ui/intelligent-ui/renderers/choices.js"
571
+ },
572
+ "./chat/ui/intelligent-ui/renderers/content": {
573
+ "source": "./src/chat/ui/intelligent-ui/renderers/content.tsx",
574
+ "types": "./dist/chat/ui/intelligent-ui/renderers/content.d.ts",
575
+ "default": "./dist/chat/ui/intelligent-ui/renderers/content.js"
576
+ },
577
+ "./chat/ui/intelligent-ui/renderers/data": {
578
+ "source": "./src/chat/ui/intelligent-ui/renderers/data.tsx",
579
+ "types": "./dist/chat/ui/intelligent-ui/renderers/data.d.ts",
580
+ "default": "./dist/chat/ui/intelligent-ui/renderers/data.js"
581
+ },
582
+ "./chat/ui/intelligent-ui/renderers/inputs": {
583
+ "source": "./src/chat/ui/intelligent-ui/renderers/inputs.tsx",
584
+ "types": "./dist/chat/ui/intelligent-ui/renderers/inputs.d.ts",
585
+ "default": "./dist/chat/ui/intelligent-ui/renderers/inputs.js"
586
+ },
587
+ "./chat/ui/intelligent-ui/renderers/links": {
588
+ "source": "./src/chat/ui/intelligent-ui/renderers/links.tsx",
589
+ "types": "./dist/chat/ui/intelligent-ui/renderers/links.d.ts",
590
+ "default": "./dist/chat/ui/intelligent-ui/renderers/links.js"
591
+ },
592
+ "./chat/ui/intelligent-ui/renderers/structure": {
593
+ "source": "./src/chat/ui/intelligent-ui/renderers/structure.tsx",
594
+ "types": "./dist/chat/ui/intelligent-ui/renderers/structure.d.ts",
595
+ "default": "./dist/chat/ui/intelligent-ui/renderers/structure.js"
596
+ },
597
+ "./chat/ui/intelligent-ui/renderers/text": {
598
+ "source": "./src/chat/ui/intelligent-ui/renderers/text.tsx",
599
+ "types": "./dist/chat/ui/intelligent-ui/renderers/text.d.ts",
600
+ "default": "./dist/chat/ui/intelligent-ui/renderers/text.js"
601
+ },
602
+ "./chat/ui/intelligent-ui/reply-parts": {
603
+ "source": "./src/chat/ui/intelligent-ui/reply-parts.ts",
604
+ "types": "./dist/chat/ui/intelligent-ui/reply-parts.d.ts",
605
+ "default": "./dist/chat/ui/intelligent-ui/reply-parts.js"
606
+ },
607
+ "./chat/ui/intelligent-ui/table-data": {
608
+ "source": "./src/chat/ui/intelligent-ui/table-data.ts",
609
+ "types": "./dist/chat/ui/intelligent-ui/table-data.d.ts",
610
+ "default": "./dist/chat/ui/intelligent-ui/table-data.js"
611
+ },
612
+ "./chat/ui/intelligent-ui/tones": {
613
+ "source": "./src/chat/ui/intelligent-ui/tones.ts",
614
+ "types": "./dist/chat/ui/intelligent-ui/tones.d.ts",
615
+ "default": "./dist/chat/ui/intelligent-ui/tones.js"
616
+ },
617
+ "./chat/ui/intelligent-ui/use-later": {
618
+ "source": "./src/chat/ui/intelligent-ui/use-later.ts",
619
+ "types": "./dist/chat/ui/intelligent-ui/use-later.d.ts",
620
+ "default": "./dist/chat/ui/intelligent-ui/use-later.js"
621
+ },
622
+ "./chat/ui/intelligent-ui/use-ui-links": {
623
+ "source": "./src/chat/ui/intelligent-ui/use-ui-links.ts",
624
+ "types": "./dist/chat/ui/intelligent-ui/use-ui-links.d.ts",
625
+ "default": "./dist/chat/ui/intelligent-ui/use-ui-links.js"
626
+ },
627
+ "./chat/ui/intelligent-ui/use-ui-queries": {
628
+ "source": "./src/chat/ui/intelligent-ui/use-ui-queries.ts",
629
+ "types": "./dist/chat/ui/intelligent-ui/use-ui-queries.d.ts",
630
+ "default": "./dist/chat/ui/intelligent-ui/use-ui-queries.js"
631
+ },
517
632
  "./chat/ui/markdown-blocks": {
518
633
  "source": "./src/chat/ui/markdown-blocks.ts",
519
634
  "types": "./dist/chat/ui/markdown-blocks.d.ts",
@@ -554,6 +669,11 @@
554
669
  "types": "./dist/chat/ui/rows/ForksRow.d.ts",
555
670
  "default": "./dist/chat/ui/rows/ForksRow.js"
556
671
  },
672
+ "./chat/ui/rows/GeneratedImageRow": {
673
+ "source": "./src/chat/ui/rows/GeneratedImageRow.tsx",
674
+ "types": "./dist/chat/ui/rows/GeneratedImageRow.d.ts",
675
+ "default": "./dist/chat/ui/rows/GeneratedImageRow.js"
676
+ },
557
677
  "./chat/ui/rows/MessageRows": {
558
678
  "source": "./src/chat/ui/rows/MessageRows.tsx",
559
679
  "types": "./dist/chat/ui/rows/MessageRows.d.ts",
@@ -891,6 +1011,8 @@
891
1011
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
892
1012
  },
893
1013
  "dependencies": {
1014
+ "@adecore/agent-contracts": "0.21.1",
1015
+ "@adecore/intelligent-ui": "0.21.1",
894
1016
  "@codemirror/commands": "^6.11.1",
895
1017
  "@codemirror/language": "^6.12.4",
896
1018
  "@codemirror/state": "^6.7.6",
@@ -899,7 +1021,6 @@
899
1021
  "@lezer/highlight": "^1.2.3",
900
1022
  "@lezer/markdown": "^1.7.2",
901
1023
  "@pierre/diffs": "^1.4.3",
902
- "@adecore/agent-contracts": "0.20.1",
903
1024
  "@tanstack/react-virtual": "^3.14.13",
904
1025
  "clsx": "^2.1.1",
905
1026
  "lucide-react": "^1.47.0",
@@ -912,7 +1033,7 @@
912
1033
  "zustand": "^5.0.15"
913
1034
  },
914
1035
  "peerDependencies": {
915
- "@adecore/ui": "^0.20.1",
1036
+ "@adecore/ui": "^0.21.1",
916
1037
  "i18next": "^26.4.2",
917
1038
  "react": "^19.3.0",
918
1039
  "react-dom": "^19.3.0",
@@ -920,14 +1041,14 @@
920
1041
  },
921
1042
  "devDependencies": {
922
1043
  "@adecore/ui": "workspace:*",
923
- "i18next": "^26.4.2",
924
- "react": "^19.3.0",
925
- "react-dom": "^19.3.0",
926
- "react-i18next": "^17.0.15",
927
1044
  "@types/bun": "^1.4.2",
928
1045
  "@types/react": "^19.3.0",
929
1046
  "@types/react-dom": "^19.3.0",
1047
+ "i18next": "^26.4.2",
930
1048
  "linkedom": "^0.18.13",
1049
+ "react": "^19.3.0",
1050
+ "react-dom": "^19.3.0",
1051
+ "react-i18next": "^17.0.15",
931
1052
  "typescript": "^7.0.2"
932
1053
  },
933
1054
  "license": "FSL-1.1-MIT",
@@ -0,0 +1,48 @@
1
+ import { CHAT_ATTACHMENT_MAX_BYTES, GeneratedImageInputSchema, type ChatAttachment, type ChatToolItem } from '@adecore/agent-contracts';
2
+
3
+ export const IMAGE_GENERATION_TOOL = 'ImageGeneration';
4
+
5
+ /* Why a generation shows no image: the provider's own words, or a check of what came back. */
6
+ export type GeneratedImageFailure =
7
+ | { kind: 'provider'; message: string | null }
8
+ | { kind: 'empty' }
9
+ | { kind: 'not-image' }
10
+ | { kind: 'too-large'; limit: number };
11
+
12
+ export type GeneratedImageView =
13
+ | { state: 'generating' }
14
+ | { state: 'failed'; failure: GeneratedImageFailure }
15
+ | { state: 'ready'; attachment: ChatAttachment; prompt: string | null; transparent: boolean };
16
+
17
+ export function isImageGeneration(tool: ChatToolItem): boolean {
18
+ return tool.name === IMAGE_GENERATION_TOOL;
19
+ }
20
+
21
+ /* What the row of an image generation draws, from the tool call alone. */
22
+ export function generatedImageView(tool: ChatToolItem): GeneratedImageView {
23
+ if (tool.state === 'running') {
24
+ return { state: 'generating' };
25
+ }
26
+ const parsed = GeneratedImageInputSchema.safeParse(tool.input);
27
+ const input = parsed.success ? parsed.data : {};
28
+ const output = tool.output?.trim() || null;
29
+ if (tool.state === 'error' || input.attachment === undefined) {
30
+ return { state: 'failed', failure: output === null && tool.state !== 'error' ? { kind: 'empty' } : { kind: 'provider', message: output } };
31
+ }
32
+ const attachment = input.attachment;
33
+ if (attachment.size === 0) {
34
+ return { state: 'failed', failure: { kind: 'empty' } };
35
+ }
36
+ if (!attachment.mime.startsWith('image/')) {
37
+ return { state: 'failed', failure: { kind: 'not-image' } };
38
+ }
39
+ if (attachment.size > CHAT_ATTACHMENT_MAX_BYTES) {
40
+ return { state: 'failed', failure: { kind: 'too-large', limit: CHAT_ATTACHMENT_MAX_BYTES } };
41
+ }
42
+ return { state: 'ready', attachment, prompt: input.revisedPrompt?.trim() || null, transparent: input.transparentBackground === true };
43
+ }
44
+
45
+ /* Width over height, when the attachment carries both. */
46
+ export function attachmentAspect(attachment: ChatAttachment): number | undefined {
47
+ return attachment.width !== undefined && attachment.height !== undefined ? attachment.width / attachment.height : undefined;
48
+ }
@@ -1,4 +1,4 @@
1
- import type { ChatItem } from '@adecore/agent-contracts';
1
+ import type { ChatItem, ChatUiChoiceOrigin } from '@adecore/agent-contracts';
2
2
  import type { TimelineRow } from './timeline';
3
3
  import { selectionWithin } from '@adecore/ui';
4
4
  import type { FileRef } from '../../host';
@@ -75,3 +75,43 @@ function positiveInteger(value: string | undefined): number | null {
75
75
  const number = Number(value);
76
76
  return Number.isSafeInteger(number) && number > 0 ? number : null;
77
77
  }
78
+
79
+ export type UiReplyTarget = Pick<ChatUiChoiceOrigin, 'itemId' | 'blockId' | 'revision'>;
80
+ export type UiReplyJump = { kind: 'missing' | 'earlier' } | { kind: 'turn'; turnId: string } | { kind: 'row'; index: number };
81
+
82
+ export function uiReplyJump(
83
+ target: UiReplyTarget,
84
+ rows: readonly TimelineRow[],
85
+ items: Record<string, ChatItem> | undefined,
86
+ expandedTurns: ReadonlySet<string>,
87
+ hasEarlier: boolean
88
+ ): UiReplyJump {
89
+ const item = items?.[target.itemId];
90
+ if (!item) {
91
+ return { kind: hasEarlier ? 'earlier' : 'missing' };
92
+ }
93
+ if (item.kind !== 'assistant' || !item.ui?.some((block) => block.id === target.blockId && block.revision === target.revision)) {
94
+ return { kind: 'missing' };
95
+ }
96
+ const index = rows.findIndex((row) => row.kind === 'assistant' && row.id === target.itemId);
97
+ if (index !== -1) {
98
+ return { kind: 'row', index };
99
+ }
100
+ return item.turnId && !expandedTurns.has(item.turnId) ? { kind: 'turn', turnId: item.turnId } : { kind: 'missing' };
101
+ }
102
+
103
+ export function revealUiReplyBlock(scroller: HTMLElement, target: UiReplyTarget): boolean {
104
+ // Compare attributes instead of interpolating provider ids into CSS selectors.
105
+ const row = Array.from(scroller.querySelectorAll<HTMLElement>('[data-item-id]')).find((element) => element.dataset.itemId === target.itemId);
106
+ const block =
107
+ row &&
108
+ Array.from(row.querySelectorAll<HTMLElement>('[data-ui-block]')).find(
109
+ (element) => element.dataset.uiBlock === target.blockId && element.dataset.uiRevision === target.revision
110
+ );
111
+ if (!block) {
112
+ return false;
113
+ }
114
+ scroller.scrollTop += block.getBoundingClientRect().top - scroller.getBoundingClientRect().top;
115
+ block.focus({ preventScroll: true });
116
+ return true;
117
+ }
@@ -16,6 +16,7 @@ import type {
16
16
  import { abortedByMachine } from '@adecore/agent-contracts';
17
17
  import type { ThreadCard } from '../../host';
18
18
  import { formatElapsedShort } from '@adecore/ui/format';
19
+ import { isImageGeneration } from './generated-image';
19
20
  import { handbackReportOf } from './handback';
20
21
  import { toolEntry } from './tool-catalog';
21
22
  import { hasFileChanges, isFileChange } from './tools';
@@ -77,7 +78,7 @@ interface TimelineOptions {
77
78
  const BLOCK_KINDS = new Set<TimelineRow['kind']>(['assistant', 'report', 'thinking', 'changed-files', 'compaction', 'app-card', 'visual']);
78
79
 
79
80
  export function isBlock(row: TimelineRow): boolean {
80
- return BLOCK_KINDS.has(row.kind);
81
+ return BLOCK_KINDS.has(row.kind) || isImageRow(row);
81
82
  }
82
83
 
83
84
  /* "Read 4 files", "Ran 2 commands", or "12 tool calls" when the run mixes kinds. */
@@ -245,6 +246,10 @@ function flushTools(buffer: ChatToolItem[], rows: TimelineRow[], options: Timeli
245
246
  }
246
247
  }
247
248
 
249
+ function isImageRow(row: TimelineRow): boolean {
250
+ return (row.kind === 'work' || row.kind === 'work-live') && isImageGeneration(row.tool);
251
+ }
252
+
248
253
  /* Rows for a run of items, in order, with tool runs folded and a subagent's work under its own row. */
249
254
  function rowsForItems(items: ChatItem[], options: TimelineOptions, children: Map<string, ChatItem[]>): TimelineRow[] {
250
255
  const rows: TimelineRow[] = [];
@@ -259,6 +264,11 @@ function rowsForItems(items: ChatItem[], options: TimelineOptions, children: Map
259
264
  rows.push({ kind: 'workflow', id: item.id, tool: item, workflow: item.workflow });
260
265
  continue;
261
266
  }
267
+ if (item.kind === 'tool' && isImageGeneration(item)) {
268
+ flushTools(tools, rows, options);
269
+ rows.push({ kind: item.state === 'running' ? 'work-live' : 'work', id: item.id, tool: item });
270
+ continue;
271
+ }
262
272
  if (item.kind === 'tool' && report === null) {
263
273
  tools.push(item);
264
274
  continue;
@@ -328,7 +338,7 @@ function lastAssistantRow(rows: TimelineRow[]): TimelineRow | null {
328
338
  if (row.kind === 'assistant') {
329
339
  return row;
330
340
  }
331
- if (row.kind !== 'note') {
341
+ if (row.kind !== 'note' && !isImageRow(row)) {
332
342
  return null;
333
343
  }
334
344
  }
@@ -389,12 +399,14 @@ export function deriveTimelineRows(items: ChatItem[], options: TimelineOptions):
389
399
  // The closing answer stays visible; the work after the last input folds behind the label.
390
400
  const finalAssistant = lastAssistantRow(work);
391
401
  const before = finalAssistant ? work.slice(0, work.indexOf(finalAssistant)) : work;
392
- // A workflow runs on past the turn that launched it, so its row stays in sight until it ends.
393
- const standing = before.filter((row) => row.kind === 'workflow' && row.tool.state === 'running');
402
+ // Images remain a turn's visible result, and a workflow may still be running after its turn ends.
403
+ const standing = before.filter((row) => isImageRow(row) || (row.kind === 'workflow' && row.tool.state === 'running'));
394
404
  const folded = before.filter((row) => !standing.includes(row));
395
405
  const expanded = options.expandedTurns.has(turnId);
396
406
  if (folded.length > 0) {
397
- const tools = rest.filter((item): item is ChatToolItem => item.kind === 'tool' && parentOf(item) === null && handbackReportOf(item) === null);
407
+ const tools = rest.filter(
408
+ (item): item is ChatToolItem => item.kind === 'tool' && parentOf(item) === null && handbackReportOf(item) === null && !isImageGeneration(item)
409
+ );
398
410
  rows.push({
399
411
  kind: 'turn-fold',
400
412
  id: `fold-${turnId}`,
@@ -404,17 +416,14 @@ export function deriveTimelineRows(items: ChatItem[], options: TimelineOptions):
404
416
  hiddenCount: folded.length,
405
417
  expanded
406
418
  });
407
- if (expanded) {
408
- rows.push(...folded);
409
- }
410
419
  }
411
- rows.push(...standing);
420
+ rows.push(...(expanded ? before : standing));
412
421
  const changed = changedFilesRow(turn, conversation);
413
422
  if (changed) {
414
423
  rows.push(changed);
415
424
  }
416
425
  if (finalAssistant) {
417
- rows.push(finalAssistant);
426
+ rows.push(...work.slice(work.indexOf(finalAssistant)));
418
427
  }
419
428
  if (options.forkedTurns?.has(turnId) === true) {
420
429
  rows.push({ kind: 'forks', id: `forks-${turnId}`, turnId });