agent-from-zero 0.35.3 → 0.35.5
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 +20 -2
- package/dist/agent.js +40 -2
- package/dist/completion.js +2 -0
- package/dist/config.js +4 -0
- package/dist/context.js +57 -10
- package/dist/ink/app.js +184 -14
- package/dist/ink/commands.js +3 -0
- package/dist/ink/launch.js +5 -0
- package/dist/ink/setup.js +8 -0
- package/dist/loop.js +52 -6
- package/dist/peers.js +332 -0
- package/dist/permissions.js +4 -0
- package/dist/suggestion.js +55 -0
- package/dist/title.js +41 -1
- package/dist/ui.js +15 -0
- package/package.json +2 -2
package/dist/title.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { currentSession, nameFromTitle, nameIsPinned, setSessionInfo } from "./peers.js"; // the session name goes on the tab; the title goes to /peers
|
|
1
2
|
// One cheap model call that turns the user's first prompt into a short,
|
|
2
3
|
// pickable session name — the same idea Claude Code uses (a Haiku-tier call
|
|
3
4
|
// producing a 3-7 word sentence-case title, stored as the session's aiTitle).
|
|
@@ -18,10 +19,49 @@ export function terminalTitleSequence(title) {
|
|
|
18
19
|
}
|
|
19
20
|
// Rename the terminal tab. Silent when stdout isn't a terminal (pipes, tests,
|
|
20
21
|
// print mode) — an escape sequence in a log file is just noise.
|
|
22
|
+
//
|
|
23
|
+
// With peer sessions the tab must tell windows apart, and it must match what
|
|
24
|
+
// /peers lists. So: the title alone ("✳ Fix login bug" — the session name is
|
|
25
|
+
// derived from it), the name before there is a title ("✳ mini-agent-2"), and
|
|
26
|
+
// "name · title" only when you chose the name yourself with /rename.
|
|
27
|
+
let lastTitle; // remembered so a rename (or the end of a flash) can redraw it
|
|
28
|
+
let flashing = null;
|
|
29
|
+
export function tabTitle(title, name = currentSession()?.name, pinned = nameIsPinned()) {
|
|
30
|
+
if (title)
|
|
31
|
+
return `${TAB_PREFIX}${pinned && name ? `${name} · ` : ""}${title}`;
|
|
32
|
+
return name ? `${TAB_PREFIX}${name}` : "mini-agent";
|
|
33
|
+
}
|
|
21
34
|
export function setTerminalTitle(title) {
|
|
35
|
+
lastTitle = title;
|
|
36
|
+
nameFromTitle(title); // the session is called what it's doing (unless you named it)
|
|
37
|
+
setSessionInfo({ title: title ?? "" }); // other sessions' /peers show it too
|
|
38
|
+
if (!process.stdout.isTTY || flashing)
|
|
39
|
+
return;
|
|
40
|
+
process.stdout.write(terminalTitleSequence(tabTitle(title)));
|
|
41
|
+
}
|
|
42
|
+
export const refreshTerminalTitle = () => setTerminalTitle(lastTitle);
|
|
43
|
+
// "Which window is this?" — another session asked. Ring the bell and blink the
|
|
44
|
+
// tab title for a few seconds, then put the real title back.
|
|
45
|
+
export function flashTerminalTitle(ms = 6000) {
|
|
22
46
|
if (!process.stdout.isTTY)
|
|
23
47
|
return;
|
|
24
|
-
process.stdout.write(
|
|
48
|
+
process.stdout.write("\x07");
|
|
49
|
+
const name = currentSession()?.name ?? "mini-agent";
|
|
50
|
+
let on = false;
|
|
51
|
+
if (flashing)
|
|
52
|
+
clearInterval(flashing);
|
|
53
|
+
const stopAt = Date.now() + ms;
|
|
54
|
+
flashing = setInterval(() => {
|
|
55
|
+
on = !on;
|
|
56
|
+
if (Date.now() >= stopAt) {
|
|
57
|
+
clearInterval(flashing);
|
|
58
|
+
flashing = null;
|
|
59
|
+
process.stdout.write(terminalTitleSequence(tabTitle(lastTitle)));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
process.stdout.write(terminalTitleSequence(on ? `👋 ${name} — HERE 👋` : tabTitle(lastTitle)));
|
|
63
|
+
}, 500);
|
|
64
|
+
flashing.unref();
|
|
25
65
|
}
|
|
26
66
|
// The prompt is quoted inside <prompt> tags and the system message says so
|
|
27
67
|
// explicitly: sent bare, a chat-tuned model reads "有没有app能…?" as a question
|
package/dist/ui.js
CHANGED
|
@@ -117,6 +117,21 @@ export function spinnerText(word, elapsedSec, subAgent, tokens, thinking) {
|
|
|
117
117
|
bits.push("Ctrl+C to interrupt");
|
|
118
118
|
return `${head}… ${chalk.dim(`(${bits.join(" · ")})`)}`;
|
|
119
119
|
}
|
|
120
|
+
// The compaction progress bar, Claude Code's look:
|
|
121
|
+
// Compacting conversation…
|
|
122
|
+
// ▰▰▰▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱▱ 8%
|
|
123
|
+
// The two lines travel as ONE status text (a spinner carries one string); the
|
|
124
|
+
// Ink spinner draws the part after the newline under the verb, ora prints it as
|
|
125
|
+
// a second line. ▰/▱ are single-width everywhere, so the bar never jitters.
|
|
126
|
+
export function progressBar(pct, width = 40) {
|
|
127
|
+
const p = Math.max(0, Math.min(100, Math.floor(pct)));
|
|
128
|
+
const filled = Math.round((p / 100) * width);
|
|
129
|
+
return chalk.white("▰".repeat(filled)) + chalk.dim("▱".repeat(width - filled)) + chalk.dim(` ${p}%`);
|
|
130
|
+
}
|
|
131
|
+
export const COMPACTING_VERB = "Compacting conversation…";
|
|
132
|
+
export function compactingText(pct, columns = process.stdout.columns || 80) {
|
|
133
|
+
return `${COMPACTING_VERB}\n${progressBar(pct, Math.max(10, Math.min(40, columns - 10)))}`;
|
|
134
|
+
}
|
|
120
135
|
// The persistent status line — model, project, branch, context use, spend, time.
|
|
121
136
|
// Pure (dir + branch passed in) so it's testable without a filesystem or git.
|
|
122
137
|
export function statusLine(model, dir, branch, ctxPct, costUsd, elapsedMs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-from-zero",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mini-agent": "dist/agent.js"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"auto:report": "tsx eval/auto-report.ts",
|
|
18
18
|
"build": "tsc -p tsconfig.build.json",
|
|
19
19
|
"prepare": "npm run build",
|
|
20
|
-
"test": "export MINI_AGENT_REVIEW_DEBUG=0 && tsx tests/tools.test.ts && tsx tests/permissions.test.ts && tsx tests/context.test.ts && tsx tests/hooks.test.ts && tsx tests/mcp.test.ts && tsx tests/judge.test.ts && tsx tests/auto.test.ts && tsx tests/auto-context.test.ts && tsx tests/auto-providers.test.ts && tsx tests/auto-cascade.test.ts && tsx tests/auto-rules.test.ts && tsx tests/auto-rule-cascade.test.ts && tsx tests/auto-debug.test.ts && tsx tests/auto-report.test.ts && tsx tests/auto-clarification.test.ts && tsx tests/memory.test.ts && tsx tests/cost.test.ts && tsx tests/cli.test.ts && tsx tests/print.test.ts && tsx tests/status.test.ts && tsx tests/validate.test.ts && tsx tests/plan.test.ts && tsx tests/diff.test.ts && tsx tests/undo.test.ts && tsx tests/tiering.test.ts && tsx tests/mcp-http.test.ts && tsx tests/mcp-oauth.test.ts && tsx tests/changes.test.ts && tsx tests/mentions.test.ts && tsx tests/session.test.ts && tsx tests/title.test.ts && tsx tests/ui.test.ts && tsx tests/activity.test.ts && tsx tests/follow-up.test.ts && tsx tests/follow-up-ui.test.tsx && tsx tests/agents.test.ts && tsx tests/images.test.ts && tsx tests/approval.test.ts && tsx tests/form.test.ts && tsx tests/model.test.ts && tsx tests/reasoning.test.ts && tsx tests/effort.test.ts && tsx tests/completion.test.ts && tsx tests/pasted-text.test.ts && tsx tests/skills.test.ts && tsx tests/markdown.test.ts && tsx tests/editor.test.ts && tsx tests/todos.test.ts && tsx tests/background.test.ts && tsx tests/team.test.ts && tsx tests/board.test.ts && tsx tests/drop.test.ts && tsx tests/editline.test.ts && tsx tests/cron.test.ts"
|
|
20
|
+
"test": "export MINI_AGENT_REVIEW_DEBUG=0 && tsx tests/tools.test.ts && tsx tests/permissions.test.ts && tsx tests/context.test.ts && tsx tests/hooks.test.ts && tsx tests/mcp.test.ts && tsx tests/judge.test.ts && tsx tests/auto.test.ts && tsx tests/auto-context.test.ts && tsx tests/auto-providers.test.ts && tsx tests/auto-cascade.test.ts && tsx tests/auto-rules.test.ts && tsx tests/auto-rule-cascade.test.ts && tsx tests/auto-debug.test.ts && tsx tests/auto-report.test.ts && tsx tests/auto-clarification.test.ts && tsx tests/memory.test.ts && tsx tests/cost.test.ts && tsx tests/cli.test.ts && tsx tests/print.test.ts && tsx tests/status.test.ts && tsx tests/validate.test.ts && tsx tests/plan.test.ts && tsx tests/diff.test.ts && tsx tests/undo.test.ts && tsx tests/tiering.test.ts && tsx tests/mcp-http.test.ts && tsx tests/mcp-oauth.test.ts && tsx tests/changes.test.ts && tsx tests/mentions.test.ts && tsx tests/session.test.ts && tsx tests/title.test.ts && tsx tests/ui.test.ts && tsx tests/activity.test.ts && tsx tests/follow-up.test.ts && tsx tests/follow-up-ui.test.tsx && tsx tests/agents.test.ts && tsx tests/images.test.ts && tsx tests/approval.test.ts && tsx tests/form.test.ts && tsx tests/model.test.ts && tsx tests/reasoning.test.ts && tsx tests/effort.test.ts && tsx tests/completion.test.ts && tsx tests/pasted-text.test.ts && tsx tests/skills.test.ts && tsx tests/markdown.test.ts && tsx tests/editor.test.ts && tsx tests/todos.test.ts && tsx tests/background.test.ts && tsx tests/team.test.ts && tsx tests/peers.test.ts && tsx tests/suggestion.test.ts && tsx tests/board.test.ts && tsx tests/drop.test.ts && tsx tests/editline.test.ts && tsx tests/cron.test.ts"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=20.6"
|