min-agent 0.5.1 → 0.6.0
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.
- package/README.md +18 -18
- package/dist/cli.js +538 -12
- package/docs/API.md +6 -6
- package/package.json +6 -6
- package/skills/self-config/SKILL.md +4 -2
- package/skills/self-config/reference.md +4 -1
- package/dist/agent.js +0 -1388
- package/dist/assistant-stream.js +0 -131
- package/dist/cli/commands/chat.js +0 -13
- package/dist/cli/commands/ctx.js +0 -7
- package/dist/cli/commands/exec.js +0 -35
- package/dist/cli/commands/history.js +0 -58
- package/dist/cli/commands/index.js +0 -249
- package/dist/cli/commands/init.js +0 -18
- package/dist/cli/commands/mcp.js +0 -173
- package/dist/cli/commands/memory.js +0 -87
- package/dist/cli/commands/models.js +0 -21
- package/dist/cli/commands/permission.js +0 -12
- package/dist/cli/commands/rules.js +0 -33
- package/dist/cli/commands/sandbox.js +0 -13
- package/dist/cli/commands/serve.js +0 -9
- package/dist/cli/commands/setup.js +0 -56
- package/dist/cli/commands/shared.js +0 -25
- package/dist/cli/commands/skills.js +0 -119
- package/dist/cli/commands/think.js +0 -12
- package/dist/cli/commands/update.js +0 -7
- package/dist/cli/commands/write-config.js +0 -52
- package/dist/cli/errors.js +0 -36
- package/dist/cli/exec-prompt.js +0 -26
- package/dist/cli/option-helpers.js +0 -65
- package/dist/cli/program.js +0 -223
- package/dist/cli/setup/detect.js +0 -17
- package/dist/cli/setup/flags.js +0 -12
- package/dist/cli/setup/flow.js +0 -108
- package/dist/cli/setup/provider-form.js +0 -102
- package/dist/cli/setup/ui.js +0 -534
- package/dist/clipboard.js +0 -142
- package/dist/code-mode.js +0 -184
- package/dist/compaction.js +0 -644
- package/dist/config.js +0 -363
- package/dist/confirm.js +0 -172
- package/dist/context-window.js +0 -256
- package/dist/ctx-cli.js +0 -30
- package/dist/ctx.js +0 -80
- package/dist/doom-loop.js +0 -278
- package/dist/fetch-timeout.js +0 -152
- package/dist/http-approvals.js +0 -60
- package/dist/http.js +0 -119
- package/dist/instructions.js +0 -196
- package/dist/logger.js +0 -95
- package/dist/markdown.js +0 -259
- package/dist/mcp.js +0 -1036
- package/dist/memory-cli.js +0 -33
- package/dist/memory.js +0 -295
- package/dist/model-catalog.js +0 -285
- package/dist/ollama-model.js +0 -234
- package/dist/ollama-openai-bridge.js +0 -383
- package/dist/output.js +0 -76
- package/dist/paste-handler.js +0 -41
- package/dist/permission-cli.js +0 -40
- package/dist/plugins.js +0 -131
- package/dist/pricing.js +0 -119
- package/dist/provider.js +0 -63
- package/dist/question-format.js +0 -60
- package/dist/reasoning-stream.js +0 -158
- package/dist/sandbox-cli.js +0 -79
- package/dist/sandbox.js +0 -403
- package/dist/save-throttle.js +0 -45
- package/dist/scope.js +0 -23
- package/dist/serve/common.js +0 -425
- package/dist/serve/routes-chat.js +0 -367
- package/dist/serve/routes-mcp.js +0 -212
- package/dist/serve/routes-memory.js +0 -95
- package/dist/serve/routes-meta.js +0 -268
- package/dist/serve/routes-sessions.js +0 -61
- package/dist/serve/routes-skills.js +0 -70
- package/dist/serve.js +0 -138
- package/dist/sessions.js +0 -265
- package/dist/skills.js +0 -599
- package/dist/structured-output.js +0 -29
- package/dist/synthetic.js +0 -7
- package/dist/think-cli.js +0 -36
- package/dist/thinking-wire.js +0 -239
- package/dist/thinking.js +0 -166
- package/dist/title-gen.js +0 -55
- package/dist/token-display.js +0 -39
- package/dist/tool-display.js +0 -178
- package/dist/tool-output.js +0 -126
- package/dist/tools/apply_patch.js +0 -265
- package/dist/tools/atomic-file.js +0 -35
- package/dist/tools/backend.js +0 -61
- package/dist/tools/bash.js +0 -231
- package/dist/tools/code_search.js +0 -98
- package/dist/tools/edit.js +0 -68
- package/dist/tools/explore.js +0 -232
- package/dist/tools/glob.js +0 -40
- package/dist/tools/grep.js +0 -174
- package/dist/tools/index.js +0 -34
- package/dist/tools/question.js +0 -54
- package/dist/tools/read.js +0 -109
- package/dist/tools/search-searxng.js +0 -223
- package/dist/tools/search-serper.js +0 -189
- package/dist/tools/task.js +0 -165
- package/dist/tools/todo.js +0 -213
- package/dist/tools/web_fetch.js +0 -195
- package/dist/tools/web_search.js +0 -228
- package/dist/tools/write.js +0 -55
- package/dist/tui/App.js +0 -138
- package/dist/tui/ConfirmBar.js +0 -66
- package/dist/tui/CtxPicker.js +0 -68
- package/dist/tui/InputBar.js +0 -618
- package/dist/tui/MessageList.js +0 -718
- package/dist/tui/ModelPicker.js +0 -113
- package/dist/tui/QuestionBar.js +0 -136
- package/dist/tui/SessionPicker.js +0 -79
- package/dist/tui/Spinner.js +0 -6
- package/dist/tui/StatusBar.js +0 -22
- package/dist/tui/ThinkPicker.js +0 -75
- package/dist/tui/agent-runner.js +0 -223
- package/dist/tui/bracketed-paste.js +0 -37
- package/dist/tui/caret-pos.js +0 -179
- package/dist/tui/caret.js +0 -69
- package/dist/tui/click-count.js +0 -13
- package/dist/tui/diff-view.js +0 -61
- package/dist/tui/drag-state.js +0 -49
- package/dist/tui/hydrate.js +0 -129
- package/dist/tui/index.js +0 -264
- package/dist/tui/input-history.js +0 -125
- package/dist/tui/layout.js +0 -105
- package/dist/tui/mouse.js +0 -46
- package/dist/tui/overlay-input.js +0 -12
- package/dist/tui/paste-draft.js +0 -173
- package/dist/tui/prompt-queue.js +0 -24
- package/dist/tui/selection.js +0 -232
- package/dist/tui/session-switch.js +0 -28
- package/dist/tui/slash-commands.js +0 -129
- package/dist/tui/slash-handler.js +0 -615
- package/dist/tui/text-width.js +0 -113
- package/dist/tui/theme.js +0 -12
- package/dist/tui/token-info.js +0 -7
- package/dist/tui/tool-children.js +0 -19
- package/dist/tui/types.js +0 -1
- package/dist/tui/undo-stack.js +0 -14
- package/dist/tui/use-sgr-mouse.js +0 -29
- package/dist/tui-chat.js +0 -478
- package/dist/updater.js +0 -116
- package/dist/xml-search.js +0 -194
- package/docs/superpowers/plans/2026-08-16-batch1-tui-improvements.md +0 -1510
- package/docs/superpowers/plans/2026-08-16-batch2-cli-tools-api.md +0 -2105
- package/docs/superpowers/plans/2026-08-16-batch3-config-engineering.md +0 -1595
- package/docs/superpowers/plans/2026-08-16-input-caret.md +0 -782
- package/docs/superpowers/plans/2026-08-20-tui-completeness.md +0 -873
- package/docs/superpowers/plans/2026-08-20-unified-tui-default.md +0 -631
- package/docs/superpowers/plans/2026-08-23-cli-setup.md +0 -501
- package/docs/superpowers/plans/2026-08-23-input-paste-attachments.md +0 -475
- package/docs/superpowers/plans/2026-08-23-thinking-wire-profile.md +0 -450
- package/docs/superpowers/specs/2026-08-16-batch1-tui-improvements-design.md +0 -183
- package/docs/superpowers/specs/2026-08-16-batch2-cli-tools-api-design.md +0 -220
- package/docs/superpowers/specs/2026-08-16-batch3-config-engineering-design.md +0 -196
- package/docs/superpowers/specs/2026-08-16-input-caret-design.md +0 -63
- package/docs/superpowers/specs/2026-08-17-mouse-selection-design.md +0 -116
- package/docs/superpowers/specs/2026-08-20-config-http-alignment-design.md +0 -47
- package/docs/superpowers/specs/2026-08-20-mcp-plugins-alignment-design.md +0 -37
- package/docs/superpowers/specs/2026-08-20-sandbox-permissions-design.md +0 -68
- package/docs/superpowers/specs/2026-08-20-tui-completeness-design.md +0 -273
- package/docs/superpowers/specs/2026-08-20-unified-tui-default-design.md +0 -165
- package/docs/superpowers/specs/2026-08-23-cli-setup-design.md +0 -282
- package/docs/superpowers/specs/2026-08-23-input-paste-attachments-design.md +0 -174
- package/docs/superpowers/specs/2026-08-23-thinking-wire-profile-design.md +0 -140
package/docs/API.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# min-agent HTTP API
|
|
2
2
|
|
|
3
|
-
`min-agent serve` 启动本地 HTTP
|
|
3
|
+
`min-agent serve` 启动本地 HTTP 服务,以编程方式调用代理能力。未配置服务商时使用内置 OpenRouter 模型,不必先运行 `min-agent setup`。
|
|
4
4
|
|
|
5
5
|
## 启动
|
|
6
6
|
|
|
@@ -91,7 +91,7 @@ min-agent serve --host 0.0.0.0 --port 3000
|
|
|
91
91
|
## `GET /v1/meta`
|
|
92
92
|
|
|
93
93
|
```json
|
|
94
|
-
{ "version": "0.1.0", "cwd": "/path/to/project", "instructions_chars": 1234, "sandbox": { "mode": "off", "network": "allow", "extraWriteRoots": [], "extraReadRoots": [], "source": null, "label": "未隔离,允许联网" }, "permission": { "permission": "
|
|
94
|
+
{ "version": "0.1.0", "cwd": "/path/to/project", "instructions_chars": 1234, "sandbox": { "mode": "off", "network": "allow", "extraWriteRoots": [], "extraReadRoots": [], "source": null, "label": "未隔离,允许联网" }, "permission": { "permission": "accept-edits", "source": null, "label": "accept edits" }, "thinking": { "thinking": "medium", "source": null, "label": "medium" }, "memory": { "memory": "off", "source": null, "label": "off" } }
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
## `GET /v1/update`
|
|
@@ -226,7 +226,7 @@ CLI 升级请使用 `min-agent update`(执行 `npm install -g min-agent`)。
|
|
|
226
226
|
| `error` | message | 错误 |
|
|
227
227
|
| `done` | step_count, usage, context_tokens, has_error, aborted, max_steps_reached, incomplete, budget_exceeded, continues, stopped, empty_response, empty_attempts, messages, session_id, task_state, project | 结束 |
|
|
228
228
|
| `confirm` | id, message | 等待确认(仅 `auto_approve: false`) |
|
|
229
|
-
| `question` | id, prompt, options | 等待回答(仅 `auto_approve: false`)。`options` 为字符串数组;对象选项(如 `{label, description}
|
|
229
|
+
| `question` | id, prompt, options, multiple | 等待回答(仅 `auto_approve: false`)。`options` 为字符串数组;对象选项(如 `{label, description}`)会先被规范成字符串再下发。有选项时末尾会补上「其他」以便自定义输入。`multiple: true` 表示可多选 |
|
|
230
230
|
| `fatal` | message | 致命错误 |
|
|
231
231
|
|
|
232
232
|
---
|
|
@@ -338,10 +338,10 @@ CLI 升级请使用 `min-agent update`(执行 `npm install -g min-agent`)。
|
|
|
338
338
|
## `GET /v1/permission`
|
|
339
339
|
|
|
340
340
|
```json
|
|
341
|
-
{ "permission": "
|
|
341
|
+
{ "permission": "accept-edits", "source": null, "label": "accept edits" }
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
`permission` 为 `ask` / `accept-edits` / `allow-all`。`source` 为 `cli`、`project`、`global` 或 `null
|
|
344
|
+
`permission` 为 `ask` / `accept-edits` / `allow-all`。`source` 为 `cli`、`project`、`global` 或 `null`(使用默认:`accept-edits`,自动允许文件修改)。
|
|
345
345
|
|
|
346
346
|
## `POST /v1/permission`
|
|
347
347
|
|
|
@@ -415,7 +415,7 @@ CLI 升级请使用 `min-agent update`(执行 `npm install -g min-agent`)。
|
|
|
415
415
|
|
|
416
416
|
## `POST /v1/answers`
|
|
417
417
|
|
|
418
|
-
配合 SSE `question` 事件。`answer` 为 `null`
|
|
418
|
+
配合 SSE `question` 事件。`answer` 为 `null` 表示跳过。单选传选项原文或自定义文字;多选可传 JSON 字符串数组(如 `["A","自定义"]`),或单个字符串。
|
|
419
419
|
|
|
420
420
|
```json
|
|
421
421
|
// 请求
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "min-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Minimal AI coding agent with tool use, MCP, and skills support",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
8
|
-
"min-agent": "
|
|
8
|
+
"min-agent": "bin/min-agent.js"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=20.0.0"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"files": [
|
|
14
14
|
"bin",
|
|
15
15
|
"dist",
|
|
16
|
-
"docs",
|
|
16
|
+
"docs/API.md",
|
|
17
17
|
"skills",
|
|
18
18
|
"README.md",
|
|
19
19
|
"LICENSE"
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"homepage": "https://gitee.com/lemon8510/min-agent",
|
|
32
32
|
"scripts": {
|
|
33
33
|
"dev": "bun run src/cli.ts",
|
|
34
|
-
"build": "
|
|
34
|
+
"build": "bun run scripts/bundle.ts",
|
|
35
35
|
"typecheck": "tsc --noEmit",
|
|
36
36
|
"test": "bun test",
|
|
37
|
-
"lint": "biome check src tests",
|
|
38
|
-
"format": "biome format --write src tests",
|
|
37
|
+
"lint": "biome check src tests scripts",
|
|
38
|
+
"format": "biome format --write src tests scripts",
|
|
39
39
|
"prepack": "npm run typecheck && npm run build"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
@@ -80,13 +80,15 @@ Instructions...
|
|
|
80
80
|
|
|
81
81
|
- Rules: edit the files in the table above. `/reload` reloads rules only, not MCP.
|
|
82
82
|
- Memory: **off** by default. Config `memory` is `on` | `off` (`true`/`enable` → on, `false`/`disable` → off). Project overlays global; writing `memory` globally also removes a project `memory` overlay. When off, memories are not injected and `memory_save` / `memory_search` / `memory_delete` are not registered (takes effect next turn after you change the file). CLI `min-agent memory on|off` / `--memory` follow the same write-vs-this-run rule as permission. `/memory on|off` writes **global** by default (and clears a project overlay); `/memory --project` writes only the project file. `/memory` lists the switch plus stored entries; `/memory <text>` still writes `memory.json` even when off. Default save scope is project when `.min-agent/` exists. Shape: `{ "content": string, "tags": string[], "created": ISO string }` array. When on, memories are injected each turn as background reference, not as work to resume. Do not store secrets or API keys. HTTP: `GET/POST /v1/memory/mode`, chat body `memory`, and `GET /v1/memory` include `memory` / `source` / `label`.
|
|
83
|
-
- Permission: `
|
|
83
|
+
- Permission: `accept-edits` (default) | `ask` | `allow-all` in config `permission`. CLI `min-agent permission …` / `--permission` without a message writes config and exits; with a message it is this session only. `--yes` is this session only and does not write config.
|
|
84
84
|
- Thinking intensity: `off` | `low` | `medium` | `high` | `max` in config `thinking`. Omit the field to use **medium**, then clamp to levels the current model actually exposes (from the model catalog). `/think` opens an interactive picker of those English levels and writes **global** config; that also clears a project `thinking` overlay so a leftover project `off` cannot hide the new value after restart. `/think --project` writes only the project file. Typed `/think off|low|medium|high|max` still works when the model supports that value. `min-agent think …` / `--think` follow the same write-vs-this-run rule as permission. `xhigh` / `extra-high` / `none` are accepted as aliases (`xhigh` → `max`, `none` → `off`). Each request maps that intensity onto the current model and gateway (MiniMax uses `adaptive`/`disabled`; official OpenAI omits `thinking` and maps `max` to `xhigh`; an `ollama` provider uses native chat with `think` plus the configured window). Learned mappings are cached in `~/.min-agent/thinking-wire-cache.json` for 7 days. Per-model context window and supported effort values are loaded from the model catalog (`https://models.lonae.com`, override with `MIN_AGENT_MODELS_API_URL`) and cached in `~/.min-agent/model-catalog-cache.json` for 7 days after a successful lookup. When the provider host is unknown, effort levels are the majority across offerings that actually list efforts (toggle-only rows do not vote), so a single gateway cannot invent `medium`. An `ollama` provider skips that catalog and uses native `POST /api/show` instead (whether the model advertises thinking, plus the loaded window: Modelfile `num_ctx` if set, otherwise the architecture length capped at 32768). Chat completions are sent to native `POST /api/chat` so `options.num_ctx` and `think` actually apply — the OpenAI-compatible `/v1` endpoint ignores both. `/ctx` opens a picker of `2k` / `4k` / `8k` / `12k` / `16k` / `32k` / `64k` / `128k` / `256k` / `auto` and writes the active provider's `contextWindow` (global only; providers are not in project config). Typed `/ctx 8k` and CLI `min-agent ctx 8k` do the same; `auto` clears the override. The menu item is hidden unless the active provider is ollama. Results are cached in `~/.min-agent/ollama-model-cache.json` for 7 days.
|
|
85
85
|
- Sandbox default is **off**. `mode`: `off` | `workspace` | `strict`. Optional `network`, `extraWriteRoots`, `extraReadRoots`. Isolation is independent of permission. `--sandbox` / `--network` without a message write config and exit.
|
|
86
86
|
|
|
87
87
|
## Providers
|
|
88
88
|
|
|
89
|
-
Only in global `config.json`: `providers[]` with `name`, `type` (`openai-compatible` | `openai` | `ollama`), `baseURL`, `apiKey`, optional `defaultModel`, `contextWindow`. `activeProvider` selects one. Project config may set `activeProvider` and `defaultModel` (no keys).
|
|
89
|
+
Only in global `config.json`: `providers[]` with `name`, `type` (`openai-compatible` | `openai` | `ollama`), `baseURL`, `apiKey`, optional `defaultModel`, `contextWindow`. `activeProvider` selects one. Project config may set `activeProvider` and `defaultModel` (no keys). If `providers` is missing or empty, a built-in OpenRouter provider (`openrouter`, model `openrouter/free`) is used at runtime and is not written to disk. User-configured providers always win. `MIN_AGENT_NO_BUILTIN_PROVIDER=1` disables the fallback.
|
|
90
|
+
|
|
91
|
+
`/provider` opens an interactive picker and writes **global** `activeProvider`; that also clears a project `activeProvider` overlay so the choice is what later turns use. Typed `/provider <name>` still works. Adding, editing, or removing providers is `min-agent setup` (not the TUI picker).
|
|
90
92
|
|
|
91
93
|
CLI: `min-agent setup` (interactive wizard or flags). Flags: `--type openai-compatible|openai|ollama`, `--url`, `--api-key`, `--name`, `--default-model`, `--switch <name>`, `--remove <name>`. `--yes` skips overwrite/delete confirmation during setup; it does not change permission. Keys only in the global file.
|
|
92
94
|
|
|
@@ -23,7 +23,7 @@ Read this when you need exact keys. Files are strict JSON.
|
|
|
23
23
|
"webFetchURL": "https://firecrawl.example.com",
|
|
24
24
|
"instructions": ["./docs/rules.md"],
|
|
25
25
|
"disabledSkills": [],
|
|
26
|
-
"permission": "
|
|
26
|
+
"permission": "accept-edits",
|
|
27
27
|
"thinking": "max",
|
|
28
28
|
"memory": "on",
|
|
29
29
|
"sandbox": {
|
|
@@ -71,6 +71,8 @@ Read this when you need exact keys. Files are strict JSON.
|
|
|
71
71
|
- Web search/fetch that has not yet produced the requested output still continues even when `autoContinue` is false; further search/fetch calls return a stop-and-write notice instead of new results.
|
|
72
72
|
- Old single-provider configs migrate on first run; write the `providers` array for new files.
|
|
73
73
|
- Interactive and non-interactive provider setup both go through `min-agent setup`. API keys are written only to the global config.
|
|
74
|
+
- Interactive `/provider` (and typed `/provider <name>`) writes global `activeProvider` and clears a project `activeProvider` overlay. It does not add, edit, or remove providers.
|
|
75
|
+
- If `providers` is missing or empty, runtime uses a built-in OpenRouter provider (`name`: `openrouter`, `defaultModel`: `openrouter/free`) without writing it to disk. User entries always win. `MIN_AGENT_NO_BUILTIN_PROVIDER=1` disables that fallback.
|
|
74
76
|
|
|
75
77
|
## Project `.min-agent/config.json`
|
|
76
78
|
|
|
@@ -141,6 +143,7 @@ Array of `{ "content": string, "tags": string[], "created": string }`. Prefer me
|
|
|
141
143
|
| `MIN_AGENT_CONFIG_DIR` | Replaces `~/.min-agent` (includes `model-catalog-cache.json`, `thinking-wire-cache.json`, `ollama-model-cache.json`) |
|
|
142
144
|
| `MIN_AGENT_SKILLS_DIRS` | Replaces user skill roots (path-delimiter separated) |
|
|
143
145
|
| `MIN_AGENT_NO_BUILTIN_SKILLS` | `1` / `true` skips packaged skills |
|
|
146
|
+
| `MIN_AGENT_NO_BUILTIN_PROVIDER` | `1` / `true` skips the built-in OpenRouter fallback |
|
|
144
147
|
| `MIN_AGENT_SANDBOX` / `MIN_AGENT_SANDBOX_NETWORK` | Isolation |
|
|
145
148
|
| `MIN_AGENT_MODELS_API_URL` | Model catalog base (default `https://models.lonae.com`) |
|
|
146
149
|
| `MIN_AGENT_SERPER_API_KEY` | Overrides `serperApiKey` |
|