Skip to content

Commit 6b8bc0c

Browse files
committed
update CHANGELOG.md
1 parent 5c6e6ad commit 6b8bc0c

5 files changed

Lines changed: 196 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22

3-
<!-- last-commit: f7db5e7 -->
3+
<!-- last-commit: 5c6e6ad -->
4+
5+
## v0.1.11 - 2026-05-08
6+
7+
| Commit | Description |
8+
|--------|-------------|
9+
| `5c6e6ad` | feat: support /server |
10+
| `acf74b8` | update CHANGELOG.md |
11+
412

513
## v0.1.10 - 2026-04-30
614

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "localcoder"
3-
version = "0.1.10"
3+
version = "0.1.11"
44
edition = "2024"
55
description = "oxink."
66
license = "MIT"

README.md

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Localcoder is a Claude-like command-line AI assistant implemented in Rust. The c
1111
- ✅ Ollama-backed chat with streaming responses and one-shot mode
1212
- ✅ Tool calling runtime with file, search, Bash, web, and LSP tools
1313
- ✅ Interactive REPL with model switching, session resume, config UI, and output styles
14+
- ✅ Local server mode with HTTP and WebSocket entrypoints
1415
- ✅ Context compaction, git workflows, memory extraction, plan mode, and skills
1516
- ✅ Lightweight runtime with fast startup and low memory usage
1617

@@ -20,7 +21,7 @@ Localcoder is a Claude-like command-line AI assistant implemented in Rust. The c
2021

2122
## 📊 Implementation Status
2223

23-
The staged roadmap in [`docs/P00-plan.md`](./docs/P00-plan.md) is mostly implemented. Current status: **15 / 20 stages completed**.
24+
The staged roadmap in [`docs/P00-plan.md`](./docs/P00-plan.md) is mostly implemented. Current status: **16 / 21 stages completed**.
2425

2526
| Stage | Area | Status | Deliverable |
2627
|------|------|------|------|
@@ -44,6 +45,7 @@ The staged roadmap in [`docs/P00-plan.md`](./docs/P00-plan.md) is mostly impleme
4445
| S17 | MCP integration || MCP client and transport support are not implemented yet |
4546
| S18 | Output styles || Output style loading and `/output-style` |
4647
| S19 | LSP integration || Language-server-backed code navigation via `Lsp` |
48+
| S20 | Server mode || Axum-based local HTTP and WebSocket server via `/server` |
4749

4850
---
4951

@@ -93,7 +95,7 @@ On startup, Localcoder automatically checks for a settings file:
9395

9496
- It first looks for `.localcoder/settings.json` in the current directory
9597
- If that file does not exist, it falls back to `$HOME/.localcoder/settings.json`
96-
- If neither exists, it creates a default config in the current directory
98+
- If neither exists, it creates a default config in `$HOME/.localcoder/settings.json`
9799

98100
The default config format is:
99101

@@ -150,8 +152,77 @@ localcoder --continue
150152

151153
# Resume a specific session
152154
localcoder --resume s1712345678-12345
155+
156+
# Start the local server in the foreground
157+
localcoder -- "/server"
158+
159+
# Start the local server on a custom address
160+
localcoder -- "/server 127.0.0.1:4000"
161+
```
162+
163+
---
164+
165+
## 🌐 Server Mode
166+
167+
Localcoder can also run as a local HTTP and WebSocket server. The default bind address is `127.0.0.1:3000`.
168+
169+
You can start it in either mode:
170+
171+
```bash
172+
# Start in the REPL, but keep the REPL usable
173+
/server
174+
/server status
175+
/server stop
176+
177+
# Start in one-shot mode and keep the process in the foreground
178+
localcoder -- "/server"
179+
localcoder -- "/server 127.0.0.1:4000"
180+
```
181+
182+
Available routes:
183+
184+
- `GET /healthz`
185+
- `POST /v1/message`
186+
- `GET /v1/ws`
187+
188+
Example HTTP request:
189+
190+
```bash
191+
curl -X POST http://127.0.0.1:3000/v1/message \
192+
-H "content-type: application/json" \
193+
-d '{
194+
"message": "Explain the role of src/main.rs",
195+
"session_id": "",
196+
"output_style": "default"
197+
}'
198+
```
199+
200+
Example response:
201+
202+
```json
203+
{
204+
"session_id": "s1746690000000-12345-0",
205+
"reply": "src/main.rs bootstraps configuration, registers tools, and decides between REPL and one-shot execution.",
206+
"model": "qwen3.5:4b"
207+
}
153208
```
154209

210+
WebSocket messages are JSON-based and currently one request maps to one full agent execution:
211+
212+
```json
213+
{
214+
"type": "message",
215+
"message": "Continue the previous turn and summarize main.rs",
216+
"session_id": "s1746690000000-12345-0"
217+
}
218+
```
219+
220+
The server is intentionally local-first:
221+
222+
- It listens on `127.0.0.1` by default
223+
- There is no built-in auth or TLS yet
224+
- `wss` should be handled by a reverse proxy if needed
225+
155226
---
156227

157228
## 🛠️ Built-in Tools
@@ -189,6 +260,7 @@ localcoder -- "Fetch https://www.rust-lang.org/"
189260
| `/output-style [name]` | List or switch output styles |
190261
| `/web <query>` | Search the public web directly |
191262
| `/fetch <url>` | Fetch a public web page |
263+
| `/server [status\|stop\|host:port]` | Start, stop, or inspect the local HTTP/WebSocket server |
192264
| `/plan` | Show plan-mode status |
193265
| `/plan on` | Enable plan mode manually |
194266
| `/plan off` | Disable plan mode manually |
@@ -218,7 +290,7 @@ localcoder/
218290
├── README.zh.md # Chinese documentation
219291
├── docs/ # Roadmap and stage-by-stage implementation notes
220292
│ ├── P00-plan.md # Overall staged plan
221-
│ └── S00-S19*.md # Detailed stage documents
293+
│ └── S00-S20*.md # Detailed stage documents
222294
├── examples/ # Example programs
223295
│ ├── basic.rs # Basic API usage
224296
│ ├── streaming.rs # Streaming responses
@@ -236,6 +308,8 @@ localcoder/
236308
├── output_style.rs # Output style loading and prompt injection
237309
├── plan.rs # Plan mode state and todo management
238310
├── repl.rs # Interactive REPL interface
311+
├── runtime.rs # Shared runtime/bootstrap helpers
312+
├── server.rs # Local HTTP and WebSocket server mode
239313
├── session.rs # JSONL session persistence
240314
├── skills.rs # SKILL.md loading and activation
241315
├── tools/ # Built-in tools
@@ -251,6 +325,7 @@ localcoder/
251325
|------|----------|
252326
| Async runtime | tokio 1.40 |
253327
| HTTP client | reqwest 0.12 |
328+
| Local server | axum 0.8 |
254329
| JSON handling | serde + serde_json 1.0 |
255330
| Line editing | rustyline 14.0 |
256331
| Error handling | anyhow |

README.zh.md

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Localcoder 是一个基于 Rust 实现的 Claude-like 命令行 AI 助手,当
1111
- ✅ 基于 Ollama 的对话、流式响应和单次查询模式
1212
- ✅ 文件、搜索、Bash、Web、LSP 等工具调用运行时
1313
- ✅ 带模型切换、会话恢复、配置菜单和输出风格的交互式 REPL
14+
- ✅ 本地 Server 模式,支持 HTTP 和 WebSocket 入口
1415
- ✅ 上下文压缩、Git 工作流、记忆提取、计划模式和技能系统
1516
- ✅ 轻量级(启动快、内存占用低)
1617

@@ -20,7 +21,7 @@ Localcoder 是一个基于 Rust 实现的 Claude-like 命令行 AI 助手,当
2021

2122
## 📊 实现状态
2223

23-
[`docs/P00-plan.md`](./docs/P00-plan.md) 中的阶段路线图大部分已经落地。当前进度:**20 个阶段中已完成 15**
24+
[`docs/P00-plan.md`](./docs/P00-plan.md) 中的阶段路线图大部分已经落地。当前进度:**21 个阶段中已完成 16**
2425

2526
| 阶段 | 模块 | 状态 | 核心交付物 |
2627
|------|------|------|------|
@@ -44,6 +45,7 @@ Localcoder 是一个基于 Rust 实现的 Claude-like 命令行 AI 助手,当
4445
| S17 | MCP 集成 || MCP 客户端和多传输支持尚未实现 |
4546
| S18 | 输出样式 || 输出样式加载和 `/output-style` |
4647
| S19 | LSP 集成 || 基于语言服务器的代码导航 `Lsp` |
48+
| S20 | Server 模式 || 基于 Axum 的本地 HTTP / WebSocket 服务与 `/server` |
4749

4850
---
4951

@@ -93,19 +95,45 @@ localcoder
9395

9496
- 优先读取当前目录的 `.localcoder/settings.json`
9597
- 如果当前目录没有,则读取 `$HOME/.localcoder/settings.json`
96-
- 如果两处都没有,则在当前目录自动创建默认配置
98+
- 如果两处都没有,则在 `$HOME/.localcoder/settings.json` 自动创建默认配置
9799

98100
默认配置格式如下:
99101

100102
```json
101103
{
102-
"ollama": {
103-
"url": "http://localhost:11434",
104+
"llm": {
105+
"type": "ollama",
106+
"base_url": "http://localhost:11434",
104107
"model": "qwen3.5:4b"
105108
}
106109
}
107110
```
108111

112+
`llm.type` 用于选择提供商:`ollama``lmstudio``openai`
113+
114+
```json
115+
{
116+
"llm": {
117+
"type": "lmstudio",
118+
"base_url": "http://localhost:1234",
119+
"model": "qwen/qwen3-coder-30b"
120+
}
121+
}
122+
```
123+
124+
对于 OpenAI 兼容服务:
125+
126+
```json
127+
{
128+
"llm": {
129+
"type": "openai",
130+
"base_url": "https://api.openai.com/v1",
131+
"api_key": "sk-...",
132+
"model": "gpt-4o-mini"
133+
}
134+
}
135+
```
136+
109137
你也可以手动编辑这个文件,或在 REPL 中使用 `/model` 指令切换模型。
110138

111139
---
@@ -124,8 +152,77 @@ localcoder --continue
124152

125153
# 恢复指定会话
126154
localcoder --resume s1712345678-12345
155+
156+
# 前台启动本地服务
157+
localcoder -- "/server"
158+
159+
# 使用自定义地址启动本地服务
160+
localcoder -- "/server 127.0.0.1:4000"
161+
```
162+
163+
---
164+
165+
## 🌐 Server 模式
166+
167+
Localcoder 也可以作为本地 HTTP / WebSocket 服务运行。默认监听地址为 `127.0.0.1:3000`
168+
169+
可以通过两种方式启动:
170+
171+
```bash
172+
# 在 REPL 中后台启动,同时继续使用 REPL
173+
/server
174+
/server status
175+
/server stop
176+
177+
# 在 one-shot 模式下前台运行
178+
localcoder -- "/server"
179+
localcoder -- "/server 127.0.0.1:4000"
180+
```
181+
182+
当前可用路由:
183+
184+
- `GET /healthz`
185+
- `POST /v1/message`
186+
- `GET /v1/ws`
187+
188+
HTTP 请求示例:
189+
190+
```bash
191+
curl -X POST http://127.0.0.1:3000/v1/message \
192+
-H "content-type: application/json" \
193+
-d '{
194+
"message": "解释一下 src/main.rs 的职责",
195+
"session_id": "",
196+
"output_style": "default"
197+
}'
198+
```
199+
200+
响应示例:
201+
202+
```json
203+
{
204+
"session_id": "s1746690000000-12345-0",
205+
"reply": "src/main.rs 负责初始化配置、注册工具,并决定进入 REPL 还是 one-shot 执行流程。",
206+
"model": "qwen3.5:4b"
207+
}
127208
```
128209

210+
WebSocket 消息同样使用 JSON;当前一条请求对应一次完整 agent 执行:
211+
212+
```json
213+
{
214+
"type": "message",
215+
"message": "继续上一轮,并总结一下 main.rs",
216+
"session_id": "s1746690000000-12345-0"
217+
}
218+
```
219+
220+
当前服务模式的定位是本地优先:
221+
222+
- 默认只监听 `127.0.0.1`
223+
- 暂时没有内建认证和 TLS
224+
- 如果需要 `wss`,建议通过反向代理处理
225+
129226
---
130227

131228
## 🛠️ 内置工具
@@ -163,6 +260,7 @@ localcoder -- "抓取 https://www.rust-lang.org/"
163260
| `/output-style [name]` | 列出或切换输出风格 |
164261
| `/web <query>` | 直接搜索公网内容 |
165262
| `/fetch <url>` | 抓取公开网页 |
263+
| `/server [status\|stop\|host:port]` | 启动、停止或查看本地 HTTP / WebSocket 服务 |
166264
| `/plan` | 查看计划模式状态 |
167265
| `/plan on` | 手动启用计划模式 |
168266
| `/plan off` | 手动关闭计划模式 |
@@ -192,7 +290,7 @@ localcoder/
192290
├── README.zh.md # 中文说明
193291
├── docs/ # 路线图与分阶段实现文档
194292
│ ├── P00-plan.md # 总体阶段计划
195-
│ └── S00-S19*.md # 各阶段详细说明
293+
│ └── S00-S20*.md # 各阶段详细说明
196294
├── examples/ # 示例代码
197295
│ ├── basic.rs # 基本 API 调用
198296
│ ├── streaming.rs # 流式响应
@@ -210,6 +308,8 @@ localcoder/
210308
├── output_style.rs # 输出风格加载与 prompt 注入
211309
├── plan.rs # 计划模式状态与 todo 管理
212310
├── repl.rs # 交互式 REPL
311+
├── runtime.rs # 共享运行时与启动辅助
312+
├── server.rs # 本地 HTTP / WebSocket 服务模式
213313
├── session.rs # JSONL 会话持久化
214314
├── skills.rs # SKILL.md 加载与激活
215315
├── tools/ # 内置工具
@@ -225,10 +325,11 @@ localcoder/
225325
|------|----------|
226326
| 异步运行时 | tokio 1.40 |
227327
| HTTP 客户端 | reqwest 0.12 |
328+
| 本地服务 | axum 0.8 |
228329
| JSON 处理 | serde + serde_json 1.0 |
229330
| 命令行编辑 | rustyline 14.0 |
230331
| 错误处理 | anyhow |
231-
| 终端彩色 | colored 2.1 |
332+
| 终端彩色 | oxink 0.1.1 |
232333

233334
---
234335

0 commit comments

Comments
 (0)