import React, { useState } from 'react'; import { usePluginLogs } from '../../../application/state/usePluginLogs'; import { useI18n } from '../../../application/i18n/I18nProvider'; import { Button } from '../../ui/button'; import { ConfirmDialog } from '../../ui/confirm-dialog'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '../../ui/dialog'; import { SettingRow, Toggle } from '../settings-ui'; /** Host settings row; detailed controls stay inside the standard host dialog. */ export function PluginLogSettings() { const { t, resolvedLocale } = useI18n(); const zh = resolvedLocale.startsWith('zh'); const { status, error, busy, run } = usePluginLogs(); const [open, setOpen] = useState(false); const [confirmVerbose, setConfirmVerbose] = useState(false); const title = zh ? '本地插件日志' : 'Local plugin logs'; const saveLabel = zh ? '将宿主审计日志保存到本地' : 'Save host audit logs locally'; const verboseLabel = zh ? '包含插件详细诊断文字' : 'Include verbose plugin text'; const disclosure = zh ? '插件编写的日志文字可能包含敏感数据。截断和字段过滤不能保证任意文字安全。只为排查问题临时开启,导出前请检查。重启应用后自动关闭详细日志。' : 'Plugin-authored text may contain sensitive data. Truncation and field filtering cannot make arbitrary text safe. Enable temporarily for troubleshooting and review files before sharing. Verbose diagnostics turn off after app restart.'; return