Skip to content

feat: update ai chat ui component - #576

Merged
lixun910 merged 7 commits into
mainfrom
xli-from-b8cadf57
May 4, 2026
Merged

lixun910 merged 7 commits into
mainfrom
xli-from-b8cadf57

Conversation

@lixun910

@lixun910 lixun910 commented Apr 29, 2026 •

Copy link
Copy Markdown
Collaborator
  • Activity boxes can be collapsed to a clickable summary row and expanded back; running activities stay visible.
  • Completed tool groups and agent activities show summary labels when collapsed (e.g., "Worked with N tool(s)").
  • Vega charts display optional reasoning text above the chart when provided.
  • Log and content text wrap better with improved hyphenation and word-breaking.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an optional summaryLabel prop and collapse/expand behavior to ActivityBox, threads summaryLabel generation from AnalysisResult and FlatAgentRenderer, adjusts text wrapping, introduces several Kepler legend/memoization changes, minor Vega UI addition, and a TypeScript type-assertion tweak in table interop.

Changes

Cohort / File(s) Summary
ActivityBox core
packages/ai-core/src/components/ActivityBox.tsx
Adds optional summaryLabel?: string, expandedForLabel state and visible gating to render a chevron summary when collapsed; adds collapse/expand controls; includes visible in measurement/scroll effect deps; adds hyphens-auto style.
Summary generation & propagation
packages/ai-core/src/components/AnalysisResult.tsx, packages/ai-core/src/components/FlatAgentRenderer.tsx
Derives summaryLabel for tool-group segments when tools exist, none are pending/approval-requested, and agent/group is complete; threads isAgentComplete through FlatSegmentList and passes summaryLabel into ActivityBox.
Text wrapping tweaks
packages/ai-core/src/components/FlatAgentRenderer.tsx
Replaces break-all with break-words hyphens-auto for leaf log lines and orchestrator lines to improve wrapping/hyphenation.
Vega chart small UI addition
packages/vega/src/VegaChartToolResult.tsx
Component now accepts input and renders input.reasoning as an extra paragraph above the Vega chart when present.
Kepler: legend & panel changes
packages/kepler/src/components/CustomMapLegend.tsx, packages/kepler/src/components/CustomMapLegendPanel.tsx, packages/kepler/src/components/KeplerMapContainer.tsx
MapLegend gains optional onClose callback; CustomMapLegendPanelFactory signature changed to receive explicit deps and adds a new SplitPaneLegend variant controlled by local state; bottomWidgetFields memoized and legend fields normalized/forced active=false in derived widget fields.
Type assertion tweak
packages/mosaic/src/tableInterop.ts
Moves the MosaicTable cast to the decodeIPC(ipcBytes) result at the attachTableInterop call site and removes the trailing as MosaicTable on the return expression.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant Renderer as FlatAgentRenderer
  participant Analyzer as AnalysisResult
  participant Activity as ActivityBox
  participant DOM as DOM/ResizeObserver

  User->>Renderer: view activity list / interact
  Renderer->>Analyzer: build segments (derive summaryLabel if applicable)
  Analyzer->>Activity: render ActivityBox with optional `summaryLabel`
  User->>Activity: click chevron (toggle expandedForLabel)
  Activity->>DOM: mount full UI (measure/observe scroll)
  DOM-->>Activity: resize/scroll events trigger effects
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • ilyabo

Poem

🐰 I tuck a tale behind a chevron bright,
Tap once, it blooms, tap again—goodnight.
Lines now wrap with gentle, hyphenated grace,
Tools counted, panels split, a snug little place.
Hooray — a rabbit hops, summary in its pace! 🥕✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'feat: update ai chat ui component' is vague and does not accurately reflect the actual changes, which span multiple packages including kepler map components, vega charts, mosaic tables, and AI core components. The title suggests only AI chat UI updates but misses the primary objective of collapsing activity boxes and map legend improvements. Consider a more descriptive title like 'feat: collapse activity boxes on completion and enhance map legend controls' that better captures the main changes across the affected components.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch xli-from-b8cadf57

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ai-core/src/components/AnalysisResult.tsx (1)

198-211: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Treat approval-responded as completed in the pending-state check.

At Line 201, anyPending does not consider approval-responded as terminal, so approved calls can stay marked as “running” and never get the collapse summary even after completion.

Proposed fix
               return (
                 s !== 'output-available' &&
+                s !== 'approval-responded' &&
                 s !== 'output-error' &&
                 s !== 'output-denied'
               );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai-core/src/components/AnalysisResult.tsx` around lines 198 - 211,
The pending-state check for seg.parts (the anyPending computation) treats
'approval-responded' as non-terminal causing approved parts to remain "pending";
update the predicate in the anyPending arrow function (used on seg.parts.some)
to also treat s === 'approval-responded' as a completed/terminal state (i.e.,
include it alongside 'output-available', 'output-error', and 'output-denied') so
allToolsDone/summaryLabel logic toggles correctly when
analysisResult.isCompleted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/ai-core/src/components/AnalysisResult.tsx`:
- Around line 198-211: The pending-state check for seg.parts (the anyPending
computation) treats 'approval-responded' as non-terminal causing approved parts
to remain "pending"; update the predicate in the anyPending arrow function (used
on seg.parts.some) to also treat s === 'approval-responded' as a
completed/terminal state (i.e., include it alongside 'output-available',
'output-error', and 'output-denied') so allToolsDone/summaryLabel logic toggles
correctly when analysisResult.isCompleted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa25b755-037c-4b0c-b1da-4ab8897b6703

📥 Commits

Reviewing files that changed from the base of the PR and between ae2c193 and 24d63e7.

📒 Files selected for processing (3)
  • packages/ai-core/src/components/ActivityBox.tsx
  • packages/ai-core/src/components/AnalysisResult.tsx
  • packages/ai-core/src/components/FlatAgentRenderer.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ai-core/src/components/ActivityBox.tsx`:
- Around line 83-91: The effects that attach observers/listeners (the
ResizeObserver/MutationObserver and the scroll listener in useEffect hooks
referencing measure, updateScrollFlags, visible, and scrollRef) must also depend
on isRunning because showBox can change when isRunning toggles even if visible
stays the same; update the dependency arrays for these useEffect hooks (the one
with [measure, updateScrollFlags, visible] and the one with [updateScrollFlags,
visible]) to include isRunning so the effects re-run and attach
observers/listeners when transitioning to the full box view.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f95cfaa-e37c-4377-a3a5-9d83f3a8d560

📥 Commits

Reviewing files that changed from the base of the PR and between 784252a and 2b97c50.

📒 Files selected for processing (3)
  • packages/ai-core/src/components/ActivityBox.tsx
  • packages/ai-core/src/components/FlatAgentRenderer.tsx
  • packages/kepler/src/components/KeplerMapContainer.tsx

Comment thread packages/ai-core/src/components/ActivityBox.tsx Outdated
@ilyabo

ilyabo commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Could the kepler / vega changes be a separate PR?

@lixun910
lixun910 force-pushed the xli-from-b8cadf57 branch 2 times, most recently from a40f406 to e559c4d Compare May 4, 2026 18:49
@lixun910
lixun910 force-pushed the xli-from-b8cadf57 branch from 1462c12 to dafe0a1 Compare May 4, 2026 20:58
@sqlrooms sqlrooms deleted a comment from Copilot AI May 4, 2026
@lixun910
lixun910 merged commit 0770869 into main May 4, 2026
3 checks passed
@lixun910
lixun910 deleted the xli-from-b8cadf57 branch May 4, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants