feat(feishu): support optional header in streaming cards#22826
feat(feishu): support optional header in streaming cards#22826Takhoffman merged 1 commit intoopenclaw:mainfrom
Conversation
| const cardJson: Record<string, unknown> = { | ||
| schema: "2.0", | ||
| config: { | ||
| streaming_mode: true, |
There was a problem hiding this comment.
Widened type loses compile-time safety
Changing cardJson from the inferred object literal to Record<string, unknown> drops all type information on the card structure. Per repo guidelines (prefer strict typing; avoid any), consider keeping the original inferred type and spreading the header into the object literal instead:
| streaming_mode: true, | |
| const cardJson = { |
Then construct with the header inline:
const cardJson = {
schema: "2.0" as const,
config: { ... },
body: { ... },
...(header && {
header: {
title: { tag: "plain_text" as const, content: header.title },
template: header.template ?? "blue",
},
}),
};This preserves the inferred literal type while conditionally including the header.
Context Used: Context from dashboard - CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/feishu/src/streaming-card.ts
Line: 98
Comment:
**Widened type loses compile-time safety**
Changing `cardJson` from the inferred object literal to `Record<string, unknown>` drops all type information on the card structure. Per repo guidelines (prefer strict typing; avoid `any`), consider keeping the original inferred type and spreading the header into the object literal instead:
```suggestion
const cardJson = {
```
Then construct with the header inline:
```ts
const cardJson = {
schema: "2.0" as const,
config: { ... },
body: { ... },
...(header && {
header: {
title: { tag: "plain_text" as const, content: header.title },
template: header.template ?? "blue",
},
}),
};
```
This preserves the inferred literal type while conditionally including the header.
**Context Used:** Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.|
This pull request has been automatically marked as stale due to inactivity. |
Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes #13267 (partial) Co-Authored-By: Claude Opus 4.6 <[email protected]>
999f82b to
5e87e30
Compare
|
PR #22826 - feat(feishu): support optional header in streaming cards (#22826) Merged via squash.
Thanks @nszhsl! |
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]> (cherry picked from commit f406fd6)
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]> (cherry picked from commit f406fd6)
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]> (cherry picked from commit f406fd6)
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Cherry-pick of upstream 8a2273e.
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Cherry-pick of upstream 8a2273e.
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial)
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]>
) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) Co-authored-by: Claude Opus 4.6 <[email protected]> (cherry picked from commit 8a2273e)
) (#1474) Add an optional `header` parameter to `FeishuStreamingSession.start()` so that streaming cards can display a colored title bar, matching the appearance of non-streaming interactive cards. The Card Kit API already supports `header` alongside `streaming_mode`, but the current implementation omits it, producing headerless cards. This change is fully backward-compatible: when `header` is not provided, behavior is identical to before. Closes openclaw#13267 (partial) (cherry picked from commit 8a2273e) Co-authored-by: songlei <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
Summary
headerparameter toFeishuStreamingSession.start()so streaming cards can display a colored title barheaderalongsidestreaming_mode, but the current implementation omits it — producing headerless white cardsheaderis not provided, behavior is identical to beforeMotivation
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.tsStreamingCardHeaderwithtitle(required) andtemplate(optional color, defaults to"blue")header?: StreamingCardHeadertostart()headerinto the Card Kit card JSON before creating the card entityTest plan
headerparam work unchanged (backward compat)header: { title: "Test", template: "green" }show colored title bar🤖 Generated with Claude Code
Greptile Summary
Adds optional
headersupport toFeishuStreamingSession.start()so streaming cards can display a colored title bar via the Card Kit API. The change introduces a new exportedStreamingCardHeadertype and conditionally injects the header into the card JSON when provided. Fully backward-compatible — existing callers pass no header and behavior is unchanged.title.tag,title.content,template) follows the Feishu v2 card schema correctlyreply-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 featurecardJsontype was widened from an inferred literal toRecord<string, unknown>, which could be avoided with a spread pattern to preserve compile-time type safetyConfidence Score: 4/5
Last reviewed commit: 999f82b
(2/5) Greptile learns from your feedback when you react with thumbs up/down!
Context used:
dashboard- CLAUDE.md (source)