import { CheckCircle2, TriangleAlert } from 'lucide-react' import React from 'react' import ReactMarkdown from 'react-markdown' import { isDark } from '../../../../utils/theme' import { DefaultLayout } from '../../../components/DefaultLayout' import type { PosterProps } from '../../../types/ctx' import type { RuntimeReportData } from './types' /** * `#kkk版本` 运行环境诊断海报。 * * 面向手机端看图场景:整幅统一底色 + 多色弥散光 + 高对比离散噪点层,内容单列纵向排布、 * 不使用卡片容器,靠大留白与字号层级分区,超大实心版本号作为第一视觉中心。 * 深色主题为紫罗兰 → 品红 → 琥珀橙弥散;浅色主题为 #271151 / #9754c7 / #deacf5 同色系紫,避免多色对撞。 */ export const RuntimeReport: React.FC> = React.memo((props) => { const { data } = props const dark = isDark(props.ctx) const releaseLabel = data.identity.releaseType.toLowerCase() === 'stable' ? '正式版' : data.identity.releaseType.toLowerCase() === 'preview' ? '预览版' : data.identity.releaseType const buildStatus = data.build.state === 'matched' ? { label: '构建信息一致', icon: , color: '#22c55e' } : data.build.state === 'mismatched' ? { label: '构建信息不一致', icon: , color: '#f59e0b' } : { label: '未找到构建信息', icon: , color: '#94a3b8' } const palette = dark ? { background: '#0d0a1c', glowPrimary: 'rgba(139, 92, 246, 0.34)', glowSecondary: 'rgba(217, 70, 239, 0.22)', glowWarm: 'rgba(251, 146, 60, 0.20)', versionGlow: 'radial-gradient(ellipse at center, rgba(167, 139, 250, 0.30) 0%, rgba(240, 171, 252, 0.15) 50%, transparent 75%)', versionInk: '#f6f3ff', versionAccent: '#fdba74', accentText: '#c4b5fd', pillBg: 'rgba(139, 92, 246, 0.12)', pillBorder: 'rgba(196, 181, 253, 0.35)', pillText: '#c4b5fd', statusDot: 'linear-gradient(112deg, #c4b5fd 0%, #f0abfc 48%, #fdba74 100%)', dotGlow: '0 0 28px rgba(192, 132, 252, 0.85)', barAccent: 'linear-gradient(112deg, #c4b5fd 0%, #f0abfc 48%, #fdba74 100%)', meterGradient: 'linear-gradient(112deg, #c4b5fd 0%, #f0abfc 48%, #fdba74 100%)', bgWord: '#ede9fe', noteHeading: '#f5f3ff', noteBody: 'rgba(240, 237, 255, 0.72)', noteStrong: '#ffffff', noteCodeBg: 'rgba(139, 92, 246, 0.16)', noteCodeText: '#c4b5fd', noteLink: '#c4b5fd', noteBulletClass: 'before:bg-violet-400/70', warnText: '#fbbf24', noiseOpacity: 0.16 } : { background: '#f7f1fe', glowPrimary: 'rgba(151, 84, 199, 0.30)', glowSecondary: 'rgba(222, 172, 245, 0.55)', glowWarm: 'rgba(250, 211, 22, 0.38)', versionGlow: 'radial-gradient(ellipse at center, rgba(222, 172, 245, 0.50) 0%, rgba(250, 211, 22, 0.16) 55%, transparent 78%)', versionInk: '#271151', versionAccent: '#9754c7', accentText: '#9754c7', pillBg: 'rgba(151, 84, 199, 0.10)', pillBorder: 'rgba(151, 84, 199, 0.30)', pillText: '#7a3db0', statusDot: '#9754c7', dotGlow: '0 0 26px rgba(151, 84, 199, 0.55)', barAccent: 'linear-gradient(90deg, #271151 0%, #9754c7 100%)', meterGradient: 'linear-gradient(90deg, #271151 0%, #9754c7 100%)', bgWord: '#271151', noteHeading: '#271151', noteBody: 'rgba(39, 17, 81, 0.70)', noteStrong: '#271151', noteCodeBg: 'rgba(151, 84, 199, 0.10)', noteCodeText: '#7a3db0', noteLink: '#7a3db0', noteBulletClass: 'before:bg-[#9754c7]/70', warnText: '#8a5a06', noiseOpacity: 0.12 } return (
RUNTIME
{/* 高对比离散噪点层(与 Help 模板同源:feComponentTransfer 离散化为纯黑白颗粒) */}
运行诊断 · RUNTIME REPORT
{releaseLabel}

运行环境

插件、框架与本地宿主的精简诊断快照

插件版本
v {data.identity.pluginVersion}
{data.identity.pluginName} {buildStatus.icon} {buildStatus.label}
构建 {data.build.shortCommitHash ?? '未知'} · {data.build.buildTime ?? '时间未知'}
环境摘要
操作系统
{data.runtime.os}
{data.runtime.platform} · {data.runtime.arch}
当前适配器
{data.adapter.name}
v{data.adapter.version}
Koishi 版本
v{data.identity.karinVersion}
Node.js 版本
{data.runtime.nodeVersion}
内存占用
{data.resources.memoryUsagePercent} {data.resources.usedMemory} / {data.resources.totalMemory}
处理器
{data.resources.cpuModel}
{data.resources.cpuCores} 核心
仅展示当前版本

本版变更

{data.releaseNotes.available ? (
(

{children}

), h3: ({ children }) => (

{children}

), p: ({ children }) => (

{children}

), ul: ({ children }) =>
    {children}
, ol: ({ children }) =>
    {children}
, li: ({ children }) => (
  • {children}
  • ), strong: ({ children }) => ( {children} ), code: ({ children }) => ( {children} ), a: ({ children }) => ( {children} ) }} > {data.releaseNotes.markdown}
    ) : (
    当前构建没有可用的变更日志
    环境摘要仍可正常用于问题定位。
    )}
    ) }) RuntimeReport.displayName = 'RuntimeReport' export default RuntimeReport