min-agent 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +145 -290
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,366 +1,221 @@
1
+ <div align="center">
2
+
1
3
  # min-agent
2
4
 
3
- Minimal AI coding agent for the terminal. Works with any OpenAI-compatible API.
5
+ 一款在终端里运行的 AI 编程助手 · An AI coding agent that lives in your terminal
4
6
 
5
- ## Install
7
+ [![English](https://img.shields.io/badge/lang-English-blue.svg)](#english)
8
+ [![简体中文](https://img.shields.io/badge/lang-简体中文-red.svg)](#简体中文)
6
9
 
7
- ```bash
8
- npm install -g min-agent
9
- min-agent update # Upgrade to the latest npm release
10
- ```
10
+ </div>
11
11
 
12
- ## Quick Start
12
+ <br>
13
13
 
14
- ```bash
15
- min-agent setup # Configure provider
16
- min-agent # Interactive session
17
- min-agent "hello" # Interactive session, send immediately
18
- min-agent exec "hello" # One-shot, then exit
19
- min-agent exec --resume <id> "continue" # Continue a saved one-shot session
20
- ```
14
+ <div align="center">
21
15
 
22
- ---
16
+ ⬇️ 请选择你的语言 / Please choose your language ⬇️
23
17
 
24
- ## Commands
18
+ **➡️ [English](#english)  ➡️ [简体中文](#简体中文)**
25
19
 
26
- ```bash
27
- min-agent # Interactive session
28
- min-agent "msg" # Interactive session, send immediately
29
- min-agent exec "msg" # One-shot, then exit
30
- min-agent exec --resume <id> "msg" # Continue a saved one-shot session
31
- min-agent -m <model> "msg" # Override model
32
- min-agent --provider <name> "msg" # Use a specific provider
33
- min-agent -i img.png "msg" # Attach image
34
- min-agent --resume <id> # Resume session
35
- min-agent chat | code # Same as interactive session (compat)
36
- min-agent setup # Configure API provider
37
- min-agent models # List available models
38
- min-agent history # List saved sessions
39
- min-agent history delete <id> # Delete a session
40
- min-agent history rename <id> <t> # Rename a session
41
- min-agent history export <id> [-o file] # Export a session as JSON
42
- min-agent update # Upgrade to the latest npm release
43
- min-agent rules # Show loaded rules
44
- min-agent rules edit # Edit global rules
45
- min-agent memory # List project + global memories
46
- min-agent memory add "text" # Save memory (project if .min-agent exists)
47
- min-agent memory add "text" --project
48
- min-agent memory add "text" --global
49
- min-agent mcp -h # MCP server management
50
- min-agent skills -h # Skills management
51
- min-agent sandbox # Show isolation
52
- min-agent sandbox off # Write isolation to config and exit
53
- min-agent --sandbox workspace "msg" # This session only; does not write config
54
- min-agent sandbox network deny --project
55
- min-agent permission # Show confirmation mode
56
- min-agent --permission ask # Write confirmation mode to config and exit
57
- min-agent --permission accept-edits --project
58
- min-agent --permission allow-all "msg" # This session only
59
- min-agent serve # Start HTTP API server
60
- ```
20
+ </div>
61
21
 
62
- ## Interactive Commands
22
+ <br><br>
63
23
 
64
- Type `/` in the interactive session to pop up a command menu (type to filter, Tab/Enter select, Esc close). **↑↓** in the input box recall previously sent messages, skipping slash commands. All commands also work by typing them directly:
24
+ <a id="english"></a>
65
25
 
66
- | Command | Description |
67
- |---------|-------------|
68
- | `/new` | Start a new session (keeps the current one) |
69
- | `/compact` | Force compaction |
70
- | `/model [name]` | Interactive model picker (↑↓ navigate, Enter confirm) |
71
- | `/provider [name]` | List/switch provider |
72
- | `/plan` | Toggle read-only plan mode |
73
- | `/memory [text]` | List/save memory (`--project` writes to this repo) |
74
- | `/tokens` | Context occupancy, session totals & cost |
75
- | `/budget [n]` | Show/set cost budget (USD; `--project` writes to this repo) |
76
- | `/permission` | Show/set confirmation (`ask` / `accept-edits` / `allow-all`; `--project` writes to this repo) |
77
- | `/sandbox` | Show/set isolation (`off` / `workspace` / `strict`; `--project` writes to this repo) |
78
- | `/undo` | Undo last turn |
79
- | `/redo` | Resend last message |
80
- | `/diff` | Show working tree diff |
81
- | `/sessions [id]` | List or switch saved sessions |
82
- | `/resume [id]` | Same as `/sessions` |
83
- | `/reload` | Reload rules |
84
- | `/rename <title>` | Rename current session |
85
- | `/attach <path>` | Attach a local image |
86
- | `/paste [text]` | Clipboard image |
87
- | `/mcp` | MCP server status |
88
- | `/skills` | List skills; `/skills info <name>` to view; `/skills enable\|disable <name>` to toggle |
89
- | `/models` | List available models |
90
- | `/path` | Working directory |
91
- | `/help` | All commands |
92
- | `/exit` | Exit |
26
+ # 🇬🇧 English
93
27
 
94
- **Ctrl+C** clears the input box and saves it to history (↑ / ↓ to recall). Press **Ctrl+C twice** on an empty input to exit; the current session is saved. While generating, it interrupts the current run. **Ctrl+B** enters message selection mode (arrow keys expand the selection, Enter copies, Esc exits). **↑ / ↓** in the input box recall previously typed or sent messages. **Home / End** move to the start or end of the line.
28
+ > A minimal AI coding agent for your terminal. Works with OpenAI, Ollama, and any OpenAI-compatible provider.
95
29
 
96
- 授权确认时 **[y] / [N]** 始终留在窗口底部;详情过长时用 **↑↓** **PageUp / PageDown** 滚动,不必翻到消息区底部。提问输入行同样固定可见。
30
+ <sub>[🔝 Back to language selector](#min-agent) · [🇨🇳 Switch to 简体中文](#简体中文)</sub>
97
31
 
98
- **鼠标** 在消息区拖拽选择文本,松开自动复制;双击选词、三击选中该条可见内容。复制时不含 `>` 与工具前缀。状态栏会短暂提示"已复制"。
32
+ ## Get Started
99
33
 
100
- ---
34
+ ```bash
35
+ npm install -g min-agent
36
+ min-agent setup # Configure your AI provider
37
+ min-agent # Start chatting
38
+ ```
101
39
 
102
- ## Configuration
40
+ ## Basic Usage
103
41
 
104
- All config in `~/.min-agent/`:
105
-
106
- ```json
107
- // ~/.min-agent/config.json
108
- {
109
- "providers": [
110
- {
111
- "name": "default",
112
- "type": "openai-compatible",
113
- "baseURL": "https://api.openai.com/v1",
114
- "apiKey": "sk-...",
115
- "defaultModel": "gpt-5.5",
116
- "contextWindow": 1000000
117
- }
118
- ],
119
- "activeProvider": "default",
120
- "webSearchURL": "https://your-searxng.example.com",
121
- "serperApiKey": "your-serper-key",
122
- "instructions": ["./docs/rules.md"],
123
- "disabledSkills": [],
124
- "pricing": { "gpt-5.5": { "inputPerMillion": 1.25, "outputPerMillion": 10 } },
125
- "sampling": { "temperature": 0.7, "maxTokens": 4096 },
126
- "budget": { "maxCostUSD": 5 }
127
- }
42
+ ```bash
43
+ min-agent # Start an interactive session
44
+ min-agent "your message" # Start a session and send a message immediately
45
+ min-agent exec "your message" # Ask a single question, then exit
46
+ min-agent --resume <id> # Resume a previous session
47
+ min-agent history # List saved sessions
48
+ min-agent models # List available models
49
+ min-agent update # Upgrade to the latest version
128
50
  ```
129
51
 
130
- Project-level config lives in `.min-agent/config.json`. It can override skill state and selected global settings; API keys stay in `~/.min-agent/config.json` only:
131
-
132
- ```json
133
- // .min-agent/config.json
134
- {
135
- "disabledSkills": ["noisy-skill"],
136
- "enabledSkills": ["skill-disabled-globally"],
137
- "activeProvider": "default",
138
- "defaultModel": "gpt-5.5",
139
- "sampling": { "temperature": 0.4 },
140
- "budget": { "maxCostUSD": 2 },
141
- "permission": "ask",
142
- "sandbox": { "mode": "workspace", "network": "allow" },
143
- "compaction": { "autoContinue": false }
144
- }
52
+ Attach an image or pick a specific model/provider for one message:
53
+
54
+ ```bash
55
+ min-agent -i photo.png "what's in this image?"
56
+ min-agent -m gpt-5.5 "your message"
57
+ min-agent --provider anthropic "your message"
145
58
  ```
146
59
 
147
- Project values overlay the global file when present (`sampling` / `budget` / `sandbox` / `compaction` / `agent` merge field-by-field). `/budget 5 --project` writes the project budget. `/sandbox workspace --project` writes project isolation. `/permission accept-edits --project` writes project confirmation mode.
60
+ ## While Chatting
148
61
 
149
- Isolation is **off by default**. `--permission` / `--yes` only skip confirmations; they do not change isolation.
62
+ Type `/` to open a command menu. Use **↑ / ↓** to recall previous messages.
150
63
 
151
- `--permission ask|accept-edits|allow-all` without a message writes config and exits (same as `min-agent permission …`). With a message, `--resume`, `--model`, or `--provider`, it only overrides that session. `--yes` / `-y` is this session only (same as `--permission allow-all`) and does not write config.
64
+ | Command | Description |
65
+ |---|---|
66
+ | `/new` | Start a new session |
67
+ | `/model` | Switch model |
68
+ | `/provider` | Switch provider |
69
+ | `/plan` | Toggle plan mode (look, don't touch) |
70
+ | `/undo` | Undo the last turn |
71
+ | `/diff` | Show file changes made so far |
72
+ | `/sessions` | List or switch sessions |
73
+ | `/attach <path>` | Attach a local image |
74
+ | `/mcp` | Show connected MCP servers |
75
+ | `/skills` | Manage skills |
76
+ | `/tokens` | Usage and estimated cost |
77
+ | `/help` | Show all commands |
78
+ | `/exit` | Exit |
152
79
 
153
- ```bash
154
- min-agent permission # show current confirmation mode
155
- min-agent --permission ask # write global config, then exit
156
- min-agent --permission accept-edits --project
157
- min-agent --permission allow-all "msg" # this session only; does not write config
158
- ```
80
+ Shortcuts: **Ctrl+C** clears the input (press twice to exit) · **Ctrl+B** selects text to copy · mouse drag-select also copies on release.
159
81
 
160
- `ask` (default) prompts before dangerous operations. `accept-edits` auto-approves file writes and still prompts for dangerous commands. `allow-all` auto-approves everything.
82
+ ## Staying in Control
161
83
 
162
- Without a message, `--sandbox` / `--network` write config and exit (same as `min-agent sandbox …`). With a message, `--resume`, `--model`, or `--provider`, they only override that session:
84
+ min-agent asks for confirmation before risky actions by default.
163
85
 
164
86
  ```bash
165
- min-agent sandbox # show current isolation
166
- min-agent --sandbox off # write global config, then exit
167
- min-agent --sandbox workspace --project
168
- min-agent --sandbox workspace "msg" # this session only; does not write config
169
- min-agent sandbox network deny
87
+ min-agent permission # Show current setting
88
+ min-agent --permission ask # Confirm before risky actions (default)
89
+ min-agent --permission accept-edits # Auto-approve file edits only
90
+ min-agent --permission allow-all # Auto-approve everything use with care
170
91
  ```
171
92
 
172
- ```json
173
- "sandbox": {
174
- "mode": "workspace",
175
- "network": "allow",
176
- "extraWriteRoots": ["/path/allowed-to-write"],
177
- "extraReadRoots": []
178
- }
179
- ```
180
-
181
- `mode`: `off` (default) | `workspace` (write only in the working directory, plus temp/cache) | `strict` (read and write only there). `extraWriteRoots` / `extraReadRoots` add extra directories when isolation is on. Env: `MIN_AGENT_SANDBOX`, `MIN_AGENT_SANDBOX_NETWORK`.
93
+ You can also limit what it's allowed to touch on your machine:
182
94
 
183
- Project memories live in `.min-agent/memory.json`; global memories in `~/.min-agent/memory.json`. The agent reads project first, then global. Saving without `--project` / `--global` uses the project file when `.min-agent/` exists.
95
+ ```bash
96
+ min-agent sandbox # Show current restriction level
97
+ min-agent sandbox off # No restriction (default)
98
+ min-agent sandbox workspace # Only allow changes inside the current folder
99
+ ```
184
100
 
185
- `pricing` 覆盖模型价格(USD / 1M tokens),用于成本估算;未配置时自动从 models.dev 获取。
101
+ ## Configuration
186
102
 
187
- Multiple providers are supported: add entries to `providers` and set `activeProvider` (or use `min-agent setup`). Old single-provider configs are migrated automatically on first run.
103
+ Run `min-agent setup` for a guided setup this is the easiest way to add or switch AI providers.
188
104
 
189
- `contextWindow` 填写该模型的上下文长度(token)。自定义接口请按实际容量填写,例如 100 万填 `1000000`。未填写时会向接口查询;查不到时按 512k 处理。旧的工具输出会自动省略,避免占满上下文。
105
+ Settings live in `~/.min-agent/config.json` (global). A project can have its own `.min-agent/config.json` that only applies there.
190
106
 
191
- `sampling` sets defaults for temperature/maxTokens/topP (overridable per request). `budget.maxCostUSD` aborts the current run as soon as cumulative cost exceeds the limit (checked after each model step).
107
+ ## Extending It
192
108
 
193
- A run continues in one model pass until the model finishes, the context fills (~75% of the window), the reply comes back empty, or a tool-only turn has no final answer. Context overflow and empty turns auto-continue up to `agent.maxContinues` times (default 40). Set `agent.autoContinue` to `false` to stop and wait for the next message (web research that has not yet produced the requested file or answer still continues, and further search/fetch calls return a notice to write from what is already known). If `agent.autoContinue` is omitted, `compaction.autoContinue` is used (default true). Optional `agent.maxSteps` is a hard tool-step ceiling for one pass (unset means no ceiling). When the provider answers with an empty stream (HTTP 200 and no content at all — usually an upstream timeout), the same request is re-sent up to `agent.maxEmptyAttempts` times (default 4; first retry immediate, then exponential backoff from `agent.emptyRetryDelayMs`, default 1000 ms) regardless of `autoContinue`, and the run then reports that the provider returned nothing instead of a vague "incomplete". Task lists and the original request are stored with the session and survive compaction. Repeated identical tool calls are stopped. Long stretches of web search/fetch without producing the requested output are redirected to finish the work; further search/fetch calls then return that same notice instead of new results.
109
+ - **MCP servers** connect external tools and data sources: `min-agent mcp -h`
110
+ - **Skills** — reusable instructions the agent loads automatically: `min-agent skills -h`
111
+ - **Project rules** — add an `AGENTS.md` or `RULES.md` file to your project for custom instructions; use `~/.min-agent/rules.md` for global ones.
194
112
 
195
- A turn also has a time / step budget (`agent.turnTimeLimitMs`, default 20 min; `agent.softStepLimit`, default 120 tool steps). When it runs out the model is asked once to wrap up and summarise, then the turn stops — a finished answer is never overridden by the budget. Model requests are guarded by a first-byte timeout (`agent.requestTimeoutMs`, default 180 s) and a stream idle timeout (`agent.streamIdleTimeoutMs`, default 90 s); a stalled request is aborted and retried like an empty reply. Old tool payloads are only trimmed once the context is filling up (60% of the window), biggest first, and each stub keeps the path of the full output on disk so the model can read it again. Sessions are written incrementally during a run, so a crash keeps the work done so far. `bash` commands are killed after `tools.bashTimeoutMs` (default 10 min) unless the call sets its own timeout. Sub-agents (`task`, `explore`) share the parent's research and cost budget; their step ceilings are `agent.subAgentMaxSteps` / `agent.exploreMaxSteps`.
113
+ ## API Access
196
114
 
197
- Research is judged by what it returns: rounds that bring new URLs or domains are free (up to `agent.researchTotalCap`, default 24 calls per turn), while `agent.researchSteerAfter` (default 3) rounds without a new source steer the model to write, and `agent.researchStopAfter` (default 5) removes `search_web` / `web_fetch` for the rest of the turn.
115
+ `min-agent serve` starts a local HTTP API server so other apps can talk to min-agent. Reference: [docs/API.md](docs/API.md)
198
116
 
199
- Provider types: `openai-compatible` | `openai` | `ollama`
117
+ ## License
200
118
 
201
- Logs: `~/.min-agent/logs/min-agent.YYYY-MM-DD.log` (rotated daily, kept 7 days). Lines inside a run carry `[run=<id> pass=<n>]`. Set `MIN_AGENT_TRACE=1` to also log a summary of every model request and response (model, message/tool counts, status, time to first byte).
119
+ MIT
202
120
 
203
- Input history: `~/.min-agent/input-history.json` (up to 1000 entries)
121
+ <br>
204
122
 
205
123
  ---
206
124
 
207
- ## MCP
125
+ <br>
208
126
 
209
- ```bash
210
- min-agent mcp add <name> <cmd...> # Local stdio
211
- min-agent mcp add <name> <cmd...> --env K=V # Local stdio with env vars
212
- min-agent mcp add <name> --url <url> --token T # Remote HTTP
213
- min-agent mcp add <name> --url <url> --sse # Legacy SSE transport
214
- min-agent mcp add <name> --url <url> --streamable-http # Force streamable HTTP
215
- min-agent mcp add <name> ... --project # Save to .min-agent/mcp.json (this repo only)
216
- min-agent mcp add <name> ... --timeout 10000 # Connection/call timeout in ms
217
- min-agent mcp list # List (name + status + scope)
218
- min-agent mcp info <name> # Details
219
- min-agent mcp enable/disable <name...> [--project] # Toggle
220
- min-agent mcp remove <name> [--project] # Remove
221
- min-agent mcp check # Test connectivity
222
- ```
127
+ <a id="简体中文"></a>
223
128
 
224
- 配置合并规则:`~/.min-agent/mcp.json`(全局)与 `.min-agent/mcp.json`(项目)按名称合并,项目条目覆盖同名全局条目;`mcp list` 会标注 `[project]`。
225
-
226
- Connected servers expose resources and prompts to the agent via `mcp_list_resources` / `mcp_read_resource` / `mcp_list_prompts` / `mcp_get_prompt`. `/mcp` shows counts when a server advertises them.
227
-
228
- 远程服务器如需 OAuth 登录(部分云端 MCP),在 mcp.json 里加 `"oauth": {}`(或用 `"clientId"`/`"clientSecret"`/`"scope"` 显式指定),连接时自动打开浏览器完成授权,令牌缓存在 `~/.min-agent/mcp-oauth/`。`"oauth": false` 关闭。
229
-
230
- mcp.json 完整字段(`min-agent mcp add` 只生成子集,其余手写):
231
-
232
- ```json
233
- {
234
- "mcpServers": {
235
- "filesystem": {
236
- "command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
237
- "environment": { "KEY": "VALUE" },
238
- "enabled": true,
239
- "connectTimeout": 10000,
240
- "callTimeout": 30000
241
- },
242
- "remote": {
243
- "url": "https://mcp.example.com/mcp",
244
- "remoteTransport": "auto",
245
- "token": "bearer-token",
246
- "headers": { "X-API-Key": "..." },
247
- "oauth": {},
248
- "connectTimeout": 15000,
249
- "callTimeout": 30000
250
- }
251
- }
252
- }
253
- ```
129
+ # 🇨🇳 简体中文
254
130
 
255
- - `remoteTransport`:`auto`(默认,先 streamable-http sse)、`streamable-http`、`sse`
256
- - `timeout`:连接与调用共用的旧字段;`connectTimeout` / `callTimeout` 可分别覆盖
257
- - 连接失败时错误信息会带上服务器 stderr 的最后几行,便于排查
131
+ > 一款可在终端里运行的极简 AI 编程助手,支持 OpenAI、Ollama 以及任何兼容 OpenAI 接口的服务商。
258
132
 
259
- ## Skills
133
+ <sub>[🔝 返回语言选择](#min-agent) · [🇬🇧 Switch to English](#english)</sub>
134
+
135
+ ## 快速上手
260
136
 
261
137
  ```bash
262
- min-agent skills list # List (status + scope + description + path)
263
- min-agent skills list --json # Machine-readable output
264
- min-agent skills info <name> # Details + content
265
- min-agent skills info <name> --json # Details as JSON
266
- min-agent skills new <name> # Create a skill scaffold (.min-agent/skills/<name>/)
267
- min-agent skills new <name> --global # Create in ~/.agents/skills/<name>/
268
- min-agent skills disable <name...> # Disable everywhere (global)
269
- min-agent skills disable <name...> --project # Disable in this repo only
270
- min-agent skills enable <name...> --project # Re-enable here even if disabled globally
138
+ npm install -g min-agent
139
+ min-agent setup # 配置你的 AI 服务商
140
+ min-agent # 开始对话
271
141
  ```
272
142
 
273
- Scope: project state lives in `.min-agent/config.json`, global state in `~/.min-agent/config.json`.
274
- Project wins over global, so disabling a repo-local skill never affects other repos.
143
+ ## 基本用法
275
144
 
276
- In the interactive session: `/skills`, `/skills info <name>`, `/skills disable <name> [--project]`, `/skills enable <name> [--project]`.
277
- Type `/skills ` and press Tab to complete subcommands and skill names.
145
+ ```bash
146
+ min-agent # 进入交互会话
147
+ min-agent "你的消息" # 进入交互会话并立即发送消息
148
+ min-agent exec "你的消息" # 单次提问后自动退出
149
+ min-agent --resume <id> # 恢复之前的会话
150
+ min-agent history # 查看已保存的会话
151
+ min-agent models # 查看可用模型
152
+ min-agent update # 升级到最新版本
153
+ ```
278
154
 
279
- Create: `min-agent skills new <name>` scaffolds a `SKILL.md` template into `.min-agent/skills/<name>/` (add `--global` for `~/.agents/skills/`), or write it by hand:
155
+ 为单条消息附带图片,或指定模型/服务商:
280
156
 
281
- ```markdown
282
- ---
283
- name: my-skill
284
- description: What it does
285
- # optional
286
- version: 1.0.0
287
- allowed-tools: [read, grep]
288
- metadata:
289
- requires:
290
- bins: ["some-cli"]
291
- ---
292
- # Instructions...
157
+ ```bash
158
+ min-agent -i photo.png "这张图片是什么?"
159
+ min-agent -m gpt-5.5 "你的消息"
160
+ min-agent --provider anthropic "你的消息"
293
161
  ```
294
162
 
295
- - `description` may use a YAML block scalar (`|` / `>`) for multi-line text.
296
- - Discovery paths, in override order: `~/.agents/skills/` → `.min-agent/skills/` → `.agents/skills/` → `.opencode/skills/` → `.claude/skills/`. Symlinked skill directories are followed, so one shared skill library can be linked into several of these.
297
- - A same-named skill in a later user path overrides the earlier one; within one path the top-level `SKILL.md` wins over a nested copy.
298
- - Built-in skills shipped with min-agent (including `self-config`, which the agent loads automatically when changing its own settings) are always discovered and win on name over user copies.
299
- - `MIN_AGENT_SKILLS_DIRS` (path-delimiter separated) replaces the user discovery list; built-in skills still load unless `MIN_AGENT_NO_BUILTIN_SKILLS=1`.
300
- - Files next to `SKILL.md` (including subdirectories such as `scripts/`) are listed for the agent when the skill loads; `metadata.requires.bins` entries missing from `PATH` are reported.
163
+ ## 对话中的操作
301
164
 
302
- ## Rules
165
+ 输入 `/` 弹出命令菜单。使用 **↑ / ↓** 翻看之前的消息。
303
166
 
304
- | Source | Scope |
305
- |--------|-------|
306
- | `~/.min-agent/rules.md` | Global |
307
- | `./AGENTS.md` or `./RULES.md` | Project |
308
- | `config.instructions[]` | Custom paths/URLs |
167
+ | 命令 | 说明 |
168
+ |---|---|
169
+ | `/new` | 开始新会话 |
170
+ | `/model` | 切换模型 |
171
+ | `/provider` | 切换服务商 |
172
+ | `/plan` | 切换"计划模式"(只看不改) |
173
+ | `/undo` | 撤销上一轮操作 |
174
+ | `/diff` | 查看当前已产生的文件改动 |
175
+ | `/sessions` | 查看或切换会话 |
176
+ | `/attach <路径>` | 附加本地图片 |
177
+ | `/mcp` | 查看已连接的 MCP 服务 |
178
+ | `/skills` | 管理技能 |
179
+ | `/tokens` | 查看用量与预估费用 |
180
+ | `/help` | 查看全部命令 |
181
+ | `/exit` | 退出 |
309
182
 
310
- ## Plugins
183
+ 快捷键:**Ctrl+C** 清空输入框(连按两次退出)· **Ctrl+B** 选中文本以复制 · 也支持鼠标拖拽选中并自动复制。
311
184
 
312
- Custom tools: `.min-agent/tools/*.ts` or `~/.min-agent/tools/*.ts`
185
+ ## 掌控风险
313
186
 
314
- By default a custom tool asks before it runs. Set `readOnly: true` (or `dangerous: false`) to skip the prompt. Plan mode only keeps `readOnly` custom tools.
187
+ min-agent 默认会在执行有风险的操作前先询问你。
315
188
 
316
- ```typescript
317
- export const myTool = {
318
- description: "...",
319
- parameters: { arg: { type: "string", description: "..." } },
320
- execute: async ({ arg }) => "result"
321
- }
189
+ ```bash
190
+ min-agent permission # 查看当前设置
191
+ min-agent --permission ask # 有风险操作前先询问(默认)
192
+ min-agent --permission accept-edits # 仅自动批准文件修改
193
+ min-agent --permission allow-all # 自动批准所有操作 —— 请谨慎使用
322
194
  ```
323
195
 
324
- ```typescript
325
- export const dockerPs = {
326
- description: "List running docker containers",
327
- readOnly: true,
328
- parameters: { limit: { type: "number", description: "Max containers to show" } },
329
- execute: async ({ limit }) => {
330
- const { execSync } = await import("child_process")
331
- return execSync(`docker ps --format "table {{.Names}}\t{{.Status}}" --limit ${limit ?? 10}`, {
332
- encoding: "utf-8",
333
- })
334
- }
335
- }
196
+ 也可以限制它能在你电脑上访问的范围:
197
+
198
+ ```bash
199
+ min-agent sandbox # 查看当前限制级别
200
+ min-agent sandbox off # 不限制(默认)
201
+ min-agent sandbox workspace # 仅允许修改当前项目文件夹内的内容
336
202
  ```
337
203
 
338
- ---
204
+ ## 配置
339
205
 
340
- ## HTTP API
206
+ 运行 `min-agent setup` 即可通过引导式流程完成配置,这是添加或切换 AI 服务商最简单的方式。
341
207
 
342
- ```bash
343
- min-agent serve [--port 8787]
344
- ```
208
+ 配置保存在 `~/.min-agent/config.json`(全局生效)。也可以在某个项目下单独创建 `.min-agent/config.json`,仅对该项目生效。
345
209
 
346
- Full reference: [docs/API.md](docs/API.md)
210
+ ## 扩展能力
347
211
 
348
- ---
212
+ - **MCP 服务**:连接外部工具与数据源,运行 `min-agent mcp -h` 了解详情
213
+ - **技能(Skills)**:可自动加载的可复用指令集,运行 `min-agent skills -h` 了解详情
214
+ - **项目规则**:在项目根目录添加 `AGENTS.md` 或 `RULES.md` 编写自定义指令;全局规则写入 `~/.min-agent/rules.md`
215
+
216
+ ## API 接入
349
217
 
350
- ## Environment Variables
351
-
352
- | Variable | Description |
353
- |----------|-------------|
354
- | `EXA_API_KEY` | Enable Exa code search |
355
- | `MIN_AGENT_SERPER_API_KEY` | Optional Serper key override for `search_web` (takes precedence over `serperApiKey` in config; a built-in default is used otherwise) |
356
- | `MIN_AGENT_SEARXNG_URL` | Use SearXNG instead of Serper for `search_web` (takes precedence over `webSearchURL` in config) |
357
- | `MIN_AGENT_SEARXNG_FALLBACK_ENGINES` | Engines retried when the SearXNG instance's default engines return nothing (default `google,bing`; empty string disables the retry) |
358
- | `MIN_AGENT_FIRECRAWL_URL` | Firecrawl instance for `web_fetch` (takes precedence over `webFetchURL` in config) |
359
- | `MIN_AGENT_SKILLS_DIRS` | `:`-separated dirs that replace the user skill discovery list (built-in skills still load) |
360
- | `MIN_AGENT_NO_BUILTIN_SKILLS` | `1` to skip skills shipped with min-agent |
361
- | `MIN_AGENT_SHOW_THINKING` | `0` to hide thinking |
362
- | `MIN_AGENT_SERVE_TOKEN` | API auth token |
363
- | `MIN_AGENT_SERVE_CORS` | `1` to enable CORS (without a token, only localhost origins are allowed) |
218
+ `min-agent serve` 可启动本地 HTTP API 服务,供其他应用调用。完整说明见 [docs/API.md](docs/API.md)
364
219
 
365
220
  ## License
366
221
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "min-agent",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Minimal AI coding agent with tool use, MCP, and skills support",
6
6
  "license": "MIT",