mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-09 17:29:12 +00:00
* feat(agent-core): strengthen the language-matching rule in the default system prompt * chore: refine changeset wording * fix(kaos): enrich PATH from the user's login shell at startup When kimi-code is launched from a context that skipped the user's shell profile (GUI launchers, non-login parent shells), process.env.PATH misses entries like /opt/homebrew/bin, so commands spawned by the Bash tool cannot find user-installed tools such as gh. LocalKaos.create() now probes the user's login shell once ($SHELL -l -c env, 5s timeout, memoised) and appends the missing PATH entries to process.env.PATH. Existing entries keep their order and priority; probe failures silently leave PATH untouched. Windows is skipped: the problem is specific to POSIX login-shell profiles. * fix(kaos): fall back to the account login shell when $SHELL is unset launchd/daemon launches can leave $SHELL unset or blank — the very contexts whose PATH is impoverished — so the login-shell PATH probe would give up exactly where it matters most. Resolve the shell from the OS user database (os.userInfo().shell) before giving up; lookups that throw (uid without a database entry) or yield nologin shells degrade silently as before. * fix(kaos): preserve empty PATH components when merging login-shell PATH POSIX command lookup treats an empty PATH component (leading colon, trailing colon, or double colon) as the current directory. The merge previously filtered those out of the current PATH and rewrote the value even when nothing was appended, silently dropping cwd lookup for users who rely on it. Keep the current PATH string verbatim as the prefix, append only the missing login-shell entries, and skip the env write entirely when the login shell contributes nothing — an unset PATH stays unset, a set PATH is never rewritten. Empty login-shell components are still never imported. * fix(kaos): only import absolute login-shell PATH entries A `.` or relative component in the login-shell PATH is cwd-dependent lookup with another spelling, and LocalKaos runs commands from arbitrary workspace directories — importing one would let a command name resolve from an untrusted project cwd. Tighten the merge's skip condition from "empty" to "not absolute", which subsumes the empty-component check. * fix(kaos): invoke the login-shell probe's env by absolute path A bare `env` inside `$SHELL -l -c` resolves through the inherited PATH from the workspace cwd. If that PATH carries a cwd-dependent component (which the merge deliberately preserves), a repo-planted `env` binary would run automatically at session startup and could feed the probe an arbitrary PATH. /usr/bin/env is guaranteed on mainstream POSIX systems and also bypasses profile function shadowing. |
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| CHANGELOG.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| vitest.config.ts | ||