Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion apps/kimi-code/scripts/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(
Expand All @@ -28,6 +35,8 @@ const child = spawn(
cwd: APP_ROOT,
env,
stdio: 'inherit',
shell: useShell,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid shell:true with forwarded CLI args

On Windows this switches the dev launcher to shell: true while still passing the hard-coded tsx flags and forwarded cliArgs as an args array. Node 24's DEP0190 warning for this exact mode says the arguments are not escaped and are only concatenated, so common invocations such as pnpm dev -- --prompt "hello world" or any option value containing spaces/metacharacters can be split or interpreted by cmd.exe before reaching the CLI. Use a Windows-safe executable path or quote/escape the command instead of forwarding user args through the shell.

Useful? React with 👍 / 👎.

windowsHide: true,
},
);

Expand Down
5 changes: 4 additions & 1 deletion apps/kimi-code/src/tui/constant/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;