@bolt-cli/cli 0.12.0 → 0.14.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/README.md +4 -4
- package/bin/bolt.js +21 -21
- package/lib/agent.js +51 -40
- package/lib/api.js +6 -3
- package/lib/browser.js +19 -3
- package/lib/cli.js +141 -54
- package/lib/completion.js +1 -1
- package/lib/config.js +22 -1
- package/lib/permissions.js +1 -1
- package/lib/present.js +12 -11
- package/lib/toolparse.js +752 -0
- package/lib/tools.js +9 -27
- package/lib/ui.js +67 -30
- package/lib/updatecheck.js +114 -0
- package/package.json +1 -4
package/lib/cli.js
CHANGED
|
@@ -25,6 +25,7 @@ const exporter = require("./export");
|
|
|
25
25
|
const checkpoints = require("./checkpoints");
|
|
26
26
|
const cancel = require("./cancel");
|
|
27
27
|
const watch = require("./watch");
|
|
28
|
+
const updatecheck = require("./updatecheck");
|
|
28
29
|
|
|
29
30
|
const VERSION = require(path.join(__dirname, "..", "package.json")).version;
|
|
30
31
|
|
|
@@ -36,6 +37,7 @@ function help(topic) {
|
|
|
36
37
|
if (t === "session") return `bolt session [list|show <id>|delete <id>|new] — local sessions at ~/.bolt/sessions/\n\n bolt session list\n bolt session show <id>\n bolt export <id> --format md|json|sarif [--output file]\n`;
|
|
37
38
|
if (t === "export") return `bolt export <id> [--format md|json|sarif] [--output file]\n\nmd for humans, json for scripts, sarif for CI code-scanning (GitHub compatible).\n`;
|
|
38
39
|
if (t === "doctor") return `bolt doctor — pre-flight checks: node version, auth, backend reachability, WSL, clipboard.\n\nExits non-zero when a check fails. Run before reporting bugs.\n`;
|
|
40
|
+
if (t === "update") return `bolt update — upgrade the globally installed CLI via npm (runs: npm install -g @bolt-cli/cli).\n\nThe check that notices a new release is automatic and quiet (12h cadence, BOLT_NO_UPDATE_CHECK=1 to disable); the upgrade itself always asks: run bolt update.\n`;
|
|
39
41
|
if (t === "completion") return `bolt completion <bash|zsh|fish|powershell> — print shell completions to stdout.\n\n bolt completion bash >> ~/.bashrc\n bolt completion zsh >> ~/.zshrc\n`;
|
|
40
42
|
if (t === "undo") return `bolt undo <path> — restore the last backup of a file written/edited by the agent.\n\nBackups live under ~/.bolt/backups/ (last 10 kept per file).\n`;
|
|
41
43
|
if (t === "templates") return `bolt templates [name] — printable lab runbooks shipped with Bolt.\n\n bolt templates list (ASLR probe, crash-offset pattern)\n bolt templates aslr-offset-probe.sh print to stdout\n bolt templates README the lab-only guide\n\nAuthorized lab work only; every script prints an authorization notice.\n`;
|
|
@@ -47,7 +49,7 @@ Install: npm install -g @bolt-cli/cli Update: npm update -g @bolt-cli
|
|
|
47
49
|
Web: https://bolt.beerasafe.com Bugs: security@beerasafe.com
|
|
48
50
|
|
|
49
51
|
Usage:
|
|
50
|
-
bolt interactive agent (
|
|
52
|
+
bolt interactive agent (Bolt backend only)
|
|
51
53
|
bolt login | signin sign in through your browser
|
|
52
54
|
bolt auth status | logout session info, sign out this machine
|
|
53
55
|
bolt run "<prompt>" [options] single autonomous run
|
|
@@ -59,9 +61,10 @@ Usage:
|
|
|
59
61
|
bolt templates [name] print lab runbooks (ASLR probe, offsets)
|
|
60
62
|
bolt watch <subcommand> background defensive checks (status|check|start|stop|…)
|
|
61
63
|
bolt doctor pre-flight checks (node, auth, backend, WSL)
|
|
64
|
+
bolt update upgrade the CLI via npm (notice appears when a release ships)
|
|
62
65
|
bolt completion <shell> shell completions (bash|zsh|fish|powershell)
|
|
63
66
|
bolt balance tokens, runs, spend
|
|
64
|
-
bolt help <command> per-command help (run|build|session|export|doctor|completion|undo|watch|templates)
|
|
67
|
+
bolt help <command> per-command help (run|build|session|export|doctor|completion|undo|watch|templates|update)
|
|
65
68
|
|
|
66
69
|
Press Esc during any run to stop it (the session is saved). Out of tokens
|
|
67
70
|
stops the run at once with the top-up link — it never spins forever.
|
|
@@ -211,7 +214,7 @@ function finishSignin(url, data) {
|
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
/**
|
|
214
|
-
*
|
|
217
|
+
* Task-first entry: a missing token signs you in instead of stopping
|
|
215
218
|
* you. On an interactive terminal the browser flow starts automatically and
|
|
216
219
|
* the command continues once it completes; without a TTY (pipes, CI) there
|
|
217
220
|
* is nothing to open, so it stays an error telling you exactly what to run.
|
|
@@ -457,9 +460,13 @@ async function watchTriageIncident(cfg, incident) {
|
|
|
457
460
|
const clean = redact.redact(evidence);
|
|
458
461
|
const prompt = api.buildPrompt({ objective, evidence: clean.text, mode: "defensive" });
|
|
459
462
|
const stream = ui.createStream(ui.errWrite);
|
|
463
|
+
// Machine syntax that a drifted model emits (tool blocks, XML tags, think
|
|
464
|
+
// reasoning) must never reach the operator's screen, even in triage.
|
|
465
|
+
const filtered = agent.toolFenceWriter((t) => stream.write(t));
|
|
460
466
|
let text = "";
|
|
461
467
|
try {
|
|
462
|
-
await api.streamGenerate({ url: cfg.url, token: cfg.token, prompt, mode: "defensive", source: "watch", onToken: (t) => { text += t;
|
|
468
|
+
await api.streamGenerate({ url: cfg.url, token: cfg.token, prompt, mode: "defensive", source: "watch", onToken: (t) => { text += t; filtered.write(t); } });
|
|
469
|
+
filtered.end();
|
|
463
470
|
stream.end();
|
|
464
471
|
return { ok: true, text: redact.redact(text).text };
|
|
465
472
|
} catch (error) {
|
|
@@ -674,7 +681,7 @@ function positionalPrompt(rest) {
|
|
|
674
681
|
.trim();
|
|
675
682
|
}
|
|
676
683
|
|
|
677
|
-
// Agents:
|
|
684
|
+
// Agents: modern terminal presets, explicit opt-in. Arming one wraps the next
|
|
678
685
|
// objective with its template client-side; unarmed runs stay verbatim.
|
|
679
686
|
const AGENTS = {
|
|
680
687
|
sweep: {
|
|
@@ -780,7 +787,7 @@ function readEvidence(rest) {
|
|
|
780
787
|
return parts.join("\n\n");
|
|
781
788
|
}
|
|
782
789
|
|
|
783
|
-
// Approval asker for tool calls,
|
|
790
|
+
// Approval asker for tool calls, modern agent CLI style: an arrow-key
|
|
784
791
|
// dropdown with Allow once / Always allow / Deny. Elevated commands (sudo,
|
|
785
792
|
// system installs, service control) render a shield card explaining why they
|
|
786
793
|
// need admin. A throwaway readline is used for the text fallback only (never
|
|
@@ -914,7 +921,10 @@ function handleToolEvent(event) {
|
|
|
914
921
|
} else {
|
|
915
922
|
toolStarted.set(toolTimingKey(event.call), Date.now());
|
|
916
923
|
const elevated = event.call && event.call.tool === "bash" ? permissions.isElevatedCommand(event.call.command) : false;
|
|
917
|
-
|
|
924
|
+
// reference terminals render tool traffic as dim text under the answer, not a
|
|
925
|
+
// branded announcement; the elevated warning keeps its colour so the
|
|
926
|
+
// one thing that must be seen, is.
|
|
927
|
+
ui.status(`${ui.c.muted(`${ui.GLYPH.caret} ${tools.describeCall(event.call)}`)}${elevated ? ` ${ui.c.warning("[elevated]")}` : ""}`);
|
|
918
928
|
}
|
|
919
929
|
return;
|
|
920
930
|
}
|
|
@@ -924,13 +934,15 @@ function handleToolEvent(event) {
|
|
|
924
934
|
if (event.call.tool === "(parse error)") {
|
|
925
935
|
ui.warn(`tool request ignored: ${r.summary || "bad block"}`);
|
|
926
936
|
} else {
|
|
927
|
-
|
|
937
|
+
// Result rows stay dim like the call row; failure keeps a warning tone
|
|
938
|
+
// so a scan down the transcript still catches it.
|
|
939
|
+
ui.status(` ${r.ok ? ui.c.muted("ok") : ui.c.warning("FAILED")} ${ui.c.muted(r.summary || "")}${took}`);
|
|
928
940
|
}
|
|
929
941
|
}
|
|
930
942
|
}
|
|
931
943
|
|
|
932
944
|
// Start timestamps for approved tool calls, so the result row can carry an
|
|
933
|
-
//
|
|
945
|
+
// modern terminal elapsed time. Keyed by the rendered call description; a
|
|
934
946
|
// repeated call re-arms the timer, which is the honest behaviour for a map
|
|
935
947
|
// (the newest start wins). Unmatched results simply show no duration.
|
|
936
948
|
const toolStarted = new Map();
|
|
@@ -1056,7 +1068,14 @@ async function executeTurn({ cfg, objective, mode, target, evidence, sess, onTok
|
|
|
1056
1068
|
session: sess ? sess.id : "", account: cfg.email || "",
|
|
1057
1069
|
});
|
|
1058
1070
|
const scrubbed = redact.redact(raw);
|
|
1059
|
-
|
|
1071
|
+
// Even without the tool loop, a drifted model may emit machine syntax —
|
|
1072
|
+
// never show it to the operator.
|
|
1073
|
+
const filtered = onToken ? agent.toolFenceWriter(onToken) : null;
|
|
1074
|
+
const { text, done } = await api.streamGenerate({
|
|
1075
|
+
url: cfg.url, token: cfg.token, prompt: scrubbed.text, mode, signal,
|
|
1076
|
+
onToken: filtered ? (t) => filtered.write(t) : onToken,
|
|
1077
|
+
});
|
|
1078
|
+
if (filtered) filtered.end();
|
|
1060
1079
|
if (sess) session.appendTurn(sess, { prompt: objective, response: text, mode, target });
|
|
1061
1080
|
return { text, done, redactions: scrubbed.count };
|
|
1062
1081
|
}
|
|
@@ -1375,6 +1394,38 @@ async function cmdDoctor() {
|
|
|
1375
1394
|
}
|
|
1376
1395
|
}
|
|
1377
1396
|
|
|
1397
|
+
// ── update ────────────────────────────────────────────────────────────────
|
|
1398
|
+
// `bolt update` shells npm to upgrade the globally installed package. npm's
|
|
1399
|
+
// launcher is a .cmd on Windows, so the child runs through a shell; stdio is
|
|
1400
|
+
// inherited so the npm progress bars show as they are.
|
|
1401
|
+
function cmdUpdate() {
|
|
1402
|
+
console.log(`running: npm install -g @bolt-cli/cli (current: v${VERSION})`);
|
|
1403
|
+
const child = spawn("npm", ["install", "-g", "@bolt-cli/cli"], { stdio: "inherit", shell: process.platform === "win32" });
|
|
1404
|
+
return new Promise((resolve) => {
|
|
1405
|
+
child.on("error", (error) => {
|
|
1406
|
+
ui.err(`update failed: ${error.message} - try: npm install -g @bolt-cli/cli`);
|
|
1407
|
+
resolve();
|
|
1408
|
+
});
|
|
1409
|
+
child.on("close", (code) => {
|
|
1410
|
+
if (code === 0) {
|
|
1411
|
+
// Restart into the new version before the next check: clear the
|
|
1412
|
+
// cached check so the fresh install re-verifies against the registry
|
|
1413
|
+
// instead of greeting itself with a stale notice.
|
|
1414
|
+
try {
|
|
1415
|
+
const cfg = config.load();
|
|
1416
|
+
config.save({ ...cfg, updateCheckedAt: 0, updateLatest: "" });
|
|
1417
|
+
} catch {
|
|
1418
|
+
// Cache hygiene is best-effort; the update itself already succeeded.
|
|
1419
|
+
}
|
|
1420
|
+
ui.ok("update complete - restart bolt to run the new version");
|
|
1421
|
+
} else {
|
|
1422
|
+
ui.err(`update failed (exit ${code}) - try: npm install -g @bolt-cli/cli`);
|
|
1423
|
+
}
|
|
1424
|
+
resolve();
|
|
1425
|
+
});
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1378
1429
|
function cmdCompletion(rest) {
|
|
1379
1430
|
const shell = rest[0] || "";
|
|
1380
1431
|
if (!shell) throw new Error("Usage: bolt completion <bash|zsh|fish|powershell>");
|
|
@@ -1508,7 +1559,7 @@ function resolvePalettePick(raw, items) {
|
|
|
1508
1559
|
return { action: "filter", text: text.replace(/^\//, "") };
|
|
1509
1560
|
}
|
|
1510
1561
|
|
|
1511
|
-
// Grouped help box,
|
|
1562
|
+
// Grouped help box, `?`-overlay style: four small menus with stable
|
|
1512
1563
|
// numbers so the picker flow keeps working - the operator answers with a
|
|
1513
1564
|
// number exactly like the flat list. Returns the flat row list for
|
|
1514
1565
|
// pendingPalette. Pure rows in, console lines out.
|
|
@@ -1568,32 +1619,20 @@ function pickTip(n) {
|
|
|
1568
1619
|
return TIPS[((Number(n) || 0) % TIPS.length + TIPS.length) % TIPS.length];
|
|
1569
1620
|
}
|
|
1570
1621
|
|
|
1571
|
-
// Welcome lines for the REPL
|
|
1572
|
-
//
|
|
1573
|
-
//
|
|
1574
|
-
|
|
1575
|
-
|
|
1622
|
+
// Welcome lines for the REPL: quiet, polished. One identity line
|
|
1623
|
+
// (name, version, backend, working directory), one state line (session, the
|
|
1624
|
+
// single verb that matters), one muted mechanics line. No logo wall, no box,
|
|
1625
|
+
// no rotating tip. Pure (ui.c degrades to identity), tested.
|
|
1626
|
+
function replWelcomeLines({ sid, version, host, cwd, update }) {
|
|
1627
|
+
const identity = [version ? `v${version}` : "", host, cwd].filter(Boolean);
|
|
1576
1628
|
const lines = [
|
|
1577
|
-
`${ui.c.primary(ui.c.bold("bolt"))}
|
|
1578
|
-
|
|
1629
|
+
`${ui.c.primary(ui.c.bold("bolt"))}${identity.length ? ` ${ui.c.muted(identity.join(` ${ui.GLYPH.dot} `))}` : ""}`,
|
|
1630
|
+
ui.c.muted(`session ${sid.slice(0, 8)} ${ui.GLYPH.dot} type a task and press enter`),
|
|
1631
|
+
` ${ui.c.muted(`/ opens the command dropdown ${ui.GLYPH.dot} type to filter, up/down to pick, Tab fills and keeps your place ${ui.GLYPH.dot} @path attaches a file`)}`,
|
|
1579
1632
|
];
|
|
1580
|
-
if (
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
if (cwd) where.push(`${ui.c.muted("cwd")} ${cwd}`);
|
|
1584
|
-
lines.push(where.join(` ${ui.c.muted(ui.GLYPH.dot)} `));
|
|
1585
|
-
}
|
|
1586
|
-
lines.push(
|
|
1587
|
-
"",
|
|
1588
|
-
ui.bullets([
|
|
1589
|
-
"type a task and press enter to run it",
|
|
1590
|
-
`${ui.c.bold("/")} then Enter lists commands ${ui.c.muted(ui.GLYPH.dot)} ${pickHint} ${ui.c.muted(ui.GLYPH.dot)} Tab completes ${ui.c.muted(ui.GLYPH.dot)} @path attaches a file`,
|
|
1591
|
-
`${ui.c.bold("/status")} dashboard ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/sessions")} resume ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("?")} help ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/keys")} shortcuts ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/help <cmd>")} detail`,
|
|
1592
|
-
`${ui.c.bold("/agents")} presets ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/target")} scope ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/init")} map repo ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/mode")} offensive or defensive`,
|
|
1593
|
-
`${ui.c.bold("/doctor")} health ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/export")} file ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/undo")} restore ${ui.c.muted(ui.GLYPH.dot)} ${ui.c.bold("/exit")} save and quit`,
|
|
1594
|
-
]),
|
|
1595
|
-
);
|
|
1596
|
-
if (tip) lines.push("", `${ui.c.muted("tip")} ${tip}`);
|
|
1633
|
+
if (update) {
|
|
1634
|
+
lines.push("", `${ui.c.warning("update")} ${update}`);
|
|
1635
|
+
}
|
|
1597
1636
|
return lines;
|
|
1598
1637
|
}
|
|
1599
1638
|
|
|
@@ -1633,7 +1672,7 @@ function completeFileFrag(frag) {
|
|
|
1633
1672
|
|
|
1634
1673
|
function completer(line) {
|
|
1635
1674
|
// Tab-completes slash commands, their arguments, and agent names,
|
|
1636
|
-
//
|
|
1675
|
+
// modern terminal. @-mentions and /file complete filesystem paths,
|
|
1637
1676
|
// Claude Code style. /resume and /session complete saved session ids.
|
|
1638
1677
|
const atMatch = line.match(/@([^\s@]*)$/);
|
|
1639
1678
|
if (atMatch && !line.startsWith("/")) {
|
|
@@ -1660,6 +1699,39 @@ function completer(line) {
|
|
|
1660
1699
|
const hits = completeFileFrag(frag.trimStart()).map((h) => `/file ${h}`);
|
|
1661
1700
|
return [hits, line];
|
|
1662
1701
|
}
|
|
1702
|
+
if (line.startsWith("/undo ")) {
|
|
1703
|
+
const frag = line.slice(6).trimStart();
|
|
1704
|
+
const hits = completeFileFrag(frag).map((h) => `/undo ${h}`);
|
|
1705
|
+
return [hits, line];
|
|
1706
|
+
}
|
|
1707
|
+
if (line.startsWith("/export ")) {
|
|
1708
|
+
const frag = line.slice(8).trim().toLowerCase();
|
|
1709
|
+
const hits = ["md", "json", "sarif"].filter((f) => f.startsWith(frag)).map((f) => `/export ${f}`);
|
|
1710
|
+
return [hits, line];
|
|
1711
|
+
}
|
|
1712
|
+
if (line.startsWith("/templates ")) {
|
|
1713
|
+
const frag = line.slice(11).trim().toLowerCase();
|
|
1714
|
+
let names = ["README.md"];
|
|
1715
|
+
try {
|
|
1716
|
+
names = ["README.md", ...fs.readdirSync(templateDir()).filter((f) => f !== "README.md" && !f.startsWith("."))];
|
|
1717
|
+
} catch {
|
|
1718
|
+
// install without templates: README alone is still completable
|
|
1719
|
+
}
|
|
1720
|
+
const hits = names.filter((n) => n.toLowerCase().startsWith(frag)).map((n) => `/templates ${n}`);
|
|
1721
|
+
return [hits, line];
|
|
1722
|
+
}
|
|
1723
|
+
if (line.startsWith("/watch ")) {
|
|
1724
|
+
const frag = line.slice(7).trim().toLowerCase();
|
|
1725
|
+
const subs = ["status", "check", "start", "stop", "events", "policy", "playbook", "baseline", "respond"];
|
|
1726
|
+
const hits = subs.filter((s) => s.startsWith(frag)).map((s) => `/watch ${s}`);
|
|
1727
|
+
return [hits, line];
|
|
1728
|
+
}
|
|
1729
|
+
if (line.startsWith("/help ")) {
|
|
1730
|
+
const frag = line.slice(6).trim().toLowerCase();
|
|
1731
|
+
const bases = [...new Set(COMMANDS.map(([cmd]) => cmd.split(" ")[0]))];
|
|
1732
|
+
const hits = bases.filter((b) => b.slice(1).startsWith(frag)).map((b) => `/help ${b.slice(1)}`);
|
|
1733
|
+
return [hits, line];
|
|
1734
|
+
}
|
|
1663
1735
|
if (line.startsWith("/resume ") || line.startsWith("/session ") || line.startsWith("/sessions ")) {
|
|
1664
1736
|
const prefix = line.startsWith("/resume ") ? "/resume " : line.startsWith("/sessions ") ? "/sessions " : "/session ";
|
|
1665
1737
|
const frag = line.slice(prefix.length).trim().toLowerCase();
|
|
@@ -1745,7 +1817,7 @@ async function cmdRepl() {
|
|
|
1745
1817
|
let allowAll = false;
|
|
1746
1818
|
const sessionAllowed = new Set();
|
|
1747
1819
|
// Persistent always-allow store: "Always allow" survives restarts via
|
|
1748
|
-
// ~/.bolt/permissions.json (
|
|
1820
|
+
// ~/.bolt/permissions.json (modern agent CLI style).
|
|
1749
1821
|
const alwaysStore = permissions.load();
|
|
1750
1822
|
const persistAlways = (call) => {
|
|
1751
1823
|
const next = permissions.allowAlways(permissions.load(), call);
|
|
@@ -1773,21 +1845,24 @@ async function cmdRepl() {
|
|
|
1773
1845
|
const setPrompt = () => rl.setPrompt(present.promptLine(state()));
|
|
1774
1846
|
|
|
1775
1847
|
console.log("");
|
|
1776
|
-
|
|
1848
|
+
// Quiet polished welcome: two header lines, not a logo wall in a box.
|
|
1849
|
+
// Update notice comes from the cache first (instant, no network); a stale
|
|
1850
|
+
// cache is refreshed in the background for the next session, and a newly
|
|
1851
|
+
// discovered update prints one line mid-session.
|
|
1852
|
+
const cachedUpdate = updatecheck.cachedNotice(VERSION);
|
|
1777
1853
|
console.log(
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
cwd: process.cwd(),
|
|
1786
|
-
tip: pickTip(Math.floor(Date.now() / 86400000)),
|
|
1787
|
-
}),
|
|
1788
|
-
}),
|
|
1854
|
+
replWelcomeLines({
|
|
1855
|
+
sid: sess.id,
|
|
1856
|
+
version: VERSION,
|
|
1857
|
+
host: backendHost(cfg.url),
|
|
1858
|
+
cwd: process.cwd(),
|
|
1859
|
+
update: cachedUpdate || undefined,
|
|
1860
|
+
}).join("\n"),
|
|
1789
1861
|
);
|
|
1790
1862
|
console.log("");
|
|
1863
|
+
void updatecheck
|
|
1864
|
+
.refresh(VERSION, cachedUpdate ? {} : { onNotice: (notice) => console.log(`\n${ui.c.warning(`! ${notice}`)}`) })
|
|
1865
|
+
.catch(() => undefined);
|
|
1791
1866
|
|
|
1792
1867
|
// Balance is a nice-to-have in the prompt, so failure here must never block
|
|
1793
1868
|
// the session.
|
|
@@ -1919,13 +1994,18 @@ async function cmdRepl() {
|
|
|
1919
1994
|
continue;
|
|
1920
1995
|
}
|
|
1921
1996
|
rl.pause();
|
|
1922
|
-
const { item } = await ui.selectLive({ title: "commands", items: all, initialFilter: "" });
|
|
1997
|
+
const { item, tabFill } = await ui.selectLive({ title: "commands", items: all, initialFilter: "" });
|
|
1923
1998
|
rl.resume();
|
|
1924
1999
|
setPrompt();
|
|
1925
2000
|
if (!item) {
|
|
1926
2001
|
rl.prompt();
|
|
1927
2002
|
continue;
|
|
1928
2003
|
}
|
|
2004
|
+
if (tabFill) {
|
|
2005
|
+
rl.write(`${item.label.split(" <")[0].split(" [")[0]} `);
|
|
2006
|
+
rl.prompt();
|
|
2007
|
+
continue;
|
|
2008
|
+
}
|
|
1929
2009
|
if (item.label === "/" || item.label === "/help") {
|
|
1930
2010
|
printPalette("");
|
|
1931
2011
|
rl.prompt();
|
|
@@ -2015,10 +2095,11 @@ async function cmdRepl() {
|
|
|
2015
2095
|
continue;
|
|
2016
2096
|
}
|
|
2017
2097
|
rl.pause();
|
|
2018
|
-
const { item } = await ui.selectLive({ title: "sessions", items, initialFilter: q });
|
|
2098
|
+
const { item, tabFill } = await ui.selectLive({ title: "sessions", items, initialFilter: q });
|
|
2019
2099
|
rl.resume();
|
|
2020
2100
|
setPrompt();
|
|
2021
|
-
if (!item) {
|
|
2101
|
+
if (!item || tabFill) {
|
|
2102
|
+
if (item && tabFill) rl.write(`${item.label.split(" <")[0].split(" [")[0]} `);
|
|
2022
2103
|
rl.prompt();
|
|
2023
2104
|
continue;
|
|
2024
2105
|
}
|
|
@@ -2056,13 +2137,18 @@ async function cmdRepl() {
|
|
|
2056
2137
|
continue;
|
|
2057
2138
|
}
|
|
2058
2139
|
rl.pause();
|
|
2059
|
-
const { item } = await ui.selectLive({ title: "commands", items: all, initialFilter: q });
|
|
2140
|
+
const { item, tabFill } = await ui.selectLive({ title: "commands", items: all, initialFilter: q });
|
|
2060
2141
|
rl.resume();
|
|
2061
2142
|
setPrompt();
|
|
2062
2143
|
if (!item) {
|
|
2063
2144
|
rl.prompt();
|
|
2064
2145
|
continue;
|
|
2065
2146
|
}
|
|
2147
|
+
if (tabFill) {
|
|
2148
|
+
rl.write(`${item.label.split(" <")[0].split(" [")[0]} `);
|
|
2149
|
+
rl.prompt();
|
|
2150
|
+
continue;
|
|
2151
|
+
}
|
|
2066
2152
|
if (item.label === "/" || item.label === "/help") {
|
|
2067
2153
|
printPalette("");
|
|
2068
2154
|
rl.prompt();
|
|
@@ -2498,7 +2584,7 @@ async function run(argv) {
|
|
|
2498
2584
|
// Piped input with no command: single non-interactive run.
|
|
2499
2585
|
return cmdRun([], { buildMode: false });
|
|
2500
2586
|
}
|
|
2501
|
-
if (flag(argv, "-h", "--help") && (cmd === "run" || cmd === "build" || cmd === "watch" || cmd === "session" || cmd === "auth" || cmd === "signin" || cmd === "-p" || cmd === "--print" || cmd === "export" || cmd === "doctor" || cmd === "completion" || cmd === "undo")) {
|
|
2587
|
+
if (flag(argv, "-h", "--help") && (cmd === "run" || cmd === "build" || cmd === "watch" || cmd === "session" || cmd === "auth" || cmd === "signin" || cmd === "-p" || cmd === "--print" || cmd === "export" || cmd === "doctor" || cmd === "completion" || cmd === "undo" || cmd === "update")) {
|
|
2502
2588
|
console.log(help(cmd === "-p" || cmd === "--print" ? "run" : cmd));
|
|
2503
2589
|
return;
|
|
2504
2590
|
}
|
|
@@ -2525,6 +2611,7 @@ async function run(argv) {
|
|
|
2525
2611
|
if (cmd === "build") return cmdRun(rest, { buildMode: true });
|
|
2526
2612
|
if (cmd === "session") return cmdSession(rest);
|
|
2527
2613
|
if (cmd === "doctor") return cmdDoctor();
|
|
2614
|
+
if (cmd === "update") return cmdUpdate();
|
|
2528
2615
|
if (cmd === "completion") return cmdCompletion(rest);
|
|
2529
2616
|
if (cmd === "export") return cmdExport(rest);
|
|
2530
2617
|
if (cmd === "undo") return cmdUndo(rest);
|
package/lib/completion.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Shell completions for bolt. Static word lists only — no subprocesses,
|
|
3
3
|
// no filesystem access. Emitted to stdout so callers can redirect:
|
|
4
4
|
// bolt completion bash >> ~/.bashrc
|
|
5
|
-
const COMMANDS = ["run", "build", "login", "signin", "auth", "balance", "session", "doctor", "completion", "export", "undo", "help"];
|
|
5
|
+
const COMMANDS = ["run", "build", "login", "signin", "auth", "balance", "session", "doctor", "update", "completion", "export", "undo", "help"];
|
|
6
6
|
const FLAGS = [
|
|
7
7
|
"--target", "-t", "--mode", "-m", "--agent", "--tools", "--dry-run", "--allow-all",
|
|
8
8
|
"--max-iters", "-p", "--print", "--file", "-f", "--evidence", "--session", "-s",
|
package/lib/config.js
CHANGED
|
@@ -27,6 +27,10 @@ function load() {
|
|
|
27
27
|
token: cfg.token || process.env.BOLT_TOKEN || "",
|
|
28
28
|
expiresAt: cfg.expiresAt || "",
|
|
29
29
|
email: cfg.email || "",
|
|
30
|
+
// Update-check cache (lib/updatecheck.js): survives every save unless
|
|
31
|
+
// explicitly overwritten, so an auth save never erases the notice.
|
|
32
|
+
updateCheckedAt: typeof cfg.updateCheckedAt === "number" ? cfg.updateCheckedAt : 0,
|
|
33
|
+
updateLatest: typeof cfg.updateLatest === "string" ? cfg.updateLatest : "",
|
|
30
34
|
};
|
|
31
35
|
} catch {
|
|
32
36
|
return {
|
|
@@ -34,14 +38,31 @@ function load() {
|
|
|
34
38
|
token: process.env.BOLT_TOKEN || "",
|
|
35
39
|
expiresAt: "",
|
|
36
40
|
email: "",
|
|
41
|
+
updateCheckedAt: 0,
|
|
42
|
+
updateLatest: "",
|
|
37
43
|
};
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
function save(cfg) {
|
|
42
48
|
fs.mkdirSync(dir(), { recursive: true, mode: 0o700 });
|
|
49
|
+
// Callers own the auth fields; the update-check cache rides along from the
|
|
50
|
+
// previous file unless this save explicitly passes new values.
|
|
51
|
+
let prev = {};
|
|
52
|
+
try {
|
|
53
|
+
prev = JSON.parse(fs.readFileSync(file(), "utf8"));
|
|
54
|
+
} catch {
|
|
55
|
+
// No previous file (first signin): defaults below apply.
|
|
56
|
+
}
|
|
43
57
|
const data = JSON.stringify(
|
|
44
|
-
{
|
|
58
|
+
{
|
|
59
|
+
url: cfg.url,
|
|
60
|
+
token: cfg.token || "",
|
|
61
|
+
expiresAt: cfg.expiresAt || "",
|
|
62
|
+
email: cfg.email || "",
|
|
63
|
+
updateCheckedAt: cfg.updateCheckedAt !== undefined ? cfg.updateCheckedAt : prev.updateCheckedAt || 0,
|
|
64
|
+
updateLatest: cfg.updateLatest !== undefined ? cfg.updateLatest : prev.updateLatest || "",
|
|
65
|
+
},
|
|
45
66
|
null,
|
|
46
67
|
2,
|
|
47
68
|
);
|
package/lib/permissions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Persistent permission store for the bolt agent loop.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// Modern agent CLIs remember "allow always" decisions across sessions.
|
|
5
5
|
// Session-only approvals live in memory (a Set passed around the loop); this
|
|
6
6
|
// module persists the "always" tier to ~/.bolt/permissions.json so a tool the
|
|
7
7
|
// operator trusts never asks again. File mode 600, same as the auth token.
|
package/lib/present.js
CHANGED
|
@@ -67,18 +67,19 @@ function turnFooter({ done, elapsed, turns }) {
|
|
|
67
67
|
return ui.isTTY() ? `${ui.c.border(ui.GLYPH.rule.repeat(6))} ${joined}` : joined;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
// The prompt doubles as the status line, the way
|
|
70
|
+
// The prompt doubles as the status line, the way quiet terminals keep state visible:
|
|
71
71
|
// mode, target, armed agent and attachment count all live here so you never
|
|
72
|
-
// have to remember what you set.
|
|
73
|
-
|
|
72
|
+
// have to remember what you set. One quiet caret leads, mode carries the only
|
|
73
|
+
// emphasis, everything else is muted; the session id lives in /status and the
|
|
74
|
+
// welcome line, not on every keystroke.
|
|
75
|
+
function promptLine({ mode, target, agent, files, balance, tools }) {
|
|
74
76
|
const bits = [ui.c.primary(ui.c.bold(mode))];
|
|
75
|
-
if (target) bits.push(ui.c.
|
|
76
|
-
if (agent) bits.push(
|
|
77
|
+
if (target) bits.push(ui.c.muted(target));
|
|
78
|
+
if (agent) bits.push(ui.c.muted(`agent ${agent}`));
|
|
77
79
|
if (files) bits.push(ui.c.muted(`${files} file${files === 1 ? "" : "s"}`));
|
|
78
|
-
if (tools !== undefined) bits.push(
|
|
80
|
+
if (tools !== undefined) bits.push(ui.c.muted(tools ? "tools" : "no-tools"));
|
|
79
81
|
if (balance !== undefined && balance !== null) bits.push(ui.c.muted(`${balance} tok`));
|
|
80
|
-
bits.
|
|
81
|
-
return `${ui.c.primary(ui.GLYPH.bar)} ${bits.join(ui.c.muted(` ${ui.GLYPH.dot} `))} ${ui.c.primary(ui.GLYPH.caret)} `;
|
|
82
|
+
return `${ui.c.primary(ui.GLYPH.caret)} ${bits.join(ui.c.muted(` ${ui.GLYPH.dot} `))} ${ui.c.primary(ui.GLYPH.caret)} `;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
// Palette rows for `select()`; label is what gets typed back into the prompt.
|
|
@@ -109,7 +110,7 @@ function filterPalette(query, commands, agents) {
|
|
|
109
110
|
return all.filter((it) => `${it.label} ${it.hint || ""}`.toLowerCase().includes(q));
|
|
110
111
|
}
|
|
111
112
|
|
|
112
|
-
// Grouped help,
|
|
113
|
+
// Grouped help, `?`-overlay style: commands read as four small
|
|
113
114
|
// menus (run, session, safety, system) instead of one flat list. Pure:
|
|
114
115
|
// group membership is by command base, rows keep their COMMANDS text.
|
|
115
116
|
const HELP_GROUPS = [
|
|
@@ -142,7 +143,7 @@ function helpDetail(query, commands) {
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
// Status dashboard rows for the `/status` box: everything about the live
|
|
145
|
-
// session in one glance,
|
|
146
|
+
// session in one glance, status-dialog style. All fields optional;
|
|
146
147
|
// missing values read as "(none)" or are skipped. Pure.
|
|
147
148
|
function statusLines({ sid, mode, target, agent, files, tools, balance, turns, memChars, cwd, backend } = {}) {
|
|
148
149
|
const rows = [];
|
|
@@ -164,7 +165,7 @@ function statusLines({ sid, mode, target, agent, files, tools, balance, turns, m
|
|
|
164
165
|
return rows;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
// Session picker rows for `/sessions`,
|
|
168
|
+
// Session picker rows for `/sessions`, session-list style: newest
|
|
168
169
|
// first, title plus turn count plus relative age in the hint, and the live
|
|
169
170
|
// session flagged so resuming it is never a surprise. Pure.
|
|
170
171
|
function sessionRows(sessions, currentId) {
|