agent-from-zero 0.32.2 → 0.32.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/dist/ink/app.js +4 -1
- package/dist/ink/sink.js +14 -1
- package/package.json +1 -1
package/dist/ink/app.js
CHANGED
|
@@ -36,7 +36,10 @@ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧",
|
|
|
36
36
|
// <Static> (formatted as markdown) the moment it finishes.
|
|
37
37
|
function liveTail(s) {
|
|
38
38
|
const rows = process.stdout.rows || 24;
|
|
39
|
-
|
|
39
|
+
// Keep the preview SMALL (≤10 lines) even on a tall terminal: Ink repaints this
|
|
40
|
+
// whole region on every (throttled) update, and a smaller block repaints with
|
|
41
|
+
// far less flicker. The full reply still lands in <Static> on commit.
|
|
42
|
+
const maxLines = Math.max(3, Math.min(10, rows - 14)); // reserve rows for the input box + status bar + agent bar + margins
|
|
40
43
|
const cols = process.stdout.columns || 80;
|
|
41
44
|
const maxChars = maxLines * cols; // rough bound so one very long line can't blow past either
|
|
42
45
|
let t = s.length > maxChars ? s.slice(-maxChars) : s;
|
package/dist/ink/sink.js
CHANGED
|
@@ -29,15 +29,28 @@ export function makeInkSink(api) {
|
|
|
29
29
|
// The streamed answer accumulates in the dynamic region as raw text (live,
|
|
30
30
|
// "it's typing"), then commits as ONE markdown-rendered item when it ends —
|
|
31
31
|
// partial markdown mid-stream renders badly, so we format only once it's whole.
|
|
32
|
+
//
|
|
33
|
+
// THROTTLED on purpose: a fast stream delivers tokens dozens of times a
|
|
34
|
+
// second, and Ink erases+redraws the whole live region on every state change
|
|
35
|
+
// — repainting a multi-line block that often is what makes a long answer
|
|
36
|
+
// "shake" violently. So we coalesce a burst of tokens into ONE setLive every
|
|
37
|
+
// ~90ms (≈11 fps, smooth but cheap). The final, complete answer still commits
|
|
38
|
+
// to <Static> on end(), so nothing is lost or under-rendered.
|
|
32
39
|
answer() {
|
|
33
40
|
let buf = "";
|
|
41
|
+
let timer = null;
|
|
34
42
|
api.setLive("");
|
|
35
43
|
return {
|
|
36
44
|
push: (tok) => {
|
|
37
45
|
buf += tok;
|
|
38
|
-
|
|
46
|
+
if (!timer)
|
|
47
|
+
timer = setTimeout(() => { timer = null; api.setLive(buf); }, 90); // leading-edge throttle: schedule one repaint, ignore the burst until it fires
|
|
39
48
|
},
|
|
40
49
|
end: () => {
|
|
50
|
+
if (timer) {
|
|
51
|
+
clearTimeout(timer);
|
|
52
|
+
timer = null;
|
|
53
|
+
} // drop the pending repaint — we're committing now
|
|
41
54
|
api.setLive(null); // clear the live preview first, then commit (no flicker/duplicate)
|
|
42
55
|
if (buf.trim())
|
|
43
56
|
api.pushItem({ kind: "answer", text: buf });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-from-zero",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.3",
|
|
4
4
|
"description": "Build a Claude Code-style CLI agent from scratch, with AI as your pair programmer — companion code for a 10-day tutorial (DeepSeek by default, any OpenAI-compatible model)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|