min-agent 0.5.0 → 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 +32 -18
- package/dist/cli.js +538 -12
- package/docs/API.md +25 -8
- package/package.json +6 -6
- package/skills/self-config/SKILL.md +7 -3
- package/skills/self-config/reference.md +8 -4
- package/dist/agent.js +0 -1342
- package/dist/assistant-stream.js +0 -131
- package/dist/cli/commands/chat.js +0 -13
- package/dist/cli/commands/exec.js +0 -35
- package/dist/cli/commands/history.js +0 -58
- package/dist/cli/commands/index.js +0 -241
- 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 -4
- package/dist/cli/commands/shared.js +0 -16
- 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 -217
- package/dist/clipboard.js +0 -142
- package/dist/code-mode.js +0 -184
- package/dist/compaction.js +0 -644
- package/dist/config.js +0 -470
- package/dist/confirm.js +0 -172
- package/dist/context-window.js +0 -246
- 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/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 -233
- 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 -228
- package/dist/thinking.js +0 -142
- 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 -126
- package/dist/tui/ConfirmBar.js +0 -66
- package/dist/tui/InputBar.js +0 -616
- 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 -77
- 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 -258
- 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 -123
- package/dist/tui/slash-handler.js +0 -589
- 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 -456
- 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-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-input-paste-attachments-design.md +0 -174
- package/docs/superpowers/specs/2026-08-23-thinking-wire-profile-design.md +0 -140
package/dist/markdown.js
DELETED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lightweight streaming markdown renderer for terminal.
|
|
3
|
-
* Tracks state across text deltas to apply ANSI formatting.
|
|
4
|
-
*/
|
|
5
|
-
import { displayWidth } from "./tui/text-width.js";
|
|
6
|
-
function useColor() {
|
|
7
|
-
if ("NO_COLOR" in process.env)
|
|
8
|
-
return false;
|
|
9
|
-
if (process.env.FORCE_COLOR === "0")
|
|
10
|
-
return false;
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
const C = {
|
|
14
|
-
reset: "\x1b[0m",
|
|
15
|
-
bold: "\x1b[1m",
|
|
16
|
-
dim: "\x1b[2m",
|
|
17
|
-
italic: "\x1b[3m",
|
|
18
|
-
cyan: "\x1b[36m",
|
|
19
|
-
green: "\x1b[32m",
|
|
20
|
-
yellow: "\x1b[33m",
|
|
21
|
-
magenta: "\x1b[35m",
|
|
22
|
-
gray: "\x1b[90m",
|
|
23
|
-
underline: "\x1b[4m",
|
|
24
|
-
};
|
|
25
|
-
const Z = {
|
|
26
|
-
reset: "",
|
|
27
|
-
bold: "",
|
|
28
|
-
dim: "",
|
|
29
|
-
italic: "",
|
|
30
|
-
cyan: "",
|
|
31
|
-
green: "",
|
|
32
|
-
yellow: "",
|
|
33
|
-
magenta: "",
|
|
34
|
-
gray: "",
|
|
35
|
-
underline: "",
|
|
36
|
-
};
|
|
37
|
-
export class MarkdownRenderer {
|
|
38
|
-
buffer = "";
|
|
39
|
-
inCodeBlock = false;
|
|
40
|
-
codeLang = "";
|
|
41
|
-
tableRows = [];
|
|
42
|
-
inTable = false;
|
|
43
|
-
/** Process a text delta and return formatted output */
|
|
44
|
-
write(text) {
|
|
45
|
-
this.buffer += text;
|
|
46
|
-
let output = "";
|
|
47
|
-
const c = useColor() ? C : Z;
|
|
48
|
-
// Process complete lines
|
|
49
|
-
while (true) {
|
|
50
|
-
const nlIdx = this.buffer.indexOf("\n");
|
|
51
|
-
if (nlIdx === -1)
|
|
52
|
-
break;
|
|
53
|
-
const line = this.buffer.slice(0, nlIdx);
|
|
54
|
-
this.buffer = this.buffer.slice(nlIdx + 1);
|
|
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
|
-
}
|
|
64
|
-
if (this.isTableRow(line)) {
|
|
65
|
-
if (this.isTableSeparator(line)) {
|
|
66
|
-
this.inTable = true;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
this.inTable = true;
|
|
70
|
-
this.tableRows.push(this.parseTableRow(line));
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
// Table just ended — flush it
|
|
74
|
-
if (this.inTable) {
|
|
75
|
-
output += this.renderTable(c);
|
|
76
|
-
this.tableRows = [];
|
|
77
|
-
this.inTable = false;
|
|
78
|
-
}
|
|
79
|
-
output += this.formatLine(line, c) + "\n";
|
|
80
|
-
}
|
|
81
|
-
// Stream partial line immediately for real-time feel
|
|
82
|
-
// Hold back only if it could be start of table or code fence
|
|
83
|
-
if (!this.inTable && !this.inCodeBlock && this.buffer.length > 0) {
|
|
84
|
-
if (!this.buffer.startsWith("|") && !this.buffer.startsWith("`")) {
|
|
85
|
-
const partial = this.buffer;
|
|
86
|
-
this.buffer = "";
|
|
87
|
-
output += this.formatInline(partial, c);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// If we're in a table and buffer starts with "|", hold it (waiting for \n)
|
|
91
|
-
// If we're in a table and buffer does NOT start with "|", the table ended mid-stream
|
|
92
|
-
if (this.inTable && this.buffer.length > 0 && !this.buffer.startsWith("|")) {
|
|
93
|
-
output += this.renderTable(c);
|
|
94
|
-
this.tableRows = [];
|
|
95
|
-
this.inTable = false;
|
|
96
|
-
// Now output the non-table buffer content
|
|
97
|
-
if (this.buffer.length > 0 && !this.buffer.startsWith("`")) {
|
|
98
|
-
const partial = this.buffer;
|
|
99
|
-
this.buffer = "";
|
|
100
|
-
output += this.formatInline(partial, c);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return output;
|
|
104
|
-
}
|
|
105
|
-
/** Flush remaining buffer */
|
|
106
|
-
flush() {
|
|
107
|
-
const c = useColor() ? C : Z;
|
|
108
|
-
let out = "";
|
|
109
|
-
// If buffer has a pending table row, add it
|
|
110
|
-
if (this.inTable && this.buffer.length > 0) {
|
|
111
|
-
if (this.isTableRow(this.buffer)) {
|
|
112
|
-
if (!this.isTableSeparator(this.buffer)) {
|
|
113
|
-
this.tableRows.push(this.parseTableRow(this.buffer));
|
|
114
|
-
}
|
|
115
|
-
this.buffer = "";
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// Flush pending table
|
|
119
|
-
if (this.inTable && this.tableRows.length > 0) {
|
|
120
|
-
out += this.renderTable(c);
|
|
121
|
-
this.tableRows = [];
|
|
122
|
-
this.inTable = false;
|
|
123
|
-
}
|
|
124
|
-
if (!this.buffer)
|
|
125
|
-
return out;
|
|
126
|
-
out += this.formatLine(this.buffer, c);
|
|
127
|
-
this.buffer = "";
|
|
128
|
-
return out;
|
|
129
|
-
}
|
|
130
|
-
isTableRow(line) {
|
|
131
|
-
const trimmed = line.trim();
|
|
132
|
-
return trimmed.startsWith("|") && trimmed.endsWith("|") && trimmed.includes("|", 1);
|
|
133
|
-
}
|
|
134
|
-
isTableSeparator(line) {
|
|
135
|
-
return /^\s*\|[\s:]*-+[\s:|-]*\|\s*$/.test(line);
|
|
136
|
-
}
|
|
137
|
-
parseTableRow(line) {
|
|
138
|
-
return line
|
|
139
|
-
.trim()
|
|
140
|
-
.slice(1, -1)
|
|
141
|
-
.split("|")
|
|
142
|
-
.map((cell) => cell.trim());
|
|
143
|
-
}
|
|
144
|
-
/** Pad string to target display width */
|
|
145
|
-
clipToWidth(str, targetWidth) {
|
|
146
|
-
let width = 0;
|
|
147
|
-
let out = "";
|
|
148
|
-
for (const ch of str) {
|
|
149
|
-
const w = displayWidth(ch);
|
|
150
|
-
if (width + w > targetWidth)
|
|
151
|
-
break;
|
|
152
|
-
out += ch;
|
|
153
|
-
width += w;
|
|
154
|
-
}
|
|
155
|
-
return out;
|
|
156
|
-
}
|
|
157
|
-
padToWidth(str, targetWidth) {
|
|
158
|
-
const clipped = this.clipToWidth(str, targetWidth);
|
|
159
|
-
const padding = targetWidth - displayWidth(clipped);
|
|
160
|
-
return padding > 0 ? clipped + " ".repeat(padding) : clipped;
|
|
161
|
-
}
|
|
162
|
-
renderTable(c) {
|
|
163
|
-
if (this.tableRows.length === 0)
|
|
164
|
-
return "";
|
|
165
|
-
const colCount = Math.max(0, ...this.tableRows.map((r) => r.length));
|
|
166
|
-
if (colCount === 0)
|
|
167
|
-
return "";
|
|
168
|
-
const widths = Array(colCount).fill(0);
|
|
169
|
-
const maxCol = 64;
|
|
170
|
-
for (const row of this.tableRows) {
|
|
171
|
-
for (let i = 0; i < row.length; i++) {
|
|
172
|
-
widths[i] = Math.min(maxCol, Math.max(widths[i], displayWidth(row[i] ?? "")));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
const lines = [];
|
|
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}`;
|
|
179
|
-
lines.push(top);
|
|
180
|
-
for (let r = 0; r < this.tableRows.length; r++) {
|
|
181
|
-
const row = this.tableRows[r];
|
|
182
|
-
const cells = widths.map((w, i) => {
|
|
183
|
-
const cell = row[i] ?? "";
|
|
184
|
-
const padded = this.padToWidth(cell, w);
|
|
185
|
-
return r === 0 ? `${c.bold}${padded}${c.reset}` : padded;
|
|
186
|
-
});
|
|
187
|
-
lines.push(`${c.dim}│${c.reset} ${cells.join(` ${c.dim}│${c.reset} `)} ${c.dim}│${c.reset}`);
|
|
188
|
-
if (r === 0)
|
|
189
|
-
lines.push(mid);
|
|
190
|
-
}
|
|
191
|
-
lines.push(bot);
|
|
192
|
-
return lines.join("\n") + "\n";
|
|
193
|
-
}
|
|
194
|
-
formatInline(line, c) {
|
|
195
|
-
// Split by inline code spans; format outside segments only
|
|
196
|
-
const parts = line.split(/(`[^`]*`)/g);
|
|
197
|
-
return parts
|
|
198
|
-
.map((seg) => {
|
|
199
|
-
if (seg.startsWith("`") && seg.endsWith("`") && seg.length >= 2) {
|
|
200
|
-
const inner = seg.slice(1, -1);
|
|
201
|
-
return `${c.cyan}${inner}${c.reset}`;
|
|
202
|
-
}
|
|
203
|
-
let s = seg;
|
|
204
|
-
s = s.replace(/\*\*([^*]+)\*\*/g, `${c.bold}$1${c.reset}`);
|
|
205
|
-
s = s.replace(/\*([^*]+)\*/g, `${c.italic}$1${c.reset}`);
|
|
206
|
-
s = s.replace(/\[([^\]]+)\]\(([^)]+)\)/g, `${c.cyan}$1${c.reset} ${c.dim}($2)${c.reset}`);
|
|
207
|
-
return s;
|
|
208
|
-
})
|
|
209
|
-
.join("");
|
|
210
|
-
}
|
|
211
|
-
formatLine(line, c) {
|
|
212
|
-
// Code block fence
|
|
213
|
-
if (line.startsWith("```")) {
|
|
214
|
-
if (!this.inCodeBlock) {
|
|
215
|
-
this.inCodeBlock = true;
|
|
216
|
-
this.codeLang = line.slice(3).trim();
|
|
217
|
-
return `${c.dim}┌─ ${this.codeLang || "code"} ${"─".repeat(Math.max(0, 40 - (this.codeLang?.length ?? 0)))}${c.reset}`;
|
|
218
|
-
}
|
|
219
|
-
this.inCodeBlock = false;
|
|
220
|
-
this.codeLang = "";
|
|
221
|
-
return `${c.dim}└${"─".repeat(44)}${c.reset}`;
|
|
222
|
-
}
|
|
223
|
-
// Inside code block — dim
|
|
224
|
-
if (this.inCodeBlock) {
|
|
225
|
-
return `${c.dim}│${c.reset} ${line}`;
|
|
226
|
-
}
|
|
227
|
-
// Headers
|
|
228
|
-
if (line.startsWith("### "))
|
|
229
|
-
return `${c.bold}${this.formatInline(line.slice(4), c)}${c.reset}`;
|
|
230
|
-
if (line.startsWith("## "))
|
|
231
|
-
return `${c.bold}${this.formatInline(line.slice(3), c)}${c.reset}`;
|
|
232
|
-
if (line.startsWith("# "))
|
|
233
|
-
return `${c.bold}${c.cyan}${this.formatInline(line.slice(2), c)}${c.reset}`;
|
|
234
|
-
// Horizontal rule
|
|
235
|
-
if (/^---+$/.test(line))
|
|
236
|
-
return `${c.dim}${"─".repeat(44)}${c.reset}`;
|
|
237
|
-
// Blockquote
|
|
238
|
-
const bq = line.match(/^(\s*)>\s?(.*)$/);
|
|
239
|
-
if (bq) {
|
|
240
|
-
const indent = bq[1];
|
|
241
|
-
const body = bq[2];
|
|
242
|
-
return `${indent}${c.dim}▎${c.reset} ${this.formatInline(body, c)}`;
|
|
243
|
-
}
|
|
244
|
-
// Numbered list (1. item)
|
|
245
|
-
if (/^\s*\d+\.\s/.test(line)) {
|
|
246
|
-
const m = line.match(/^(\s*)(\d+\.)(\s)(.*)$/);
|
|
247
|
-
if (m) {
|
|
248
|
-
return `${m[1]}${c.yellow}${m[2]}${c.reset}${m[3]}${this.formatInline(m[4], c)}`;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
// Bullet points
|
|
252
|
-
if (line.match(/^\s*[-*]\s/)) {
|
|
253
|
-
return line.replace(/^(\s*)([-*])(\s)(.*)$/, (_a, sp, _mark, sp2, rest) => {
|
|
254
|
-
return `${sp}${c.cyan}•${c.reset}${sp2}${this.formatInline(rest, c)}`;
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
return this.formatInline(line, c);
|
|
258
|
-
}
|
|
259
|
-
}
|