@hncode/hncode 0.8.1 → 0.8.3
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 +18 -0
- package/README_CN.md +14 -0
- package/bin/hncode +54 -8
- package/package.json +1 -1
- package/src/agent-task.js +356 -337
- package/src/agent.js +1465 -1405
- package/src/animate.js +56 -0
- package/src/colors.js +615 -593
- package/src/config.js +50 -7
- package/src/context-bar.js +280 -278
- package/src/doctor.js +4 -3
- package/src/file-tree.js +4 -3
- package/src/highlight.js +20 -6
- package/src/i18n.js +1432 -389
- package/src/image-row.js +11 -2
- package/src/index.js +218 -6
- package/src/keybindings.js +2 -1
- package/src/llm.js +146 -21
- package/src/log-file.js +112 -0
- package/src/markdown.js +646 -567
- package/src/mcp-server.js +409 -0
- package/src/mcp.js +279 -29
- package/src/memory-profile.js +19 -16
- package/src/migrate-index.js +175 -0
- package/src/migrate.js +392 -0
- package/src/panels.js +9 -7
- package/src/plan.js +7 -5
- package/src/plugin.js +37 -21
- package/src/registry-browser.js +17 -15
- package/src/rows-plan-bg.js +3 -2
- package/src/rows-status.js +20 -6
- package/src/rows-tool-result.js +242 -208
- package/src/screen-paint.js +153 -128
- package/src/session-recover.js +317 -0
- package/src/session.js +203 -13
- package/src/settings-schema.js +9 -0
- package/src/swarm-progress.js +6 -2
- package/src/tasks-browser.js +37 -36
- package/src/team-panel.js +12 -11
- package/src/term.js +57 -21
- package/src/text.js +254 -149
- package/src/tool-line.js +7 -2
- package/src/tool-result.js +400 -327
- package/src/tools/agent.js +7 -2
- package/src/tools/ask-user-question.js +1 -2
- package/src/tools/bash.js +446 -434
- package/src/tools/edit.js +653 -665
- package/src/tools/goal.js +130 -93
- package/src/tools/read.js +141 -133
- package/src/tools/tasks.js +214 -214
- package/src/tools/utils.js +143 -104
- package/src/tui.js +20887 -19942
package/src/animate.js
CHANGED
|
@@ -327,6 +327,27 @@ export function lightAt(phaseMs, index, count, edge = 'cosine', stepMs = STEP_MS
|
|
|
327
327
|
* @param {string} edge shoulder shape: 'cosine' (default) or 'linear'
|
|
328
328
|
* @returns {string} ANSI, ready to splice into a row
|
|
329
329
|
*/
|
|
330
|
+
/**
|
|
331
|
+
* The glint for a base colour: the same hue, lifted part-way to white.
|
|
332
|
+
*
|
|
333
|
+
* The light that travels across a word must be a SHADE of the word, not another colour.
|
|
334
|
+
* `[255, 240, 120]` against orange reads as "this text is yellow now" — a status change —
|
|
335
|
+
* while a few percent of lift reads as a sheen passing over.
|
|
336
|
+
*
|
|
337
|
+
* Derived rather than fixed because the base is not fixed: the Working row turns blue while
|
|
338
|
+
* a compaction runs. A single hard-coded warm glint stayed yellow over that blue base, which
|
|
339
|
+
* is two colours fighting rather than one highlight.
|
|
340
|
+
*/
|
|
341
|
+
export const GLINT_LIFT = 0.45;
|
|
342
|
+
export function glintFor(base) {
|
|
343
|
+
const b = Array.isArray(base) ? base : [255, 140, 0];
|
|
344
|
+
return [
|
|
345
|
+
Math.round(b[0] + (255 - b[0]) * GLINT_LIFT),
|
|
346
|
+
Math.round(b[1] + (255 - b[1]) * GLINT_LIFT),
|
|
347
|
+
Math.round(b[2] + (255 - b[2]) * GLINT_LIFT),
|
|
348
|
+
];
|
|
349
|
+
}
|
|
350
|
+
|
|
330
351
|
export function shimmerText(text, phaseMs, base, glint, edge = 'cosine', stepMs = STEP_MS) {
|
|
331
352
|
const s = String(text == null ? '' : text);
|
|
332
353
|
const n = s.length;
|
|
@@ -369,3 +390,38 @@ export function framesPerChar(n, ticks = SWEEP_TICKS) {
|
|
|
369
390
|
const BAND = bandCharsFor(n) / n;
|
|
370
391
|
return (BAND * ticks) / (1 + BAND * SWEEP_TRAVEL_PAD);
|
|
371
392
|
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* A slow, even breath between two colours, for a surface that is WAITING on the user.
|
|
397
|
+
*
|
|
398
|
+
* The screen has exactly one state where the user is the bottleneck: a prompt that blocks the agent until they answer
|
|
399
|
+
* (a tool approval, a plan review, a question). Those boxes are currently drawn in a flat border colour, which reads as
|
|
400
|
+
* ordinary chrome — and a reader busy in another window has no cue that the program has stopped for them.
|
|
401
|
+
*
|
|
402
|
+
* NOT the travelling light. A sweep says "work is happening", which is the opposite of the truth here: nothing is
|
|
403
|
+
* happening until someone presses a key. A breath is the shape for waiting.
|
|
404
|
+
*
|
|
405
|
+
* `t` is a 0..1 triangle over the cycle, so the two ends meet exactly and there is no visible seam when it repeats.
|
|
406
|
+
* Reduced motion collapses this to the resting colour: a surface that fades in and out is motion, and the point of
|
|
407
|
+
* the setting is that there is none.
|
|
408
|
+
*
|
|
409
|
+
* @param {string} rest the colour the surface rests at (an SGR foreground or background run)
|
|
410
|
+
* @param {string} peak the colour it breathes toward
|
|
411
|
+
* @param {number} phaseMs milliseconds into the cycle
|
|
412
|
+
* @param {number} cycleMs length of one full breath
|
|
413
|
+
* @param {boolean} [reduced] true to return `rest` unchanged
|
|
414
|
+
*/
|
|
415
|
+
export function breatheColour(rest, peak, phaseMs, cycleMs = 2400, reduced = false) {
|
|
416
|
+
if (reduced || !peak) return rest;
|
|
417
|
+
// A triangle, not a sine: the two are indistinguishable at this speed and the triangle needs no trig per frame.
|
|
418
|
+
const half = cycleMs / 2;
|
|
419
|
+
const at = ((phaseMs % cycleMs) + cycleMs) % cycleMs;
|
|
420
|
+
const t = at < half ? at / half : 1 - (at - half) / half;
|
|
421
|
+
// The colours arrive as SGR runs, so the blend happens on the NUMBERS inside them rather than on the strings.
|
|
422
|
+
const a = /38;2;(\d+);(\d+);(\d+)/.exec(rest);
|
|
423
|
+
const b = /38;2;(\d+);(\d+);(\d+)/.exec(peak);
|
|
424
|
+
if (!a || !b) return rest; // a named colour, not truecolor: nothing to interpolate, so leave it alone
|
|
425
|
+
const mix = (i) => Math.round(Number(a[i]) + (Number(b[i]) - Number(a[i])) * t);
|
|
426
|
+
return `\x1b[38;2;${mix(1)};${mix(2)};${mix(3)}m`;
|
|
427
|
+
}
|