Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ export class ClineProvider
openRouterImageGenerationSelectedModel,
openRouterUseMiddleOutTransform,
featureRoomoteControlEnabled,
debug: vscode.workspace.getConfiguration(Package.name).get<boolean>("debug", false),
}
}

Expand Down
57 changes: 57 additions & 0 deletions src/core/webview/webviewMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3043,6 +3043,63 @@ export const webviewMessageHandler = async (
})
break
}

case "openDebugApiHistory":
case "openDebugUiHistory": {
const currentTask = provider.getCurrentTask()
if (!currentTask) {
vscode.window.showErrorMessage("No active task to view history for")
break
}

try {
const { getTaskDirectoryPath } = await import("../../utils/storage")
const globalStoragePath = provider.contextProxy.globalStorageUri.fsPath
const taskDirPath = await getTaskDirectoryPath(globalStoragePath, currentTask.taskId)

const fileName =
message.type === "openDebugApiHistory" ? "api_conversation_history.json" : "ui_messages.json"
const sourceFilePath = path.join(taskDirPath, fileName)

// Check if file exists
if (!(await fileExistsAtPath(sourceFilePath))) {
vscode.window.showErrorMessage(`File not found: ${fileName}`)
break
}

// Read the source file
const content = await fs.readFile(sourceFilePath, "utf8")
let jsonContent: unknown

try {
jsonContent = JSON.parse(content)
} catch {
vscode.window.showErrorMessage(`Failed to parse ${fileName}`)
break
}

// Prettify the JSON
const prettifiedContent = JSON.stringify(jsonContent, null, 2)

// Create a temporary file
const tmpDir = os.tmpdir()
const timestamp = Date.now()
const tempFileName = `roo-debug-${message.type === "openDebugApiHistory" ? "api" : "ui"}-${currentTask.taskId.slice(0, 8)}-${timestamp}.json`
const tempFilePath = path.join(tmpDir, tempFileName)

await fs.writeFile(tempFilePath, prettifiedContent, "utf8")

// Open the temp file in VS Code
const doc = await vscode.workspace.openTextDocument(tempFilePath)
await vscode.window.showTextDocument(doc, { preview: true })
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error)
provider.log(`Error opening debug history: ${errorMessage}`)
vscode.window.showErrorMessage(`Failed to open debug history: ${errorMessage}`)
}
break
}

default: {
// console.log(`Unhandled message type: ${message.type}`)
//
Expand Down
5 changes: 5 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@
"minimum": 1,
"maximum": 200,
"description": "%settings.codeIndex.embeddingBatchSize.description%"
},
"roo-cline.debug": {
"type": "boolean",
"default": false,
"description": "%settings.debug.description%"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/package.nls.ca.json

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

3 changes: 2 additions & 1 deletion src/package.nls.de.json

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

3 changes: 2 additions & 1 deletion src/package.nls.es.json

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

3 changes: 2 additions & 1 deletion src/package.nls.fr.json

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

3 changes: 2 additions & 1 deletion src/package.nls.hi.json

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

3 changes: 2 additions & 1 deletion src/package.nls.id.json

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

3 changes: 2 additions & 1 deletion src/package.nls.it.json

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

3 changes: 2 additions & 1 deletion src/package.nls.ja.json

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

3 changes: 2 additions & 1 deletion src/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@
"settings.useAgentRules.description": "Enable loading of AGENTS.md files for agent-specific rules (see https://agent-rules.org/)",
"settings.apiRequestTimeout.description": "Maximum time in seconds to wait for API responses (0 = no timeout, 1-3600s, default: 600s). Higher values are recommended for local providers like LM Studio and Ollama that may need more processing time.",
"settings.newTaskRequireTodos.description": "Require todos parameter when creating new tasks with the new_task tool",
"settings.codeIndex.embeddingBatchSize.description": "The batch size for embedding operations during code indexing. Adjust this based on your API provider's limits. Default is 60."
"settings.codeIndex.embeddingBatchSize.description": "The batch size for embedding operations during code indexing. Adjust this based on your API provider's limits. Default is 60.",
"settings.debug.description": "Enable debug mode to show additional buttons for viewing API conversation history and UI messages as prettified JSON in temporary files."
}
3 changes: 2 additions & 1 deletion src/package.nls.ko.json

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

3 changes: 2 additions & 1 deletion src/package.nls.nl.json

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

3 changes: 2 additions & 1 deletion src/package.nls.pl.json

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

3 changes: 2 additions & 1 deletion src/package.nls.pt-BR.json

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

Loading
Loading