Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
86 changes: 34 additions & 52 deletions bun.lock

Large diffs are not rendered by default.

71 changes: 26 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"name": "@coder/cmux",
"name": "cmux",
"version": "0.3.0",
"description": "cmux - coder multiplexer",
"author": "Coder",
"main": "dist/main.js",
"bin": {
"cmux": "dist/main.js"
},
"license": "AGPL-3.0-only",
"repository": {
"type": "git",
"url": "https://github.com/coder/cmux.git"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "make dev",
"prebuild:main": "./scripts/generate-version.sh",
Expand Down Expand Up @@ -46,29 +35,44 @@
"dependencies": {
"@ai-sdk/anthropic": "^2.0.29",
"@ai-sdk/openai": "^2.0.52",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"ai": "^5.0.72",
"ai-tokenizer": "^1.0.3",
"chalk": "^5.6.2",
"cors": "^2.8.5",
"cmdk": "^1.0.0",
"crc-32": "^1.2.2",
"diff": "^8.0.2",
"disposablestack": "^1.1.7",
"electron-updater": "^6.6.2",
"express": "^5.1.0",
"escape-html": "^1.0.3",
"jsonc-parser": "^3.3.1",
"lru-cache": "^11.2.2",
"markdown-it": "^14.1.0",
"mermaid": "^11.12.0",
"mime-types": "^3.0.1",
"minimist": "^1.2.8",
"posthog-js": "^1.276.0",
"react": "^18.2.0",
"react-compiler-runtime": "^1.0.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.2.0",
"react-markdown": "^10.1.0",
"rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"shiki": "^3.13.0",
"source-map-support": "^0.5.21",
"undici": "^7.16.0",
"write-file-atomic": "^6.0.0",
"ws": "^8.18.3",
"zod": "^4.1.11",
"zod-to-json-schema": "^3.24.6"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.13.5",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@eslint/js": "^9.36.0",
"@playwright/test": "^1.56.0",
"@storybook/addon-essentials": "^8.6.14",
Expand All @@ -87,6 +91,7 @@
"@types/jest": "^30.0.0",
"@types/katex": "^0.16.7",
"@types/markdown-it": "^14.1.2",
"@types/mime-types": "^3.0.1",
"@types/minimist": "^1.2.5",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
Expand All @@ -97,8 +102,8 @@
"@typescript/native-preview": "^7.0.0-dev.20251014.1",
"@vitejs/plugin-react": "^4.0.0",
"babel-plugin-react-compiler": "^1.0.0",
"cmdk": "^1.0.0",
"concurrently": "^8.2.0",
"cors": "^2.8.5",
"dotenv": "^17.2.3",
"electron": "^38.2.1",
"electron-builder": "^24.6.0",
Expand All @@ -107,44 +112,20 @@
"eslint": "^9.36.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"escape-html": "^1.0.3",
"express": "^5.1.0",
"jest": "^30.1.3",
"markdown-it": "^14.1.0",
"mermaid": "^11.12.0",
"playwright": "^1.56.0",
"posthog-js": "^1.276.0",
"prettier": "^3.6.2",
"react": "^18.2.0",
"react-compiler-runtime": "^1.0.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.2.0",
"react-markdown": "^10.1.0",
"rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"shiki": "^3.13.0",
"storybook": "^8.6.14",
"ts-jest": "^29.4.4",
"tsc-alias": "^1.8.16",
"typescript": "^5.1.3",
"typescript-eslint": "^8.45.0",
"vite": "^4.4.0",
"vite-plugin-svgr": "^4.5.0",
"vite-plugin-top-level-await": "^1.6.0"
"vite-plugin-top-level-await": "^1.6.0",
"ws": "^8.18.3"
},
"files": [
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.wasm",
"dist/**/*.html",
"dist/**/*.css",
"dist/assets/**/*",
"README.md",
"LICENSE"
],
"build": {
"appId": "com.cmux.app",
"productName": "cmux",
Expand Down
46 changes: 35 additions & 11 deletions src/components/tools/FileReadToolCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ const InfoValue = styled.span`
word-break: break-all;
`;

const ImagePreview = styled.img`
max-width: 100%;
max-height: 400px;
border-radius: 3px;
display: block;
margin: 8px 0;
`;

interface FileReadToolCallProps {
args: FileReadToolArgs;
result?: FileReadToolResult;
Expand Down Expand Up @@ -170,7 +178,10 @@ export const FileReadToolCall: React.FC<FileReadToolCallProps> = ({
<Tooltip>file_read</Tooltip>
</TooltipWrapper>
<FilePathText>{filePath}</FilePathText>
{result && result.success && parsedContent && (
{result && result.success && result.mime_type?.startsWith("image/") && (
<MetadataText>{result.mime_type}</MetadataText>
)}
{result && result.success && parsedContent && !result.mime_type?.startsWith("image/") && (
<MetadataText>
read {formatBytes(parsedContent.actualBytes)} of {formatBytes(result.file_size)}
</MetadataText>
Expand Down Expand Up @@ -210,19 +221,32 @@ export const FileReadToolCall: React.FC<FileReadToolCallProps> = ({
</DetailSection>
)}

{result.success && result.content && parsedContent && (
{result.success && result.mime_type?.startsWith("image/") && (
<DetailSection>
<DetailLabel>Content</DetailLabel>
<ContentBlock>
<LineNumbers>
{parsedContent.lineNumbers.map((lineNum, i) => (
<div key={i}>{lineNum}</div>
))}
</LineNumbers>
<ContentText>{parsedContent.actualContent}</ContentText>
</ContentBlock>
<DetailLabel>Image Preview</DetailLabel>
<ImagePreview
src={`data:${result.mime_type};base64,${result.content}`}
alt={args.filePath}
/>
</DetailSection>
)}

{result.success &&
result.content &&
!result.mime_type?.startsWith("image/") &&
parsedContent && (
<DetailSection>
<DetailLabel>Content</DetailLabel>
<ContentBlock>
<LineNumbers>
{parsedContent.lineNumbers.map((lineNum, i) => (
<div key={i}>{lineNum}</div>
))}
</LineNumbers>
<ContentText>{parsedContent.actualContent}</ContentText>
</ContentBlock>
</DetailSection>
)}
</>
)}

Expand Down
6 changes: 5 additions & 1 deletion src/services/aiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,13 @@ export class AIService extends EventEmitter {
log.debug_obj(`${workspaceId}/2a_redacted_messages.json`, redactedForProvider);

// Convert CmuxMessage to ModelMessage format using Vercel AI SDK utility
// Pass earlyTools so convertToModelMessages can use toModelOutput for tool results
// (earlyTools has stub config but same tool definitions with toModelOutput functions)
// Type assertion needed because CmuxMessage has custom tool parts for interrupted tools
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
const modelMessages = convertToModelMessages(redactedForProvider as any);
const modelMessages = convertToModelMessages(redactedForProvider as any, {
tools: earlyTools,
});
log.debug_obj(`${workspaceId}/2_model_messages.json`, modelMessages);

// Apply ModelMessage transforms based on provider requirements
Expand Down
Loading