Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
240637e
Initial plan
Copilot Aug 13, 2025
3fb5773
Initial exploration: Understand Sequential Thinking MCP display issue
Copilot Aug 13, 2025
cea5d33
Implement SequentialThinkingWidget with smart UX improvements
Copilot Aug 13, 2025
e387077
Refactor session store and improve error handling
thedotmack Aug 13, 2025
763b40f
Refactor code structure for improved readability and maintainability
thedotmack Aug 13, 2025
0f6744f
Enhance ThinkingWidget with expand/collapse functionality for long th…
thedotmack Aug 13, 2025
827a249
Add ThinkingPreferencesService for managing default expansion of thin…
thedotmack Aug 13, 2025
fef5c9c
Complete code review and testing - Sequential Thinking widget impleme…
Copilot Aug 13, 2025
5b8295f
Merge branch 'main' into copilot/fix-1
thedotmack Aug 13, 2025
b81ca87
Merge pull request #3 from thedotmack/copilot/fix-1
thedotmack Aug 13, 2025
29e85c6
Merge branch 'getAsterisk:main' into main
thedotmack Aug 14, 2025
ce25e41
Initial plan
Copilot Aug 19, 2025
8e033e5
Implement complete TypeScript server with full API and documentation
Copilot Aug 19, 2025
07f347a
Add final documentation, tests, and deployment guides
Copilot Aug 19, 2025
82cd6bd
📝 Add docstrings to `copilot/fix-6`
coderabbitai[bot] Aug 19, 2025
3161bf1
Update CLAUDIA-SERVER.md
thedotmack Aug 19, 2025
a03e281
Update claudia-server/examples/javascript/client.js
thedotmack Aug 19, 2025
b7906b6
Update claudia-server/package.json
thedotmack Aug 19, 2025
0d2dc72
Update claudia-server/src/services/project.ts
thedotmack Aug 19, 2025
2460cdc
Update claudia-server/test.sh
thedotmack Aug 19, 2025
f261eea
Update claudia-server/tsconfig.json
thedotmack Aug 19, 2025
940b60f
Merge pull request #8 from thedotmack/coderabbitai/docstrings/07f347a
thedotmack Aug 19, 2025
d1c365a
CodeRabbit Generated Unit Tests: Add comprehensive unit tests for Cla…
coderabbitai[bot] Aug 19, 2025
9b15063
Merge pull request #9 from thedotmack/coderabbitai/utg/940b60f
thedotmack Aug 19, 2025
447e461
Merge pull request #7 from thedotmack/copilot/fix-6
thedotmack Aug 19, 2025
31e2b7e
Merge remote-tracking branch 'origin/main' into pr-275
thedotmack Sep 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor code structure for improved readability and maintainability
  • Loading branch information
thedotmack committed Aug 13, 2025
commit 763b40fced17f404b122b9a250ee63ed5a2f886e
1 change: 1 addition & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"react-markdown": "^9.0.3",
"react-syntax-highlighter": "^15.6.1",
"recharts": "^2.14.1",
"rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0",
"tailwind-merge": "^2.6.0",
"tailwindcss": "^4.1.8",
Expand Down
Binary file added reg-think.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added seq-think.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 116 additions & 9 deletions src/components/StreamMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Card, CardContent } from "@/components/ui/card";
import { cn } from "@/lib/utils";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import rehypeRaw from "rehype-raw";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { getClaudeSyntaxTheme } from "@/lib/claudeSyntaxTheme";
import { useTheme } from "@/hooks";
Expand Down Expand Up @@ -666,10 +667,10 @@ const StreamMessageComponent: React.FC<StreamMessageProps> = ({
</div>

{beforeReminder && (
<div className="ml-6 p-2 bg-background rounded-md border">
<pre className="text-xs font-mono overflow-x-auto whitespace-pre-wrap">
<div className="ml-6 p-2 bg-background rounded-md border prose prose-sm dark:prose-invert max-w-none">
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
{beforeReminder}
</pre>
</ReactMarkdown>
</div>
)}

Expand All @@ -678,10 +679,10 @@ const StreamMessageComponent: React.FC<StreamMessageProps> = ({
</div>

{afterReminder && (
<div className="ml-6 p-2 bg-background rounded-md border">
<pre className="text-xs font-mono overflow-x-auto whitespace-pre-wrap">
<div className="ml-6 p-2 bg-background rounded-md border prose prose-sm dark:prose-invert max-w-none">
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>
{afterReminder}
</pre>
</ReactMarkdown>
</div>
)}
</div>
Expand Down Expand Up @@ -849,6 +850,90 @@ const StreamMessageComponent: React.FC<StreamMessageProps> = ({
);
}

// Check if this is thinking content that should be rendered with markdown
const isThinkingResult = (() => {
if (!content.tool_use_id || typeof contentText !== "string") return false;

// Check if this result came from a thinking-related tool or contains thinking patterns
let isFromThinkingTool = false;

// Search in previous assistant messages for the matching tool_use
if (streamMessages) {
for (let i = streamMessages.length - 1; i >= 0; i--) {
const prevMsg = streamMessages[i];
if (
prevMsg.type === "assistant" &&
prevMsg.message?.content &&
Array.isArray(prevMsg.message.content)
) {
const toolUse = prevMsg.message.content.find(
(c: any) =>
c.type === "tool_use" &&
c.id === content.tool_use_id &&
(c.name?.toLowerCase().includes("thinking") ||
c.name?.toLowerCase().includes("sequential"))
);
if (toolUse) {
isFromThinkingTool = true;
break;
}
}
}
}

// Also check if content looks like thinking content (has markdown patterns)
const hasMarkdownPatterns = contentText.includes('**') ||
contentText.includes('```') ||
contentText.includes('##') ||
contentText.includes('- ') ||
contentText.includes('1. ');

return isFromThinkingTool || hasMarkdownPatterns;
})();

if (isThinkingResult) {
renderedSomething = true;
return (
<div key={idx} className="space-y-2">
<div className="flex items-center gap-2">
<CheckCircle2 className="h-4 w-4 text-purple-500" />
<span className="text-sm font-medium">
Thinking Result
</span>
</div>
<div className="ml-6 p-4 bg-gradient-to-br from-purple-50/80 to-indigo-50/60 dark:from-purple-950/20 dark:to-indigo-950/10 rounded-xl border border-purple-200/40 dark:border-purple-700/20">
<div className="prose prose-sm dark:prose-invert max-w-none">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
components={{
code({ node, inline, className, children, ...props }: any) {
const match = /language-(\w+)/.exec(className || "");
return !inline && match ? (
<SyntaxHighlighter
style={syntaxTheme}
language={match[1]}
PreTag="div"
{...props}
>
{String(children).replace(/\n$/, "")}
</SyntaxHighlighter>
) : (
<code className={className} {...props}>
{children}
</code>
);
},
}}
>
{contentText}
</ReactMarkdown>
</div>
</div>
</div>
);
}

// Handle empty tool results
if (!contentText || contentText.trim() === "") {
renderedSomething = true;
Expand Down Expand Up @@ -880,10 +965,32 @@ const StreamMessageComponent: React.FC<StreamMessageProps> = ({
Tool Result
</span>
</div>
<div className="ml-6 p-2 bg-background rounded-md border">
<pre className="text-xs font-mono overflow-x-auto whitespace-pre-wrap">
<div className="ml-6 p-2 bg-background rounded-md border prose prose-sm dark:prose-invert max-w-none">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
components={{
code({ node, inline, className, children, ...props }: any) {
const match = /language-(\w+)/.exec(className || "");
return !inline && match ? (
<SyntaxHighlighter
style={syntaxTheme}
language={match[1]}
PreTag="div"
{...props}
>
{String(children).replace(/\n$/, "")}
</SyntaxHighlighter>
) : (
<code className={className} {...props}>
{children}
</code>
);
},
}}
>
{contentText}
</pre>
</ReactMarkdown>
</div>
</div>
);
Expand Down
47 changes: 20 additions & 27 deletions src/components/ToolWidgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ import { Card, CardContent } from "@/components/ui/card";
import { detectLinks, makeLinksClickable } from "@/lib/linkDetector";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { getClaudeSyntaxTheme } from "@/lib/claudeSyntaxTheme";
import rehypeRaw from "rehype-raw";
import { open } from "@tauri-apps/plugin-shell";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Input } from "@/components/ui/input";
Expand Down Expand Up @@ -2483,11 +2482,16 @@ export const ThinkingWidget: React.FC<{
signature?: string;
}> = ({ thinking }) => {
const [isExpanded, setIsExpanded] = useState(false);
const { theme } = useTheme();
// theme not needed here

// Process thinking content similar to sequential thinking
const formattedThinking = thinking
.replace(/\\n/g, '\n')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&amp;/g, '&')
.replace(/&quot;/g, '"')
.replace(/&#x27;/g, "'")
.trim();

// Determine if content is long and should be collapsible
Expand Down Expand Up @@ -2543,30 +2547,18 @@ export const ThinkingWidget: React.FC<{
!isExpanded && isLongThinking && "max-h-32 overflow-hidden"
)}>
<div className="text-sm text-slate-700 dark:text-slate-300 leading-relaxed prose prose-sm dark:prose-invert max-w-none">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
components={{
code({ node, inline, className, children, ...props }: any) {
const match = /language-(\w+)/.exec(className || "");
return !inline && match ? (
<SyntaxHighlighter
style={getClaudeSyntaxTheme(theme)}
language={match[1]}
PreTag="div"
{...props}
>
{String(children).replace(/\n$/, "")}
</SyntaxHighlighter>
) : (
<code className={className} {...props}>
{children}
</code>
);
},
}}
>
{formattedThinking}
</ReactMarkdown>
{formattedThinking ? (
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
>
{formattedThinking}
</ReactMarkdown>
) : (
<span className="italic text-slate-500 dark:text-slate-400">
Thinking...
</span>
)}
</div>
{!isExpanded && isLongThinking && (
<div className="text-xs text-purple-600 dark:text-purple-400 italic text-center pt-2 border-t border-purple-200/20 dark:border-purple-700/20">
Expand Down Expand Up @@ -2683,6 +2675,7 @@ export const SequentialThinkingWidget: React.FC<{
{formattedThought ? (
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw]}
components={{
code({ node, inline, className, children, ...props }: any) {
const match = /language-(\w+)/.exec(className || "");
Expand Down