Skip to content

feat(thread): ✨ add hover copy button to user and assistant messages#210

Merged
jorben merged 1 commit into
masterfrom
feat/message-copy-support
May 27, 2026
Merged

feat(thread): ✨ add hover copy button to user and assistant messages#210
jorben merged 1 commit into
masterfrom
feat/message-copy-support

Conversation

@jorben
Copy link
Copy Markdown
Contributor

@jorben jorben commented May 27, 2026

Summary

  • Add hover-reveal copy button below user and assistant messages in the thread timeline
  • Copy text filters out non-text parts (chart, data, tool-like artifacts), only copying plain text content
  • Slash command messages copy the original user display text, not the expanded effective prompt
  • Discarded messages, system messages, and empty-text messages do not show the copy button

Test Plan

  • npm run typecheck passes
  • npm run test:unit — 46 tests pass including 5 new copyable text helper tests
  • Manual: hover user/assistant message → copy icon appears below
  • Manual: click copy → icon switches to check, paste content matches text only
  • Manual: slash command message copies /command display text, not expanded prompt
  • Manual: messages with tool use cards do not include tool input/result in copied text

🤖 Generated with TiyCode

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 27, 2026

AI Code Review Summary

PR: #210 (feat(thread): ✨ add hover copy button to user and assistant messages)
Preferred language: English

Overall Assessment

Detected 1 actionable findings, prioritize CRITICAL/HIGH before merge.

Major Findings by Severity

  • MEDIUM (1)
    • src/i18n/locales/zh-CN.ts:1015 - Missing i18n keys in other locale files

Actionable Suggestions

  • Move the copy timeout set logic after await resolves and use a ref counter to guard against stale closures.
  • Add message.copy and message.copied to all active locale files beyond en.ts and zh-CN.ts.

Potential Risks

  • Other locales missing translations for new message action keys could cause UI breaks.
  • Copy icon state may become stale on rapid consecutive clicks due to timing after async clipboard write.

Test Suggestions

  • Add integration test for MessageActions visibility logic in message surface.
  • Add test for getCopyableThreadMessageText with invalid/malformed commandComposer metadata.

File-Level Coverage Notes

  • src/i18n/locales/en.ts: Good: two new i18n keys added with clear purpose.
  • src/i18n/locales/zh-CN.ts: Good translation coverage; note potential missing keys in other locales.
  • src/modules/workbench-shell/ui/runtime-thread-surface-state.ts: Clean separation of copy logic into pure functions. Good fallback behavior.
  • src/modules/workbench-shell/ui/runtime-thread-surface.test.tsx: Excellent test coverage for copy behavior, including fallbacks, part filtering, and command vs plain routing.
  • src/modules/workbench-shell/ui/runtime-thread-surface.tsx: Feature integration is clean with proper clipboard fallback handling and loading state. Slight race condition with timeout cleanup possible.

Inline Downgraded Items (processed but not inline)

  • None

Coverage Status

  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
  • No-patch/binary covered as file-level: 0
  • Findings with unknown confidence (N/A): 0

Uncovered list:

  • None

No-patch covered list:

  • None

Runtime/Budget

  • Rounds used: 1/4
  • Planned batches: 1
  • Executed batches: 1
  • Sub-agent runs: 1
  • Planner calls: 1
  • Reviewer calls: 1
  • Model calls: 2/64
  • Structured-output summary-only degradation: NO

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

Comment thread src/i18n/locales/en.ts
@@ -973,6 +973,10 @@ const en: Record<TranslationKey, string> = {
"artifact.expandCode": "Expand code",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review completed for this PR diff. No concrete inline issue was selected after aggregation.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

Comment thread src/i18n/locales/en.ts
@@ -973,6 +973,10 @@ const en: Record<TranslationKey, string> = {
"artifact.expandCode": "Expand code",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated review completed for this PR diff. No concrete inline issue was selected after aggregation.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated PR review completed.

  • Findings kept: 1
  • Findings with unknown confidence: 0
  • Inline comments attempted: 1
  • Target files: 5
  • Covered files: 5
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

Comment thread src/i18n/locales/zh-CN.ts
"artifact.expandCode": "展开代码",
"artifact.preview": "点击预览",

// ── Message actions ───────────────────────────────────────
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] Missing i18n keys in other locale files

Added new i18n keys only in en.ts and zh-CN.ts, but there may be other locale files that need corresponding translations.

Suggestion: Ensure all active locale files have the message.copy and message.copied translations, otherwise they will fall back to the i18n default or crash.

Risk: Missing translations in other locales will result in untranslated or broken UI strings for those users.

Confidence: 0.90

[From SubAgent: general]

@jorben jorben merged commit c9dfaf3 into master May 27, 2026
6 checks passed
@jorben jorben deleted the feat/message-copy-support branch May 27, 2026 11:27
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.

1 participant