mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-07 05:45:39 +08:00
fix: precise Claude SDK denial message detection in deriveToolStatus
This commit is contained in:
@@ -47,11 +47,19 @@ function getToolCategory(toolName: string): string {
|
|||||||
return 'default';
|
return 'default';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Exact denial messages from server/claude-sdk.js — other providers can't reliably signal denial
|
||||||
|
const CLAUDE_DENIAL_MESSAGES = [
|
||||||
|
'user denied tool use',
|
||||||
|
'tool disallowed by settings',
|
||||||
|
'permission request timed out',
|
||||||
|
'permission request cancelled',
|
||||||
|
];
|
||||||
|
|
||||||
function deriveToolStatus(toolResult: any): ToolStatus {
|
function deriveToolStatus(toolResult: any): ToolStatus {
|
||||||
if (!toolResult) return 'running';
|
if (!toolResult) return 'running';
|
||||||
if (toolResult.isError) {
|
if (toolResult.isError) {
|
||||||
const content = String(toolResult.content || '').toLowerCase();
|
const content = String(toolResult.content || '').toLowerCase().trim();
|
||||||
if (content.includes('permission') || content.includes('denied') || content.includes('not allowed')) {
|
if (CLAUDE_DENIAL_MESSAGES.some((msg) => content.includes(msg))) {
|
||||||
return 'denied';
|
return 'denied';
|
||||||
}
|
}
|
||||||
return 'error';
|
return 'error';
|
||||||
|
|||||||
Reference in New Issue
Block a user