UNPKG

pyb-ts

Version:

PYB-CLI - Minimal AI Agent with multi-model support and CLI interface

53 lines (52 loc) 1.61 kB
import * as React from "react"; import { Box, Text } from "ink"; import { getTheme } from "@utils/theme"; function categoryForRiskScore(riskScore) { return riskScore >= 70 ? "high" : riskScore >= 30 ? "moderate" : "low"; } function colorSchemeForRiskScoreCategory(category) { const theme = getTheme(); switch (category) { case "low": return { highlightColor: theme.success, textColor: theme.permission }; case "moderate": return { highlightColor: theme.warning, textColor: theme.warning }; case "high": return { highlightColor: theme.error, textColor: theme.error }; } } function textColorForRiskScore(riskScore) { if (riskScore === null) { return getTheme().permission; } const category = categoryForRiskScore(riskScore); return colorSchemeForRiskScoreCategory(category).textColor; } function PermissionRiskScore({ riskScore }) { const category = categoryForRiskScore(riskScore); return /* @__PURE__ */ React.createElement(Text, { color: textColorForRiskScore(riskScore) }, "Risk: ", category); } function PermissionRequestTitle({ title, riskScore }) { return /* @__PURE__ */ React.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React.createElement(Text, { bold: true, color: getTheme().permission }, title), riskScore !== null && /* @__PURE__ */ React.createElement(PermissionRiskScore, { riskScore })); } export { PermissionRequestTitle, PermissionRiskScore, categoryForRiskScore, textColorForRiskScore }; //# sourceMappingURL=PermissionRequestTitle.js.map