archymedes-cli 2.0.0 → 2.2.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.
@@ -537,6 +537,7 @@ function defineCommands(table) {
537
537
  return Object.entries(table).map(([name, command]) => ({ name, ...command }));
538
538
  }
539
539
  var COMMANDS2 = defineCommands({
540
+ "/layout": { args: "[fixed|scrollback]", description: "Toggle the fixed workspace or terminal scrollback layout" },
540
541
  "/mode": { args: "[plan|build|auto|defender]", description: "Show or switch the permission mode" },
541
542
  "/plan": { description: "Switch to plan mode — read and reason, no writes" },
542
543
  "/build": { description: "Switch to build mode — edits need approval" },
@@ -560,7 +561,7 @@ var COMMANDS2 = defineCommands({
560
561
  "/slow": { args: "[on|strict|off]", description: "Spend at a slower pace: fewer model rounds, smaller replies, a pause between turns" },
561
562
  "/workspace": { description: "Open the control panel: every tab and watched job, live, on one screen" },
562
563
  "/watch": { args: "[id|show <id>|stop <id>]", description: "Follow a background job's output without giving up the prompt" },
563
- "/theme": { args: "[name|list|where]", description: "Change the colours — blueprint, parchment, chalkboard, high-contrast, or a .tss file of your own" },
564
+ "/theme": { args: "[name|list|where]", description: "Change the colours — blueprint, parchment, chalkboard, high-contrast, rainbow, or a .tss file of your own" },
564
565
  "/tab": { args: "[new|next|prev|close|rename|N]", description: "Several pieces of work, one at a time — only the tab in front runs (/detach for parallel)" },
565
566
  "/pull": { args: "[dir]", description: "Copy sandbox files here" },
566
567
  "/where": { description: "Show the current workspace" },
@@ -582,6 +583,7 @@ var COMMANDS2 = defineCommands({
582
583
  "/guide": { args: "[topic|search <text>|all]", description: "The user guide, as a screen you can browse — or print one topic with /guide <topic>" },
583
584
  "/files": { description: "Browse the project tree — expand folders, preview a file, pick one to @mention" },
584
585
  "/edit": { args: "<path>", description: "Open a file in the built-in editor — through the workspace, so it works in a sandbox too" },
586
+ "/cat": { args: "<path>", description: "Print a file into the transcript — markdown rendered like a document, code numbered and highlighted" },
585
587
  "/help": { args: "[all|work|review|steer|parallel|learn|setup]", description: "Commands grouped by purpose" },
586
588
  "/exit": { description: "Leave" }
587
589
  });
@@ -1,11 +1,13 @@
1
1
  import {
2
- ASCII_GLYPHS,
3
- UNICODE_GLYPHS,
4
2
  padToWidth,
5
3
  progressBar,
6
- sliceToWidth,
4
+ sliceToWidth
5
+ } from "./archymedes-r54qthg5.mjs";
6
+ import {
7
+ ASCII_GLYPHS,
8
+ UNICODE_GLYPHS,
7
9
  visibleWidth
8
- } from "./archymedes-dwvn4c51.mjs";
10
+ } from "./archymedes-5zn4zp84.mjs";
9
11
 
10
12
  // packages/archymedes-cli/src/canvas.ts
11
13
  var BRAILLE_DOTS = [
@@ -1,351 +1,13 @@
1
1
  import {
2
- rgbTo256
3
- } from "./archymedes-jecyxv5c.mjs";
4
-
5
- // packages/archymedes-cli/src/glyphs.ts
6
- var UNICODE_GLYPHS = {
7
- starGlyphs: [".", "·", "✧", "✦", "✶"],
8
- spinnerFrames: [" ◜ ", " ◠ ", " ◝ ", " ◞ ", " ◡ ", " ◟ "],
9
- star: "✦",
10
- starDim: "✧",
11
- check: "✓",
12
- cross: "✗",
13
- pending: "⋯",
14
- prompt: "❯",
15
- caret: "›",
16
- bullet: "•",
17
- ellipsis: "…",
18
- middot: "·",
19
- elbow: "⎿",
20
- boxTopLeft: "╭",
21
- boxTopRight: "╮",
22
- boxBottomLeft: "╰",
23
- boxBottomRight: "╯",
24
- boxHorizontal: "─",
25
- boxVertical: "│",
26
- boxTeeLeft: "├",
27
- boxTeeRight: "┤",
28
- boxCross: "┼",
29
- circleEmpty: "○",
30
- circleHalf: "◐",
31
- circleFull: "●",
32
- checkbox: "☐",
33
- checkboxDone: "☑",
34
- paused: "⏸",
35
- cancelled: "⊘",
36
- treeBranch: "├─",
37
- treeLast: "╰─",
38
- treeTrunk: "│ ",
39
- collapsed: "▸",
40
- expanded: "▾",
41
- arrowUp: "↑",
42
- arrowLeft: "←",
43
- arrowRight: "→",
44
- arrowDown: "↓",
45
- plus: "+",
46
- minus: "-",
47
- warning: "!",
48
- effectWorkspace: "✎",
49
- effectExternal: "◎",
50
- sparkLevels: ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
51
- };
52
- var ASCII_GLYPHS = {
53
- starGlyphs: [".", ".", "+", "*", "*"],
54
- spinnerFrames: ["-", "\\", "|", "/"],
55
- star: "*",
56
- starDim: "+",
57
- check: "+",
58
- cross: "x",
59
- pending: "~",
60
- prompt: ">",
61
- caret: ">",
62
- bullet: "-",
63
- ellipsis: "...",
64
- middot: "-",
65
- elbow: "\\",
66
- boxTopLeft: "+",
67
- boxTopRight: "+",
68
- boxBottomLeft: "+",
69
- boxBottomRight: "+",
70
- boxHorizontal: "-",
71
- boxVertical: "|",
72
- boxTeeLeft: "+",
73
- boxTeeRight: "+",
74
- boxCross: "+",
75
- circleEmpty: "o",
76
- circleHalf: "*",
77
- circleFull: "*",
78
- checkbox: "[ ]",
79
- checkboxDone: "[x]",
80
- paused: "=",
81
- cancelled: "x",
82
- treeBranch: "|-",
83
- treeLast: "`-",
84
- treeTrunk: "| ",
85
- collapsed: ">",
86
- expanded: "v",
87
- arrowUp: "^",
88
- arrowLeft: "<-",
89
- arrowRight: "->",
90
- arrowDown: "v",
91
- plus: "+",
92
- minus: "-",
93
- warning: "!",
94
- effectWorkspace: "w",
95
- effectExternal: "e",
96
- sparkLevels: [" ", ".", ":", "-", "=", "+", "*", "#"]
97
- };
98
- var ROUND_BORDER = { topLeft: "╭", topRight: "╮", bottomLeft: "╰", bottomRight: "╯", horizontal: "─", vertical: "│", teeLeft: "├", teeRight: "┤", cross: "┼" };
99
- var SINGLE_BORDER = { topLeft: "┌", topRight: "┐", bottomLeft: "└", bottomRight: "┘", horizontal: "─", vertical: "│", teeLeft: "├", teeRight: "┤", cross: "┼" };
100
- var DOUBLE_BORDER = { topLeft: "╔", topRight: "╗", bottomLeft: "╚", bottomRight: "╝", horizontal: "═", vertical: "║", teeLeft: "╠", teeRight: "╣", cross: "╬" };
101
- var ASCII_BORDER = { topLeft: "+", topRight: "+", bottomLeft: "+", bottomRight: "+", horizontal: "-", vertical: "|", teeLeft: "+", teeRight: "+", cross: "+" };
102
- function borderGlyphsFor(style, glyphs) {
103
- if (glyphs === ASCII_GLYPHS)
104
- return ASCII_BORDER;
105
- if (style === "single")
106
- return SINGLE_BORDER;
107
- if (style === "double")
108
- return DOUBLE_BORDER;
109
- return ROUND_BORDER;
110
- }
111
-
112
- // packages/archymedes-cli/src/markdown.ts
113
- var RESET = "\x1B[0m";
114
- var BOLD = "\x1B[1m";
115
- var DIM = "\x1B[2m";
116
- var ITALIC = "\x1B[3m";
117
- var STRIKE = "\x1B[9m";
118
- var CYAN = "\x1B[36m";
119
- var BLUE = "\x1B[34m";
120
- var GREEN = "\x1B[32m";
121
- var YELLOW = "\x1B[33m";
122
- var ANSI = /\x1b\[[0-9;]*m/g;
123
- function visibleWidth(text) {
124
- let width = 0;
125
- for (const character of text.replace(ANSI, "")) {
126
- const code = character.codePointAt(0) ?? 0;
127
- if (code >= 768 && code <= 879)
128
- continue;
129
- width += isWide(code) ? 2 : 1;
130
- }
131
- return width;
132
- }
133
- function isWide(code) {
134
- return code >= 4352 && code <= 4447 || code >= 11904 && code <= 42191 || code >= 44032 && code <= 55203 || code >= 63744 && code <= 64255 || code >= 65072 && code <= 65135 || code >= 65280 && code <= 65376 || code >= 127744 && code <= 129535;
135
- }
136
- var INLINE_PATTERN = /(?<!\\)(`[^`\n]+`)|(?<!\\)(\*\*[^*\n]+\*\*)|(?<!\\)(__[^_\n]+__)|(?<!\\)(~~[^~\n]+~~)|(?<!\\)(\*[^*\n]+\*)|(?<!\\)(_[^_\n]+_)|(!?\[([^\]\n]+)\]\((https?:\/\/[^\s)\n]+)\))|(<(https?:\/\/[^>\s]+)>)/g;
137
- var unescapeMarkdown = (text) => text.replace(/\\([\\`*_[\]{}()#+.!~>-])/g, "$1");
138
- function parseInline(line) {
139
- const tokens = [];
140
- let lastIndex = 0;
141
- INLINE_PATTERN.lastIndex = 0;
142
- for (let match = INLINE_PATTERN.exec(line);match !== null; match = INLINE_PATTERN.exec(line)) {
143
- if (match.index > lastIndex)
144
- tokens.push({ text: unescapeMarkdown(line.slice(lastIndex, match.index)), code: "" });
145
- const [whole, code, boldStars, boldUnderscores, strike, italicStars, italicUnderscores, link, linkLabel, linkUrl, autolink, autolinkUrl] = match;
146
- if (code !== undefined)
147
- tokens.push({ text: code.slice(1, -1), code: CYAN });
148
- else if (boldStars !== undefined)
149
- tokens.push({ text: boldStars.slice(2, -2), code: BOLD });
150
- else if (boldUnderscores !== undefined)
151
- tokens.push({ text: boldUnderscores.slice(2, -2), code: BOLD });
152
- else if (strike !== undefined)
153
- tokens.push({ text: strike.slice(2, -2), code: STRIKE });
154
- else if (italicStars !== undefined)
155
- tokens.push({ text: italicStars.slice(1, -1), code: ITALIC });
156
- else if (italicUnderscores !== undefined)
157
- tokens.push({ text: italicUnderscores.slice(1, -1), code: ITALIC });
158
- else if (link !== undefined)
159
- tokens.push({ text: `${link.startsWith("!") ? `image: ${linkLabel}` : linkLabel} (${linkUrl})`, code: CYAN });
160
- else if (autolink !== undefined)
161
- tokens.push({ text: autolinkUrl, code: CYAN });
162
- lastIndex = match.index + whole.length;
163
- }
164
- if (lastIndex < line.length)
165
- tokens.push({ text: unescapeMarkdown(line.slice(lastIndex)), code: "" });
166
- return tokens.filter((token) => token.text.length > 0);
167
- }
168
- function paint(text, code, depth) {
169
- return depth === "none" || code === "" ? text : `${code}${text}${RESET}`;
170
- }
171
- function wrapTokens(tokens, width, options) {
172
- const firstPrefix = options.firstPrefix ?? "";
173
- const continuationPrefix = options.continuationPrefix ?? "";
174
- const lines = [];
175
- let current = "";
176
- let currentWidth = 0;
177
- let prefix = firstPrefix;
178
- let prefixWidth = visibleWidth(firstPrefix);
179
- const limit = Math.max(1, width);
180
- const flush = () => {
181
- lines.push(`${prefix}${current}`.replace(/[ \t]+$/, ""));
182
- current = "";
183
- currentWidth = 0;
184
- prefix = continuationPrefix;
185
- prefixWidth = visibleWidth(continuationPrefix);
186
- };
187
- for (const token of tokens) {
188
- for (const word of token.text.split(/(\s+)/)) {
189
- if (word === "")
190
- continue;
191
- const wordWidth = visibleWidth(word);
192
- if (/^\s+$/.test(word)) {
193
- if (currentWidth > 0 && prefixWidth + currentWidth + wordWidth <= limit) {
194
- current += word;
195
- currentWidth += wordWidth;
196
- }
197
- continue;
198
- }
199
- if (currentWidth > 0 && prefixWidth + currentWidth + wordWidth > limit)
200
- flush();
201
- if (prefixWidth + wordWidth > limit) {
202
- let remaining = word;
203
- while (remaining.length > 0) {
204
- const available = Math.max(1, limit - prefixWidth - currentWidth);
205
- if (visibleWidth(remaining) <= available)
206
- break;
207
- const head = [...remaining].slice(0, available).join("");
208
- current += paint(head, token.code, options.depth);
209
- remaining = [...remaining].slice(available).join("");
210
- flush();
211
- }
212
- if (remaining.length > 0) {
213
- current += paint(remaining, token.code, options.depth);
214
- currentWidth += visibleWidth(remaining);
215
- }
216
- continue;
217
- }
218
- current += paint(word, token.code, options.depth);
219
- currentWidth += wordWidth;
220
- }
221
- }
222
- if (current !== "" || lines.length === 0)
223
- lines.push(`${prefix}${current}`.replace(/[ \t]+$/, ""));
224
- return lines;
225
- }
226
- function newMarkdownState() {
227
- return { inFence: false, fenceLanguage: "" };
228
- }
229
- var HEADING = /^(#{1,6})\s+(.*)$/;
230
- var BULLET = /^(\s*)([-*+])\s+(.*)$/;
231
- var TASK = /^(\s*)[-*+]\s+\[([ xX])\]\s+(.*)$/;
232
- var NUMBERED = /^(\s*)(\d+[.)])\s+(.*)$/;
233
- var BLOCKQUOTE = /^>\s?(.*)$/;
234
- var RULE = /^\s*([-*_])\s*(?:\1\s*){2,}$/;
235
- var FENCE = /^\s*```(.*)$/;
236
- var TABLE_SEPARATOR_CELL = /^:?-{3,}:?$/;
237
- function tableCells(line) {
238
- if (!line.includes("|"))
239
- return null;
240
- const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
241
- const cells = trimmed.split("|").map((cell) => cell.trim());
242
- return cells.length >= 2 ? cells : null;
243
- }
244
- function fitCell(text, width, glyphs = UNICODE_GLYPHS) {
245
- let result = "";
246
- for (const character of text) {
247
- if (visibleWidth(result + character) > width) {
248
- while (visibleWidth(result) > Math.max(0, width - visibleWidth(glyphs.ellipsis)))
249
- result = [...result].slice(0, -1).join("");
250
- result += glyphs.ellipsis;
251
- return result + " ".repeat(Math.max(0, width - visibleWidth(result)));
252
- }
253
- result += character;
254
- }
255
- return result + " ".repeat(Math.max(0, width - visibleWidth(result)));
256
- }
257
- function renderTableLine(cells, separator, width, depth, glyphs) {
258
- const cellWidth = Math.max(3, Math.floor((Math.max(width, 12) - cells.length - 1) / cells.length));
259
- if (separator)
260
- return paint(`${glyphs.boxTeeLeft}${cells.map(() => glyphs.boxHorizontal.repeat(cellWidth)).join(glyphs.boxCross)}${glyphs.boxTeeRight}`, DIM, depth);
261
- const contentWidth = Math.max(1, cellWidth - 2);
262
- const rendered = cells.map((cell) => fitCell(parseInline(cell).map((token) => token.text).join(""), contentWidth, glyphs));
263
- return `${glyphs.boxVertical}${rendered.map((cell) => ` ${cell} `).join(glyphs.boxVertical)}${glyphs.boxVertical}`;
264
- }
265
- function renderMarkdownLine(line, state, options) {
266
- const { width, depth } = options;
267
- const glyphs = options.glyphs ?? UNICODE_GLYPHS;
268
- const fence = FENCE.exec(line);
269
- if (fence) {
270
- const ruleWidth = Math.max(4, Math.min(width - 4, 40));
271
- if (state.inFence) {
272
- state.inFence = false;
273
- state.fenceLanguage = "";
274
- return [paint(` ${glyphs.boxBottomLeft}${glyphs.boxHorizontal.repeat(ruleWidth)}`, DIM, depth)];
275
- }
276
- state.inFence = true;
277
- state.fenceLanguage = fence[1].trim();
278
- const label = state.fenceLanguage ? ` ${state.fenceLanguage} ` : "";
279
- const drawn = 1 + visibleWidth(label);
280
- return [paint(` ${glyphs.boxTopLeft}${glyphs.boxHorizontal}${label}${glyphs.boxHorizontal.repeat(Math.max(0, ruleWidth - drawn))}`, DIM, depth)];
281
- }
282
- if (state.inFence) {
283
- return [`${paint(` ${glyphs.boxVertical} `, DIM, depth)}${paint(line, GREEN, depth)}`];
284
- }
285
- const table = tableCells(line);
286
- if (table) {
287
- const separator = table.every((cell) => TABLE_SEPARATOR_CELL.test(cell));
288
- return [renderTableLine(table, separator, width, depth, glyphs)];
289
- }
290
- if (RULE.test(line) && line.trim().length > 0) {
291
- return [paint(" " + glyphs.boxHorizontal.repeat(Math.max(4, Math.min(width - 4, 40))), DIM, depth)];
292
- }
293
- const heading = HEADING.exec(line);
294
- if (heading) {
295
- const level = heading[1].length;
296
- const code = level <= 2 ? `${BOLD}${CYAN}` : BOLD;
297
- const tokens = parseInline(heading[2]).map((token) => ({ text: token.text, code }));
298
- return wrapTokens(tokens, width, { depth });
299
- }
300
- const task = TASK.exec(line);
301
- if (task) {
302
- return wrapTokens(parseInline(task[3]), width, {
303
- firstPrefix: `${task[1]}${paint(task[2].trim() ? glyphs.checkboxDone : glyphs.checkbox, task[2].trim() ? GREEN : BLUE, depth)} `,
304
- continuationPrefix: `${task[1]} `,
305
- depth
306
- });
307
- }
308
- const bullet = BULLET.exec(line);
309
- if (bullet) {
310
- const indent = bullet[1];
311
- return wrapTokens(parseInline(bullet[3]), width, {
312
- firstPrefix: `${indent}${paint(glyphs.bullet, BLUE, depth)} `,
313
- continuationPrefix: `${indent} `,
314
- depth
315
- });
316
- }
317
- const numbered = NUMBERED.exec(line);
318
- if (numbered) {
319
- const indent = numbered[1];
320
- const marker = numbered[2];
321
- return wrapTokens(parseInline(numbered[3]), width, {
322
- firstPrefix: `${indent}${paint(marker, BLUE, depth)} `,
323
- continuationPrefix: `${indent}${" ".repeat(marker.length + 1)}`,
324
- depth
325
- });
326
- }
327
- const quote = BLOCKQUOTE.exec(line);
328
- if (quote) {
329
- return wrapTokens([{ text: quote[1], code: DIM }], width, {
330
- firstPrefix: paint(`${glyphs.boxVertical} `, YELLOW, depth),
331
- continuationPrefix: paint(`${glyphs.boxVertical} `, YELLOW, depth),
332
- depth
333
- });
334
- }
335
- if (line.trim() === "")
336
- return [""];
337
- return wrapTokens(parseInline(line), width, { depth });
338
- }
339
- function renderMarkdown(text, options) {
340
- const state = newMarkdownState();
341
- const glyphs = options.glyphs ?? UNICODE_GLYPHS;
342
- const rendered = text.split(`
343
- `).flatMap((line) => renderMarkdownLine(line, state, options));
344
- if (state.inFence)
345
- rendered.push(paint(` ${glyphs.boxBottomLeft}${glyphs.boxHorizontal.repeat(4)}`, DIM, options.depth));
346
- return rendered.join(`
347
- `);
348
- }
2
+ ASCII_GLYPHS,
3
+ UNICODE_GLYPHS,
4
+ borderGlyphsFor,
5
+ newMarkdownState,
6
+ rainbowText,
7
+ renderMarkdownLine,
8
+ rgbTo256,
9
+ visibleWidth
10
+ } from "./archymedes-5zn4zp84.mjs";
349
11
 
350
12
  // packages/archymedes-cli/src/output.ts
351
13
  var terminalStream = {
@@ -361,14 +23,14 @@ var terminalStream = {
361
23
  };
362
24
 
363
25
  // packages/archymedes-cli/src/tui.ts
364
- var RESET2 = "\x1B[0m";
365
- var DIM2 = "\x1B[2m";
366
- var CYAN2 = "\x1B[36m";
367
- var GREEN2 = "\x1B[32m";
368
- var YELLOW2 = "\x1B[33m";
26
+ var RESET = "\x1B[0m";
27
+ var DIM = "\x1B[2m";
28
+ var CYAN = "\x1B[36m";
29
+ var GREEN = "\x1B[32m";
30
+ var YELLOW = "\x1B[33m";
369
31
  var RED = "\x1B[31m";
370
- function paint2(text, code, depth) {
371
- return depth === "none" ? text : `${code}${text}${RESET2}`;
32
+ function paint(text, code, depth) {
33
+ return depth === "none" ? text : `${code}${text}${RESET}`;
372
34
  }
373
35
  function archymedesSpinnerFrame(index, glyphs = UNICODE_GLYPHS) {
374
36
  const frames = glyphs.spinnerFrames;
@@ -541,7 +203,7 @@ function table(columns, rows, options) {
541
203
  const row = (cells) => `${border.vertical} ${widths.map((width, index) => cell(cells[index] ?? "", width)).join(` ${border.vertical} `)} ${border.vertical}`;
542
204
  return [
543
205
  rule(border.topLeft, border.horizontal, border.topRight),
544
- row(columns.map((header) => paint2(header, DIM2, options.depth))),
206
+ row(columns.map((header) => paint(header, DIM, options.depth))),
545
207
  rule(border.teeLeft, border.cross, border.teeRight),
546
208
  ...rows.map((line) => row(line)),
547
209
  rule(border.bottomLeft, border.horizontal, border.bottomRight)
@@ -617,12 +279,12 @@ function stepProgress(done, total, options) {
617
279
  });
618
280
  return `${label}${counted} ${bar}`;
619
281
  }
620
- function formatStatusLine(fields, width, depth, glyphs = UNICODE_GLYPHS, accent = CYAN2) {
282
+ function formatStatusLine(fields, width, depth, glyphs = UNICODE_GLYPHS, accent = CYAN) {
621
283
  const label = activityLabel(fields.phase ?? "thinking", fields.operation, fields.elapsedMs);
622
284
  const ellipsis = glyphs.ellipsis;
623
285
  const separator = ` ${glyphs.middot} `;
624
286
  const left = `${fields.spinnerGlyph} ${label}${ellipsis}`;
625
- const paintedLeft = `${paint2(fields.spinnerGlyph, accent, depth)} ${paint2(`${label}${ellipsis}`, DIM2, depth)}`;
287
+ const paintedLeft = `${paint(fields.spinnerGlyph, accent, depth)} ${paint(`${label}${ellipsis}`, DIM, depth)}`;
626
288
  const optional = [
627
289
  fields.cost,
628
290
  fields.tokens > 0 ? formatTokens(fields.tokens) : "",
@@ -642,11 +304,11 @@ function formatStatusLine(fields, width, depth, glyphs = UNICODE_GLYPHS, accent
642
304
  return paintedLeft;
643
305
  const compact = `${fields.spinnerGlyph} ${ellipsis}`;
644
306
  if (visibleWidth(compact) <= width)
645
- return `${paint2(fields.spinnerGlyph, accent, depth)} ${paint2(ellipsis, DIM2, depth)}`;
646
- return width > 0 ? paint2(glyphs.star, accent, depth) : "";
307
+ return `${paint(fields.spinnerGlyph, accent, depth)} ${paint(ellipsis, DIM, depth)}`;
308
+ return width > 0 ? paint(glyphs.star, accent, depth) : "";
647
309
  }
648
310
  const gap = Math.max(1, width - visibleWidth(left) - right.length);
649
- return `${paintedLeft}${" ".repeat(gap)}${paint2(right, DIM2, depth)}`;
311
+ return `${paintedLeft}${" ".repeat(gap)}${paint(right, DIM, depth)}`;
650
312
  }
651
313
  kept = kept.slice(0, -1);
652
314
  }
@@ -742,14 +404,21 @@ function box(lines, options) {
742
404
  const border = borderGlyphsFor(options.borderStyle ?? "round", glyphs);
743
405
  const titleWidth = options.title ? visibleWidth(options.title) : 0;
744
406
  const titlePaint = TONE_CODES[options.titleColor ?? "cyan"];
745
- const edge = (text) => options.borderColor === undefined ? text : paint2(text, TONE_CODES[options.borderColor], options.depth);
407
+ const rainbowBorder = options.borderColor === "rainbow";
408
+ const edge = (text, phase = 0) => {
409
+ if (options.borderColor === undefined)
410
+ return text;
411
+ return rainbowBorder ? rainbowText(text, options.depth, phase) : paint(text, TONE_CODES[options.borderColor], options.depth);
412
+ };
746
413
  const contentWidth = Math.min(Math.max(titleWidth, ...lines.map((line) => visibleWidth(line)), 1), Math.max(1, terminalWidth - 4));
747
414
  const horizontal = border.horizontal.repeat(contentWidth + 2);
748
- const top = options.title ? `${edge(`${border.topLeft}${border.horizontal}`)} ${paint2(options.title, titlePaint, options.depth)} ${edge(`${border.horizontal.repeat(Math.max(0, contentWidth - titleWidth - 1))}${border.topRight}`)}` : edge(`${border.topLeft}${horizontal}${border.topRight}`);
749
- const bottom = edge(`${border.bottomLeft}${horizontal}${border.bottomRight}`);
750
- const body = lines.map((line) => {
415
+ const top = options.title ? `${edge(`${border.topLeft}${border.horizontal}`, 0)} ${paint(options.title, titlePaint, options.depth)} ${edge(`${border.horizontal.repeat(Math.max(0, contentWidth - titleWidth - 1))}${border.topRight}`, 0.08)}` : edge(`${border.topLeft}${horizontal}${border.topRight}`, 0);
416
+ const bottomPhase = (lines.length + 1) * 0.1;
417
+ const bottom = edge(`${border.bottomLeft}${horizontal}${border.bottomRight}`, bottomPhase);
418
+ const body = lines.map((line, index) => {
751
419
  const clipped = visibleWidth(line) > contentWidth ? `${sliceToWidth(line, contentWidth - visibleWidth(glyphs.ellipsis))}${glyphs.ellipsis}` : line;
752
- return `${edge(border.vertical)} ${clipped}${" ".repeat(Math.max(0, contentWidth - visibleWidth(clipped)))} ${edge(border.vertical)}`;
420
+ const rowPhase = (index + 1) * 0.1;
421
+ return `${edge(border.vertical, rowPhase)} ${clipped}${" ".repeat(Math.max(0, contentWidth - visibleWidth(clipped)))} ${edge(border.vertical, rowPhase)}`;
753
422
  });
754
423
  return [top, ...body, bottom].join(`
755
424
  `);
@@ -785,22 +454,22 @@ function joinHorizontal(left, right, options) {
785
454
  const separator = options.separator ?? " ";
786
455
  return `${padToWidth(left, options.leftWidth, options.leftAlign)}${separator}${padToWidth(right, options.rightWidth, options.rightAlign)}`;
787
456
  }
788
- var TONE_CODES = { cyan: CYAN2, green: GREEN2, yellow: YELLOW2, red: RED };
789
- var MODE_COLORS = { plan: YELLOW2, auto: GREEN2, build: CYAN2, defender: RED };
457
+ var TONE_CODES = { cyan: CYAN, green: GREEN, yellow: YELLOW, red: RED };
458
+ var MODE_COLORS = { plan: YELLOW, auto: GREEN, build: CYAN, defender: RED };
790
459
  var PROMPT_CHROME_COLUMNS = 6;
791
460
  function renderPromptBox(options) {
792
461
  const { mode, workspace, depth } = options;
793
462
  const glyphs = options.glyphs ?? UNICODE_GLYPHS;
794
463
  const border = borderGlyphsFor(options.palette?.borderStyle ?? options.borderStyle ?? "round", glyphs);
795
464
  const width = Math.max(12, options.width);
796
- const primary = options.palette?.primary ?? CYAN2;
797
- const modeColor = options.palette ? { plan: options.palette.warning, auto: options.palette.success, build: primary, defender: options.palette.error }[mode] ?? primary : MODE_COLORS[mode] ?? CYAN2;
798
- const horizontal = (count) => paint2(border.horizontal.repeat(Math.max(0, count)), primary, depth);
465
+ const primary = options.palette?.primary ?? CYAN;
466
+ const modeColor = options.palette ? { plan: options.palette.warning, auto: options.palette.success, build: primary, defender: options.palette.error }[mode] ?? primary : MODE_COLORS[mode] ?? CYAN;
467
+ const horizontal = (count) => paint(border.horizontal.repeat(Math.max(0, count)), primary, depth);
799
468
  const CHROME = PROMPT_CHROME_COLUMNS;
800
469
  const status = options.status ?? "";
801
470
  const separator = ` ${glyphs.middot} `;
802
- const full = `${paint2(glyphs.star, primary, depth)} ${paint2("archymedes", primary, depth)}${separator}${paint2(mode, modeColor, depth)}`;
803
- const compact = `${paint2(glyphs.star, primary, depth)} ${paint2(mode, modeColor, depth)}`;
471
+ const full = `${paint(glyphs.star, primary, depth)} ${paint("archymedes", primary, depth)}${separator}${paint(mode, modeColor, depth)}`;
472
+ const compact = `${paint(glyphs.star, primary, depth)} ${paint(mode, modeColor, depth)}`;
804
473
  const statusRoom = status === "" ? 0 : visibleWidth(status) + 2;
805
474
  const showStatus = status !== "" && width - CHROME - 1 - statusRoom - visibleWidth(compact) >= 0;
806
475
  const room = width - CHROME - 1 - (showStatus ? statusRoom : 0);
@@ -808,19 +477,19 @@ function renderPromptBox(options) {
808
477
  let title;
809
478
  if (workspaceRoom >= 4) {
810
479
  const shown = visibleWidth(workspace) <= workspaceRoom ? workspace : `${sliceToWidth(workspace, Math.max(0, workspaceRoom - visibleWidth(glyphs.ellipsis)))}${glyphs.ellipsis}`;
811
- title = `${full}${separator}${paint2(shown, DIM2, depth)}`;
480
+ title = `${full}${separator}${paint(shown, DIM, depth)}`;
812
481
  } else if (visibleWidth(full) <= room)
813
482
  title = full;
814
483
  else if (visibleWidth(compact) <= room)
815
484
  title = compact;
816
485
  else
817
- title = paint2(glyphs.star, primary, depth);
486
+ title = paint(glyphs.star, primary, depth);
818
487
  const tail = showStatus ? ` ${status} ` : "";
819
488
  const filler = Math.max(1, width - visibleWidth(title) - visibleWidth(tail) - CHROME);
820
- const top = `${paint2(`${border.topLeft}${border.horizontal}`, primary, depth)} ${title} ${horizontal(filler)}${tail}${horizontal(1)}${paint2(border.topRight, primary, depth)}`;
821
- const prefix = `${paint2(border.vertical, primary, depth)} ${paint2(glyphs.caret, modeColor, depth)} `;
822
- const bottom = `${paint2(border.bottomLeft, primary, depth)}${horizontal(width - 2)}${paint2(border.bottomRight, primary, depth)}`;
489
+ const top = `${paint(`${border.topLeft}${border.horizontal}`, primary, depth)} ${title} ${horizontal(filler)}${tail}${horizontal(1)}${paint(border.topRight, primary, depth)}`;
490
+ const prefix = `${paint(border.vertical, primary, depth)} ${paint(glyphs.caret, modeColor, depth)} `;
491
+ const bottom = `${paint(border.bottomLeft, primary, depth)}${horizontal(width - 2)}${paint(border.bottomRight, primary, depth)}`;
823
492
  return { top, prefix, bottom };
824
493
  }
825
494
 
826
- export { UNICODE_GLYPHS, ASCII_GLYPHS, borderGlyphsFor, visibleWidth, newMarkdownState, renderMarkdownLine, renderMarkdown, terminalStream, archymedesSpinnerFrame, SpringAnimator, sparkline, progressBar, table, scrollPercent, scrollIndicator, paginator, stepProgress, formatStatusLine, rowsOccupied, box, sliceToWidth, padToWidth, joinHorizontal, renderPromptBox };
495
+ export { terminalStream, archymedesSpinnerFrame, SpringAnimator, sparkline, progressBar, table, scrollPercent, scrollIndicator, paginator, stepProgress, formatStatusLine, rowsOccupied, box, sliceToWidth, padToWidth, joinHorizontal, renderPromptBox };