-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(mothership): thinking and subagent text #3613
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
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,6 +27,7 @@ export interface CredentialTagData { | |||||||||||||||||
|
|
||||||||||||||||||
| export type ContentSegment = | ||||||||||||||||||
| | { type: 'text'; content: string } | ||||||||||||||||||
| | { type: 'thinking'; content: string } | ||||||||||||||||||
| | { type: 'options'; data: OptionsTagData } | ||||||||||||||||||
| | { type: 'usage_upgrade'; data: UsageUpgradeTagData } | ||||||||||||||||||
| | { type: 'credential'; data: CredentialTagData } | ||||||||||||||||||
|
|
@@ -36,7 +37,7 @@ export interface ParsedSpecialContent { | |||||||||||||||||
| hasPendingTag: boolean | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| const SPECIAL_TAG_NAMES = ['options', 'usage_upgrade', 'credential'] as const | ||||||||||||||||||
| const SPECIAL_TAG_NAMES = ['thinking', 'options', 'usage_upgrade', 'credential'] as const | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Parses inline special tags (`<options>`, `<usage_upgrade>`) from streamed | ||||||||||||||||||
|
|
@@ -103,11 +104,17 @@ export function parseSpecialTags(content: string, isStreaming: boolean): ParsedS | |||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| const body = content.slice(bodyStart, closeIdx) | ||||||||||||||||||
| try { | ||||||||||||||||||
| const data = JSON.parse(body) | ||||||||||||||||||
| segments.push({ type: nearestTagName as 'options' | 'usage_upgrade' | 'credential', data }) | ||||||||||||||||||
| } catch { | ||||||||||||||||||
| /* malformed JSON — drop the tag silently */ | ||||||||||||||||||
| if (nearestTagName === 'thinking') { | ||||||||||||||||||
| if (body.trim()) { | ||||||||||||||||||
| segments.push({ type: 'thinking', content: body }) | ||||||||||||||||||
| } | ||||||||||||||||||
| } else { | ||||||||||||||||||
| try { | ||||||||||||||||||
| const data = JSON.parse(body) | ||||||||||||||||||
| segments.push({ type: nearestTagName as 'options' | 'usage_upgrade' | 'credential', data }) | ||||||||||||||||||
| } catch { | ||||||||||||||||||
| /* malformed JSON — drop the tag silently */ | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| cursor = closeIdx + closeTag.length | ||||||||||||||||||
|
|
@@ -137,6 +144,13 @@ interface SpecialTagsProps { | |||||||||||||||||
| */ | ||||||||||||||||||
| export function SpecialTags({ segment, onOptionSelect }: SpecialTagsProps) { | ||||||||||||||||||
| switch (segment.type) { | ||||||||||||||||||
| /** TODO: FIX THINKING BLOCK RENDERING*/ | ||||||||||||||||||
| case 'thinking': | ||||||||||||||||||
| return ( | ||||||||||||||||||
| <div className='rounded-lg border border-[var(--divider)] bg-[var(--surface-4)] px-3 py-2 text-[13px] text-[var(--text-tertiary)] italic'> | ||||||||||||||||||
| {segment.content.trim()} | ||||||||||||||||||
| </div> | ||||||||||||||||||
| ) | ||||||||||||||||||
|
Comment on lines
+147
to
+153
Contributor
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. TODO comment signals incomplete implementation The
Comment on lines
+149
to
+153
Contributor
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. Missing The thinking content rendered here follows the same pattern as the Additionally, the identical class string
Suggested change
|
||||||||||||||||||
| case 'options': | ||||||||||||||||||
| return <OptionsDisplay data={segment.data} onSelect={onOptionSelect} /> | ||||||||||||||||||
| case 'usage_upgrade': | ||||||||||||||||||
|
|
||||||||||||||||||
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.
Missing
whitespace-pre-wrapcauses newlines to collapseThe original
<p>element had the Tailwind classwhitespace-pre-wrap, which preserves both whitespace sequences and newlines in the rendered output. The replacement<div>drops this class entirely, so any multi-line subagent text (e.g. step-by-step explanations or prose with explicit line breaks) will now be collapsed into a single run of text with no visible line breaks.Add
whitespace-pre-wrapback to the new<div>'s className to restore the previous behavior.