Repository navigation
Commit 1cf8060
authored
refactor(agui): delimit the outbound message id and its suffix (#4554)
## Summary
This is an optimization of the outbound message ID format, not a bug
fix. `AguiMessageConverter.toAguiMessages` builds the ID of an outbound
AG-UI message as `agui::<sourceId>-<UUID>`. That format is usable: a
reader who knows that the suffix is a UUID can strip it by its length.
It is simply less reliable to depend on in the long run. The separator
is a hyphen, which the UUID itself and many source ids also contain, so
the source id can only be recovered by counting the fixed length of the
UUID rather than by finding a boundary the format guarantees.
This changes the tail to `::<UUID without hyphens>`. The suffix no
longer contains the separator, so the source id is whatever precedes the
last `::`. Reading the source id back then no longer depends on the
length of the suffix, and source ids that contain hyphens or colons need
no special handling. The prefix and the rule that reuses an id which
already carries it are unchanged. The id format introduced in #3239
changes for callers of these conversion methods; the adapter's run path
streams events and does not call them.
## Changes
- `generatedMessageId` appends `::` and a hyphen-free UUID instead of
`-` and a UUID.
- The Javadoc of `toAguiMessages` and `toAguiMessageList` states the
format and how to read the source id back.
- The converter tests assert the full shape of the id and cover source
ids that contain colons.1 parent 4c63e6c commit 1cf8060
2 files changed
Lines changed: 67 additions & 14 deletions
File tree
- agentscope-extensions/agentscope-extensions-protocol/agentscope-extensions-agui/src
- main/java/io/agentscope/core/agui/converter
- test/java/io/agentscope/core/agui/converter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | | - | |
305 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| |||
630 | 632 | | |
631 | 633 | | |
632 | 634 | | |
633 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
634 | 638 | | |
635 | 639 | | |
636 | 640 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
159 | 164 | | |
160 | 165 | | |
161 | 166 | | |
162 | | - | |
| 167 | + | |
163 | 168 | | |
164 | 169 | | |
165 | 170 | | |
| |||
182 | 187 | | |
183 | 188 | | |
184 | 189 | | |
185 | | - | |
| 190 | + | |
186 | 191 | | |
187 | 192 | | |
188 | 193 | | |
| |||
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
220 | | - | |
| 225 | + | |
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
227 | 269 | | |
228 | 270 | | |
229 | 271 | | |
| |||
690 | 732 | | |
691 | 733 | | |
692 | 734 | | |
693 | | - | |
| 735 | + | |
694 | 736 | | |
695 | 737 | | |
696 | 738 | | |
| |||
710 | 752 | | |
711 | 753 | | |
712 | 754 | | |
713 | | - | |
714 | | - | |
| 755 | + | |
| 756 | + | |
715 | 757 | | |
716 | 758 | | |
717 | 759 | | |
| |||
748 | 790 | | |
749 | 791 | | |
750 | 792 | | |
751 | | - | |
| 793 | + | |
752 | 794 | | |
753 | 795 | | |
754 | 796 | | |
| |||
773 | 815 | | |
774 | 816 | | |
775 | 817 | | |
776 | | - | |
| 818 | + | |
777 | 819 | | |
778 | 820 | | |
779 | | - | |
| 821 | + | |
780 | 822 | | |
781 | 823 | | |
782 | 824 | | |
| |||
2448 | 2490 | | |
2449 | 2491 | | |
2450 | 2492 | | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
2451 | 2500 | | |
0 commit comments