min-agent 0.2.1 → 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.
- package/README.md +242 -31
- package/dist/agent.js +1233 -485
- package/dist/assistant-stream.js +11 -7
- package/dist/cli/commands/chat.js +10 -0
- package/dist/cli/commands/exec.js +32 -0
- package/dist/cli/commands/history.js +58 -0
- package/dist/cli/commands/index.js +224 -0
- package/dist/cli/commands/init.js +18 -0
- package/dist/cli/commands/mcp.js +173 -0
- package/dist/cli/commands/memory.js +69 -0
- package/dist/cli/commands/models.js +21 -0
- package/dist/cli/commands/permission.js +12 -0
- package/dist/cli/commands/rules.js +33 -0
- package/dist/cli/commands/sandbox.js +13 -0
- package/dist/cli/commands/serve.js +9 -0
- package/dist/cli/commands/setup.js +4 -0
- package/dist/cli/commands/shared.js +16 -0
- package/dist/cli/commands/skills.js +119 -0
- package/dist/cli/commands/update.js +7 -0
- package/dist/cli/commands/write-config.js +30 -0
- package/dist/cli/errors.js +36 -0
- package/dist/cli/exec-prompt.js +26 -0
- package/dist/cli/option-helpers.js +53 -0
- package/dist/cli/program.js +180 -0
- package/dist/cli.js +7 -632
- package/dist/clipboard.js +59 -23
- package/dist/code-mode.js +35 -17
- package/dist/compaction.js +457 -169
- package/dist/config.js +298 -38
- package/dist/confirm.js +105 -9
- package/dist/context-window.js +156 -75
- package/dist/doom-loop.js +268 -26
- package/dist/fetch-timeout.js +152 -0
- package/dist/http-approvals.js +60 -0
- package/dist/http.js +119 -0
- package/dist/instructions.js +72 -33
- package/dist/logger.js +95 -0
- package/dist/markdown.js +35 -50
- package/dist/mcp.js +847 -102
- package/dist/memory.js +128 -45
- package/dist/output.js +42 -31
- package/dist/paste-handler.js +3 -3
- package/dist/permission-cli.js +43 -0
- package/dist/plugins.js +76 -11
- package/dist/pricing.js +119 -0
- package/dist/provider.js +34 -15
- package/dist/question-format.js +60 -0
- package/dist/sandbox-cli.js +82 -0
- package/dist/sandbox.js +403 -0
- package/dist/save-throttle.js +45 -0
- package/dist/serve/common.js +404 -0
- package/dist/serve/routes-chat.js +347 -0
- package/dist/serve/routes-mcp.js +212 -0
- package/dist/serve/routes-memory.js +66 -0
- package/dist/serve/routes-meta.js +205 -0
- package/dist/serve/routes-sessions.js +61 -0
- package/dist/serve/routes-skills.js +70 -0
- package/dist/serve.js +74 -635
- package/dist/sessions.js +197 -15
- package/dist/skills.js +531 -77
- package/dist/synthetic.js +7 -0
- package/dist/title-gen.js +9 -2
- package/dist/token-display.js +36 -0
- package/dist/tool-display.js +178 -0
- package/dist/tool-output.js +53 -46
- package/dist/tools/apply_patch.js +265 -0
- package/dist/tools/atomic-file.js +35 -0
- package/dist/tools/backend.js +61 -0
- package/dist/tools/bash.js +186 -71
- package/dist/tools/code_search.js +13 -6
- package/dist/tools/edit.js +26 -9
- package/dist/tools/explore.js +144 -16
- package/dist/tools/glob.js +7 -3
- package/dist/tools/grep.js +153 -14
- package/dist/tools/index.js +9 -24
- package/dist/tools/question.js +31 -30
- package/dist/tools/read.js +77 -15
- package/dist/tools/search-searxng.js +223 -0
- package/dist/tools/search-serper.js +189 -0
- package/dist/tools/task.js +100 -33
- package/dist/tools/todo.js +178 -67
- package/dist/tools/web_fetch.js +158 -46
- package/dist/tools/web_search.js +217 -29
- package/dist/tools/write.js +34 -11
- package/dist/tui/App.js +89 -6
- package/dist/tui/ConfirmBar.js +57 -4
- package/dist/tui/InputBar.js +504 -44
- package/dist/tui/MessageList.js +674 -20
- package/dist/tui/ModelPicker.js +113 -0
- package/dist/tui/QuestionBar.js +136 -0
- package/dist/tui/SessionPicker.js +79 -0
- package/dist/tui/StatusBar.js +14 -12
- package/dist/tui/agent-runner.js +223 -0
- package/dist/tui/caret-pos.js +177 -0
- package/dist/tui/caret.js +69 -0
- package/dist/tui/click-count.js +13 -0
- package/dist/tui/diff-view.js +61 -0
- package/dist/tui/drag-state.js +49 -0
- package/dist/tui/hydrate.js +129 -0
- package/dist/tui/index.js +189 -31
- package/dist/tui/input-history.js +125 -0
- package/dist/tui/layout.js +88 -0
- package/dist/tui/mouse.js +46 -0
- package/dist/tui/prompt-queue.js +24 -0
- package/dist/tui/selection.js +226 -0
- package/dist/tui/session-switch.js +28 -0
- package/dist/tui/slash-commands.js +106 -0
- package/dist/tui/slash-handler.js +545 -0
- package/dist/tui/text-width.js +113 -0
- package/dist/tui/theme.js +12 -0
- package/dist/tui/token-info.js +7 -0
- package/dist/tui/tool-children.js +19 -0
- package/dist/tui/undo-stack.js +14 -0
- package/dist/tui/use-sgr-mouse.js +29 -0
- package/dist/tui-chat.js +346 -330
- package/dist/updater.js +116 -0
- package/dist/xml-search.js +194 -0
- package/docs/API.md +410 -32
- package/docs/superpowers/plans/2026-08-16-batch1-tui-improvements.md +1510 -0
- package/docs/superpowers/plans/2026-08-16-batch2-cli-tools-api.md +2105 -0
- package/docs/superpowers/plans/2026-08-16-batch3-config-engineering.md +1595 -0
- package/docs/superpowers/plans/2026-08-16-input-caret.md +782 -0
- package/docs/superpowers/plans/2026-08-20-tui-completeness.md +873 -0
- package/docs/superpowers/plans/2026-08-20-unified-tui-default.md +631 -0
- package/docs/superpowers/specs/2026-08-16-batch1-tui-improvements-design.md +183 -0
- package/docs/superpowers/specs/2026-08-16-batch2-cli-tools-api-design.md +220 -0
- package/docs/superpowers/specs/2026-08-16-batch3-config-engineering-design.md +196 -0
- package/docs/superpowers/specs/2026-08-16-input-caret-design.md +63 -0
- package/docs/superpowers/specs/2026-08-17-mouse-selection-design.md +116 -0
- package/docs/superpowers/specs/2026-08-20-config-http-alignment-design.md +47 -0
- package/docs/superpowers/specs/2026-08-20-mcp-plugins-alignment-design.md +37 -0
- package/docs/superpowers/specs/2026-08-20-sandbox-permissions-design.md +68 -0
- package/docs/superpowers/specs/2026-08-20-tui-completeness-design.md +273 -0
- package/docs/superpowers/specs/2026-08-20-unified-tui-default-design.md +165 -0
- package/package.json +12 -8
- package/skills/self-config/SKILL.md +90 -0
- package/skills/self-config/reference.md +149 -0
package/dist/markdown.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Lightweight streaming markdown renderer for terminal.
|
|
3
3
|
* Tracks state across text deltas to apply ANSI formatting.
|
|
4
4
|
*/
|
|
5
|
+
import { displayWidth } from "./tui/text-width.js";
|
|
5
6
|
function useColor() {
|
|
6
7
|
if ("NO_COLOR" in process.env)
|
|
7
8
|
return false;
|
|
@@ -51,7 +52,15 @@ export class MarkdownRenderer {
|
|
|
51
52
|
break;
|
|
52
53
|
const line = this.buffer.slice(0, nlIdx);
|
|
53
54
|
this.buffer = this.buffer.slice(nlIdx + 1);
|
|
54
|
-
|
|
55
|
+
if (this.inCodeBlock || line.startsWith("```")) {
|
|
56
|
+
if (this.inTable) {
|
|
57
|
+
output += this.renderTable(c);
|
|
58
|
+
this.tableRows = [];
|
|
59
|
+
this.inTable = false;
|
|
60
|
+
}
|
|
61
|
+
output += this.formatLine(line, c) + "\n";
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
55
64
|
if (this.isTableRow(line)) {
|
|
56
65
|
if (this.isTableSeparator(line)) {
|
|
57
66
|
this.inTable = true;
|
|
@@ -126,71 +135,47 @@ export class MarkdownRenderer {
|
|
|
126
135
|
return /^\s*\|[\s:]*-+[\s:|-]*\|\s*$/.test(line);
|
|
127
136
|
}
|
|
128
137
|
parseTableRow(line) {
|
|
129
|
-
return line
|
|
138
|
+
return line
|
|
139
|
+
.trim()
|
|
140
|
+
.slice(1, -1)
|
|
141
|
+
.split("|")
|
|
142
|
+
.map((cell) => cell.trim());
|
|
130
143
|
}
|
|
131
|
-
/**
|
|
132
|
-
|
|
144
|
+
/** Pad string to target display width */
|
|
145
|
+
clipToWidth(str, targetWidth) {
|
|
133
146
|
let width = 0;
|
|
147
|
+
let out = "";
|
|
134
148
|
for (const ch of str) {
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
(code >= 0x3040 && code <= 0x33bf) ||
|
|
141
|
-
(code >= 0x3400 && code <= 0x4dbf) ||
|
|
142
|
-
(code >= 0x4e00 && code <= 0x9fff) ||
|
|
143
|
-
(code >= 0xa000 && code <= 0xa4cf) ||
|
|
144
|
-
(code >= 0xac00 && code <= 0xd7af) ||
|
|
145
|
-
(code >= 0xf900 && code <= 0xfaff) ||
|
|
146
|
-
(code >= 0xfe30 && code <= 0xfe6f) ||
|
|
147
|
-
(code >= 0xff01 && code <= 0xff60) ||
|
|
148
|
-
(code >= 0xffe0 && code <= 0xffe6) ||
|
|
149
|
-
(code >= 0x20000 && code <= 0x2fffd) ||
|
|
150
|
-
(code >= 0x30000 && code <= 0x3fffd) ||
|
|
151
|
-
// Emoji
|
|
152
|
-
(code >= 0x1f300 && code <= 0x1f9ff) || // Misc Symbols, Emoticons, Dingbats, etc.
|
|
153
|
-
(code >= 0x1fa00 && code <= 0x1faff) || // Chess, Extended-A
|
|
154
|
-
(code >= 0x2600 && code <= 0x27bf) || // Misc Symbols, Dingbats
|
|
155
|
-
(code >= 0xfe00 && code <= 0xfe0f) || // Variation Selectors (skip width)
|
|
156
|
-
(code >= 0x200d && code <= 0x200d) || // ZWJ (skip width)
|
|
157
|
-
(code >= 0x1f1e0 && code <= 0x1f1ff) // Regional Indicators (flags)
|
|
158
|
-
) {
|
|
159
|
-
// Variation selectors and ZWJ are zero-width joiners
|
|
160
|
-
if ((code >= 0xfe00 && code <= 0xfe0f) || code === 0x200d) {
|
|
161
|
-
width += 0;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
width += 2;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
width += 1;
|
|
169
|
-
}
|
|
149
|
+
const w = displayWidth(ch);
|
|
150
|
+
if (width + w > targetWidth)
|
|
151
|
+
break;
|
|
152
|
+
out += ch;
|
|
153
|
+
width += w;
|
|
170
154
|
}
|
|
171
|
-
return
|
|
155
|
+
return out;
|
|
172
156
|
}
|
|
173
|
-
/** Pad string to target display width */
|
|
174
157
|
padToWidth(str, targetWidth) {
|
|
175
|
-
const
|
|
176
|
-
const padding = targetWidth -
|
|
177
|
-
return padding > 0 ?
|
|
158
|
+
const clipped = this.clipToWidth(str, targetWidth);
|
|
159
|
+
const padding = targetWidth - displayWidth(clipped);
|
|
160
|
+
return padding > 0 ? clipped + " ".repeat(padding) : clipped;
|
|
178
161
|
}
|
|
179
162
|
renderTable(c) {
|
|
180
163
|
if (this.tableRows.length === 0)
|
|
181
164
|
return "";
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
const colCount = Math.max(0, ...this.tableRows.map((r) => r.length));
|
|
166
|
+
if (colCount === 0)
|
|
167
|
+
return "";
|
|
184
168
|
const widths = Array(colCount).fill(0);
|
|
169
|
+
const maxCol = 64;
|
|
185
170
|
for (const row of this.tableRows) {
|
|
186
171
|
for (let i = 0; i < row.length; i++) {
|
|
187
|
-
widths[i] = Math.max(widths[i],
|
|
172
|
+
widths[i] = Math.min(maxCol, Math.max(widths[i], displayWidth(row[i] ?? "")));
|
|
188
173
|
}
|
|
189
174
|
}
|
|
190
175
|
const lines = [];
|
|
191
|
-
const top = `${c.dim}┌${widths.map((w) => "─".repeat(w + 2)).join("┬")}┐${c.reset}`;
|
|
192
|
-
const mid = `${c.dim}├${widths.map((w) => "─".repeat(w + 2)).join("┼")}┤${c.reset}`;
|
|
193
|
-
const bot = `${c.dim}└${widths.map((w) => "─".repeat(w + 2)).join("┴")}┘${c.reset}`;
|
|
176
|
+
const top = `${c.dim}┌${widths.map((w) => "─".repeat(Math.max(0, w + 2))).join("┬")}┐${c.reset}`;
|
|
177
|
+
const mid = `${c.dim}├${widths.map((w) => "─".repeat(Math.max(0, w + 2))).join("┼")}┤${c.reset}`;
|
|
178
|
+
const bot = `${c.dim}└${widths.map((w) => "─".repeat(Math.max(0, w + 2))).join("┴")}┘${c.reset}`;
|
|
194
179
|
lines.push(top);
|
|
195
180
|
for (let r = 0; r < this.tableRows.length; r++) {
|
|
196
181
|
const row = this.tableRows[r];
|