min-agent 0.3.0 → 0.4.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.
Files changed (120) hide show
  1. package/README.md +111 -28
  2. package/dist/agent.js +1119 -256
  3. package/dist/cli/commands/chat.js +10 -0
  4. package/dist/cli/commands/exec.js +32 -0
  5. package/dist/cli/commands/history.js +58 -0
  6. package/dist/cli/commands/index.js +224 -0
  7. package/dist/cli/commands/init.js +18 -0
  8. package/dist/cli/commands/mcp.js +173 -0
  9. package/dist/cli/commands/memory.js +69 -0
  10. package/dist/cli/commands/models.js +21 -0
  11. package/dist/cli/commands/permission.js +12 -0
  12. package/dist/cli/commands/rules.js +33 -0
  13. package/dist/cli/commands/sandbox.js +13 -0
  14. package/dist/cli/commands/serve.js +9 -0
  15. package/dist/cli/commands/setup.js +4 -0
  16. package/dist/cli/commands/shared.js +16 -0
  17. package/dist/cli/commands/skills.js +119 -0
  18. package/dist/cli/commands/update.js +7 -0
  19. package/dist/cli/commands/write-config.js +30 -0
  20. package/dist/cli/errors.js +36 -0
  21. package/dist/cli/exec-prompt.js +26 -0
  22. package/dist/cli/option-helpers.js +53 -0
  23. package/dist/cli/program.js +180 -0
  24. package/dist/cli.js +5 -888
  25. package/dist/code-mode.js +32 -14
  26. package/dist/compaction.js +347 -160
  27. package/dist/config.js +119 -10
  28. package/dist/confirm.js +56 -9
  29. package/dist/context-window.js +107 -39
  30. package/dist/doom-loop.js +264 -29
  31. package/dist/fetch-timeout.js +152 -0
  32. package/dist/http-approvals.js +60 -0
  33. package/dist/instructions.js +21 -0
  34. package/dist/logger.js +33 -4
  35. package/dist/markdown.js +37 -11
  36. package/dist/mcp.js +328 -30
  37. package/dist/memory.js +97 -56
  38. package/dist/output.js +7 -5
  39. package/dist/permission-cli.js +43 -0
  40. package/dist/plugins.js +46 -8
  41. package/dist/pricing.js +4 -4
  42. package/dist/provider.js +23 -6
  43. package/dist/question-format.js +60 -0
  44. package/dist/sandbox-cli.js +82 -0
  45. package/dist/sandbox.js +403 -0
  46. package/dist/save-throttle.js +45 -0
  47. package/dist/serve/common.js +404 -0
  48. package/dist/serve/routes-chat.js +347 -0
  49. package/dist/serve/routes-mcp.js +212 -0
  50. package/dist/serve/routes-memory.js +66 -0
  51. package/dist/serve/routes-meta.js +205 -0
  52. package/dist/serve/routes-sessions.js +61 -0
  53. package/dist/serve/routes-skills.js +70 -0
  54. package/dist/serve.js +33 -883
  55. package/dist/sessions.js +53 -9
  56. package/dist/skills.js +82 -18
  57. package/dist/title-gen.js +8 -2
  58. package/dist/token-display.js +36 -0
  59. package/dist/tool-display.js +5 -0
  60. package/dist/tool-output.js +1 -3
  61. package/dist/tools/apply_patch.js +85 -11
  62. package/dist/tools/atomic-file.js +35 -0
  63. package/dist/tools/backend.js +2 -2
  64. package/dist/tools/bash.js +57 -19
  65. package/dist/tools/code_search.js +7 -1
  66. package/dist/tools/edit.js +11 -10
  67. package/dist/tools/explore.js +74 -14
  68. package/dist/tools/glob.js +4 -0
  69. package/dist/tools/grep.js +17 -10
  70. package/dist/tools/index.js +6 -21
  71. package/dist/tools/question.js +28 -9
  72. package/dist/tools/read.js +6 -4
  73. package/dist/tools/search-searxng.js +223 -0
  74. package/dist/tools/search-serper.js +189 -0
  75. package/dist/tools/task.js +84 -30
  76. package/dist/tools/todo.js +120 -19
  77. package/dist/tools/web_fetch.js +11 -3
  78. package/dist/tools/web_search.js +66 -556
  79. package/dist/tools/write.js +23 -6
  80. package/dist/tui/App.js +63 -14
  81. package/dist/tui/ConfirmBar.js +45 -13
  82. package/dist/tui/InputBar.js +150 -35
  83. package/dist/tui/MessageList.js +266 -125
  84. package/dist/tui/ModelPicker.js +8 -3
  85. package/dist/tui/QuestionBar.js +51 -19
  86. package/dist/tui/SessionPicker.js +79 -0
  87. package/dist/tui/StatusBar.js +8 -14
  88. package/dist/tui/agent-runner.js +142 -22
  89. package/dist/tui/caret-pos.js +48 -5
  90. package/dist/tui/caret.js +1 -1
  91. package/dist/tui/click-count.js +13 -0
  92. package/dist/tui/drag-state.js +8 -3
  93. package/dist/tui/hydrate.js +129 -0
  94. package/dist/tui/index.js +42 -13
  95. package/dist/tui/input-history.js +92 -11
  96. package/dist/tui/layout.js +75 -4
  97. package/dist/tui/prompt-queue.js +24 -0
  98. package/dist/tui/selection.js +113 -21
  99. package/dist/tui/session-switch.js +28 -0
  100. package/dist/tui/slash-commands.js +22 -6
  101. package/dist/tui/slash-handler.js +233 -58
  102. package/dist/tui/text-width.js +38 -16
  103. package/dist/tui/token-info.js +7 -0
  104. package/dist/tui/tool-children.js +19 -0
  105. package/dist/tui/undo-stack.js +1 -1
  106. package/dist/tui/use-sgr-mouse.js +3 -1
  107. package/dist/tui-chat.js +276 -40
  108. package/dist/updater.js +88 -29
  109. package/dist/xml-search.js +194 -0
  110. package/docs/API.md +257 -25
  111. package/docs/superpowers/plans/2026-08-20-tui-completeness.md +873 -0
  112. package/docs/superpowers/plans/2026-08-20-unified-tui-default.md +631 -0
  113. package/docs/superpowers/specs/2026-08-20-config-http-alignment-design.md +47 -0
  114. package/docs/superpowers/specs/2026-08-20-mcp-plugins-alignment-design.md +37 -0
  115. package/docs/superpowers/specs/2026-08-20-sandbox-permissions-design.md +68 -0
  116. package/docs/superpowers/specs/2026-08-20-tui-completeness-design.md +273 -0
  117. package/docs/superpowers/specs/2026-08-20-unified-tui-default-design.md +165 -0
  118. package/package.json +6 -1
  119. package/skills/self-config/SKILL.md +90 -0
  120. package/skills/self-config/reference.md +149 -0
@@ -0,0 +1,149 @@
1
+ # self-config field catalog
2
+
3
+ Read this when you need exact keys. Files are strict JSON.
4
+
5
+ ## Global `~/.min-agent/config.json`
6
+
7
+ ```json
8
+ {
9
+ "providers": [
10
+ {
11
+ "name": "default",
12
+ "type": "openai-compatible",
13
+ "baseURL": "https://api.openai.com/v1",
14
+ "apiKey": "sk-...",
15
+ "defaultModel": "gpt-5.5",
16
+ "contextWindow": 1000000
17
+ }
18
+ ],
19
+ "activeProvider": "default",
20
+ "webSearchURL": "https://searxng.example.com",
21
+ "webSearchFallbackEngines": "google,bing",
22
+ "serperApiKey": "your-serper-key",
23
+ "webFetchURL": "https://firecrawl.example.com",
24
+ "instructions": ["./docs/rules.md"],
25
+ "disabledSkills": [],
26
+ "permission": "ask",
27
+ "sandbox": {
28
+ "mode": "off",
29
+ "network": "allow",
30
+ "extraWriteRoots": [],
31
+ "extraReadRoots": []
32
+ },
33
+ "pricing": { "gpt-5.5": { "inputPerMillion": 1.25, "outputPerMillion": 10 } },
34
+ "sampling": { "temperature": 0.7, "maxTokens": 4096, "topP": 1 },
35
+ "budget": { "maxCostUSD": 5 },
36
+ "compaction": { "model": "gemini-2.0-flash", "autoContinue": true },
37
+ "tools": { "bashTimeoutMs": 600000 },
38
+ "agent": {
39
+ "maxSteps": 40,
40
+ "maxContinues": 40,
41
+ "autoContinue": true,
42
+ "maxEmptyAttempts": 4,
43
+ "emptyRetryDelayMs": 1000,
44
+ "requestTimeoutMs": 180000,
45
+ "streamIdleTimeoutMs": 90000,
46
+ "turnTimeLimitMs": 1200000,
47
+ "softStepLimit": 120,
48
+ "subAgentMaxSteps": 15,
49
+ "exploreMaxSteps": 20,
50
+ "researchSteerAfter": 3,
51
+ "researchStopAfter": 5,
52
+ "researchTotalCap": 24
53
+ }
54
+ }
55
+ ```
56
+
57
+ - `contextWindow`: tokens; omit to query the API, then 512k fallback.
58
+ - `agent.autoContinue` omitted → uses `compaction.autoContinue` (default true).
59
+ - `agent.maxSteps` omitted → no tool-step ceiling.
60
+ - `agent.maxEmptyAttempts` / `agent.emptyRetryDelayMs`: retries when the provider returns an empty stream (HTTP 200, no content). First retry is immediate, later ones back off exponentially, capped at 8s.
61
+ - `agent.requestTimeoutMs` / `agent.streamIdleTimeoutMs`: abort a request that never starts responding, or a stream that goes quiet mid-response; the run then retries it like an empty reply. 0 disables. Env overrides: `MIN_AGENT_REQUEST_TIMEOUT_MS`, `MIN_AGENT_STREAM_IDLE_TIMEOUT_MS`.
62
+ - `agent.turnTimeLimitMs` / `agent.softStepLimit`: budget for one turn. On expiry the model is asked to wrap up once, then the turn stops. 0 disables either half.
63
+ - `agent.subAgentMaxSteps` / `agent.exploreMaxSteps`: step ceilings for the `task` and `explore` sub-agents. Sub-agents share the parent's research budget and cost budget.
64
+ - `agent.researchSteerAfter` / `researchStopAfter`: research *rounds that returned no new source* before steering / dropping `search_web` and `web_fetch`; `researchTotalCap` is the hard number of research calls per turn. Productive research (new URLs or domains each round) is not penalised.
65
+ - `tools.bashTimeoutMs`: default kill timeout for `bash` (10 minutes; the model can override per call, 0 disables).
66
+ - `MIN_AGENT_TRACE=1` logs a request/response summary for every model call (model, message and tool counts, status, time to first byte).
67
+ - 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.
68
+ - Old single-provider configs migrate on first run; write the `providers` array for new files.
69
+
70
+ ## Project `.min-agent/config.json`
71
+
72
+ Allowed keys (no `providers`, no API keys, no search secrets):
73
+
74
+ `disabledSkills`, `enabledSkills`, `activeProvider`, `defaultModel`, `sampling`, `budget`, `permission`, `sandbox`, `compaction`, `agent`.
75
+
76
+ Present keys overlay the global file. Nested objects `sampling` / `budget` / `sandbox` / `compaction` / `agent` merge per field. `defaultModel` overrides the active provider's model without copying keys.
77
+
78
+ ## `mcp.json`
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "filesystem": {
84
+ "command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
85
+ "environment": { "KEY": "VALUE" },
86
+ "enabled": true,
87
+ "connectTimeout": 10000,
88
+ "callTimeout": 30000
89
+ },
90
+ "remote": {
91
+ "url": "https://mcp.example.com/mcp",
92
+ "remoteTransport": "auto",
93
+ "token": "bearer-token",
94
+ "headers": { "X-API-Key": "..." },
95
+ "oauth": {},
96
+ "connectTimeout": 15000,
97
+ "callTimeout": 30000
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ - `command` may be a string plus `args[]` (Claude/opencode shape).
104
+ - `timeout` is the legacy shared value; `connectTimeout` / `callTimeout` override it.
105
+ - `oauth`: object (optional `clientId` / `clientSecret` / `scope`) or `false`.
106
+ - Tokens for OAuth land in `~/.min-agent/mcp-oauth/`.
107
+
108
+ ## Skills frontmatter
109
+
110
+ Required: `name`, `description`. Optional: `version`, `allowed-tools` (flow `[read, grep]` or a YAML list), `always-load` (`true` injects the body into the system prompt), `metadata.requires.bins`.
111
+
112
+ Disable lists are string arrays. A project `enabledSkills` name unblocks a globally disabled skill in this repo only.
113
+
114
+ ## Plugins
115
+
116
+ `.min-agent/tools/*.ts` (or `~/.min-agent/tools/*.ts`). Each exported object:
117
+
118
+ ```typescript
119
+ export const myTool = {
120
+ description: "...",
121
+ parameters: { arg: { type: "string", description: "..." } },
122
+ execute: async ({ arg }) => "result",
123
+ }
124
+ ```
125
+
126
+ Default: confirm before run. `readOnly: true` or `dangerous: false` skips confirm. Plan mode keeps only `readOnly` custom tools. Export name `default` → tool id is the file basename; other exports → `basename_exportName`.
127
+
128
+ ## Memory `memory.json`
129
+
130
+ Array of `{ "content": string, "tags": string[], "created": string }`. Prefer memory tools.
131
+
132
+ ## Environment overrides
133
+
134
+ | Variable | Role |
135
+ |----------|------|
136
+ | `MIN_AGENT_CONFIG_DIR` | Replaces `~/.min-agent` |
137
+ | `MIN_AGENT_SKILLS_DIRS` | Replaces user skill roots (path-delimiter separated) |
138
+ | `MIN_AGENT_NO_BUILTIN_SKILLS` | `1` / `true` skips packaged skills |
139
+ | `MIN_AGENT_SANDBOX` / `MIN_AGENT_SANDBOX_NETWORK` | Isolation |
140
+ | `MIN_AGENT_SERPER_API_KEY` | Overrides `serperApiKey` |
141
+ | `MIN_AGENT_SEARXNG_URL` | Overrides `webSearchURL` (SearXNG instead of Serper) |
142
+ | `MIN_AGENT_SEARXNG_FALLBACK_ENGINES` | Default `google,bing`; empty string disables retry |
143
+ | `MIN_AGENT_FIRECRAWL_URL` | Overrides `webFetchURL` |
144
+ | `EXA_API_KEY` | Enables Exa code search |
145
+ | `MIN_AGENT_SERVE_TOKEN` / `MIN_AGENT_SERVE_CORS` | HTTP server |
146
+
147
+ ## HTTP (only if the user is running `min-agent serve`)
148
+
149
+ Skills: `GET /v1/skills`, `GET /v1/skills/:name`, `POST /v1/skills/reload`, `POST /v1/skills/:name/enable|disable` with `{ "scope": "project"|"global" }`. MCP enable/disable similarly. Full list is `docs/API.md` in the min-agent package; do not treat that file as this skill's replacement.