Skip to content

Commit 8e0d3e1

Browse files
authored
feat: add web ui for kimi cli (#775)
1 parent 5d26dc9 commit 8e0d3e1

File tree

179 files changed

+40018
-43
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+40018
-43
lines changed

.github/workflows/ci-kimi-cli.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ jobs:
7878
PYTHONUTF8: "1"
7979
run: make test-kimi-cli
8080

81+
- name: Set up Node.js (web build)
82+
if: matrix.python-version == '3.14'
83+
uses: actions/setup-node@v4
84+
with:
85+
node-version: "20"
86+
cache: "npm"
87+
cache-dependency-path: web/package-lock.json
88+
8189
- name: Build standalone binary
8290
if: matrix.python-version == '3.14'
8391
env:

.github/workflows/release-kimi-cli.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
- runner: windows-2022
5858
target: x86_64-pc-windows-msvc
5959
runs-on: ${{ matrix.runner }}
60+
env:
61+
KIMI_WEB_STRICT_VERSION: "1"
62+
KIMI_WEB_EXPECT_VERSION: ${{ github.ref_name }}
6063
steps:
6164
- name: Checkout repository
6265
uses: actions/checkout@v4
@@ -76,6 +79,13 @@ jobs:
7679
with:
7780
version: "0.8.5"
7881

82+
- name: Set up Node.js (web build)
83+
uses: actions/setup-node@v4
84+
with:
85+
node-version: "20"
86+
cache: "npm"
87+
cache-dependency-path: web/package-lock.json
88+
7989
- name: Prepare building environment
8090
run: make prepare-build
8191

@@ -457,6 +467,9 @@ jobs:
457467
name: Publish Python package
458468
needs: validate
459469
runs-on: ubuntu-latest
470+
env:
471+
KIMI_WEB_STRICT_VERSION: "1"
472+
KIMI_WEB_EXPECT_VERSION: ${{ github.ref_name }}
460473
steps:
461474
- name: Checkout repository
462475
uses: actions/checkout@v4
@@ -472,6 +485,13 @@ jobs:
472485
with:
473486
version: "0.8.5"
474487

488+
- name: Set up Node.js (web build)
489+
uses: actions/setup-node@v4
490+
with:
491+
node-version: "20"
492+
cache: "npm"
493+
cache-dependency-path: web/package-lock.json
494+
475495
- name: Build distributions
476496
run: make build-kimi-cli
477497

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@ result-*
3030

3131
# macOS files
3232
.DS_Store
33+
34+
35+
node_modules/
36+
static/
37+
.memo/

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Only write entries that are worth mentioning to users.
1111

1212
## Unreleased
1313

14+
- Web: Add new Web UI for browser-based interaction
15+
- CLI: Add `kimi web` subcommand to launch the Web UI server
16+
- Build: Add Web UI build process integrated into Makefile
17+
- Core: Add internal web worker command for session management
18+
1419
## 1.3 (2026-01-28)
1520

1621
- Auth: Fix authentication issue during agent turns

Makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ prepare-build: download-deps ## Sync dependencies for releases without workspace
2222
@echo "==> Syncing dependencies for release builds (no sources)"
2323
@uv sync --all-extras --all-packages --no-sources
2424

25-
.PHONY: format format-kimi-cli format-kosong format-pykaos format-kimi-sdk
26-
format: format-kimi-cli format-kosong format-pykaos format-kimi-sdk ## Auto-format all workspace packages with ruff.
25+
.PHONY: format format-kimi-cli format-kosong format-pykaos format-kimi-sdk format-web
26+
format: format-kimi-cli format-kosong format-pykaos format-kimi-sdk format-web ## Auto-format all workspace packages.
2727
format-kimi-cli: ## Auto-format Kimi Code CLI sources with ruff.
2828
@echo "==> Formatting Kimi Code CLI sources"
2929
@uv run ruff check --fix
@@ -40,6 +40,14 @@ format-kimi-sdk: ## Auto-format kimi-sdk sources with ruff.
4040
@echo "==> Formatting kimi-sdk sources"
4141
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ruff check --fix
4242
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk ruff format
43+
format-web: ## Auto-format web sources with npm run format.
44+
@echo "==> Formatting web sources"
45+
@if command -v npm >/dev/null 2>&1; then \
46+
npm --prefix web run format; \
47+
else \
48+
echo "npm not found. Install Node.js (npm) to run web formatting."; \
49+
exit 1; \
50+
fi
4351

4452
.PHONY: check check-kimi-cli check-kosong check-pykaos check-kimi-sdk
4553
check: check-kimi-cli check-kosong check-pykaos check-kimi-sdk ## Run linting and type checks for all packages.
@@ -86,8 +94,8 @@ test-kimi-sdk: ## Run kimi-sdk tests.
8694
@uv run --project sdks/kimi-sdk --directory sdks/kimi-sdk pytest tests -vv
8795

8896
.PHONY: build build-kimi-cli build-kosong build-pykaos build-kimi-sdk build-bin build-bin-onedir
89-
build: build-kimi-cli build-kosong build-pykaos build-kimi-sdk ## Build Python packages for release.
90-
build-kimi-cli: ## Build the kimi-cli and kimi-code sdists and wheels.
97+
build: build-web build-kimi-cli build-kosong build-pykaos build-kimi-sdk ## Build Python packages for release.
98+
build-kimi-cli: build-web ## Build the kimi-cli and kimi-code sdists and wheels.
9199
@echo "==> Building kimi-cli distributions"
92100
@uv build --package kimi-cli --no-sources --out-dir dist
93101
@echo "==> Building kimi-code distributions"
@@ -101,12 +109,15 @@ build-pykaos: ## Build the pykaos sdist and wheel.
101109
build-kimi-sdk: ## Build the kimi-sdk sdist and wheel.
102110
@echo "==> Building kimi-sdk distributions"
103111
@uv build --package kimi-sdk --no-sources --out-dir dist/kimi-sdk
104-
build-bin: ## Build the standalone executable with PyInstaller (one-file mode).
112+
build-web: ## Build web UI and sync into kimi-cli package.
113+
@echo "==> Building web UI"
114+
@python scripts/build_web.py
115+
build-bin: build-web ## Build the standalone executable with PyInstaller (one-file mode).
105116
@echo "==> Building PyInstaller binary (one-file)"
106117
@uv run pyinstaller kimi.spec
107118
@mkdir -p dist/onefile
108119
@if [ -f dist/kimi.exe ]; then mv dist/kimi.exe dist/onefile/; elif [ -f dist/kimi ]; then mv dist/kimi dist/onefile/; fi
109-
build-bin-onedir: ## Build the standalone executable with PyInstaller (one-dir mode).
120+
build-bin-onedir: build-web ## Build the standalone executable with PyInstaller (one-dir mode).
110121
@echo "==> Building PyInstaller binary (one-dir)"
111122
@rm -rf dist/onedir dist/kimi
112123
@uv run pyinstaller kimi.spec

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,14 @@ make test # run tests
158158
make test-kimi-cli # run Kimi Code CLI tests only
159159
make test-kosong # run kosong tests only
160160
make test-pykaos # run pykaos tests only
161+
make build-web # build the web UI and sync it into the package (requires Node.js/npm)
161162
make build # build python packages
162163
make build-bin # build standalone binary
163164
make help # show all make targets
164165
```
165166

167+
Note: `make build` and `make build-bin` automatically run `make build-web` to embed the web UI.
168+
166169
## Contributing
167170

168171
We welcome contributions to Kimi Code CLI! Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.

docs/.vitepress/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default withMermaid(defineConfig({
7777
{ text: 'kimi acp 子命令', link: '/zh/reference/kimi-acp' },
7878
{ text: 'kimi mcp 子命令', link: '/zh/reference/kimi-mcp' },
7979
{ text: 'kimi term 子命令', link: '/zh/reference/kimi-term' },
80+
{ text: 'kimi web 子命令', link: '/zh/reference/kimi-web' },
8081
{ text: '斜杠命令', link: '/zh/reference/slash-commands' },
8182
{ text: '键盘快捷键', link: '/zh/reference/keyboard' },
8283
],
@@ -156,6 +157,7 @@ export default withMermaid(defineConfig({
156157
{ text: 'kimi acp Subcommand', link: '/en/reference/kimi-acp' },
157158
{ text: 'kimi mcp Subcommand', link: '/en/reference/kimi-mcp' },
158159
{ text: 'kimi term Subcommand', link: '/en/reference/kimi-term' },
160+
{ text: 'kimi web Subcommand', link: '/en/reference/kimi-web' },
159161
{ text: 'Slash Commands', link: '/en/reference/slash-commands' },
160162
{ text: 'Keyboard Shortcuts', link: '/en/reference/keyboard' },
161163
],

docs/en/configuration/config-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,4 @@ When configuring the Kimi Code platform using the `/setup` command, search and f
160160

161161
If `~/.kimi/config.toml` doesn't exist but `~/.kimi/config.json` exists, Kimi Code CLI will automatically migrate the JSON configuration to TOML format and backup the original file as `config.json.bak`.
162162

163-
Configuration files specified via `--config-file` are parsed based on file extension. Configuration content passed via `--config` is first attempted as JSON, then falls back to TOML if that fails.
163+
`--config-file` specified configuration files are parsed based on file extension. `--config` passed configuration content is first attempted as JSON, then falls back to TOML if that fails.

docs/en/configuration/data-locations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ Session data is grouped by working directory and stored under `~/.kimi/sessions/
6363

6464
### `context.jsonl`
6565

66-
Context history file, stores the session's message history in JSONL format. Each line is a message (user input, model response, tool calls, etc.).
66+
Context history file, stores the session's message history in JSON Lines (JSONL) format. Each line is a message (user input, model response, tool calls, etc.).
6767

6868
Kimi Code CLI uses this file to restore session context when using `--continue` or `--session`.
6969

7070
### `wire.jsonl`
7171

72-
Wire message log file, stores Wire events during the session in JSONL format. Used for session replay and extracting session titles.
72+
Wire message log file, stores Wire events during the session in JSON Lines (JSONL) format. Used for session replay and extracting session titles.
7373

7474
## Input history
7575

docs/en/customization/wire-mode.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ interface JSONRPCError {
7373
Legacy clients can skip this request and send `prompt` directly.
7474
:::
7575

76-
- **Direction**: ClientAgent
76+
- **Direction**: clientagent
7777
- **Type**: Request (requires response)
7878

7979
Optional handshake request for negotiating protocol version, submitting external tool definitions, and retrieving the slash command list.
@@ -233,7 +233,7 @@ If no turn is in progress:
233233
234234
### `event`
235235
236-
- **Direction**: AgentClient
236+
- **Direction**: agentclient
237237
- **Type**: Notification (no response needed)
238238
239239
Events emitted by the agent during a turn. No `id` field, client doesn't need to respond.
@@ -254,7 +254,7 @@ interface EventParams {
254254

255255
### `request`
256256

257-
- **Direction**: AgentClient
257+
- **Direction**: agentclient
258258
- **Type**: Request (requires response)
259259

260260
Requests from the agent to the client, used for approval confirmation or external tool calls. The client must respond before the agent can continue execution.

0 commit comments

Comments
 (0)