Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Only write entries that are worth mentioning to users.

## Unreleased

- Core: Set process title to "Kimi Code" (visible in `ps` / Activity Monitor / terminal tab title) and label web worker subprocesses as "kimi-code-worker"

## 1.14.0 (2026-02-26)

- Shell: Make FetchURL tool's URL parameter a clickable hyperlink in the terminal
Expand Down
2 changes: 2 additions & 0 deletions docs/en/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This page documents the changes in each Kimi Code CLI release.

## Unreleased

- Core: Set process title to "Kimi Code" (visible in `ps` / Activity Monitor / terminal tab title) and label web worker subprocesses as "kimi-code-worker"

## 1.14.0 (2026-02-26)

- Shell: Make FetchURL tool's URL parameter a clickable hyperlink in the terminal
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/release-notes/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## 未发布

- Core:将进程标题设置为 "Kimi Code"(在 `ps` / 活动监视器 / 终端标签页标题中可见),并将 Web Worker 子进程标记为 "kimi-code-worker"

## 1.14.0 (2026-02-26)

- Shell:在终端中将 `FetchURL` 工具的 URL 参数显示为可点击的超链接
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies = [
"scalar-fastapi>=1.5.0",
"websockets>=14.0",
"keyring>=25.7.0",
"setproctitle>=1.3.0",
]

[dependency-groups]
Expand Down
8 changes: 8 additions & 0 deletions src/kimi_cli/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ def kimi(
] = None,
):
"""Kimi, your next CLI agent."""
from kimi_cli.utils.proctitle import init_process_name

init_process_name("Kimi Code")

if ctx.invoked_subcommand is not None:
return # skip rest if a subcommand is invoked

Expand Down Expand Up @@ -745,6 +749,10 @@ def web_worker(session_id: str) -> None:
"""Run web worker subprocess (internal)."""
from uuid import UUID

from kimi_cli.utils.proctitle import set_process_title

set_process_title("kimi-code-worker")

from kimi_cli.app import enable_logging
from kimi_cli.web.runner.worker import run_worker

Expand Down
33 changes: 33 additions & 0 deletions src/kimi_cli/utils/proctitle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from __future__ import annotations

import sys


def set_process_title(title: str) -> None:
"""Set the OS-level process title visible in ps/top/terminal panels."""
try:
import setproctitle

setproctitle.setproctitle(title)
except ImportError:
pass


def set_terminal_title(title: str) -> None:
"""Set the terminal tab/window title via ANSI OSC escape sequence.

Only writes when stderr is a TTY to avoid polluting piped output.
"""
if not sys.stderr.isatty():
return
try:
sys.stderr.write(f"\033]0;{title}\007")
sys.stderr.flush()
except OSError:
pass


def init_process_name(name: str = "Kimi Code") -> None:
"""Initialize process name: OS process title + terminal tab title."""
set_process_title(name)
set_terminal_title(name)
2 changes: 1 addition & 1 deletion src/kimi_cli/utils/pyinstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from PyInstaller.utils.hooks import collect_data_files, collect_submodules

hiddenimports = collect_submodules("kimi_cli.tools")
hiddenimports = collect_submodules("kimi_cli.tools") + ["setproctitle"]
datas = (
collect_data_files(
"kimi_cli",
Expand Down
4 changes: 4 additions & 0 deletions src/kimi_cli/web/runner/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ async def run_worker(session_id: UUID) -> None:

def main() -> None:
"""Entry point for the worker subprocess."""
from kimi_cli.utils.proctitle import set_process_title

set_process_title("kimi-code-worker")

if len(sys.argv) < 2:
print("Usage: python -m kimi_cli.web.runner.worker <session_id>", file=sys.stderr)
sys.exit(1)
Expand Down
1 change: 1 addition & 0 deletions tests/utils/test_pyinstaller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,6 @@ def test_pyinstaller_hiddenimports():
"kimi_cli.tools.web",
"kimi_cli.tools.web.fetch",
"kimi_cli.tools.web.search",
"setproctitle",
]
)
60 changes: 60 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading