← Back to PRs

#22826: feat(feishu): support optional header in streaming cards

by nszhsl open 2026-02-21 18:32 View on GitHub →
channel: feishu size: XS
## Summary - Add optional `header` parameter to `FeishuStreamingSession.start()` so streaming cards can display a colored title bar - The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it — producing headerless white cards - Fully backward-compatible: when `header` is not provided, behavior is identical to before ## Motivation Streaming cards currently render without a title bar, making them visually inconsistent with non-streaming interactive cards. Users who set `renderMode: "card"` expect consistent card styling. Adding header support allows callers to pass a title and color template for a richer UI. Related: #13267 ## Changes **`extensions/feishu/src/streaming-card.ts`** - Export new type `StreamingCardHeader` with `title` (required) and `template` (optional color, defaults to `"blue"`) - Add optional third parameter `header?: StreamingCardHeader` to `start()` - When provided, inject `header` into the Card Kit card JSON before creating the card entity ## Test plan - [ ] Verify streaming cards without `header` param work unchanged (backward compat) - [ ] Verify streaming cards with `header: { title: "Test", template: "green" }` show colored title bar - [ ] Verify on both Feishu (飞书) and Lark clients 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds optional `header` support to `FeishuStreamingSession.start()` so streaming cards can display a colored title bar via the Card Kit API. The change introduces a new exported `StreamingCardHeader` type and conditionally injects the header into the card JSON when provided. Fully backward-compatible — existing callers pass no header and behavior is unchanged. - The Card Kit header structure (`title.tag`, `title.content`, `template`) follows the Feishu v2 card schema correctly - The only current caller (`reply-dispatcher.ts:102`) does not yet pass a header, so this is plumbing-only at this stage — callers will need updates to actually surface the feature - Minor style note: `cardJson` type was widened from an inferred literal to `Record<string, unknown>`, which could be avoided with a spread pattern to preserve compile-time type safety <h3>Confidence Score: 4/5</h3> - This PR is safe to merge — it adds an optional parameter with no behavioral change to existing callers. - Small, well-scoped change that is fully backward-compatible. The new parameter is optional and unused by current callers, so there is no risk of regression. Only a minor type-safety style concern was found. - No files require special attention. <sub>Last reviewed commit: 999f82b</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) <!-- /greptile_comment -->

Most Similar PRs