import React from 'react'; import { Input } from '../../ui/input'; import { LabelWithTooltip } from '../../ui/label-with-tooltip'; import { Collapsible } from '../../ui/collapsible'; import type { AgentConfig } from '@dexto/core'; import { TOOL_CONFIRMATION_MODES, ALLOWED_TOOLS_STORAGE_TYPES, DEFAULT_TOOL_CONFIRMATION_MODE, DEFAULT_ALLOWED_TOOLS_STORAGE, } from '@dexto/core'; type ToolConfirmationConfig = NonNullable; interface ToolConfirmationSectionProps { value: ToolConfirmationConfig; onChange: (value: ToolConfirmationConfig) => void; errors?: Record; open?: boolean; onOpenChange?: (open: boolean) => void; errorCount?: number; sectionErrors?: string[]; } export function ToolConfirmationSection({ value, onChange, errors = {}, open, onOpenChange, errorCount = 0, sectionErrors = [], }: ToolConfirmationSectionProps) { const handleChange = (updates: Partial) => { onChange({ ...value, ...updates }); }; const updateAllowedToolsStorage = (type: 'memory' | 'storage') => { onChange({ ...value, allowedToolsStorage: type, }); }; return (
{/* Confirmation Mode */}
Confirmation Mode

{value.mode === 'manual' ? 'Require explicit approval before executing tools' : value.mode === 'auto-deny' ? 'Automatically deny all tool executions' : 'Automatically approve tool executions'}

{/* Timeout */} {value.mode === 'manual' && (
Timeout (seconds) handleChange({ timeout: e.target.value ? parseInt(e.target.value, 10) : undefined, }) } min="1" placeholder="e.g., 60" aria-invalid={!!errors['toolConfirmation.timeout']} /> {errors['toolConfirmation.timeout'] && (

{errors['toolConfirmation.timeout']}

)}
)} {/* Allowed Tools Storage */}
Allowed Tools Storage
); }