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
15 changes: 15 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,18 @@ condition = "AND"
paths = ['''(^|/)packages/webui/test/trajectory/store\.test\.mjs$''']
regexTarget = "match"
regexes = ['''^api_key=abcdef123456'$''']

[[rules.allowlists]]
description = "RFC 6455 sample WebSocket key (the sample nonce) in the documented handshake example, not a credential"
condition = "AND"
paths = ['''(^|/)packages/webui/docs/HTTPS-REVERSE-PROXY(\.zh-CN)?\.md$''']
regexTarget = "match"
regexes = ['''Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==''']

[[rules.allowlists]]
description = "RFC 6455 sample WebSocket key (the sample nonce) constant in the handshake test, not a credential"
condition = "AND"
paths = ['''(^|/)packages/webui/test/lib-ws-server\.test\.js$''']
regexTarget = "match"
regexes = ['''CLIENT_KEY = "dGhlIHNhbXBsZSBub25jZQ=="''']

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ From a source checkout use `pnpm mcode-web`. Without `--port` the server starts
on 18090 and moves to the next free port when 18090 is taken, printing the URL it
bound; an explicit `--port` is pinned and never moves.

The Web UI streams chat over SSE, renders tool calls and permission prompts, manages sessions and workspaces (with a modal directory picker over `/api/fs/*`, confined to allowed workspace roots), shows the current model in the selector, and mounts a read-only session **trajectory studio** at `/trajectory/`. It binds loopback by default; LAN exposure is explicit opt-in and token-gated. See [packages/webui](packages/webui/README.md) and [docs/webui.md](docs/webui.md).
The Web UI streams chat over WebSocket, renders tool calls and permission prompts, manages sessions and workspaces (with a modal directory picker over `/api/fs/*`, confined to allowed workspace roots), shows the current model in the selector, and mounts a read-only session **trajectory studio** at `/trajectory/`. It binds loopback by default; LAN exposure is explicit opt-in and token-gated. See [packages/webui](packages/webui/README.md) and [docs/webui.md](docs/webui.md).

The Web UI originated as the community **mcode-webui** plugin and was migrated into this repository as a first-class package — the people and history behind it are recorded in [co-builders.md](co-builders.md).

Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ mcode webui --port 8123 # 自定义端口,启动后打印访问地址
18090 被占用就换下一个空闲端口,并打印实际绑定的地址;显式传入的 `--port`
会被钉住,不会自动后移。

Web UI 通过 SSE 流式输出对话,渲染工具调用与权限确认,管理会话与工作区(含模态目录选择器,接口限制在允许的工作区根内),模型选择器常显当前模型,并在 `/trajectory/` 挂载只读的会话**轨迹工作室**。默认仅绑定回环地址;局域网暴露需显式开启并通过令牌鉴权。详见 [packages/webui](packages/webui/README.md) 与 [docs/webui.md](docs/webui.md)。
Web UI 通过 WebSocket 流式输出对话,渲染工具调用与权限确认,管理会话与工作区(含模态目录选择器,接口限制在允许的工作区根内),模型选择器常显当前模型,并在 `/trajectory/` 挂载只读的会话**轨迹工作室**。默认仅绑定回环地址;局域网暴露需显式开启并通过令牌鉴权。详见 [packages/webui](packages/webui/README.md) 与 [docs/webui.md](docs/webui.md)。

Web UI 源自社区的 **mcode-webui** 插件,现已作为一等公民包迁入本仓库——其人员与历史脉络记录于 [co-builders.md](co-builders.md)。

Expand Down
6 changes: 3 additions & 3 deletions co-builders.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This file is the memory of that journey.

| Handle | Role |
|---|---|
| **Wzdhehe** | Original author and lead of mcode-webui. Designed and built the entire v0.5 → v1.1.1 line (~100+ commits): the zero-dependency HTTP/SSE server, the ACP-over-stdio engine wiring, the SPA frontend, the token/LAN security surface, and the bilingual UI. Submitted [PR #16]. |
| **Wzdhehe** | Original author and lead of mcode-webui. Designed and built the entire v0.5 → v1.1.1 line (~100+ commits): the zero-dependency HTTP server and streaming push transport, the ACP-over-stdio engine wiring, the SPA frontend, the token/LAN security surface, and the bilingual UI. Submitted [PR #16]. |
| **modacker** (commits as **moc**, `moc@sgmov.com`) | External reviewer turned co-author. Tested PR #16 on macOS and fixed the db-path blocker (round 5, [PR #23]); authored the round-8 CORS tightening and cross-origin token-leak fix ([PR #31]); authored **v2.0.0 — 工业化** ([PR #55]), the industrial rewrite that closed the v1 line; synced v2.0.0 back to the standalone mirror. |
| **Hahaha** (`Mjc39672@gmail.com`) | Maintainer of the standalone mirror Wzdhehe/Mcode-webui with merge rights; merged the round-8 security fix (mirror PR #6). |
| **weekbin** | Author of **mcode-trajectory-studio** ([PR #56]): the read-only session-trajectory inspector (7 MCP tools + studio panel) over the runtime SQLite projection, including its redaction and containment design. |
Expand Down Expand Up @@ -71,13 +71,13 @@ Trajectory 视图的能力,落到一个 MCode Agent Plugin 上".
queue panel, ACP model picker, cross-workspace session search; four ACP
surface probe rounds documented; layout consolidated to a single root tree.
- **2026-09-19** — **v1.1.1**: live-test fixes (activity-aware prompt idle
timeout, throttled per-chunk SSE push).
timeout, throttled per-chunk streaming push).

### Plugin era — v2 line

- **2026-09-20** — **v2.0.0 “工业化”** ([PR #55], author modacker, closes #16):
append-only event stream with SHA-256 hash chain, per-request `authorize()`
gate (fail-closed audit), independent anomaly SSE channel, write-ahead
gate (fail-closed audit), independent anomaly REST snapshot channel, write-ahead
intent/outcome events, interaction/feedback subsystem split, rate limiting,
virtual chat list, session export (Markdown/JSON), quota forecast, token
onboarding modal, local SBOM + CVE gates, loopback-default bind with
Expand Down
2 changes: 1 addition & 1 deletion docs/webui.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The canonical disclosure is [`packages/webui/references/SECURITY-NOTES.md`](../p

## Architecture

See [`packages/webui/docs/ARCHITECTURE.md`](../packages/webui/docs/ARCHITECTURE.md) for the runtime topology, request lifecycle, and SSE contract. In short: `server.js` bootstraps an HTTP server; `server/router.js` applies the gate chain (CORS → origin/CSRF → LAN → token → rate limit → read-only) and dispatches to `server/routes/*`; `server/lib/*` holds one-concern modules; `acp.mjs` is the ACP client spawning the engine; `public/` is the SPA.
See [`packages/webui/docs/ARCHITECTURE.md`](../packages/webui/docs/ARCHITECTURE.md) for the runtime topology, request lifecycle, and WebSocket event-stream contract. In short: `server.js` bootstraps an HTTP server; `server/router.js` applies the gate chain (CORS → origin/CSRF → LAN → token → rate limit → read-only) and dispatches to `server/routes/*`; `server/lib/*` holds one-concern modules; `acp.mjs` is the ACP client spawning the engine; `public/` is the SPA.

## Trajectory studio

Expand Down
2 changes: 1 addition & 1 deletion docs/webui.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ node dist/cli.js webui --host 0.0.0.0 --no-open # PORT defaults to 18080

## 架构

运行时拓扑、请求生命周期和 SSE 契约见 [`packages/webui/docs/ARCHITECTURE.md`](../packages/webui/docs/ARCHITECTURE.md)。简言之:`server.js` 引导一个 HTTP 服务器;`server/router.js` 应用门禁链(CORS → origin/CSRF → LAN → token → rate limit → read-only)并分发到 `server/routes/*`;`server/lib/*` 存放单一职责模块;`acp.mjs` 是生成引擎的 ACP 客户端;`public/` 是 SPA。
运行时拓扑、请求生命周期和 WebSocket 事件流契约见 [`packages/webui/docs/ARCHITECTURE.md`](../packages/webui/docs/ARCHITECTURE.md)。简言之:`server.js` 引导一个 HTTP 服务器;`server/router.js` 应用门禁链(CORS → origin/CSRF → LAN → token → rate limit → read-only)并分发到 `server/routes/*`;`server/lib/*` 存放单一职责模块;`acp.mjs` 是生成引擎的 ACP 客户端;`public/` 是 SPA。

## 轨迹工作室

Expand Down
14 changes: 7 additions & 7 deletions packages/webui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**English** | [简体中文](README.zh-CN.md)

> **Browser frontend for the MiniMax Code agent runtime.**
> Streams `mcode acp` / `mcode exec` sessions over HTTP/SSE. Zero npm
> Streams `mcode acp` / `mcode exec` sessions over HTTP/WebSocket. Zero npm
> dependencies; runs on Node 22.19+.

The Web UI is a first-class part of this repository — the same engine that
Expand All @@ -29,7 +29,7 @@ node packages/webui/server.js

The server binds loopback by default. LAN exposure is explicit opt-in
(`--host` / `HOST` env, or the persisted `lanBind` setting). On first start a
token is generated and delivered to the browser over SSE; non-local requests
token is generated and delivered to the browser over the event stream; non-local requests
must carry `?token=<value>` or `Authorization: Bearer <value>`.

Recommended on non-loopback networks:
Expand All @@ -44,7 +44,7 @@ mcode webui --host 0.0.0.0

| File | What |
|------|------|
| `server.js` | HTTP + SSE server bootstrap |
| `server.js` | HTTP + WebSocket server bootstrap |
| `server/` | Router, route modules, and pure libs (`server/lib/`) |
| `acp.mjs` | `mcode acp` JSON-RPC client (spawns the engine over stdio) |
| `public/` | Static frontend SPA |
Expand All @@ -64,7 +64,7 @@ Real captures taken against a running v2.0.0 server — see
| # | What it shows |
|---|---|
| 1 | **Startup** — empty chat view on first launch |
| 2 | **Mid-stream chat** — history restored, SSE deltas in flight, tok/s meter |
| 2 | **Mid-stream chat** — history restored, stream deltas in flight, tok/s meter |
| 3 | **Settings panel** — Appearance / Language / LAN Access toggles |
| 4 | **Chat input** — prompt typed, send/stop affordances, `/` and `@file` hints |
| 5 | **Post-send + tool call** — assistant streaming, tool-call block auto-collapse |
Expand All @@ -79,7 +79,7 @@ IDE integrations match on these strings.

| Capability | One-line |
|---|---|
| `chat-streaming` | SSE deltas from `mcode acp` rendered token-by-token |
| `chat-streaming` | stream deltas from `mcode acp` rendered token-by-token |
| `tool-execution` | Bash / Read / Write / Edit forwarded from acp `tool_call` events |
| `plan-mode` | Plan review modal with `agree` / `skip` / `add context` options |
| `ask-user-tool` | 2-4 option question modal with `Other` free-text fallback |
Expand Down Expand Up @@ -125,7 +125,7 @@ degrades to sequential scans.
- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — runtime topology, request lifecycle, module contracts
- [`docs/DESKTOP-ARCHITECTURE.md`](docs/DESKTOP-ARCHITECTURE.md) — measured desktop and TUI architecture reference
- [`docs/DESIGN.md`](docs/DESIGN.md) — design system of record (tokens, theme protocol, layout) and the desktop alignment contract
- [`docs/API.md`](docs/API.md) — HTTP/SSE surface
- [`docs/API.md`](docs/API.md) — HTTP/WebSocket surface
- [`docs/CAPABILITIES.md`](docs/CAPABILITIES.md) — capability deep-dive
- [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) — dev workflow, tests
- [`docs/TROUBLESHOOTING.md`](docs/TROUBLESHOOTING.md) — common failures
Expand All @@ -137,7 +137,7 @@ degrades to sequential scans.
Read [`references/SECURITY-NOTES.md`](references/SECURITY-NOTES.md) before
binding to anything other than loopback. Highlights: loopback bind by default,
trusted-origin CORS, per-request `authorize()` gate (fail-closed audit),
independent anomaly SSE channel, workspace containment, bounded uploads,
independent anomaly REST snapshot channel, workspace containment, bounded uploads,
rate limiting, no telemetry.

## License
Expand Down
14 changes: 7 additions & 7 deletions packages/webui/README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> 简体中文 | [English](README.md)

> **MiniMax Code 智能体运行时的浏览器前端。**
> 通过 HTTP/SSE 流式传输 `mcode acp` / `mcode exec` 会话。零 npm
> 通过 HTTP/WebSocket 流式传输 `mcode acp` / `mcode exec` 会话。零 npm
> 依赖;运行于 Node 22.19+。

Web UI 是本仓库的一等组成部分 —— 驱动 TUI(`mcode acp`,基于 stdio 的
Expand All @@ -29,7 +29,7 @@ node packages/webui/server.js

服务器默认绑定回环地址。局域网暴露需显式选择开启
(`--host` / `HOST` 环境变量,或持久化的 `lanBind` 设置)。首次
启动时会生成一个令牌并通过 SSE 发送给浏览器;非本地请求必须携带
启动时会生成一个令牌并通过事件流发送给浏览器;非本地请求必须携带
`?token=<value>` 或 `Authorization: Bearer <value>`。

在非回环网络上推荐的做法:
Expand All @@ -44,7 +44,7 @@ mcode webui --host 0.0.0.0

| 文件 | 说明 |
|------|------|
| `server.js` | HTTP + SSE 服务器引导 |
| `server.js` | HTTP + WebSocket 服务器引导 |
| `server/` | 路由器、路由模块与纯函数库(`server/lib/`) |
| `acp.mjs` | `mcode acp` JSON-RPC 客户端(通过 stdio 派生引擎) |
| `public/` | 静态前端 SPA |
Expand All @@ -64,7 +64,7 @@ mcode webui --host 0.0.0.0
| # | 展示内容 |
|---|---|
| 1 | **启动** —— 首次启动时的空聊天视图 |
| 2 | **流式聊天中** —— 历史已恢复,SSE 增量正在传输,tok/s 仪表 |
| 2 | **流式聊天中** —— 历史已恢复,流式增量正在传输,tok/s 仪表 |
| 3 | **设置面板** —— 外观 / 语言 / 局域网访问开关 |
| 4 | **聊天输入** —— 已输入提示词,发送/停止控件,`/` 与 `@file` 提示 |
| 5 | **发送后 + 工具调用** —— 助手流式输出,工具调用块自动折叠 |
Expand All @@ -78,7 +78,7 @@ mcode webui --host 0.0.0.0

| 能力 | 一句话说明 |
|---|---|
| `chat-streaming` | 来自 `mcode acp` 的 SSE 增量逐令牌渲染 |
| `chat-streaming` | 来自 `mcode acp` 的流式增量逐令牌渲染 |
| `tool-execution` | 从 acp `tool_call` 事件转发的 Bash / Read / Write / Edit |
| `plan-mode` | 计划审阅模态框,含 `agree` / `skip` / `add context` 选项 |
| `ask-user-tool` | 2–4 个选项的提问模态框,带 `Other` 自由文本回退 |
Expand Down Expand Up @@ -122,7 +122,7 @@ FTS5)为 **>=22.19 <23 || >=24 <27**,与运行时自身的引擎范围一致
## 文档

- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) —— 运行时拓扑、请求生命周期、模块契约
- [`docs/API.md`](docs/API.md) —— HTTP/SSE 接口面
- [`docs/API.md`](docs/API.md) —— HTTP/WebSocket 接口面
- [`docs/CAPABILITIES.md`](docs/CAPABILITIES.md) —— 能力深入解析
- [`docs/DEVELOPMENT.md`](docs/DEVELOPMENT.md) —— 开发工作流、测试
- [`docs/TROUBLESHOOTING.md`](docs/TROUBLESHOOTING.md) —— 常见故障
Expand All @@ -134,7 +134,7 @@ FTS5)为 **>=22.19 <23 || >=24 <27**,与运行时自身的引擎范围一致
在绑定到回环之外的任何地址之前,请阅读
[`references/SECURITY-NOTES.md`](references/SECURITY-NOTES.md)。要点:
默认绑定回环、可信来源 CORS、逐请求 `authorize()` 门禁(失败关闭的
审计)、独立的异常 SSE 通道、工作区围栏、受限上传、速率限制、无遥测。
审计)、独立的异常 REST 快照通道、工作区围栏、受限上传、速率限制、无遥测。

## 许可证

Expand Down
Loading
Loading