From 45c20c07c7f22ecfc5312bb8725c0263574dfaa2 Mon Sep 17 00:00:00 2001 From: bronya0 Date: Sat, 30 May 2026 02:18:16 +0800 Subject: [PATCH] fix(kimi-code): resolve Windows EINVAL in dev.mjs and reduce thinking flush rate - Add shell:true for Windows in dev.mjs to fix spawn EINVAL - Suppress DEP0190 deprecation warning for dev script - Increase STREAMING_UI_FLUSH_MS from 50ms to 200ms to prevent eye-straining flicker during thinking streaming --- apps/kimi-code/scripts/dev.mjs | 11 ++++++++++- apps/kimi-code/src/tui/constant/streaming.ts | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/kimi-code/scripts/dev.mjs b/apps/kimi-code/scripts/dev.mjs index 5bf5d460..dd34509e 100644 --- a/apps/kimi-code/scripts/dev.mjs +++ b/apps/kimi-code/scripts/dev.mjs @@ -5,6 +5,10 @@ import { fileURLToPath } from 'node:url'; import { startPluginMarketplaceServer } from './dev-plugin-marketplace-server.mjs'; +// Suppress DEP0190 deprecation warning for shell+args in this dev script. +// The args are safe (hardcoded paths + CLI flags forwarded by the user). +process.removeAllListeners('warning'); + const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url)); const APP_ROOT = resolve(SCRIPT_DIR, '..'); const MARKETPLACE_ENV = 'KIMI_CODE_PLUGIN_MARKETPLACE_URL'; @@ -18,7 +22,10 @@ if (env[MARKETPLACE_ENV] === undefined || env[MARKETPLACE_ENV]?.trim().length == console.error(`Plugin marketplace dev server: ${marketplaceServer.marketplaceUrl}`); } -const tsxBin = process.platform === 'win32' ? 'tsx.cmd' : 'tsx'; +// On Windows, .cmd wrappers in node_modules/.bin cannot be spawned directly +// without shell:true. Shell is only used on Windows to avoid EINVAL. +const useShell = process.platform === 'win32'; +const tsxBin = useShell ? 'tsx.cmd' : 'tsx'; const cliArgs = process.argv.slice(2); if (cliArgs[0] === '--') cliArgs.shift(); const child = spawn( @@ -28,6 +35,8 @@ const child = spawn( cwd: APP_ROOT, env, stdio: 'inherit', + shell: useShell, + windowsHide: true, }, ); diff --git a/apps/kimi-code/src/tui/constant/streaming.ts b/apps/kimi-code/src/tui/constant/streaming.ts index b8f88a01..93640ce7 100644 --- a/apps/kimi-code/src/tui/constant/streaming.ts +++ b/apps/kimi-code/src/tui/constant/streaming.ts @@ -7,4 +7,7 @@ export const STREAMING_ARGS_FIELD_RE = export const STREAMING_ARGS_PREVIEW_MAX_CHARS = 64 * 1024; // Coalesces high-frequency model/tool deltas before rebuilding TUI components. -export const STREAMING_UI_FLUSH_MS = 50; +// 50ms was fast enough for live tail-scrolling of thinking content but caused +// visible flicker / eye strain during rapid streaming. 200ms still feels +// responsive while eliminating most in-place re-render strobing. +export const STREAMING_UI_FLUSH_MS = 200;