Commit e8192a1
committed
fix(react-core): address CR-loop findings on IntelligenceIndicator
Round-1 review on the indicator branch surfaced perf and defensive
hardening items. Tests: react-core 1158 — all green.
- CopilotChatMessageView auto-mount now gates on
`message.role === "assistant"` in addition to
`copilotkit.intelligence !== undefined`. Eliminates wasted
`useAgent` subscriptions, 200 ms polling intervals, and four
`useEffect`s on every user / activity / reasoning slot — the
indicator's own role gate would short-circuit anyway, but only
after a subscribe + interval-set + cleanup cycle on every render.
- IntelligenceIndicator's `toolCalls` access is now defensive:
`Array.isArray(...)` guard and `tc?.function?.name` chain. A
malformed agent payload no longer crashes the chat tree at
`.some(...)`.
Comment fixes:
- CopilotChatMessageView: stale `CopilotKitProvider.intelligenceIndicator.e2e.test.tsx`
reference updated to the actual path
`intelligence-indicator/__tests__/IntelligenceIndicator.e2e.test.tsx`.
- IntelligenceIndicator `ISRUNNING_POLL_MS` JSDoc rewritten — the
prior version claimed `addMessage` iterates subscribers live during
streaming. In fact AG-UI's `runAgent` snapshots subscribers and
threads them through the entire pipeline (including
`processApplyEvents` for streaming events), so a late-mounted
subscriber misses both `onMessagesChanged` AND `onRunFinalized`
from the run's pipeline. The poll fallback is the only thing that
catches the falling edge.
- `globals.css` pill-styles port comment listed `#BEC2FF` as part of
the palette but that hex doesn't appear anywhere in the rules.
Updated to the actual swatches: text #5B21B6, icon #7C3AED, border
#9599E0, gradient #EEE6FE, shadow #5E64AD.1 parent 678d143 commit e8192a1
3 files changed
Lines changed: 39 additions & 22 deletions
File tree
- packages/react-core/src/v2
- components
- chat
- intelligence-indicator
- styles
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
| 333 | + | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
708 | 713 | | |
709 | 714 | | |
710 | 715 | | |
| |||
Lines changed: 24 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
167 | 171 | | |
168 | 172 | | |
169 | 173 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
0 commit comments