⎿
{commandText}
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/GenericToolCall.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/GenericToolCall.tsx
index 17c29a8c..b74c4249 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/GenericToolCall.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/GenericToolCall.tsx
@@ -104,8 +104,16 @@ export const GenericToolCall: React.FC = ({ toolCall }) => {
}
// Short output - compact format
+ const statusFlag: 'success' | 'error' | 'warning' | 'loading' | 'default' =
+ toolCall.status === 'in_progress' || toolCall.status === 'pending'
+ ? 'loading'
+ : 'success';
return (
-
+
{operationText || output}
);
@@ -113,8 +121,16 @@ export const GenericToolCall: React.FC = ({ toolCall }) => {
// Success with files: show operation + file list in compact format
if (locations && locations.length > 0) {
+ const statusFlag: 'success' | 'error' | 'warning' | 'loading' | 'default' =
+ toolCall.status === 'in_progress' || toolCall.status === 'pending'
+ ? 'loading'
+ : 'success';
return (
-
+
);
@@ -122,8 +138,16 @@ export const GenericToolCall: React.FC = ({ toolCall }) => {
// No output - show just the operation
if (operationText) {
+ const statusFlag: 'success' | 'error' | 'warning' | 'loading' | 'default' =
+ toolCall.status === 'in_progress' || toolCall.status === 'pending'
+ ? 'loading'
+ : 'success';
return (
-
+
{operationText}
);
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/Read/ReadToolCall.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/Read/ReadToolCall.tsx
index 4ecd63b2..b848f380 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/Read/ReadToolCall.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/Read/ReadToolCall.tsx
@@ -9,7 +9,10 @@
import type React from 'react';
import type { BaseToolCallProps } from '../shared/types.js';
import { ToolCallContainer } from '../shared/LayoutComponents.js';
-import { groupContent } from '../shared/utils.js';
+import {
+ groupContent,
+ mapToolStatusToContainerStatus,
+} from '../shared/utils.js';
import { FileLink } from '../../ui/FileLink.js';
/**
@@ -23,6 +26,14 @@ export const ReadToolCall: React.FC = ({ toolCall }) => {
// Group content by type
const { errors } = groupContent(content);
+ // Compute container status based on toolCall.status (pending/in_progress -> loading)
+ const containerStatus:
+ | 'success'
+ | 'error'
+ | 'warning'
+ | 'loading'
+ | 'default' = mapToolStatusToContainerStatus(toolCall.status);
+
// Error case: show error
if (errors.length > 0) {
const path = locations?.[0]?.path || '';
@@ -54,7 +65,7 @@ export const ReadToolCall: React.FC = ({ toolCall }) => {
= ({ toolCall }) => {
// Success case with results: show search query + file list
if (locations && locations.length > 0) {
+ const containerStatus = mapToolStatusToContainerStatus(toolCall.status);
// If multiple results, use card layout; otherwise use compact format
if (locations.length > 1) {
return (
@@ -59,8 +64,13 @@ export const SearchToolCall: React.FC = ({ toolCall }) => {
}
// Single result - compact format
return (
-
- {queryText}
+
+ {/* {queryText} */}
→
@@ -69,8 +79,13 @@ export const SearchToolCall: React.FC = ({ toolCall }) => {
// No results - show query only
if (queryText) {
+ const containerStatus = mapToolStatusToContainerStatus(toolCall.status);
return (
-
+
{queryText}
);
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/ThinkToolCall.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/Think/ThinkToolCall.tsx
similarity index 82%
rename from packages/vscode-ide-companion/src/webview/components/toolcalls/ThinkToolCall.tsx
rename to packages/vscode-ide-companion/src/webview/components/toolcalls/Think/ThinkToolCall.tsx
index 251367da..4c49b2cc 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/ThinkToolCall.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/Think/ThinkToolCall.tsx
@@ -7,13 +7,13 @@
*/
import type React from 'react';
-import type { BaseToolCallProps } from './shared/types.js';
+import type { BaseToolCallProps } from '../shared/types.js';
import {
ToolCallContainer,
ToolCallCard,
ToolCallRow,
-} from './shared/LayoutComponents.js';
-import { groupContent } from './shared/utils.js';
+} from '../shared/LayoutComponents.js';
+import { groupContent } from '../shared/utils.js';
/**
* Specialized component for Think tool calls
@@ -56,8 +56,12 @@ export const ThinkToolCall: React.FC = ({ toolCall }) => {
}
// Short thoughts - compact format
+ const status =
+ toolCall.status === 'pending' || toolCall.status === 'in_progress'
+ ? 'loading'
+ : 'default';
return (
-
+
{thoughts}
);
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/TodoWriteToolCall.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/Think/TodoWriteToolCall.tsx
similarity index 92%
rename from packages/vscode-ide-companion/src/webview/components/toolcalls/TodoWriteToolCall.tsx
rename to packages/vscode-ide-companion/src/webview/components/toolcalls/Think/TodoWriteToolCall.tsx
index 26fa1e1d..b74a20fc 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/TodoWriteToolCall.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/Think/TodoWriteToolCall.tsx
@@ -7,10 +7,10 @@
*/
import type React from 'react';
-import type { BaseToolCallProps } from './shared/types.js';
-import { ToolCallContainer } from './shared/LayoutComponents.js';
-import { groupContent, safeTitle } from './shared/utils.js';
-import { CheckboxDisplay } from '../ui/CheckboxDisplay.js';
+import type { BaseToolCallProps } from '../shared/types.js';
+import { ToolCallContainer } from '../shared/LayoutComponents.js';
+import { groupContent, safeTitle } from '../shared/utils.js';
+import { CheckboxDisplay } from '../../ui/CheckboxDisplay.js';
type EntryStatus = 'pending' | 'in_progress' | 'completed';
@@ -20,7 +20,7 @@ interface TodoEntry {
}
const mapToolStatusToBullet = (
- status: import('./shared/types.js').ToolCallStatus,
+ status: import('../shared/types.js').ToolCallStatus,
): 'success' | 'error' | 'warning' | 'loading' | 'default' => {
switch (status) {
case 'completed':
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/WriteToolCall.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/Write/WriteToolCall.tsx
similarity index 86%
rename from packages/vscode-ide-companion/src/webview/components/toolcalls/WriteToolCall.tsx
rename to packages/vscode-ide-companion/src/webview/components/toolcalls/Write/WriteToolCall.tsx
index c5d4a534..58a5841e 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/WriteToolCall.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/Write/WriteToolCall.tsx
@@ -7,10 +7,13 @@
*/
import type React from 'react';
-import type { BaseToolCallProps } from './shared/types.js';
-import { ToolCallContainer } from './shared/LayoutComponents.js';
-import { groupContent } from './shared/utils.js';
-import { FileLink } from '../ui/FileLink.js';
+import type { BaseToolCallProps } from '../shared/types.js';
+import { ToolCallContainer } from '../shared/LayoutComponents.js';
+import {
+ groupContent,
+ mapToolStatusToContainerStatus,
+} from '../shared/utils.js';
+import { FileLink } from '../../ui/FileLink.js';
/**
* Specialized component for Write tool calls
@@ -79,10 +82,11 @@ export const WriteToolCall: React.FC = ({ toolCall }) => {
if (locations && locations.length > 0) {
const path = locations[0].path;
const lineCount = writeContent.split('\n').length;
+ const containerStatus = mapToolStatusToContainerStatus(toolCall.status);
return (
= ({ toolCall }) => {
// Fallback: show generic success
if (textOutputs.length > 0) {
+ const containerStatus = mapToolStatusToContainerStatus(toolCall.status);
return (
-
+
{textOutputs.join('\n')}
);
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/index.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/index.tsx
index 3ba0be4f..37350a20 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/index.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/index.tsx
@@ -11,15 +11,14 @@ import type { BaseToolCallProps } from './shared/types.js';
import { shouldShowToolCall } from './shared/utils.js';
import { GenericToolCall } from './GenericToolCall.js';
import { ReadToolCall } from './Read/ReadToolCall.js';
-import { WriteToolCall } from './WriteToolCall.js';
+import { WriteToolCall } from './Write/WriteToolCall.js';
import { EditToolCall } from './Edit/EditToolCall.js';
import { ExecuteToolCall as BashExecuteToolCall } from './Bash/Bash.js';
import { ExecuteToolCall } from './Execute/Execute.js';
import { UpdatedPlanToolCall } from './UpdatedPlan/UpdatedPlanToolCall.js';
import { ExecuteNodeToolCall } from './ExecuteNode/ExecuteNodeToolCall.js';
-import { SearchToolCall } from './SearchToolCall.js';
-import { ThinkToolCall } from './ThinkToolCall.js';
-import { TodoWriteToolCall } from './TodoWriteToolCall.js';
+import { SearchToolCall } from './Search/SearchToolCall.js';
+import { ThinkToolCall } from './Think/ThinkToolCall.js';
/**
* Factory function that returns the appropriate tool call component based on kind
@@ -69,7 +68,10 @@ export const getToolCallComponent = (
case 'updated_plan':
case 'updatedplan':
case 'todo_write':
+ case 'update_todos':
+ case 'todowrite':
return UpdatedPlanToolCall;
+ // return TodoWriteToolCall;
case 'search':
case 'grep':
@@ -81,18 +83,6 @@ export const getToolCallComponent = (
case 'thinking':
return ThinkToolCall;
- case 'todowrite':
- return TodoWriteToolCall;
- // case 'todo_write':
- case 'update_todos':
- return TodoWriteToolCall;
-
- // Add more specialized components as needed
- // case 'fetch':
- // return FetchToolCall;
- // case 'delete':
- // return DeleteToolCall;
-
default:
// Fallback to generic component
return GenericToolCall;
diff --git a/packages/vscode-ide-companion/src/webview/components/toolcalls/shared/LayoutComponents.tsx b/packages/vscode-ide-companion/src/webview/components/toolcalls/shared/LayoutComponents.tsx
index 2d54c5b2..b9ee02ed 100644
--- a/packages/vscode-ide-companion/src/webview/components/toolcalls/shared/LayoutComponents.tsx
+++ b/packages/vscode-ide-companion/src/webview/components/toolcalls/shared/LayoutComponents.tsx
@@ -9,6 +9,7 @@
import type React from 'react';
import { FileLink } from '../../ui/FileLink.js';
+import { isDevelopmentMode } from '../../../utils/envUtils.js';
import './LayoutComponents.css';
/**
@@ -53,12 +54,6 @@ export const ToolCallContainer: React.FC = ({
{label}
- {/* TODO: for 调试 */}
- {_toolCallId && (
-
- [{_toolCallId.slice(-8)}]
-
- )}
{labelSuffix}
{children && (
@@ -66,6 +61,13 @@ export const ToolCallContainer: React.FC = ({
{children}