-
-
Notifications
You must be signed in to change notification settings - Fork 8
Chat Phase 3 — per-framework typing-phase labels #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
765ad55
docs: Chat Phase 3 typing-phase labels spec + plan
jaylfc ca56eed
feat(chat): typing registry stores phase + detail; agents expose {slu…
jaylfc 3a95f23
feat(chat): POST /thinking accepts phase + detail with enum validation
jaylfc 3e852d7
feat(chat): TypingFooter shows phase-aware labels + icons
jaylfc 2aaa47f
feat(bridges): _thinking helper accepts phase/detail; emit per-framew…
jaylfc 50060a4
fix(tests): update test_chat_typing.py assertions to new dict shape
jaylfc e976bce
build: rebuild desktop bundle for chat Phase 3 typing labels
jaylfc c3416f9
test(e2e): chat Phase 3 typing footer smoke stub
jaylfc 31bcbce
fix(chat): guard non-string phase/detail in POST /thinking (400 not 500)
jaylfc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,13 +4,22 @@ | |||||
| * Caller feeds in live arrays — they're empty when nothing is active | ||||||
| * and the component renders nothing. | ||||||
| */ | ||||||
|
|
||||||
| type TypingPhase = "thinking" | "tool" | "reading" | "writing" | "searching" | "planning"; | ||||||
|
|
||||||
| export interface AgentTyping { | ||||||
| slug: string; | ||||||
| phase?: TypingPhase | null; | ||||||
| detail?: string | null; | ||||||
| } | ||||||
|
|
||||||
| export function TypingFooter({ | ||||||
| humans, | ||||||
| agents, | ||||||
| selfId = "user", | ||||||
| }: { | ||||||
| humans: string[]; | ||||||
| agents: string[]; | ||||||
| agents: AgentTyping[]; | ||||||
| selfId?: string; | ||||||
| }) { | ||||||
| const others = humans.filter((h) => h !== selfId); | ||||||
|
|
@@ -19,15 +28,21 @@ export function TypingFooter({ | |||||
| if (!hasHumans && !hasAgents) return null; | ||||||
|
|
||||||
| const humanLine = formatHumansTyping(others); | ||||||
| const agentLine = formatAgentsThinking(agents); | ||||||
|
|
||||||
| return ( | ||||||
| <div | ||||||
| aria-live="polite" | ||||||
| className="px-4 pt-1 text-xs text-shell-text-tertiary flex flex-col gap-0.5" | ||||||
| > | ||||||
| {humanLine && <span>{humanLine}</span>} | ||||||
| {agentLine && <span className="italic">{agentLine}</span>} | ||||||
| {agents.map((a) => { | ||||||
| const { icon, text } = phaseLabel(a.phase, a.detail); | ||||||
| return ( | ||||||
| <span key={a.slug} className="italic"> | ||||||
| {icon} @{a.slug} is {text}… | ||||||
| </span> | ||||||
| ); | ||||||
| })} | ||||||
| </div> | ||||||
| ); | ||||||
| } | ||||||
|
|
@@ -39,7 +54,28 @@ function formatHumansTyping(names: string[]): string | null { | |||||
| return `${names[0]} and ${names.length - 1} others are typing…`; | ||||||
| } | ||||||
|
|
||||||
| function formatAgentsThinking(slugs: string[]): string | null { | ||||||
| if (slugs.length === 0) return null; | ||||||
| return slugs.map((s) => `${s} is thinking…`).join(" · "); | ||||||
| function phaseLabel( | ||||||
| phase?: TypingPhase | null, | ||||||
| detail?: string | null, | ||||||
| ): { icon: string; text: string } { | ||||||
| const d = detail | ||||||
| ? detail.length > 40 | ||||||
| ? detail.slice(0, 39) + "…" | ||||||
| : detail | ||||||
| : null; | ||||||
| switch (phase) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SUGGESTION: Truncation logic incorrectly counts characters before checking length. The current code creates the truncated string before checking length, so it will always add an ellipsis even when exactly 40 characters.
Suggested change
|
||||||
| case "tool": | ||||||
| return { icon: "🔧", text: d ? `using ${d}` : "using a tool" }; | ||||||
| case "reading": | ||||||
| return { icon: "📖", text: d ? `reading ${d}` : "reading" }; | ||||||
| case "writing": | ||||||
| return { icon: "✏️", text: d ? `writing ${d}` : "writing" }; | ||||||
| case "searching": | ||||||
| return { icon: "🔍", text: d ? `searching ${d}` : "searching" }; | ||||||
| case "planning": | ||||||
| return { icon: "📋", text: "planning" }; | ||||||
| case "thinking": | ||||||
| default: | ||||||
| return { icon: "💭", text: "thinking" }; | ||||||
| } | ||||||
| } | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Stale agent entries may accumulate when multiple start events are received before an end event. The current logic removes only one matching entry, but if duplicates exist they will remain in state.
When multiple
startevents arrive for the same agent,prev.filterwill remove all matching entries, which is correct. However if multiple entries were already present (due to a race condition) they will be properly cleared.