@tiens.nguyen/gonext-cli 1.0.358 → 1.0.359
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/gonext-repl.mjs +39 -13
- package/package.json +1 -1
package/gonext-repl.mjs
CHANGED
|
@@ -58,15 +58,35 @@ const white = (s) => `\x1b[37m${s}\x1b[0m`;
|
|
|
58
58
|
// Left gutter so terminal output doesn't hug the edge (task #128, Phase 1). A terminal has
|
|
59
59
|
// no CSS padding — a "left margin" is just a space prefix on every printed line, applied
|
|
60
60
|
// consistently at the prompt, the ● bullets, plain replies, the banner and the live status
|
|
61
|
-
// so they share ONE clean left edge.
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
const GUTTER = "
|
|
61
|
+
// so they share ONE clean left edge. 3 spaces reads as a deliberate margin — 2 was too subtle
|
|
62
|
+
// against the window edge (the padding fix). `gutterLines` insets a multi-line block (blank
|
|
63
|
+
// lines left bare — no trailing whitespace).
|
|
64
|
+
const GUTTER = " ";
|
|
65
65
|
const gutterLines = (s) =>
|
|
66
66
|
String(s)
|
|
67
67
|
.split("\n")
|
|
68
68
|
.map((l) => (l.length ? GUTTER + l : l))
|
|
69
69
|
.join("\n");
|
|
70
|
+
// The ● action bullets and the final agent answer are ONE block of agent output, so they share
|
|
71
|
+
// one left edge: the bullet's TEXT column (GUTTER + "● " = GUTTER + 2). Without this the answer
|
|
72
|
+
// sat at the bare GUTTER, 2 cols left of the bullet text above it — the ragged jog between the
|
|
73
|
+
// actions and "Done!" (padding fix). Plain replies have no bullets, so they keep the GUTTER
|
|
74
|
+
// margin (aligned with the >> prompt). `outputLines` insets a block to that shared edge.
|
|
75
|
+
const OUTPUT_INDENT = GUTTER + " ";
|
|
76
|
+
const outputLines = (s) =>
|
|
77
|
+
String(s)
|
|
78
|
+
.split("\n")
|
|
79
|
+
.map((l) => (l.length ? OUTPUT_INDENT + l : l))
|
|
80
|
+
.join("\n");
|
|
81
|
+
// Render the model's inline **bold** as ANSI bold (markdown polish). The terminal has no
|
|
82
|
+
// markdown renderer, so a heading like `**What I did:**` was printing its literal asterisks.
|
|
83
|
+
// Only paired ** with non-space content between them is consumed (so a stray `**` or `a ** b`
|
|
84
|
+
// is left untouched); `.` never crosses a newline, so a bold span stays on its own line. Ends
|
|
85
|
+
// with \x1b[22m (bold-off) rather than a full \x1b[0m reset so any surrounding colour/gutter
|
|
86
|
+
// styling survives. Applied to the completed agent answer (a whole string) — the live plain-
|
|
87
|
+
// reply stream isn't marked up because ** can straddle a chunk boundary there.
|
|
88
|
+
const renderMdBold = (s) =>
|
|
89
|
+
String(s).replace(/\*\*(?=\S)(.*?\S)\*\*/g, "\x1b[1m$1\x1b[22m");
|
|
70
90
|
// Vertical rhythm between ● action/answer bullets (task #129). One blank line so the list
|
|
71
91
|
// breathes instead of being cramped. A knob: "" = the old tight list, "\n" = one blank.
|
|
72
92
|
// Applied as a LEADING blank before a bullet when the previous line wasn't already blank —
|
|
@@ -1814,12 +1834,13 @@ async function runAgentTurn(history) {
|
|
|
1814
1834
|
// GREY expanded lines (if any), then LAST the SPINNER + playful word + token labels
|
|
1815
1835
|
// (task #83/#84), e.g. " ⠙ Caffeinating… · 12.3k tok · 8.1k max".
|
|
1816
1836
|
// Gutter the live status block's first line (task #128) so the blinking ● lines up with
|
|
1817
|
-
// the finished ● bullets during a turn (no left-edge jump). The sub-lines below
|
|
1818
|
-
//
|
|
1819
|
-
// and the hover/click hit-testing is ROW-based, so a horizontal offset
|
|
1837
|
+
// the finished ● bullets during a turn (no left-edge jump). The sub-lines below use the
|
|
1838
|
+
// same GUTTER so the whole block shares one left edge. Safe for the redraw: clearStatus
|
|
1839
|
+
// clears whole lines and the hover/click hit-testing is ROW-based, so a horizontal offset
|
|
1840
|
+
// changes nothing.
|
|
1820
1841
|
let out = `${GUTTER}${green(BULLET)} ${hovering ? hoverThought(label) : green(label)}`;
|
|
1821
|
-
for (const wl of expLines) out += "\n
|
|
1822
|
-
out += "\n" +
|
|
1842
|
+
for (const wl of expLines) out += "\n" + GUTTER + dim(wl);
|
|
1843
|
+
out += "\n" + `${GUTTER}${color256(wc, `${glyph} ${thinkWord}…`)}${tokLabel}`;
|
|
1823
1844
|
process.stdout.write(out);
|
|
1824
1845
|
statusLines = drawn;
|
|
1825
1846
|
statusShown = true;
|
|
@@ -2647,9 +2668,13 @@ async function main() {
|
|
|
2647
2668
|
// termination (killed terminal, force-quit) would otherwise lose the whole
|
|
2648
2669
|
// session even though most of it completed fine.
|
|
2649
2670
|
await saveSession(cwd, history);
|
|
2650
|
-
// A plain-reply answer already streamed live in the loop above — printing
|
|
2651
|
-
// again here would just duplicate it
|
|
2652
|
-
|
|
2671
|
+
// A plain-reply answer already streamed live in the loop above (shown=true) — printing
|
|
2672
|
+
// it again here would just duplicate it, so only a spacer blank line. The AGENT answer
|
|
2673
|
+
// (shown=false) is printed here from resultText, indented to the bullet-text column
|
|
2674
|
+
// (outputLines) so it shares the ● bullets' left edge, and with ONE leading blank
|
|
2675
|
+
// (LINE_SPACING) matching the between-bullets rhythm — was a hard "\n\n" double gap at
|
|
2676
|
+
// the seam, bigger than the gaps between bullets above it (the seam padding fix).
|
|
2677
|
+
console.log(shown ? "" : `${LINE_SPACING}${outputLines(renderMdBold(answer))}\n`);
|
|
2653
2678
|
// Task #104: persistent token footer at the bottom of the screen — this turn's
|
|
2654
2679
|
// code-model INPUT + this turn's OUTPUT (↓ out), then the model's GLOBAL lifetime
|
|
2655
2680
|
// output total (all turns for this user + coding server), labelled with the model
|
|
@@ -2658,7 +2683,8 @@ async function main() {
|
|
|
2658
2683
|
if ((inputTokens ?? 0) > 0 || (turnOutputTokens ?? 0) > 0) {
|
|
2659
2684
|
const coder = sessionCodingLabel || defaultCodingModel;
|
|
2660
2685
|
console.log(
|
|
2661
|
-
|
|
2686
|
+
GUTTER +
|
|
2687
|
+
dim("tokens · ↑ in ") +
|
|
2662
2688
|
fmtTokens(inputTokens ?? 0) +
|
|
2663
2689
|
dim(" · ") +
|
|
2664
2690
|
cyan(`↓ out ${fmtTokens(turnOutputTokens ?? 0)}`) +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gonext-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.359",
|
|
4
4
|
"description": "GoNext CLI — the gonext terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|