Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix: cherry-pick PR #542 (light mode contrast) + fix TDZ in cliRuntime.ts
diegosouzapw391273449839
diff --git a/src/app/globals.css b/src/app/globals.cssindex 055ec70caf..938e9e2905 100644--- a/src/app/globals.css+++ b/src/app/globals.css@@ -36,10 +36,13 @@/* Light theme */--color-bg: #f9f9fb;--color-bg-alt: #f0f0f5;+ --color-bg-primary: #f9f9fb;+ --color-bg-subtle: #f0f0f5;--color-surface: #ffffff;--color-sidebar: rgba(245, 245, 250, 0.8);--color-border: rgba(0, 0, 0, 0.08);--color-text-main: #1a1a2e;+ --color-text-primary: #1a1a2e;--color-text-muted: #71717a;/* Shadows */@@ -52,10 +55,13 @@/* Dark theme (ClawHub deep) */--color-bg: #0b0e14;--color-bg-alt: #111520;+ --color-bg-primary: #0b0e14;+ --color-bg-subtle: #111520;--color-surface: #161b22;--color-sidebar: rgba(16, 20, 30, 0.8);--color-border: rgba(255, 255, 255, 0.08);--color-text-main: #e6e6ef;+ --color-text-primary: #e6e6ef;--color-text-muted: #a1a1aa;/* Dark shadows */@@ -81,10 +87,13 @@/* Auto-switch colors (use CSS variables from :root/.dark) */--color-bg: var(--color-bg);+ --color-bg-primary: var(--color-bg-primary);+ --color-bg-subtle: var(--color-bg-subtle);--color-surface: var(--color-surface);--color-sidebar: var(--color-sidebar);--color-border: var(--color-border);--color-text-main: var(--color-text-main);+ --color-text-primary: var(--color-text-primary);--color-text-muted: var(--color-text-muted);/* Static colors (for explicit light/dark usage) */diff --git a/src/shared/components/RequestLoggerDetail.tsx b/src/shared/components/RequestLoggerDetail.tsxindex 3db9574178..e6274c78df 100644--- a/src/shared/components/RequestLoggerDetail.tsx+++ b/src/shared/components/RequestLoggerDetail.tsx@@ -36,7 +36,7 @@ function PayloadSection({ title, json, onCopy }) {{copied ? "Copied!" : "Copy"}</button></div>- <pre className="p-4 rounded-xl bg-black/30 border border-border overflow-x-auto text-xs font-mono text-text-primary max-h-[600px] overflow-y-auto leading-relaxed whitespace-pre-wrap break-words">+ <pre className="p-4 rounded-xl bg-black/5 dark:bg-black/30 border border-border overflow-x-auto text-xs font-mono text-text-main max-h-[600px] overflow-y-auto leading-relaxed whitespace-pre-wrap break-words">{json}</pre></div>@@ -138,7 +138,7 @@ export default function RequestLoggerDetail({ log, detail, loading, onClose, onC<span className="px-2 py-0.5 rounded bg-primary/20 text-primary text-xs font-bold">In: {(detail?.tokens?.in || log.tokens?.in || 0).toLocaleString()}</span>- <span className="px-2 py-0.5 rounded bg-emerald-500/20 text-emerald-400 text-xs font-bold">+ <span className="px-2 py-0.5 rounded bg-emerald-500/20 text-emerald-700 dark:text-emerald-400 text-xs font-bold">Out: {(detail?.tokens?.out || log.tokens?.out || 0).toLocaleString()}</span></div>@@ -213,7 +213,7 @@ export default function RequestLoggerDetail({ log, detail, loading, onClose, onC<div><div className="text-[10px] text-text-muted uppercase tracking-wider mb-1">Combo</div>{detail?.comboName || log.comboName ? (- <span className="inline-block px-2.5 py-1 rounded-full text-[10px] font-bold bg-violet-500/20 text-violet-300 border border-violet-500/30">+ <span className="inline-block px-2.5 py-1 rounded-full text-[10px] font-bold bg-violet-500/20 text-violet-700 dark:text-violet-300 border border-violet-500/30">{detail?.comboName || log.comboName}</span>) : (@@ -225,10 +225,12 @@ export default function RequestLoggerDetail({ log, detail, loading, onClose, onC{/* Error Message */}{(detail?.error || log.error) && (<div className="p-4 rounded-xl bg-red-500/10 border border-red-500/30">- <div className="text-[10px] text-red-400 uppercase tracking-wider mb-1 font-bold">+ <div className="text-[10px] text-red-600 dark:text-red-400 uppercase tracking-wider mb-1 font-bold">Error</div>- <div className="text-sm text-red-300 font-mono">{detail?.error || log.error}</div>+ <div className="text-sm text-red-600 dark:text-red-300 font-mono">+ {detail?.error || log.error}+ </div></div>)}diff --git a/src/shared/services/cliRuntime.ts b/src/shared/services/cliRuntime.tsindex 56055a49d8..7332ad956e 100644--- a/src/shared/services/cliRuntime.ts+++ b/src/shared/services/cliRuntime.ts@@ -223,6 +223,41 @@ const isPathWithin = (childPath: string, parentPath: string): boolean => {return normalizedChild.startsWith(parentWithSep);};+const isSafePath = (execPath: string): boolean => {+ if (!execPath || !path.isAbsolute(execPath)) return false;+ if (DANGEROUS_PATH_CHARS.some((c) => execPath.includes(c))) return false;+ // Allow path.sep and path.delimiter — no further character filtering needed+ return true;+};++/**+ * Validate that an environment variable value is a safe, absolute path+ * within acceptable directory trees. Rejects traversal, special chars,+ * and paths outside expected locations.+ */+const validateEnvPath = (value: string | undefined, allowedParents: string[]): string => {+ if (!value) return "";+ const trimmed = value.trim();++ // Reject if not absolute+ if (!path.isAbsolute(trimmed)) return "";++ // Reject dangerous characters (same as isSafePath but applied to env vars)+ if (DANGEROUS_PATH_CHARS.some((c) => trimmed.includes(c))) return "";++ // Reject if contains path traversal segments+ const normalized = path.normalize(trimmed);+ if (normalized.includes("..")) return "";++ // Reject if outside allowed parent directories+ if (allowedParents.length > 0) {+ const withinAllowed = allowedParents.some((parent) => isPathWithin(normalized, parent));+ if (!withinAllowed) return "";+ }++ return normalized;+};+/*** Pre-compute expected parent directories at module startup for performance.* These are the allowed directories for CLI binary installation locations.@@ -259,41 +294,6 @@ const getExpectedParentPaths = (): string[] => {// Cache expected parent paths at module startup (avoid recalculation on every checkKnownPath call)const EXPECTED_PARENT_PATHS = getExpectedParentPaths();-const isSafePath = (execPath: string): boolean => {- if (!execPath || !path.isAbsolute(execPath)) return false;- if (DANGEROUS_PATH_CHARS.some((c) => execPath.includes(c))) return false;- // Allow path.sep and path.delimiter — no further character filtering needed- return true;-};--/**- * Validate that an environment variable value is a safe, absolute path- * within acceptable directory trees. Rejects traversal, special chars,- * and paths outside expected locations.- */-const validateEnvPath = (value: string | undefined, allowedParents: string[]): string => {- if (!value) return "";- const trimmed = value.trim();-- // Reject if not absolute- if (!path.isAbsolute(trimmed)) return "";-- // Reject dangerous characters (same as isSafePath but applied to env vars)- if (DANGEROUS_PATH_CHARS.some((c) => trimmed.includes(c))) return "";-- // Reject if contains path traversal segments- const normalized = path.normalize(trimmed);- if (normalized.includes("..")) return "";-- // Reject if outside allowed parent directories- if (allowedParents.length > 0) {- const withinAllowed = allowedParents.some((parent) => isPathWithin(normalized, parent));- if (!withinAllowed) return "";- }-- return normalized;-};-const getExtraPaths = () =>String(process.env.CLI_EXTRA_PATHS || "").split(path.delimiter)