Commit d2077fe
authored
* feat(chatbot): open reasoning details in a dialog matching the XTM One web chat (#322)
* fix(chatbot): gate reasoning dialog on trace/transfer fields, a11y, docs (#322)
Address the Copilot review pass plus re-review findings:
- ChatMessages: the reasoning-details affordance now also renders when a
message carries only toolCallTrace and/or transferChain (a backend can
send the trace without tool_names/reasoning); added aria-label,
aria-haspopup="dialog" and aria-expanded to the icon-only trigger
- ReasoningDetailsDialog: the header summary count falls back to the
trace length before the flat tool-name list, so it can never read
"0 tool calls" above rendered trace rows; transfer-chain chips use a
composite agentId-index key (the same agent can appear twice in a
chain and older payloads have no agent_id)
- README: document the new done-payload fields (tool_call_trace,
transfer_chain, is_truncated) with the restore behavior, and the new
translation keys
* fix(chatbot): explicit boolean success coercion and dialog focus management (#322)
Address the second Copilot review pass:
- parseToolCallTrace: only a boolean `success` is honored; any missing
or malformed value defaults to true explicitly (typeof check matching
the file's defensive-parsing style) instead of the `!== false`
comparison whose intent was easy to misread
- ReasoningDetailsDialog: move initial keyboard focus to the Close
button once the portal mounts (aria-modal dialogs must take focus)
and hand focus back to the previously focused element - the trigger
button - when the dialog closes
* fix(chatbot): trap Tab focus inside the reasoning-details dialog (#322)
Address the third Copilot review pass: aria-modal promises that focus
stays inside the dialog, but Tab/Shift+Tab could still walk out into
the panel behind the backdrop. The document keydown handler now cycles
focus across the dialog's focusable elements (first <-> last, and pulls
focus back in if it is outside), with dialogRef attached to the dialog
element.
* fix(chatbot): pretty-print trace outputs and share findChatbotRoot (#322)
Address the fourth Copilot review pass:
- ReasoningDetailsDialog: the Output block now goes through the same
pretty-printing as Input (shared prettyTraceValue helper - compact
JSON is expanded, plain text / oversized / malformed payloads stay
raw), matching the XTM One web chat and the PR description
- Extract findChatbotRoot to utils and reuse it from Tooltip, Dropdown
and ReasoningDetailsDialog - the portal-targeting DOM walk was
copy-pasted three times and could drift
1 parent eabb777 commit d2077fe
17 files changed
Lines changed: 564 additions & 80 deletions
File tree
- packages/filigran-chatbot
- src
- components
- icons
- hooks
- protocols
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
267 | 283 | | |
268 | 284 | | |
269 | 285 | | |
| |||
435 | 451 | | |
436 | 452 | | |
437 | 453 | | |
| 454 | + | |
438 | 455 | | |
439 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
440 | 462 | | |
441 | 463 | | |
442 | 464 | | |
| |||
Lines changed: 33 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
314 | 292 | | |
315 | 293 | | |
316 | 294 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
311 | 314 | | |
312 | 315 | | |
313 | 316 | | |
| |||
329 | 332 | | |
330 | 333 | | |
331 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
332 | 338 | | |
333 | 339 | | |
334 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | 15 | | |
24 | 16 | | |
25 | 17 | | |
| |||
0 commit comments