#22826: feat(feishu): support optional header in streaming cards
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
#11084: feat(feishu): implement CardKit streaming card output with typewrit...
by liuhui201069 · 2026-02-07
76.4%
#9505: fix: Refactor Feishu streaming to prevent truncation and simplify s...
by zhangyi-extra · 2026-02-05
73.7%
#22598: feat(feishu): support card action callback handler
by yingyixu · 2026-02-21
70.2%
#23382: docs(feishu): add cardkit:card:write permission for streaming card ...
by SidQin-cyber · 2026-02-22
69.1%
#22584: docs(feishu): add cardkit:card:write permission for streaming card ...
by Amateur0x1 · 2026-02-21
68.8%
#13917: fix(feishu): card rendering for tables, blockquotes, images, and ou...
by yaoting · 2026-02-11
68.6%
#16123: Feishu card default
by QiuYi111 · 2026-02-14
68.0%
#21848: feat(feishu): improve agent card experience with single-card stream...
by songshikang0111 · 2026-02-20
65.8%
#19027: fix(feishu): keep chunked messages in topic/thread context
by qiangu · 2026-02-17
64.5%
#15351: feat(feishu): Add native audio message support (voice bubble)
by lovejing0306 · 2026-02-13
63.8%