mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-19 09:53:48 +00:00
feature: Ask User Question implementation for Claude Code & upgrade claude agent sdk to 0.1.71 to support the tool
This commit is contained in:
25
src/components/chat/tools/configs/permissionPanelRegistry.ts
Normal file
25
src/components/chat/tools/configs/permissionPanelRegistry.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { ComponentType } from 'react';
|
||||
import type { PendingPermissionRequest } from '../../types/types';
|
||||
|
||||
export interface PermissionPanelProps {
|
||||
request: PendingPermissionRequest;
|
||||
onDecision: (
|
||||
requestIds: string | string[],
|
||||
decision: { allow?: boolean; message?: string; updatedInput?: unknown },
|
||||
) => void;
|
||||
}
|
||||
|
||||
const registry: Record<string, ComponentType<PermissionPanelProps>> = {};
|
||||
|
||||
export function registerPermissionPanel(
|
||||
toolName: string,
|
||||
component: ComponentType<PermissionPanelProps>,
|
||||
): void {
|
||||
registry[toolName] = component;
|
||||
}
|
||||
|
||||
export function getPermissionPanel(
|
||||
toolName: string,
|
||||
): ComponentType<PermissionPanelProps> | null {
|
||||
return registry[toolName] || null;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export interface ToolDisplayConfig {
|
||||
// Collapsible config
|
||||
title?: string | ((input: any) => string);
|
||||
defaultOpen?: boolean;
|
||||
contentType?: 'diff' | 'markdown' | 'file-list' | 'todo-list' | 'text' | 'task';
|
||||
contentType?: 'diff' | 'markdown' | 'file-list' | 'todo-list' | 'text' | 'task' | 'question-answer';
|
||||
getContentProps?: (input: any, helpers?: any) => any;
|
||||
actionButton?: 'file-button' | 'none';
|
||||
};
|
||||
@@ -35,7 +35,7 @@ export interface ToolDisplayConfig {
|
||||
title?: string | ((result: any) => string);
|
||||
defaultOpen?: boolean;
|
||||
// Special result handlers
|
||||
contentType?: 'markdown' | 'file-list' | 'todo-list' | 'text' | 'success-message' | 'task';
|
||||
contentType?: 'markdown' | 'file-list' | 'todo-list' | 'text' | 'success-message' | 'task' | 'question-answer';
|
||||
getMessage?: (result: any) => string;
|
||||
getContentProps?: (result: any) => any;
|
||||
};
|
||||
@@ -453,6 +453,34 @@ export const TOOL_CONFIGS: Record<string, ToolDisplayConfig> = {
|
||||
}
|
||||
},
|
||||
|
||||
// ============================================================================
|
||||
// INTERACTIVE TOOLS
|
||||
// ============================================================================
|
||||
|
||||
AskUserQuestion: {
|
||||
input: {
|
||||
type: 'collapsible',
|
||||
title: (input: any) => {
|
||||
const count = input.questions?.length || 0;
|
||||
const hasAnswers = input.answers && Object.keys(input.answers).length > 0;
|
||||
if (count === 1) {
|
||||
const header = input.questions[0]?.header || 'Question';
|
||||
return hasAnswers ? `${header} — answered` : header;
|
||||
}
|
||||
return hasAnswers ? `${count} questions — answered` : `${count} questions`;
|
||||
},
|
||||
defaultOpen: true,
|
||||
contentType: 'question-answer',
|
||||
getContentProps: (input: any) => ({
|
||||
questions: input.questions || [],
|
||||
answers: input.answers || {}
|
||||
}),
|
||||
},
|
||||
result: {
|
||||
hideOnSuccess: true
|
||||
}
|
||||
},
|
||||
|
||||
// ============================================================================
|
||||
// PLAN TOOLS
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user