ucode-agent 1.8.1 → 1.9.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/package.json +1 -1
- package/src/ui/screen.js +6 -6
- package/src/ui/theme.js +10 -56
package/package.json
CHANGED
package/src/ui/screen.js
CHANGED
|
@@ -39,7 +39,7 @@ import chalk from 'chalk';
|
|
|
39
39
|
import {
|
|
40
40
|
theme, blue, sky, deep, dim, edge, ADDED, REMOVED, BANNER, BANNER_WIDTH, SPINNER,
|
|
41
41
|
boxTop, boxBottom, boxRow, visLen, padVis, clip, wrapAnsi,
|
|
42
|
-
shortenPath, asLabel, ensureColour, planLine, bare,
|
|
42
|
+
shortenPath, asLabel, ensureColour, planLine, bare, narration, narrationMark } from './theme.js';
|
|
43
43
|
import { FRAME_MS, fitActivity, shimmer, spinnerGlyph, formatDuration, doneLine, stepPaint } from './activity.js';
|
|
44
44
|
import { renderer, render, polish } from './markdown.js';
|
|
45
45
|
import { VERSION } from '../core/version.js';
|
|
@@ -149,7 +149,7 @@ export class Screen {
|
|
|
149
149
|
|
|
150
150
|
async start() {
|
|
151
151
|
ensureColour(this.output);
|
|
152
|
-
this.output.write(ALT_ON + MOUSE_ON + HIDE +
|
|
152
|
+
this.output.write(ALT_ON + MOUSE_ON + HIDE + title(`ucode — ${path.basename(this.cwd)}`));
|
|
153
153
|
this.input.setRawMode?.(true);
|
|
154
154
|
this.input.resume();
|
|
155
155
|
this.input.setEncoding('utf8');
|
|
@@ -173,7 +173,7 @@ export class Screen {
|
|
|
173
173
|
this.output.off?.('resize', this.onResize);
|
|
174
174
|
this.input.setRawMode?.(false);
|
|
175
175
|
this.input.pause();
|
|
176
|
-
this.output.write(
|
|
176
|
+
this.output.write(MOUSE_OFF + ALT_OFF + SHOW);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
close() {
|
|
@@ -291,7 +291,7 @@ export class Screen {
|
|
|
291
291
|
toolCall(label) {
|
|
292
292
|
// U+25CF, not U+23FA: the latter carries emoji presentation, which Windows
|
|
293
293
|
// Terminal draws as a white circle on a blue tile.
|
|
294
|
-
this.push(`${
|
|
294
|
+
this.push(`${narrationMark()} ${narration(asLabel(label))}`);
|
|
295
295
|
this.updateSpinner(label);
|
|
296
296
|
}
|
|
297
297
|
|
|
@@ -1127,7 +1127,7 @@ export class Screen {
|
|
|
1127
1127
|
// dot flickering above the input box on every keystroke.
|
|
1128
1128
|
const out = [HIDE, HOME];
|
|
1129
1129
|
for (let i = 0; i < this.rows; i++) {
|
|
1130
|
-
out.push(
|
|
1130
|
+
out.push(CLEAR_LINE + padVis(frame[i] ?? '', width) + (i === this.rows - 1 ? '' : '\n'));
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
1133
1133
|
const [row, col] = this.caret();
|
|
@@ -1214,7 +1214,7 @@ export class Screen {
|
|
|
1214
1214
|
|
|
1215
1215
|
const out = [HIDE, HOME];
|
|
1216
1216
|
for (let i = 0; i < this.rows; i++) {
|
|
1217
|
-
out.push(
|
|
1217
|
+
out.push(CLEAR_LINE + padVis(frame[i], g.cols) + (i === this.rows - 1 ? '' : '\n'));
|
|
1218
1218
|
}
|
|
1219
1219
|
const [row, col] = this.caret();
|
|
1220
1220
|
out.push(at(row, col) + SHOW);
|
package/src/ui/theme.js
CHANGED
|
@@ -278,62 +278,16 @@ export function planLine(items) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
|
-
*
|
|
281
|
+
* Narration: what the agent is doing, as opposed to what it has to say.
|
|
282
282
|
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* Two things are needed, not one. Painting each row covers the rows ucode
|
|
290
|
-
* draws; it cannot reach the margin a terminal keeps below the last line or
|
|
291
|
-
* beside the last column, which stays the old colour and shows as a border of
|
|
292
|
-
* the wrong shade. So the terminal is also told, once, what its own background
|
|
293
|
-
* is — and told to put it back on the way out.
|
|
294
|
-
*/
|
|
295
|
-
export const BACKGROUND = process.env.UCODE_BG || '#000000';
|
|
296
|
-
|
|
297
|
-
const rgb = (hex) => {
|
|
298
|
-
const m = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex.trim());
|
|
299
|
-
return m ? [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16)] : [19, 19, 22];
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
/** Turn the background on. Everything painted after this sits on it. */
|
|
303
|
-
export const BG_ON = (() => {
|
|
304
|
-
if (process.env.NO_COLOR || process.env.UCODE_BG === 'off') return '';
|
|
305
|
-
const [r, g, b] = rgb(BACKGROUND);
|
|
306
|
-
return `\x1b[48;2;${r};${g};${b}m`;
|
|
307
|
-
})();
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Tell the terminal what its own background is.
|
|
311
|
-
*
|
|
312
|
-
* Painting each row covers the rows ucode draws, and nothing else. It cannot
|
|
313
|
-
* reach the margin a terminal keeps below the last line or beside the last
|
|
314
|
-
* column, which stays the old colour and reads as a border in the wrong
|
|
315
|
-
* shade. OSC 11 sets the window's background itself, which does reach those
|
|
316
|
-
* edges. A terminal that does not know the sequence ignores it in silence,
|
|
317
|
-
* and the per-row painting still covers everything ucode draws.
|
|
283
|
+
* These lines are scaffolding — "Reading screen.js", "Checking types". They
|
|
284
|
+
* are worth seeing and not worth reading, and at full strength they compete
|
|
285
|
+
* with the answer, which is the thing the user is actually here for. A
|
|
286
|
+
* terminal has no smaller size to set, so the only axis available is weight:
|
|
287
|
+
* faint, and a step down in colour. The answer stays at full strength and
|
|
288
|
+
* wins the page by contrast rather than by shouting.
|
|
318
289
|
*/
|
|
319
|
-
export const
|
|
320
|
-
|
|
321
|
-
/** Put the terminal's own background back, exactly as it was. */
|
|
322
|
-
export const BG_WINDOW_OFF = BG_ON ? '\x1b]111\x07' : '';
|
|
290
|
+
export const narration = (text) => chalk.dim(text);
|
|
323
291
|
|
|
324
|
-
/**
|
|
325
|
-
export const
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Keep the background on across a line that resets it.
|
|
329
|
-
*
|
|
330
|
-
* chalk closes a foreground with 39 and a background with 49, and 49 means
|
|
331
|
-
* "the terminal's default" — which is exactly the colour being painted over.
|
|
332
|
-
* A diff line, which sets its own background, would therefore punch a hole
|
|
333
|
-
* through to the terminal's ground for the rest of the line. Re-asserting the
|
|
334
|
-
* background after every reset closes those holes.
|
|
335
|
-
*/
|
|
336
|
-
export function onBackground(text) {
|
|
337
|
-
if (!BG_ON) return text;
|
|
338
|
-
return BG_ON + String(text).replace(/\x1b\[(?:0|49)m/g, (m) => m + BG_ON);
|
|
339
|
-
}
|
|
292
|
+
/** The bullet beside a narration line: present, not loud. */
|
|
293
|
+
export const narrationMark = () => chalk.dim(deep('●'));
|