@baimingtao/lbs-agent 1.1.0 → 1.2.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/bin/lbs.js +10 -11
- package/interfaces/cli/_impl/commands/chat_repl.py +31 -22
- package/package.json +1 -1
package/bin/lbs.js
CHANGED
|
@@ -72,21 +72,20 @@ function paint(text, ...colors) {
|
|
|
72
72
|
|
|
73
73
|
// ── ASCII Logo ─────────────────────────────────────────────────
|
|
74
74
|
|
|
75
|
-
const LOGO =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
const LOGO = [
|
|
76
|
+
'',
|
|
77
|
+
' ' + paint('╔══╗', C.gold) + ' ' + paint('╔═══╗', C.cyan) + ' ' + paint('╔═════╗', C.cyan),
|
|
78
|
+
' ' + paint('║ ║', C.gold) + ' ' + paint('║ ║', C.cyan) + ' ' + paint('║ ╔═╝', C.cyan),
|
|
79
|
+
' ' + paint('╠══╣', C.gold) + ' ' + paint('╠═══╣', C.cyan) + ' ' + paint('║ ╚═╗', C.cyan),
|
|
80
|
+
' ' + paint('║ ║', C.gold) + ' ' + paint('║ ║', C.cyan) + ' ' + paint('╚═════╝', C.cyan),
|
|
81
|
+
' ' + paint('╚══╝', C.gold) + ' ' + paint('╚═══╝', C.cyan) + ' ' + paint('AGENT', C.dim),
|
|
82
|
+
'',
|
|
83
|
+
].join('\n');
|
|
83
84
|
|
|
84
85
|
function printBanner() {
|
|
85
86
|
const pkg = JSON.parse(fs.readFileSync(path.join(PKG_ROOT, 'package.json'), 'utf-8'));
|
|
86
|
-
console.log();
|
|
87
87
|
console.log(LOGO);
|
|
88
|
-
console.log(paint(
|
|
89
|
-
console.log(paint(` Leaving Blank Space Agent — 多 Agent 编排框架`, C.dim));
|
|
88
|
+
console.log(paint(' v' + pkg.version, C.bold, C.gold) + paint(' Leaving Blank Space Agent', C.dim));
|
|
90
89
|
console.log();
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -25,12 +25,15 @@ from config.config import AppConfig
|
|
|
25
25
|
from interfaces.cli._impl.commands.common import project_root
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
BANNER = """\033[1;
|
|
29
|
-
|
|
30
|
-
║
|
|
31
|
-
|
|
32
|
-
║
|
|
33
|
-
|
|
28
|
+
BANNER = """\033[1;38;2;255;191;0m
|
|
29
|
+
\033[1;36m╔══╗\033[0m \033[1;36m╔═══╗\033[0m \033[1;36m╔═════╗\033[0m
|
|
30
|
+
\033[1;36m║ ║\033[0m \033[1;36m║ ║\033[0m \033[1;36m║ ╔═╝\033[0m
|
|
31
|
+
\033[1;36m╠══╣\033[0m \033[1;36m╠═══╣\033[0m \033[1;36m║ ╚═╗\033[0m
|
|
32
|
+
\033[1;36m║ ║\033[0m \033[1;36m║ ║\033[0m \033[1;36m╚═════╝\033[0m
|
|
33
|
+
\033[1;36m╚══╝\033[0m \033[1;36m╚═══╝\033[0m \033[2mAGENT\033[0m
|
|
34
|
+
\033[0m
|
|
35
|
+
\033[2mInteractive Chat · /help for commands · /exit to quit\033[0m
|
|
36
|
+
"""
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
@dataclass
|
|
@@ -62,7 +65,9 @@ def _resolve_agent(config: AppConfig) -> str:
|
|
|
62
65
|
|
|
63
66
|
def _print_turn_header(state: ChatState) -> None:
|
|
64
67
|
"""每次 turn 的 header(agent + turn 编号)。"""
|
|
65
|
-
|
|
68
|
+
agent_label = f"\033[1;36m{state.agent_name}\033[0m"
|
|
69
|
+
turn_label = f"\033[2mturn {state.turn_count}\033[0m"
|
|
70
|
+
print(f"\n{agent_label} {turn_label} \033[2m›\033[0m ", end="", flush=True)
|
|
66
71
|
|
|
67
72
|
|
|
68
73
|
def _print_help() -> None:
|
|
@@ -126,15 +131,18 @@ def _cmd_history(state: ChatState, n: int = 5) -> None:
|
|
|
126
131
|
|
|
127
132
|
def _cmd_status(state: ChatState) -> None:
|
|
128
133
|
elapsed = int(time.time() - state.started_at)
|
|
129
|
-
|
|
130
|
-
\033[
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
rows = [
|
|
135
|
+
("session", state.session_id or "\033[2m(unsaved)\033[0m"),
|
|
136
|
+
("agent", state.agent_name),
|
|
137
|
+
("provider", state.provider_name or "\033[2m(default)\033[0m"),
|
|
138
|
+
("model", state.model_name or "\033[2m(default)\033[0m"),
|
|
139
|
+
("turns", str(state.turn_count)),
|
|
140
|
+
("elapsed", f"{elapsed}s"),
|
|
141
|
+
]
|
|
142
|
+
print()
|
|
143
|
+
for label, val in rows:
|
|
144
|
+
print(f" \033[2m{label:9}\033[0m │ {val}")
|
|
145
|
+
print()
|
|
138
146
|
|
|
139
147
|
|
|
140
148
|
def _handle_command(state: ChatState, line: str) -> bool:
|
|
@@ -207,20 +215,21 @@ def _run_turn(state: ChatState, user_input: str) -> None:
|
|
|
207
215
|
# 显示结果
|
|
208
216
|
if result.success:
|
|
209
217
|
content = (result.content or "").strip()
|
|
210
|
-
print(f"\n\033[1;
|
|
218
|
+
print(f"\n\033[1;37m{content}\033[0m")
|
|
211
219
|
else:
|
|
212
220
|
err = result.error or "(无错误信息)"
|
|
213
|
-
print(f"\n\033[1;31m✗
|
|
214
|
-
|
|
221
|
+
print(f"\n\033[1;31m✗ {err[:300]}\033[0m")
|
|
222
|
+
# 状态行
|
|
223
|
+
print(f"\033[2m {elapsed:.1f}s │ iter {result.iterations} │ tools {result.total_tool_calls}\033[0m")
|
|
215
224
|
# 保存 session_id(Orchestrator 内部会创建/复用)
|
|
216
225
|
if not state.session_id:
|
|
217
226
|
state.session_id = result.session_id if hasattr(result, "session_id") and result.session_id else f"chat-{int(state.started_at)}"
|
|
218
227
|
except KeyboardInterrupt:
|
|
219
|
-
print("\n\033[1;33m
|
|
228
|
+
print("\n\033[1;33m ⏸ 已中断\033[0m")
|
|
220
229
|
except Exception as e:
|
|
221
230
|
elapsed = time.time() - t0
|
|
222
|
-
print(f"\n\033[1;31m✗
|
|
223
|
-
print(f"\033[2m
|
|
231
|
+
print(f"\n\033[1;31m ✗ {type(e).__name__}: {str(e)[:200]}\033[0m")
|
|
232
|
+
print(f"\033[2m {elapsed:.1f}s\033[0m")
|
|
224
233
|
|
|
225
234
|
|
|
226
235
|
def cmd_chat(
|