feat(cli-tools): add effort level configuration for Claude CLI

- Introduced effort level options (low, medium, high) in the CLI tool settings.
- Updated the SettingsPage and CliToolCard components to handle effort level updates.
- Enhanced CLI command options to accept effort level via --effort parameter.
- Modified backend routes to support effort level updates in tool configurations.
- Created a new CliViewerToolbar component for improved CLI viewer interactions.
- Implemented logic to manage and display execution statuses and layouts in the CLI viewer.
This commit is contained in:
catlog22
2026-02-17 20:02:44 +08:00
parent 41c6f07ee0
commit c67bf86244
27 changed files with 696 additions and 241 deletions

View File

@@ -21,6 +21,7 @@ import { remoteNotificationService } from '../core/services/remote-notification-
import {
addPendingQuestion,
getPendingQuestion,
updatePendingQuestion,
removePendingQuestion,
getAllPendingQuestions,
clearAllPendingQuestions,
@@ -451,19 +452,30 @@ export async function execute(params: AskQuestionParams): Promise<ToolResult<Ask
// Generate surface ID
const surfaceId = params.surfaceId || `question-${question.id}-${Date.now()}`;
// Check if this question was restored from disk (e.g., after MCP restart)
const existingPending = getPendingQuestion(question.id);
// Create promise for answer
const resultPromise = new Promise<AskQuestionResult>((resolve, reject) => {
// Store pending question
// Store pending question with real resolve/reject
const pendingQuestion: PendingQuestion = {
id: question.id,
surfaceId,
question,
timestamp: Date.now(),
timestamp: existingPending?.timestamp || Date.now(),
timeout: params.timeout || DEFAULT_TIMEOUT_MS,
resolve,
reject,
};
addPendingQuestion(pendingQuestion);
// If question exists (restored from disk), update it with real resolve/reject
// This fixes the "no promise attached" issue when MCP restarts
if (existingPending) {
updatePendingQuestion(question.id, pendingQuestion);
console.log(`[AskQuestion] Updated restored question "${question.id}" with real resolve/reject`);
} else {
addPendingQuestion(pendingQuestion);
}
// Set timeout
setTimeout(() => {