ucode-agent 1.2.0 → 1.3.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 +42 -8
- package/package.json +1 -1
- package/src/core/context.js +151 -0
- package/src/core/loop.js +376 -25
- package/src/core/provider.js +18 -3
- package/src/tools/files.js +173 -16
- package/src/tools/index.js +445 -394
- package/src/tools/shell.js +141 -0
- package/src/ui/plain.js +330 -325
- package/src/ui/screen.js +8 -2
- package/src/ui/theme.js +18 -0
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,
|
|
42
|
+
shortenPath, asLabel, ensureColour, planLine,
|
|
43
43
|
} from './theme.js';
|
|
44
44
|
import { renderer, render, polish } from './markdown.js';
|
|
45
45
|
import { VERSION } from '../core/version.js';
|
|
@@ -57,7 +57,7 @@ export function isLabel(text) {
|
|
|
57
57
|
|
|
58
58
|
export const COMMANDS = [
|
|
59
59
|
'/help', '/model', '/models', '/session', '/sessions', '/resume',
|
|
60
|
-
'/new', '/skills', '/clear', '/search', '/copy', '/exit',
|
|
60
|
+
'/new', '/remember', '/skills', '/clear', '/search', '/copy', '/exit',
|
|
61
61
|
];
|
|
62
62
|
|
|
63
63
|
// ANSI ----------------------------------------------------------------------
|
|
@@ -290,6 +290,12 @@ export class Screen {
|
|
|
290
290
|
this.updateSpinner(label);
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
/** The checklist, when the model updates it. One line, wrapped if it must. */
|
|
294
|
+
plan(items) {
|
|
295
|
+
const line = planLine(items);
|
|
296
|
+
if (line) this.push(line);
|
|
297
|
+
}
|
|
298
|
+
|
|
293
299
|
toolResult(summary) {
|
|
294
300
|
this.push(dim(` └ ${summary}`));
|
|
295
301
|
}
|
package/src/ui/theme.js
CHANGED
|
@@ -254,3 +254,21 @@ export function asLabel(text) {
|
|
|
254
254
|
.replace(/\s+/g, ' ')
|
|
255
255
|
.replace(/(?<=[\w)\]"'`])[.。]+$/, '');
|
|
256
256
|
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* The model's checklist, as one short line — done ticked, the current item
|
|
260
|
+
* marked, the rest dim — so progress is visible without taking over the screen.
|
|
261
|
+
*/
|
|
262
|
+
export function planLine(items) {
|
|
263
|
+
const list = (Array.isArray(items) ? items : []).slice(0, 6);
|
|
264
|
+
if (!list.length) return '';
|
|
265
|
+
const done = list.filter((i) => i?.done).length;
|
|
266
|
+
const current = list.findIndex((i) => !i?.done);
|
|
267
|
+
const parts = list.map((item, i) => {
|
|
268
|
+
const text = clip(String(item?.text ?? '').trim(), 30);
|
|
269
|
+
if (item?.done) return `${theme.ok('✓')} ${dim(text)}`;
|
|
270
|
+
if (i === current) return `${blue('▸')} ${chalk.white(text)}`;
|
|
271
|
+
return dim(`○ ${text}`);
|
|
272
|
+
});
|
|
273
|
+
return ` ${sky(`plan ${done}/${list.length}`)} ${parts.join(dim(' · '))}`;
|
|
274
|
+
}
|