@bolt-cli/cli 0.14.0 → 0.15.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/lib/cli.js +20 -18
- package/lib/present.js +1 -1
- package/lib/ui.js +49 -13
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -278,7 +278,7 @@ async function cmdSession(rest) {
|
|
|
278
278
|
const s = id ? session.load(id) : null;
|
|
279
279
|
if (!s) throw new Error("Usage: bolt session show <id>");
|
|
280
280
|
for (const [i, t] of s.turns.entries()) {
|
|
281
|
-
console.log(`\n--- turn ${i + 1} [${t.mode}] ${t.at} ---\
|
|
281
|
+
console.log(`\n--- turn ${i + 1} [${t.mode}] ${t.at} ---\n${ui.userTurn(t.prompt)}\nA: ${t.response.slice(0, 2000)}`);
|
|
282
282
|
if (t.tools && t.tools.length) {
|
|
283
283
|
console.log(`tools: ${t.tools.map((tool) => `${tool.tool}${tool.ok === false ? " (failed)" : ""}`).join(", ")}`);
|
|
284
284
|
}
|
|
@@ -921,10 +921,10 @@ function handleToolEvent(event) {
|
|
|
921
921
|
} else {
|
|
922
922
|
toolStarted.set(toolTimingKey(event.call), Date.now());
|
|
923
923
|
const elevated = event.call && event.call.tool === "bash" ? permissions.isElevatedCommand(event.call.command) : false;
|
|
924
|
-
//
|
|
925
|
-
//
|
|
926
|
-
// one thing that must be seen, is.
|
|
927
|
-
ui.status(`${ui.
|
|
924
|
+
// Transcript-style tool row: a quiet mark plus the call, the way a
|
|
925
|
+
// full-screen agent renders activity. The elevated warning keeps its
|
|
926
|
+
// colour so the one thing that must be seen, is.
|
|
927
|
+
ui.status(`${ui.toolLine(tools.describeCall(event.call))}${elevated ? ` ${ui.c.warning("[elevated]")}` : ""}`);
|
|
928
928
|
}
|
|
929
929
|
return;
|
|
930
930
|
}
|
|
@@ -934,9 +934,9 @@ function handleToolEvent(event) {
|
|
|
934
934
|
if (event.call.tool === "(parse error)") {
|
|
935
935
|
ui.warn(`tool request ignored: ${r.summary || "bad block"}`);
|
|
936
936
|
} else {
|
|
937
|
-
// Result rows
|
|
938
|
-
//
|
|
939
|
-
ui.status(
|
|
937
|
+
// Result rows mirror the call row; failure keeps an error tone so a scan
|
|
938
|
+
// down the transcript still catches it.
|
|
939
|
+
ui.status(ui.toolLine(r.ok ? "ok" : "FAILED", r.summary || "", { ok: r.ok, duration: took || undefined }));
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
942
|
}
|
|
@@ -966,8 +966,7 @@ function takeToolElapsed(call) {
|
|
|
966
966
|
if (!key || !toolStarted.has(key)) return "";
|
|
967
967
|
const ms = Date.now() - toolStarted.get(key);
|
|
968
968
|
toolStarted.delete(key);
|
|
969
|
-
|
|
970
|
-
return text ? ` ${ui.c.muted(`· ${text}`)}` : "";
|
|
969
|
+
return formatElapsed(ms);
|
|
971
970
|
}
|
|
972
971
|
|
|
973
972
|
function copyToClipboard(text) {
|
|
@@ -1619,19 +1618,22 @@ function pickTip(n) {
|
|
|
1619
1618
|
return TIPS[((Number(n) || 0) % TIPS.length + TIPS.length) % TIPS.length];
|
|
1620
1619
|
}
|
|
1621
1620
|
|
|
1622
|
-
//
|
|
1623
|
-
//
|
|
1624
|
-
//
|
|
1625
|
-
//
|
|
1621
|
+
// REPL home surface: half-block wordmark, identity/session chrome, and one
|
|
1622
|
+
// mechanics line. The wordmark is the only decoration; everything else stays
|
|
1623
|
+
// muted so the prompt below remains the focus. Pure (ui.c degrades on a pipe),
|
|
1624
|
+
// tested for the hint phrases the docs promise.
|
|
1626
1625
|
function replWelcomeLines({ sid, version, host, cwd, update }) {
|
|
1627
1626
|
const identity = [version ? `v${version}` : "", host, cwd].filter(Boolean);
|
|
1628
1627
|
const lines = [
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
` ${ui.c.muted(
|
|
1628
|
+
...ui.wordmark(" "),
|
|
1629
|
+
"",
|
|
1630
|
+
` ${ui.c.muted(identity.join(` ${ui.GLYPH.dot} `))}`,
|
|
1631
|
+
` ${ui.c.muted(`session ${sid.slice(0, 8)} ${ui.GLYPH.dot} type a task and press enter`)}`,
|
|
1632
|
+
"",
|
|
1633
|
+
` ${ui.c.primary("/")} ${ui.c.muted("opens the command dropdown")} ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.primary("Tab fills")} ${ui.c.muted("and keeps your place")} ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.primary("@path")} ${ui.c.muted("attaches a file")}`,
|
|
1632
1634
|
];
|
|
1633
1635
|
if (update) {
|
|
1634
|
-
lines.push("",
|
|
1636
|
+
lines.push("", ` ${ui.c.warning("update")} ${update}`);
|
|
1635
1637
|
}
|
|
1636
1638
|
return lines;
|
|
1637
1639
|
}
|
package/lib/present.js
CHANGED
|
@@ -79,7 +79,7 @@ function promptLine({ mode, target, agent, files, balance, tools }) {
|
|
|
79
79
|
if (files) bits.push(ui.c.muted(`${files} file${files === 1 ? "" : "s"}`));
|
|
80
80
|
if (tools !== undefined) bits.push(ui.c.muted(tools ? "tools" : "no-tools"));
|
|
81
81
|
if (balance !== undefined && balance !== null) bits.push(ui.c.muted(`${balance} tok`));
|
|
82
|
-
return `${ui.c.primary(
|
|
82
|
+
return `${ui.c.primary(">")} ${bits.join(ui.c.muted(` ${ui.GLYPH.dot} `))} `;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// Palette rows for `select()`; label is what gets typed back into the prompt.
|
package/lib/ui.js
CHANGED
|
@@ -168,21 +168,34 @@ function width() {
|
|
|
168
168
|
return typeof columns === "number" && columns > 20 ? Math.min(columns, 100) : 78;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
175
|
-
// holds. Pure, tested.
|
|
171
|
+
// Half-block wordmark in the register used by full-screen agent terminals:
|
|
172
|
+
// solid upper blocks, a dim baseline, `_` holes and a `~` shadow. One cell per
|
|
173
|
+
// glyph so visible-length maths holds; `_` is a blank cell, never a literal
|
|
174
|
+
// underscore. Colour degrades to identity on a pipe. Pure, width-tested.
|
|
176
175
|
const LOGO_RAW = [
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"██████╔╝ ██║ ██║ ██║ █",
|
|
182
|
-
"╚═════╝ ╚════╝ ██║▄▄▄▄",
|
|
176
|
+
" ",
|
|
177
|
+
"█▀▀▄ █▀▀█ █___ █▀▀▀",
|
|
178
|
+
"█▄▄▀ █__█ █___ _█__",
|
|
179
|
+
"▀~~▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀",
|
|
183
180
|
];
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
function wordmark(pad = "") {
|
|
182
|
+
if (!U) return [`${pad}bolt`];
|
|
183
|
+
return LOGO_RAW.map((line, i) => {
|
|
184
|
+
const baseline = i === LOGO_RAW.length - 1;
|
|
185
|
+
return (
|
|
186
|
+
pad +
|
|
187
|
+
[...line]
|
|
188
|
+
.map((ch) => {
|
|
189
|
+
if (ch === "_" || ch === " ") return " ";
|
|
190
|
+
if (ch === "~") return c.border("▀");
|
|
191
|
+
if (ch === "▀" && baseline) return c.muted(ch);
|
|
192
|
+
return c.primary(ch);
|
|
193
|
+
})
|
|
194
|
+
.join("")
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const LOGO = wordmark();
|
|
186
199
|
|
|
187
200
|
// Relative timestamps for pickers and dashboards ("5m ago"). Pure, tested:
|
|
188
201
|
// `now` injects the clock, unparseable input yields "".
|
|
@@ -270,6 +283,26 @@ function bullets(rows, { marker = GLYPH.dot } = {}) {
|
|
|
270
283
|
return rows.map((r) => ` ${c.muted(marker)} ${r}`).join("\n");
|
|
271
284
|
}
|
|
272
285
|
|
|
286
|
+
// Transcript shapes shared by the REPL and the tool-event renderer. A user
|
|
287
|
+
// turn gets a bright `>` marker and default-foreground text; tool activity gets
|
|
288
|
+
// a compact indented row with a semantic mark. Both are pure strings, so a
|
|
289
|
+
// piped log keeps the same readable shape without ANSI.
|
|
290
|
+
function userTurn(text) {
|
|
291
|
+
return String(text ?? "")
|
|
292
|
+
.split("\n")
|
|
293
|
+
.map((line, i) => (i === 0 ? `${c.primary(">")} ${c.bold(line)}` : ` ${line}`))
|
|
294
|
+
.join("\n");
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function toolLine(name, detail, { ok: state, duration } = {}) {
|
|
298
|
+
const mark = state === undefined ? c.info(GLYPH.dot) : state ? c.success(GLYPH.tick) : c.error(GLYPH.cross);
|
|
299
|
+
const label = state === undefined ? c.primary(name) : state ? c.success(name) : c.error(name);
|
|
300
|
+
const bits = [label];
|
|
301
|
+
if (detail) bits.push(c.muted(String(detail)));
|
|
302
|
+
if (duration) bits.push(c.border(String(duration)));
|
|
303
|
+
return ` ${mark} ${bits.join(` ${c.muted(GLYPH.dot)} `)}`;
|
|
304
|
+
}
|
|
305
|
+
|
|
273
306
|
// ---------------------------------------------------------------- status
|
|
274
307
|
|
|
275
308
|
// Quiet progress line for tool activity: reference terminals render tool traffic as
|
|
@@ -748,6 +781,9 @@ module.exports = {
|
|
|
748
781
|
ESC,
|
|
749
782
|
GLYPH,
|
|
750
783
|
LOGO,
|
|
784
|
+
wordmark,
|
|
785
|
+
userTurn,
|
|
786
|
+
toolLine,
|
|
751
787
|
PALETTE,
|
|
752
788
|
c,
|
|
753
789
|
enabled: c.enabled,
|
package/package.json
CHANGED