|
|
@@ -579,7 +579,11 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
await this.postMessageToWebview({ type: "listApiConfig", listApiConfig }),
|
|
|
])
|
|
|
})
|
|
|
- .catch(console.error)
|
|
|
+ .catch((error) =>
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error list api configuration: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ ),
|
|
|
+ )
|
|
|
|
|
|
break
|
|
|
case "newTask":
|
|
|
@@ -702,8 +706,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
this.cline.abortTask()
|
|
|
await pWaitFor(() => this.cline === undefined || this.cline.didFinishAborting, {
|
|
|
timeout: 3_000,
|
|
|
- }).catch(() => {
|
|
|
- console.error("Failed to abort task")
|
|
|
+ }).catch((error) => {
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Failed to abort task ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
})
|
|
|
if (this.cline) {
|
|
|
// 'abandoned' will prevent this cline instance from affecting future cline instance gui. this may happen if its hanging on a streaming request
|
|
|
@@ -739,7 +745,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
try {
|
|
|
await this.mcpHub?.restartConnection(message.text!)
|
|
|
} catch (error) {
|
|
|
- console.error(`Failed to retry connection for ${message.text}:`, error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Failed to retry connection for ${message.text}: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
@@ -751,7 +759,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
message.alwaysAllow!,
|
|
|
)
|
|
|
} catch (error) {
|
|
|
- console.error(`Failed to toggle auto-approve for tool ${message.toolName}:`, error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Failed to toggle auto-approve for tool ${message.toolName}: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
@@ -759,7 +769,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
try {
|
|
|
await this.mcpHub?.toggleServerDisabled(message.serverName!, message.disabled!)
|
|
|
} catch (error) {
|
|
|
- console.error(`Failed to toggle MCP server ${message.serverName}:`, error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Failed to toggle MCP server ${message.serverName}: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
}
|
|
|
break
|
|
|
}
|
|
|
@@ -839,7 +851,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
await this.updateGlobalState("customSupportPrompts", updatedPrompts)
|
|
|
await this.postStateToWebview()
|
|
|
} catch (error) {
|
|
|
- console.error("Error update support prompt:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error update support prompt: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to update support prompt")
|
|
|
}
|
|
|
break
|
|
|
@@ -861,7 +875,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
await this.updateGlobalState("customSupportPrompts", updatedPrompts)
|
|
|
await this.postStateToWebview()
|
|
|
} catch (error) {
|
|
|
- console.error("Error reset support prompt:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error reset support prompt: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to reset support prompt")
|
|
|
}
|
|
|
break
|
|
|
@@ -1026,7 +1042,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
text: enhancedPrompt,
|
|
|
})
|
|
|
} catch (error) {
|
|
|
- console.error("Error enhancing prompt:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error enhancing prompt: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to enhance prompt")
|
|
|
await this.postMessageToWebview({
|
|
|
type: "enhancedPrompt",
|
|
|
@@ -1082,7 +1100,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
mode: message.mode,
|
|
|
})
|
|
|
} catch (error) {
|
|
|
- console.error("Error getting system prompt:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error getting system prompt: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to get system prompt")
|
|
|
}
|
|
|
break
|
|
|
@@ -1096,7 +1116,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
commits,
|
|
|
})
|
|
|
} catch (error) {
|
|
|
- console.error("Error searching commits:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error searching commits: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to search commits")
|
|
|
}
|
|
|
}
|
|
|
@@ -1116,7 +1138,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
|
|
|
await this.postStateToWebview()
|
|
|
} catch (error) {
|
|
|
- console.error("Error create new api configuration:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error create new api configuration: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to create api configuration")
|
|
|
}
|
|
|
}
|
|
|
@@ -1139,7 +1163,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
|
|
|
await this.postStateToWebview()
|
|
|
} catch (error) {
|
|
|
- console.error("Error create new api configuration:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error create new api configuration: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to create api configuration")
|
|
|
}
|
|
|
}
|
|
|
@@ -1158,7 +1184,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
|
|
|
await this.postStateToWebview()
|
|
|
} catch (error) {
|
|
|
- console.error("Error load api configuration:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error load api configuration: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to load api configuration")
|
|
|
}
|
|
|
}
|
|
|
@@ -1194,7 +1222,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
|
|
|
await this.postStateToWebview()
|
|
|
} catch (error) {
|
|
|
- console.error("Error delete api configuration:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error delete api configuration: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to delete api configuration")
|
|
|
}
|
|
|
}
|
|
|
@@ -1205,7 +1235,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
await this.updateGlobalState("listApiConfigMeta", listApiConfig)
|
|
|
this.postMessageToWebview({ type: "listApiConfig", listApiConfig })
|
|
|
} catch (error) {
|
|
|
- console.error("Error get list api configuration:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error get list api configuration: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage("Failed to get list api configuration")
|
|
|
}
|
|
|
break
|
|
|
@@ -1236,7 +1268,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
try {
|
|
|
await this.mcpHub?.updateServerTimeout(message.serverName, message.timeout)
|
|
|
} catch (error) {
|
|
|
- console.error(`Failed to update timeout for ${message.serverName}:`, error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Failed to update timeout for ${message.serverName}: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
vscode.window.showErrorMessage(`Failed to update server timeout`)
|
|
|
}
|
|
|
}
|
|
|
@@ -1477,7 +1511,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
const models = await vscode.lm.selectChatModels({})
|
|
|
return models || []
|
|
|
} catch (error) {
|
|
|
- console.error("Error fetching VS Code LM models:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error fetching VS Code LM models: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
return []
|
|
|
}
|
|
|
}
|
|
|
@@ -1520,7 +1556,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
throw new Error("Invalid response from OpenRouter API")
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.error("Error exchanging code for API key:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error exchanging code for API key: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
throw error
|
|
|
}
|
|
|
|
|
|
@@ -1550,7 +1588,9 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
throw new Error("Invalid response from Glama API")
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.error("Error exchanging code for API key:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error exchanging code for API key: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
throw error
|
|
|
}
|
|
|
|
|
|
@@ -1637,12 +1677,14 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
models[rawModel.id] = modelInfo
|
|
|
}
|
|
|
} else {
|
|
|
- console.error("Invalid response from Glama API")
|
|
|
+ this.outputChannel.appendLine("Invalid response from Glama API")
|
|
|
}
|
|
|
await fs.writeFile(glamaModelsFilePath, JSON.stringify(models))
|
|
|
- console.log("Glama models fetched and saved", models)
|
|
|
+ this.outputChannel.appendLine(`Glama models fetched and saved: ${JSON.stringify(models, null, 2)}`)
|
|
|
} catch (error) {
|
|
|
- console.error("Error fetching Glama models:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error fetching Glama models: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
await this.postMessageToWebview({ type: "glamaModels", glamaModels: models })
|
|
|
@@ -1760,12 +1802,14 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|
|
models[rawModel.id] = modelInfo
|
|
|
}
|
|
|
} else {
|
|
|
- console.error("Invalid response from OpenRouter API")
|
|
|
+ this.outputChannel.appendLine("Invalid response from OpenRouter API")
|
|
|
}
|
|
|
await fs.writeFile(openRouterModelsFilePath, JSON.stringify(models))
|
|
|
- console.log("OpenRouter models fetched and saved", models)
|
|
|
+ this.outputChannel.appendLine(`OpenRouter models fetched and saved: ${JSON.stringify(models, null, 2)}`)
|
|
|
} catch (error) {
|
|
|
- console.error("Error fetching OpenRouter models:", error)
|
|
|
+ this.outputChannel.appendLine(
|
|
|
+ `Error fetching OpenRouter models: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`,
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
await this.postMessageToWebview({ type: "openRouterModels", openRouterModels: models })
|