Skip to content

Implement custom Kapa support handoff chat with polished codeblock UX - #502

Closed
dannyneira wants to merge 18 commits into
mainfrom
danny/kapa-custom-chat-handoff-clean-v1
Closed

Implement custom Kapa support handoff chat with polished codeblock UX#502
dannyneira wants to merge 18 commits into
mainfrom
danny/kapa-custom-chat-handoff-clean-v1

Conversation

@dannyneira

Copy link
Copy Markdown
Member

Summary

This PR restores a custom Kapa side-chat experience for docs and adds a robust support handoff flow to Front, while preserving Kapa answer quality and improving chat UX.

What’s included

  • Re-enabled custom Kapa chat launcher/panel behavior in docs.
  • Added trigger-based Create ticket handoff UX (uncertainty/downvote/conversation depth paths).
  • Added docs API route for support handoff submission.
  • Switched handoff transport to Hookdeck-backed endpoint routing.
  • Upgraded chat code block rendering to match docs styling with:
    • syntax highlighting,
    • stable copy button behavior,
    • horizontal scrolling,
    • no streaming flicker,
    • corrected line spacing.
  • Improved handoff success/error states and inline form behavior.

Verification

  • npm run build passes.
  • End-to-end smoke verified:
    • chat renders/streams correctly,
    • code blocks highlight and copy correctly,
    • support handoff submission succeeds.

Notes

  • This is a clean-history replacement PR for the earlier iterative branch.

Co-Authored-By: Warp Agent agent@warp.dev

Co-Authored-By: Warp Agent <agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Aug 11, 2026
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 12, 2026 7:33pm

Request Review

oz-for-oss[bot]

This comment was marked as outdated.

Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>

@oz-for-oss oz-for-oss 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.

Overview

This PR restores the custom Kapa chat panel, adds code-block rendering and copy UX, documents MCP OAuth workarounds, and introduces support handoff/highlight API routes.

Concerns

  • The code highlighting cleanup path can still emit an unhandled rejection when Shiki highlighting fails.

Security

  • The new support handoff endpoint is public and can be scripted to create support tickets without a rate limit or proof that the request came from a real Kapa conversation.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread src/components/KapaChatLauncher.tsx Outdated
Comment thread src/pages/api/support-handoff.ts Outdated
Co-authored-by: oz-for-oss[bot] <277970191+oz-for-oss[bot]@users.noreply.github.com>
Co-Authored-By: Warp Agent <agent@warp.dev>
Co-Authored-By: Warp Agent <agent@warp.dev>
Fail closed when SUPPORT_HANDOFF_SHARED_SECRET is missing so public requests cannot reach the upstream without auth.

Co-Authored-By: Warp Agent <agent@warp.dev>
The chat's copy button was a one-off lucide SVG inside EC-lookalike
markup, so Expressive Code's stylesheet (which paints the icon via
button::after mask on an empty inner div) never styled it, leaving a
plain clipboard glyph that didn't match docs code blocks.

- ChatCodeBlock now emits EC's exact copy markup (aria-live feedback
  div + button with data-copied/data-code, newlines encoded as \u007f),
  so ec.css styles it pixel-identical to docs blocks and ec.js attaches
  its own click handler (navigator.clipboard with execCommand fallback
  plus the "Copied!" tooltip) via its MutationObserver.
- KapaLauncher.astro renders a hidden <Code> block so EC's hashed
  assets ship on every page, not just pages with fenced code blocks.
- Dropped the now-redundant React copy state/helpers and the
  Kapa-specific .copy CSS overrides.

Co-Authored-By: Warp Agent <agent@warp.dev>
Stop reusing Expressive Code .copy markup, which stacked EC's CSS mask icon with residual SVG. Own one frosted-glass button with a CSS-mask icon and clipboard handler.

Co-Authored-By: Warp Agent <agent@warp.dev>
gcp-front-docs-handoff validates WEBHOOK_SECRET via ?secret=, not Authorization bearer.

Co-Authored-By: Warp Agent <agent@warp.dev>
@dannyneira

Copy link
Copy Markdown
Member Author

Closing in favor of #512, which replaces this PR with the final curated Kapa custom chat and support handoff change set on a clean branch. It preserves the intended fixes while removing unrelated and stale work from this PR.

@dannyneira dannyneira closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant