@tiens.nguyen/gu-cli 1.0.939 → 1.0.941
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 +17 -7
- package/agent-deps-preflight.mjs +1 -1
- package/autocompact.mjs +2 -2
- package/browser-bridge.mjs +2 -2
- package/browser-chrome.mjs +2 -2
- package/browser-command.mjs +4 -4
- package/browser-extension/README.md +6 -6
- package/clear-logs.mjs +3 -3
- package/clear-state.mjs +3 -3
- package/cli-token.mjs +8 -8
- package/client-expert-api.mjs +9 -9
- package/client-expert-run.mjs +7 -7
- package/client-expert-setup.mjs +4 -4
- package/command-allow.mjs +1 -1
- package/conversation-archive.mjs +2 -2
- package/credential-recovery.mjs +1 -1
- package/daemon-control.mjs +4 -4
- package/device-login.mjs +3 -3
- package/free-model.mjs +1 -1
- package/full-log-command.mjs +1 -1
- package/gonext_agent_chat.py +160 -89
- package/gu-cli.mjs +55 -29
- package/gu-home-move.mjs +193 -0
- package/gu-repl.mjs +342 -59
- package/gu_browser.py +3 -3
- package/gu_free_budget.py +2 -2
- package/gu_gif.py +1 -1
- package/gu_hooks.py +1 -1
- package/gu_turn_notes.py +2 -2
- package/gu_turn_trail.py +138 -0
- package/gudb-size.mjs +198 -0
- package/hooks-config.mjs +4 -4
- package/image-paste.mjs +8 -8
- package/install-path.mjs +1 -1
- package/log-level.mjs +1 -1
- package/log-policy.mjs +1 -1
- package/lsp-host.mjs +2 -2
- package/lsp-registry.mjs +9 -9
- package/mcp-command.mjs +1 -1
- package/mcp-config.mjs +5 -5
- package/memory-task.mjs +85 -0
- package/model-doctor.mjs +10 -10
- package/mongo-mac.mjs +2 -2
- package/mongo-windows.mjs +3 -3
- package/next-suggestion.mjs +13 -8
- package/package.json +5 -1
- package/platform-tools.mjs +3 -3
- package/poll-errors.mjs +2 -2
- package/prompt_scaffold_check.py +1 -1
- package/proxy-store.mjs +1 -1
- package/python-unix.mjs +6 -6
- package/python-windows.mjs +1 -1
- package/rag-selftest.mjs +2 -2
- package/resume-memory.mjs +1 -1
- package/scripts/image-paste-check.mjs +1 -1
- package/setup-fixes.mjs +4 -4
- package/shell-details.mjs +2 -2
- package/skill-install.mjs +9 -9
- package/skill-package.mjs +10 -10
- package/skill-source.mjs +4 -4
- package/skills-copy.mjs +15 -15
- package/skills.mjs +4 -4
- package/support-bundle.mjs +6 -6
- package/support-report.mjs +5 -5
- package/terminal-layout.mjs +25 -1
- package/turn-notes.mjs +2 -2
- package/version-check.mjs +1 -1
- package/workspace-revert.mjs +2 -2
package/gu-repl.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* $ gu
|
|
8
8
|
*
|
|
9
9
|
* It offers to register the CURRENT folder as an agent workspace (with a trust prompt
|
|
10
|
-
* that maps to --allow-run), authenticates with the worker key from ~/.
|
|
10
|
+
* that maps to --allow-run), authenticates with the worker key from ~/.gu/worker.env
|
|
11
11
|
* (the same file `gu-cli set` / the Wizard write), and loops on a `>> `
|
|
12
12
|
* prompt. Each question is ENQUEUED as a normal agent_chat job (models/budgets/RAG
|
|
13
13
|
* resolved from your user settings by POST /api/worker/agent-ask) and executed by the
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* logs, exactly like a web question. The REPL polls the job and streams the persisted
|
|
16
16
|
* chunks live into the terminal.
|
|
17
17
|
*
|
|
18
|
-
* Conversation history is saved to ~/.
|
|
18
|
+
* Conversation history is saved to ~/.gu/sessions/<hash-of-folder-path>.json after
|
|
19
19
|
* every turn and reloaded on the next `gu` in the SAME folder — so closing the
|
|
20
20
|
* terminal and coming back later still has context (e.g. "continue" after an
|
|
21
21
|
* interrupted investigation actually resumes it). /new clears it.
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
* Commands: /exit /model /new /help Ctrl-C stops following the current run.
|
|
25
25
|
*/
|
|
26
26
|
import { RELAUNCHED } from "./gu-relaunch.mjs"; // FIRST: may replace this process (#358)
|
|
27
|
+
import { moveProjectToGu } from "./gu-home-move.mjs"; // GH #582: moves the old home folder to ~/.gu once, before anything uses it
|
|
27
28
|
import { installInternalLabel } from "./cli-token.mjs";
|
|
28
|
-
installInternalLabel(); // our own machines only (GU_INTERNAL_LABEL / ~/.
|
|
29
|
+
installInternalLabel(); // our own machines only (GU_INTERNAL_LABEL / ~/.gu/internal-label): label gucli.com requests
|
|
29
30
|
import { readFile, mkdir, writeFile, unlink, rename } from "node:fs/promises";
|
|
30
31
|
import { readStepTokens, readTurnCache } from "./step-tokens.mjs";
|
|
31
32
|
import { snapshotInput, restoreInput, replaceStoppedQuestion, restoredQuestionLetGo, stopNoteLines } from "./turn-stop.mjs";
|
|
@@ -79,6 +80,7 @@ import {
|
|
|
79
80
|
createMouseReportReader,
|
|
80
81
|
stripLeakedMouseReports,
|
|
81
82
|
agentPickerItems,
|
|
83
|
+
agentsPanelRows,
|
|
82
84
|
agentsIndicator,
|
|
83
85
|
classifyCliArg,
|
|
84
86
|
maskKey,
|
|
@@ -148,6 +150,7 @@ import {
|
|
|
148
150
|
import { completedFlush, splitLiveStream } from "./completed-flush.mjs";
|
|
149
151
|
import { isScaffoldStep, isGroupableStep, stepGroupRows, stepRowSpans, relativizePaths } from "./step-group.mjs";
|
|
150
152
|
import { clearLogsNoticeText } from "./clear-logs.mjs";
|
|
153
|
+
import { gudbNotice as gudbNoticeSync, lowDiskNotice } from "./gudb-size.mjs"; // GH #594, #597
|
|
151
154
|
import { commandAllowedIn, commandAllowProject, commandAllowSource, commandForget, commandProjectAllowed, sourcedFileOf, PROJECT_CHOICE } from "./command-allow.mjs";
|
|
152
155
|
import { allowIn, allowedIn, bridgeCommand, browserReport, bridgeStatus, extensionDir, findDevInstalls, helpInstall, installExtensionFiles, installSteps, localLeftovers, openExtensionsPage, removeLocalFiles, STORE_URL, stopBridge } from "./browser-command.mjs";
|
|
153
156
|
import { commandLogFile, killShell, logTail, markAnnounced, readShells, recapQuestion, runningShells, shellsToRecap, statusText as shellStatusText, renderShellDetails, shellPanelRows, shellPickerLabel, shellState, shellsNotice } from "./shell-details.mjs";
|
|
@@ -155,7 +158,8 @@ import { discoverSkills, matchSkillCommand } from "./skills.mjs";
|
|
|
155
158
|
import { appendNew, archivePathFor, archivedWorkspaceKey, markReset, seedArchive } from "./conversation-archive.mjs";
|
|
156
159
|
import { addAllowRule, listServers as listMcpServers } from "./mcp-config.mjs";
|
|
157
160
|
import { unapprovedProjectServers } from "./mcp-command.mjs";
|
|
158
|
-
import { readHooks } from "./hooks-config.mjs";
|
|
161
|
+
import { readHooks, hooksForTurn, sessionForTurn } from "./hooks-config.mjs";
|
|
162
|
+
import { memoryRuntime, currentTask, setTask, memoryBarText, taskPickerLabels } from "./memory-task.mjs"; // GH #595
|
|
159
163
|
import { readSkillSource, sourceLabel, SKILL_SOURCE_KEY } from "./skill-source.mjs";
|
|
160
164
|
import { codingBannerLabel, isOllamaCloudUrl, SECRET_KEY_HINT } from "./coding-key-prompt.mjs";
|
|
161
165
|
import { questionEchoText, thoughtPrintSeq, wrapDiffText } from "./terminal-layout.mjs";
|
|
@@ -233,6 +237,8 @@ import {
|
|
|
233
237
|
zoneResizePlan,
|
|
234
238
|
blockClosedPad,
|
|
235
239
|
} from "./terminal-viewport.mjs";
|
|
240
|
+
// GH #582: a project that still has gu's old folder gets it renamed to ./.gu, once.
|
|
241
|
+
if (process.env.GU_NO_HOME_MOVE !== "1") for (const l of moveProjectToGu()) process.stderr.write(` ${l}\n`);
|
|
236
242
|
|
|
237
243
|
const DIR = dirname(fileURLToPath(import.meta.url));
|
|
238
244
|
|
|
@@ -258,9 +264,9 @@ setInterval(() => {
|
|
|
258
264
|
/* try again next time */
|
|
259
265
|
}
|
|
260
266
|
}, 20_000).unref();
|
|
261
|
-
const ENV_FILE = join(homedir(), ".
|
|
262
|
-
const WS_FILE = join(homedir(), ".
|
|
263
|
-
const SESSIONS_DIR = join(homedir(), ".
|
|
267
|
+
const ENV_FILE = join(homedir(), ".gu", "worker.env");
|
|
268
|
+
const WS_FILE = join(homedir(), ".gu", "workspaces.json");
|
|
269
|
+
const SESSIONS_DIR = join(homedir(), ".gu", "sessions");
|
|
264
270
|
|
|
265
271
|
// Through paint() so NO_COLOR / GU_ACCENT=off / TERM=dumb turn ALL of them off, not only the
|
|
266
272
|
// accent (task #29 bug B1 — red '-' rows stayed red under NO_COLOR).
|
|
@@ -697,7 +703,7 @@ if (cliVerdict.kind === "run") {
|
|
|
697
703
|
" gu doctor|login|set # models / account (same as `gu-cli …`)\n" +
|
|
698
704
|
" gu rag # is RAG working? tests the embedder end-to-end\n\n" +
|
|
699
705
|
" -v, --verbose show RAG index-file activity in the bottom bar (each shard written)\n" +
|
|
700
|
-
" --log log this run in detail (~/.
|
|
706
|
+
" --log log this run in detail (~/.gu/worker.log). Without it only starts,\n" +
|
|
701
707
|
" stops and errors are logged. Ends when this gu closes.\n" +
|
|
702
708
|
" --color colour the live thought, the thinking spinner and its playful word.\n" +
|
|
703
709
|
" Without it they are plain white.\n" +
|
|
@@ -707,13 +713,13 @@ if (cliVerdict.kind === "run") {
|
|
|
707
713
|
" client / MLX host / private). Without it, a first install is\n" +
|
|
708
714
|
" private by default — the whole stack on this machine.\n" +
|
|
709
715
|
" -h, --help this help\n\n" +
|
|
710
|
-
"Auth comes from ~/.
|
|
716
|
+
"Auth comes from ~/.gu/worker.env; models/budgets/RAG come from your web Settings.\n" +
|
|
711
717
|
"Inside the REPL: /exit · /model · /new · /help — Ctrl-C stops following a turn.\n" +
|
|
712
718
|
"Questions are enqueued like web questions and executed by the RUNNING\n" +
|
|
713
719
|
"gu-cli daemon — its terminal shows the full [gu-agent] logs.\n" +
|
|
714
|
-
"Conversation history is saved per-folder in ~/.
|
|
720
|
+
"Conversation history is saved per-folder in ~/.gu/sessions and resumed next time\n" +
|
|
715
721
|
"you run `gu` in the same folder; /new starts a new conversation and keeps the old one\n" +
|
|
716
|
-
"in ~/.
|
|
722
|
+
"in ~/.gu/sessions/archive."
|
|
717
723
|
);
|
|
718
724
|
process.exit(0);
|
|
719
725
|
}
|
|
@@ -723,7 +729,7 @@ if (cliVerdict.kind === "run") {
|
|
|
723
729
|
// the job stream. It now drives a real, streamable signal.
|
|
724
730
|
const REPL_VERBOSE = argv.includes("-v") || argv.includes("--verbose");
|
|
725
731
|
// --log (task #352): THIS RUN logs in detail. By default the worker writes only starts, stops and
|
|
726
|
-
// errors; a run started with --log takes a lease (its pid, in ~/.
|
|
732
|
+
// errors; a run started with --log takes a lease (its pid, in ~/.gu/log-detail.json) that the
|
|
727
733
|
// worker reads, and gives it back on exit. Per run by the owner's rule — nothing is saved, and a
|
|
728
734
|
// run that is killed leaves a lease for a dead process, which is no lease.
|
|
729
735
|
const REPL_LOG = argv.includes("--log");
|
|
@@ -749,7 +755,7 @@ if (REPL_LOG) {
|
|
|
749
755
|
const ll = await import("./log-level.mjs");
|
|
750
756
|
await ll.takeLease().catch(() => {});
|
|
751
757
|
process.on("exit", () => ll.releaseLeaseSync());
|
|
752
|
-
console.log(dim(" --log: detailed logging is on for this run (~/.
|
|
758
|
+
console.log(dim(" --log: detailed logging is on for this run (~/.gu/worker.log); back to minimal when gu closes."));
|
|
753
759
|
}
|
|
754
760
|
|
|
755
761
|
// WHAT THE INSTALL DID, FIRST (GH #557 follow-up): npm hides postinstall output, so gu says what
|
|
@@ -793,14 +799,14 @@ if (REPL_VERBOSE) {
|
|
|
793
799
|
process.env.GONEXT_REPL_VERBOSE = "1";
|
|
794
800
|
}
|
|
795
801
|
|
|
796
|
-
// ---------- auth: worker key + API base from ~/.
|
|
802
|
+
// ---------- auth: worker key + API base from ~/.gu/worker.env ----------
|
|
797
803
|
dotenv.config({ path: ENV_FILE });
|
|
798
804
|
dotenv.config();
|
|
799
805
|
let workerKey = String(process.env.GONEXT_WORKER_KEY ?? "").trim();
|
|
800
806
|
let apiBase = String(process.env.GONEXT_API_BASE ?? "").trim().replace(/\/+$/, "");
|
|
801
807
|
|
|
802
808
|
/**
|
|
803
|
-
* Re-read ~/.
|
|
809
|
+
* Re-read ~/.gu/worker.env into this process.
|
|
804
810
|
*
|
|
805
811
|
* Client Expert setup WRITES that file mid-run, so without this the very first session after
|
|
806
812
|
* setup still holds the values it started with — the banner and every request would describe
|
|
@@ -1140,6 +1146,7 @@ const COMMANDS = [
|
|
|
1140
1146
|
{ name: "/tokens", desc: "break down the last prompt sent to the coding model — how much of it was RAG" },
|
|
1141
1147
|
{ name: "/voucher", usage: "/voucher CODE", desc: "use a voucher code — free days for this computer's trial or your free account, or a free model allowance" },
|
|
1142
1148
|
{ name: "/support", desc: "send the gu support team a request with gu's logs attached (secrets masked) — shows what goes first, then asks" },
|
|
1149
|
+
{ name: "/backup-db", desc: "back up gu's built-in database safely (SQLite's own backup, consistent while gu runs) — keeps the last 3" },
|
|
1143
1150
|
{ name: "/clear-logs", desc: "show what gu's logs, RAG indexes and old API versions take on disk, then ask what to clear — the logs first" },
|
|
1144
1151
|
{ name: "/cost", usage: "/cost [all]", desc: "what this session and the last turn cost, and the price of the model in use — \"all\" shows every price (prices update by themselves)" },
|
|
1145
1152
|
// ONE name, /new (user, #278). /reset and /clear still work (HIDDEN_COMMANDS) for habit and
|
|
@@ -1147,11 +1154,12 @@ const COMMANDS = [
|
|
|
1147
1154
|
{ name: "/new", desc: "start a new conversation in this folder — the old one is kept (archived); the folder's settings stay" },
|
|
1148
1155
|
{ name: "/hooks", usage: "/hooks [list|approve|unapprove]", desc: "hooks: commands gu runs on onStart, onAsk, onToolDone, onTurnEnd — list them, approve this project's" },
|
|
1149
1156
|
{ name: "/mcp", usage: "/mcp [list|tools|add|remove|enable|disable|approve|allow|disallow|reconnect]", desc: "MCP servers: see which connect, add one (asks step by step), choose which tools run without asking" },
|
|
1150
|
-
{ name: "/switch-skill", usage: "/switch-skill [claude|gu]", desc: "whose skills, MCP servers and hooks this folder uses — Claude Code's (.claude) or gu's own (.
|
|
1157
|
+
{ name: "/switch-skill", usage: "/switch-skill [claude|gu]", desc: "whose skills, MCP servers and hooks this folder uses — Claude Code's (.claude) or gu's own (.gu)" },
|
|
1158
|
+
{ name: "/task", desc: "choose the task the memory skill records this session's work under (shown at the bottom)" },
|
|
1151
1159
|
{ name: "/resume", desc: "carry on the last unfinished task in this folder — Claude Code's or gu's — from where it stopped (memory skill)" },
|
|
1152
1160
|
{ name: "/skill-pack", usage: "/skill-pack <name> [--out <file>] [--runtime <dir>]", desc: "pack a skill (gu's or Claude's) with its MCP servers, hooks and code into one zip for another machine" },
|
|
1153
1161
|
{ name: "/skill-install", usage: "/skill-install <zip|folder> [--gu] [--claude] [--dry-run]", desc: "install a packed skill for gu and Claude Code (whichever is set up here)" },
|
|
1154
|
-
{ name: "/skills-copy-to-claude", usage: "/skills-copy-to-claude [--dry-run] [name…]", desc: "copy gu's skills (.
|
|
1162
|
+
{ name: "/skills-copy-to-claude", usage: "/skills-copy-to-claude [--dry-run] [name…]", desc: "copy gu's skills (.gu) into Claude Code's folders (.claude), renamed to Claude's names, with their MCP servers" },
|
|
1155
1163
|
{ name: "/help", desc: "list these commands" },
|
|
1156
1164
|
{ name: "/exit", aliases: ["/quit"], desc: "quit" },
|
|
1157
1165
|
];
|
|
@@ -1159,8 +1167,8 @@ const COMMANDS = [
|
|
|
1159
1167
|
// terminal-layout.mjs — their handlers are below, above the unknown-command guard. Not
|
|
1160
1168
|
// imported here: nothing in the REPL reads the list, the tests do (task #153).
|
|
1161
1169
|
const COMMAND_NAMES = COMMANDS.flatMap((c) => [c.name, ...(c.aliases ?? [])]);
|
|
1162
|
-
// SKILLS ARE COMMANDS TOO (task #269): each ~/.
|
|
1163
|
-
// .
|
|
1170
|
+
// SKILLS ARE COMMANDS TOO (task #269): each ~/.gu/skills/<name>/SKILL.md (and this folder's
|
|
1171
|
+
// .gu/skills) is /<name>, in Tab-completion and /help like any other. Scanned from disk — kept
|
|
1164
1172
|
// for 2s only, because the overlay asks on every keystroke — so a skill added, edited or DELETED
|
|
1165
1173
|
// while gu runs shows up (or quietly disappears) without a restart. A built-in name always wins.
|
|
1166
1174
|
let _skillScan = { at: 0, skills: [] };
|
|
@@ -1810,6 +1818,16 @@ function applyClick({ row, col }) {
|
|
|
1810
1818
|
void runLimitsSeen();
|
|
1811
1819
|
return;
|
|
1812
1820
|
}
|
|
1821
|
+
if (diskRowTarget && row === updateRowAbs &&
|
|
1822
|
+
col - 1 >= diskRowTarget.from && col - 1 < diskRowTarget.to) {
|
|
1823
|
+
void runClearLogs(); // what gu itself can free
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
if (gudbRowTarget && row === updateRowAbs &&
|
|
1827
|
+
col - 1 >= gudbRowTarget.from && col - 1 < gudbRowTarget.to) {
|
|
1828
|
+
void runCleanOldData(); // GH #594: one click, no questions
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1813
1831
|
if (logsRowTarget && row === updateRowAbs &&
|
|
1814
1832
|
col - 1 >= logsRowTarget.from && col - 1 < logsRowTarget.to) {
|
|
1815
1833
|
void runClearLogs();
|
|
@@ -1915,7 +1933,7 @@ if (TITLE_ON) {
|
|
|
1915
1933
|
}
|
|
1916
1934
|
|
|
1917
1935
|
// ---------- language servers (GH #539/#540) --------------------------------------------------
|
|
1918
|
-
// The choices live in ~/.
|
|
1936
|
+
// The choices live in ~/.gu/lsp-state.json (the offer and /lsp write it); the worker's host
|
|
1919
1937
|
// (lsp-host.mjs) reads it, runs the servers, and says what is running on /status.
|
|
1920
1938
|
const loadLspState = () => {
|
|
1921
1939
|
try {
|
|
@@ -2071,7 +2089,7 @@ async function autocompactCommand(arg) {
|
|
|
2071
2089
|
// ---------- the next message, suggested (GH #536) -------------------------------------------
|
|
2072
2090
|
// After SOME turns the empty input shows a dim suggestion; Tab puts it in the input. See
|
|
2073
2091
|
// next-suggestion.mjs for when (two gates: cheap rules, then the coder answering NONE or a reply).
|
|
2074
|
-
const SUGGESTIONS_FILE = join(homedir(), ".
|
|
2092
|
+
const SUGGESTIONS_FILE = join(homedir(), ".gu", "prompt-suggestions");
|
|
2075
2093
|
let suggestionsOn = (() => {
|
|
2076
2094
|
try {
|
|
2077
2095
|
return suggestionsOnFromFile(readFileSync(SUGGESTIONS_FILE, "utf8"));
|
|
@@ -2335,7 +2353,7 @@ function showImageNotice(text) {
|
|
|
2335
2353
|
}
|
|
2336
2354
|
/**
|
|
2337
2355
|
* Images go to the coding model when it takes them: Claude, Kimi K3 (image-capable-coders.json), and
|
|
2338
|
-
* since GH #528 every model the cloud list marks `images: true` — read from ~/.
|
|
2356
|
+
* since GH #528 every model the cloud list marks `images: true` — read from ~/.gu/image-models.json
|
|
2339
2357
|
* at start, refreshed with the cloud token table (refreshLimitsUpdate).
|
|
2340
2358
|
*/
|
|
2341
2359
|
loadCloudImageCoders();
|
|
@@ -2538,6 +2556,17 @@ rl.on("line", (l) => {
|
|
|
2538
2556
|
imageStore.clear();
|
|
2539
2557
|
typedDuringTurn = false;
|
|
2540
2558
|
turnTyping.reset();
|
|
2559
|
+
// GH #588: /model during a turn opens the picker NOW — it used to go to the agent as a note.
|
|
2560
|
+
// The running job carries its own coder (its payload), so the choice is for the next turn.
|
|
2561
|
+
if (/^\/models?$/i.test(queued)) {
|
|
2562
|
+
void chooseModelDuringTurn();
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2565
|
+
// GH #595: /task mid-turn — the rest of this turn's steps are filed under the chosen task.
|
|
2566
|
+
if (/^\/tasks?$/i.test(queued)) {
|
|
2567
|
+
void runTaskCommand();
|
|
2568
|
+
return;
|
|
2569
|
+
}
|
|
2541
2570
|
// GH #506: with a running job, the text goes to the agent's NEXT step (appended after the
|
|
2542
2571
|
// current step's result — cache-safe). Not read by the end of the turn = the next question.
|
|
2543
2572
|
// GH #514: like chat — no notices. Pinned, it waits as a ">> " row above the input box until the agent
|
|
@@ -2823,9 +2852,65 @@ function slashCloseSeq(line, cursor, cols) {
|
|
|
2823
2852
|
// so the bar reflects it and Shift+Tab cycles it; wiring it to actually gate the agent's
|
|
2824
2853
|
// edits is a deliberate follow-up.
|
|
2825
2854
|
let editMode = "accept"; // "accept" | "manual"
|
|
2826
|
-
const modeLineText = () =>
|
|
2827
|
-
white("✎ " + (editMode === "accept" ? "accept edits on" : "manually edit")) +
|
|
2828
|
-
|
|
2855
|
+
const modeLineText = () => {
|
|
2856
|
+
const base = white("✎ " + (editMode === "accept" ? "accept edits on" : "manually edit")) + dim(" (shift+tab to switch)");
|
|
2857
|
+
const quick = quickBarHint(quickModels) ? dim(" " + quickBarHint(quickModels)) : "";
|
|
2858
|
+
// GH #595: the task the memory skill files this session's work under — yellow when it is only the
|
|
2859
|
+
// project's newest open task (not chosen for this session): that is how work gets misfiled.
|
|
2860
|
+
const width = Math.max(20, process.stdout.columns || 80) - GUTTER.length - 1;
|
|
2861
|
+
const room = width - visibleLen(base) - 3;
|
|
2862
|
+
const mem = memoryBarText(memCurrent, Math.min(room, 70));
|
|
2863
|
+
if (!mem.text || room < 16) return base + quick;
|
|
2864
|
+
const memPart = " " + (mem.guess ? yellow(mem.text) : dim(mem.text));
|
|
2865
|
+
return base + memPart + (visibleLen(base + memPart + quick) <= width ? quick : "");
|
|
2866
|
+
};
|
|
2867
|
+
// GH #595: the memory skill's current task for this session (null = no memory here / not installed for gu).
|
|
2868
|
+
let memCurrent = null;
|
|
2869
|
+
let memRuntimeFound = null;
|
|
2870
|
+
async function refreshMemoryTask() {
|
|
2871
|
+
try {
|
|
2872
|
+
const cwd = resolve(process.cwd());
|
|
2873
|
+
memRuntimeFound = memoryRuntime(hooksForTurn({ cwd }));
|
|
2874
|
+
const next = memRuntimeFound ? await currentTask({ runtime: memRuntimeFound, cwd, session: sessionForTurn(cwd)?.id ?? "" }) : null;
|
|
2875
|
+
const changed = JSON.stringify(next?.task ?? null) + next?.chosen !== JSON.stringify(memCurrent?.task ?? null) + memCurrent?.chosen;
|
|
2876
|
+
memCurrent = next;
|
|
2877
|
+
if (changed && barPinned()) paintBar();
|
|
2878
|
+
} catch {
|
|
2879
|
+
/* the bar just says nothing about memory */
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* /task (GH #595): choose the task the memory files this session's work under. The list is the
|
|
2884
|
+
* project's open tasks, newest first, the current one marked.
|
|
2885
|
+
*/
|
|
2886
|
+
async function runTaskCommand() {
|
|
2887
|
+
if (listPickerActive || approvalActive) return;
|
|
2888
|
+
await refreshMemoryTask();
|
|
2889
|
+
if (!memRuntimeFound) {
|
|
2890
|
+
console.log("\n" + GUTTER + dim("The memory skill isn't installed for gu — /skills shows how to add it.") + "\n");
|
|
2891
|
+
return;
|
|
2892
|
+
}
|
|
2893
|
+
if (!memCurrent?.open?.length) {
|
|
2894
|
+
console.log("\n" + GUTTER + dim("No open tasks in this project's memory. Ask gu to create one (\"create a task …\").") + "\n");
|
|
2895
|
+
return;
|
|
2896
|
+
}
|
|
2897
|
+
const width = Math.max(20, process.stdout.columns || 80);
|
|
2898
|
+
console.log("");
|
|
2899
|
+
console.log(dim(` Record this session's work under which task? (${PICK_HINT}):`));
|
|
2900
|
+
const at = memCurrent.open.findIndex((t) => t.id === memCurrent.task?.id);
|
|
2901
|
+
const pick = await pickFromList(taskPickerLabels(memCurrent, width), Math.max(0, at));
|
|
2902
|
+
if (pick < 0) {
|
|
2903
|
+
console.log(dim(" (cancelled)\n"));
|
|
2904
|
+
paintBar();
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2907
|
+
const cwd = resolve(process.cwd());
|
|
2908
|
+
const t = await setTask({ runtime: memRuntimeFound, cwd, session: sessionForTurn(cwd)?.id ?? "", id: memCurrent.open[pick].id });
|
|
2909
|
+
if (t) console.log(GUTTER + accent(`✓ this session's work is recorded under #${t.id} ${t.title}`) + "\n");
|
|
2910
|
+
else console.log(GUTTER + red("couldn't switch the task — the memory skill didn't answer") + "\n");
|
|
2911
|
+
await refreshMemoryTask();
|
|
2912
|
+
paintBar();
|
|
2913
|
+
}
|
|
2829
2914
|
// Token usage for the bar's middle row (task #104): the LAST turn's code-model input +
|
|
2830
2915
|
// output, then the coder's lifetime output total. Unlike the old per-turn print, this row is
|
|
2831
2916
|
// ALWAYS on screen — a turn that did no code-model work honestly reads "0", and the lifetime
|
|
@@ -2961,7 +3046,7 @@ async function refreshAvailableUpdates() {
|
|
|
2961
3046
|
const { readdir } = await import("node:fs/promises");
|
|
2962
3047
|
const { existsSync } = await import("node:fs");
|
|
2963
3048
|
const { pickUsableVersion } = await import("./version-check.mjs");
|
|
2964
|
-
const base = join(homedir(), ".
|
|
3049
|
+
const base = join(homedir(), ".gu", "api");
|
|
2965
3050
|
const dirs = await readdir(base).catch(() => []);
|
|
2966
3051
|
apiRunning = pickUsableVersion(dirs, (v) =>
|
|
2967
3052
|
existsSync(join(base, v, "node_modules", "mongodb", "package.json"))
|
|
@@ -3028,7 +3113,7 @@ async function refreshCliToken() {
|
|
|
3028
3113
|
tokenNotice = null; // no key (none embedded, GU_CLI_TOKEN_PUBLIC_KEY empty): nothing to check against
|
|
3029
3114
|
return;
|
|
3030
3115
|
}
|
|
3031
|
-
const dir = join(homedir(), ".
|
|
3116
|
+
const dir = join(homedir(), ".gu");
|
|
3032
3117
|
const mode = isClientExpert() ? "expert" : "client";
|
|
3033
3118
|
const site = ct.siteUrl();
|
|
3034
3119
|
let state = await ct.readState(dir);
|
|
@@ -3094,7 +3179,7 @@ const TOKEN_TICK_MS = 60 * 60 * 1000;
|
|
|
3094
3179
|
|
|
3095
3180
|
// The last in-app CLI update attempt (task #21): lets the next start say WHY an update did not
|
|
3096
3181
|
// take effect instead of offering the very same update again, forever.
|
|
3097
|
-
const UPDATE_ATTEMPT_FILE = join(homedir(), ".
|
|
3182
|
+
const UPDATE_ATTEMPT_FILE = join(homedir(), ".gu", "last-cli-update.json");
|
|
3098
3183
|
function readUpdateAttempt() {
|
|
3099
3184
|
try { return JSON.parse(readFileSync(UPDATE_ATTEMPT_FILE, "utf8")); } catch { return null; }
|
|
3100
3185
|
}
|
|
@@ -3551,6 +3636,12 @@ function zoneNotice(width) {
|
|
|
3551
3636
|
const shells = shellsNotice(shellEntries, { cwd: process.cwd() });
|
|
3552
3637
|
if (shells) items.push({ key: "shells", clickable: true, paint: shells.tone === "warn" ? yellow : accent, text: shells.text });
|
|
3553
3638
|
// LAST, so it is the first to give way on a narrow window: housekeeping, never urgent (#329).
|
|
3639
|
+
// GH #597: a nearly full disk — before the database item: nothing can be saved once it is full.
|
|
3640
|
+
const disk = lowDiskNotice(diskFree);
|
|
3641
|
+
if (disk) items.push({ key: "disk", clickable: true, paint: yellow, text: disk.text });
|
|
3642
|
+
// GH #594: the database, when it is big enough to matter (1 GB; yellow from 5 GB).
|
|
3643
|
+
const db = gudbNoticeSync(gudbSize);
|
|
3644
|
+
if (db) items.push({ key: "gudb", clickable: true, paint: db.urgent ? yellow : dim, text: db.text });
|
|
3554
3645
|
const logs = clearLogsNoticeText(logsBytes);
|
|
3555
3646
|
if (logs) items.push({ key: "logs", clickable: true, paint: dim, text: logs });
|
|
3556
3647
|
return noticeRow(items, { width, gutter: GUTTER });
|
|
@@ -3673,6 +3764,8 @@ function frozenZone() {
|
|
|
3673
3764
|
agentsRowTarget = notice?.spans.agents ?? null;
|
|
3674
3765
|
limitsRowTarget = notice?.spans.limits ?? null;
|
|
3675
3766
|
logsRowTarget = notice?.spans.logs ?? null;
|
|
3767
|
+
gudbRowTarget = notice?.spans.gudb ?? null;
|
|
3768
|
+
diskRowTarget = notice?.spans.disk ?? null;
|
|
3676
3769
|
shellsRowTarget = notice?.spans.shells ?? null;
|
|
3677
3770
|
jumpSpan = notice?.spans.jump ?? null;
|
|
3678
3771
|
return { ...zone, rows, statusRows: sep, noticeRow: Boolean(notice) };
|
|
@@ -3743,7 +3836,7 @@ function paintBar() {
|
|
|
3743
3836
|
// THE NOTICE ROW is the one directly above the separator (#318) — never the separator itself.
|
|
3744
3837
|
const noticeAbs = zone.noticeRow ? sepAbs - 1 : 0;
|
|
3745
3838
|
jumpRowTarget = scrolledBack() && jumpSpan ? { row: noticeAbs, ...jumpSpan } : null;
|
|
3746
|
-
updateRowAbs = updateRowTarget || agentsRowTarget || limitsRowTarget || logsRowTarget || shellsRowTarget ? noticeAbs : 0;
|
|
3839
|
+
updateRowAbs = updateRowTarget || agentsRowTarget || limitsRowTarget || logsRowTarget || gudbRowTarget || diskRowTarget || shellsRowTarget ? noticeAbs : 0;
|
|
3747
3840
|
// preserveCaret:false — the save slot holds the OUTPUT position (see regionUi), and the caret
|
|
3748
3841
|
// is parked on the input line right after, so there is nothing to preserve here.
|
|
3749
3842
|
ui(
|
|
@@ -3907,6 +4000,8 @@ let agentsRowTarget = null;
|
|
|
3907
4000
|
let limitsRowTarget = null;
|
|
3908
4001
|
// …and "clear logs · 175 MB" (#329), shown only once the logs are worth a row.
|
|
3909
4002
|
let logsRowTarget = null;
|
|
4003
|
+
let gudbRowTarget = null; // GH #594
|
|
4004
|
+
let diskRowTarget = null; // GH #597
|
|
3910
4005
|
// …and "1 shell running (click)" (#360) — a long command the agent left running in the background.
|
|
3911
4006
|
let shellsRowTarget = null;
|
|
3912
4007
|
// A terminal left with a scrolling region is a broken shell — a hard guarantee, like the
|
|
@@ -7790,6 +7885,28 @@ async function quickSwitch() {
|
|
|
7790
7885
|
}
|
|
7791
7886
|
}
|
|
7792
7887
|
|
|
7888
|
+
/**
|
|
7889
|
+
* GH #588: /model while a turn runs. The pickers work mid-turn (a command approval uses one), and
|
|
7890
|
+
* the turn keeps the coder it was sent with — its job payload names it — so the choice simply
|
|
7891
|
+
* waits for the next turn. Say which model finishes this one, so the bar's new name can't mislead.
|
|
7892
|
+
*/
|
|
7893
|
+
async function chooseModelDuringTurn() {
|
|
7894
|
+
if (listPickerActive || approvalActive || zonePanel) return;
|
|
7895
|
+
const before = { url: activeCodingUrl(), model: activeCodingModelId() };
|
|
7896
|
+
console.log("");
|
|
7897
|
+
try {
|
|
7898
|
+
await chooseModel();
|
|
7899
|
+
} catch (e) {
|
|
7900
|
+
console.log(GUTTER + red(`could not change the model: ${e?.message ?? e}`));
|
|
7901
|
+
}
|
|
7902
|
+
const after = { url: activeCodingUrl(), model: activeCodingModelId() };
|
|
7903
|
+
const changed = after.url !== before.url || after.model !== before.model;
|
|
7904
|
+
if (changed && following) {
|
|
7905
|
+
console.log(GUTTER + accent(`✓ your next turn uses ${after.model}`) + dim(` — this one finishes on ${before.model}`) + "\n");
|
|
7906
|
+
}
|
|
7907
|
+
paintBar();
|
|
7908
|
+
}
|
|
7909
|
+
|
|
7793
7910
|
async function chooseModel() {
|
|
7794
7911
|
let probe;
|
|
7795
7912
|
try {
|
|
@@ -8499,8 +8616,8 @@ function sayWrapped(text, paint = (s) => s, hang = " ") {
|
|
|
8499
8616
|
}
|
|
8500
8617
|
/**
|
|
8501
8618
|
* /switch-skill — whose skills, MCP servers and hooks THIS FOLDER uses (task #325): Claude Code's,
|
|
8502
|
-
* read where Claude keeps them (~/.claude, ./.claude, ~/.claude.json), or gu's own (~/.
|
|
8503
|
-
* ./.
|
|
8619
|
+
* read where Claude keeps them (~/.claude, ./.claude, ~/.claude.json), or gu's own (~/.gu,
|
|
8620
|
+
* ./.gu). One choice for all three — a skill names its MCP server's tools and the hooks feed
|
|
8504
8621
|
* the same database, so they only make sense together. Stored in the folder's session file, which
|
|
8505
8622
|
* the worker reads for every turn (skill-source.mjs): it holds from the next question, no restart.
|
|
8506
8623
|
*/
|
|
@@ -8508,7 +8625,7 @@ async function runSwitchSkillCommand(line) {
|
|
|
8508
8625
|
const cwd = resolve(process.cwd());
|
|
8509
8626
|
const current = readSkillSource(cwd);
|
|
8510
8627
|
const arg = (line.trim().split(/\s+/)[1] ?? "").toLowerCase();
|
|
8511
|
-
const where = (src) => (src === "claude" ? "~/.claude, ./.claude, ~/.claude.json" : "~/.
|
|
8628
|
+
const where = (src) => (src === "claude" ? "~/.claude, ./.claude, ~/.claude.json" : "~/.gu, ./.gu");
|
|
8512
8629
|
let pick = "";
|
|
8513
8630
|
console.log("");
|
|
8514
8631
|
if (arg) {
|
|
@@ -8714,7 +8831,7 @@ async function runSkillInstallCommand(line) {
|
|
|
8714
8831
|
|
|
8715
8832
|
/**
|
|
8716
8833
|
* /skills-copy-to-claude [--dry-run] [name…] — gu's skills into Claude Code's folders (#241):
|
|
8717
|
-
* ~/.
|
|
8834
|
+
* ~/.gu/skills → ~/.claude/skills and ./.gu/skills → ./.claude/skills, "gu-" names become
|
|
8718
8835
|
* "claude-", and a skill's MCP server goes into ~/.claude.json (skills-copy.mjs). Shows the plan,
|
|
8719
8836
|
* then asks; a Claude skill that differs is kept unless the user picks "replace" (backed up).
|
|
8720
8837
|
*/
|
|
@@ -8738,7 +8855,7 @@ async function runSkillsCopyCommand(line) {
|
|
|
8738
8855
|
for (const w of plan.warnings) say(yellow(w));
|
|
8739
8856
|
if (plan.missing.length) say(yellow(`gu has no skill named ${plan.missing.join(", ")}`));
|
|
8740
8857
|
if (!plan.items.length) {
|
|
8741
|
-
say(dim("gu has no skills to copy — ~/.
|
|
8858
|
+
say(dim("gu has no skills to copy — ~/.gu/skills and ./.gu/skills have none.\n"));
|
|
8742
8859
|
return;
|
|
8743
8860
|
}
|
|
8744
8861
|
const word = { new: accent("new"), same: dim("already there"), differs: yellow("Claude's differs") };
|
|
@@ -8751,7 +8868,7 @@ async function runSkillsCopyCommand(line) {
|
|
|
8751
8868
|
say(dim(` MCP server ${s.name} → ~/.claude.json${s.scope === "local" ? " (this folder)" : ""} `) + word[s.status]);
|
|
8752
8869
|
}
|
|
8753
8870
|
if (it.guLines.length) {
|
|
8754
|
-
say(yellow(` SKILL.md line${it.guLines.length === 1 ? "" : "s"} ${it.guLines.join(", ")} still name${it.guLines.length === 1 ? "s" : ""} ~/.
|
|
8871
|
+
say(yellow(` SKILL.md line${it.guLines.length === 1 ? "" : "s"} ${it.guLines.join(", ")} still name${it.guLines.length === 1 ? "s" : ""} ~/.gu — check the copy`));
|
|
8755
8872
|
}
|
|
8756
8873
|
}
|
|
8757
8874
|
const todo = plan.items.filter((i) => i.status !== "same" || i.servers.some((s) => s.status !== "same"));
|
|
@@ -9130,7 +9247,7 @@ async function applyTransferDoc(value, opts = {}) {
|
|
|
9130
9247
|
...opts,
|
|
9131
9248
|
api: replPresetApi(),
|
|
9132
9249
|
io: replPresetIo,
|
|
9133
|
-
backupDir: join(homedir(), ".
|
|
9250
|
+
backupDir: join(homedir(), ".gu", "preset-backups"),
|
|
9134
9251
|
host: hostname(),
|
|
9135
9252
|
});
|
|
9136
9253
|
if (result?.applied) await refreshAfterPresetApply(value, opts.codingDefault, result);
|
|
@@ -9216,7 +9333,7 @@ async function bannerAccount(settingsEmail = "") {
|
|
|
9216
9333
|
try {
|
|
9217
9334
|
const ct = await import("./cli-token.mjs");
|
|
9218
9335
|
const pk = ct.publicKey();
|
|
9219
|
-
const state = pk ? await ct.readState(join(homedir(), ".
|
|
9336
|
+
const state = pk ? await ct.readState(join(homedir(), ".gu")) : { token: "" };
|
|
9220
9337
|
const check = state.token ? ct.verifyCliToken(state.token, pk) : { ok: false };
|
|
9221
9338
|
return ct.accountLine({ payload: check.ok ? check.payload : null, settingsEmail });
|
|
9222
9339
|
} catch {
|
|
@@ -9359,7 +9476,7 @@ async function noteTurnCost(inputTokens, breakdown, coder = null) {
|
|
|
9359
9476
|
// ---------------------------------------------------------------------------------------------
|
|
9360
9477
|
let freeModel = null; // the saved state (free-model.mjs), or null = no free model on this computer
|
|
9361
9478
|
let freeModelNoticed = ""; // the level already shown this month, so a notice is said once
|
|
9362
|
-
const freeModelDir = () => join(homedir(), ".
|
|
9479
|
+
const freeModelDir = () => join(homedir(), ".gu");
|
|
9363
9480
|
|
|
9364
9481
|
async function freeModelHostedBase() {
|
|
9365
9482
|
const { DEFAULT_API_BASE } = await import("./device-login.mjs");
|
|
@@ -9436,7 +9553,7 @@ async function freeModelAtStart() {
|
|
|
9436
9553
|
// Ask even with no saved state (GH #440/#442): a code redeemed while the server had no free model, or on
|
|
9437
9554
|
// another computer, gets its model here without a second /voucher. Quiet unless there is one to set up.
|
|
9438
9555
|
const ct = await import("./cli-token.mjs");
|
|
9439
|
-
const st = await ct.readState(join(homedir(), ".
|
|
9556
|
+
const st = await ct.readState(join(homedir(), ".gu"));
|
|
9440
9557
|
if (st?.token) await setUpFreeModel({ token: st.token });
|
|
9441
9558
|
} catch {
|
|
9442
9559
|
/* the free model is never worth a failed start */
|
|
@@ -9468,7 +9585,7 @@ async function noteFreeModelTurn(inputTokens, breakdown, outputTokens, coder, au
|
|
|
9468
9585
|
console.log(GUTTER + (n.level === "ok" ? dim(n.text) : yellow(n.text)) + "\n");
|
|
9469
9586
|
}
|
|
9470
9587
|
const ct = await import("./cli-token.mjs");
|
|
9471
|
-
const st = await ct.readState(join(homedir(), ".
|
|
9588
|
+
const st = await ct.readState(join(homedir(), ".gu"));
|
|
9472
9589
|
void fm.reportSpend({ hostedBase: await freeModelHostedBase(), token: st?.token, state: freeModel });
|
|
9473
9590
|
} catch {
|
|
9474
9591
|
/* counting is never worth a broken prompt */
|
|
@@ -9489,7 +9606,7 @@ async function runVoucherCommand(line = "/voucher") {
|
|
|
9489
9606
|
}
|
|
9490
9607
|
const ct = await import("./cli-token.mjs");
|
|
9491
9608
|
const pk = ct.publicKey();
|
|
9492
|
-
const dir = join(homedir(), ".
|
|
9609
|
+
const dir = join(homedir(), ".gu");
|
|
9493
9610
|
const state = await ct.readState(dir);
|
|
9494
9611
|
const { DEFAULT_API_BASE } = await import("./device-login.mjs");
|
|
9495
9612
|
const device = await ct.thisDevice({ instanceId: myInstanceId || "" }).catch(() => null);
|
|
@@ -9711,12 +9828,12 @@ async function runPricesUpdate({ tables: given = null, quiet = false } = {}) {
|
|
|
9711
9828
|
// "OUTPUT TOKEN LIMITS UPDATED <date>": the cloud token table (GET /api/model-limits, Mongo
|
|
9712
9829
|
// "model_limits", pushed by the Deploy app's "Push token table to cloud" button) is checked at
|
|
9713
9830
|
// start and hourly beside the version and price checks. When its updatedAt is newer than the one
|
|
9714
|
-
// this machine last saw (~/.
|
|
9831
|
+
// this machine last saw (~/.gu/model-limits-seen.json), a clickable item joins the notice
|
|
9715
9832
|
// row. Nothing needs applying: the worker reads the cloud table on every run. The click lists
|
|
9716
9833
|
// what changed and marks it seen.
|
|
9717
9834
|
// ---------------------------------------------------------------------------------------------
|
|
9718
9835
|
let limitsUpdate = null; // { updatedAt, label, rows } while unseen changes wait
|
|
9719
|
-
const limitsSeenFile = () => join(homedir(), ".
|
|
9836
|
+
const limitsSeenFile = () => join(homedir(), ".gu", "model-limits-seen.json");
|
|
9720
9837
|
|
|
9721
9838
|
async function readLimitsSeen() {
|
|
9722
9839
|
try {
|
|
@@ -9774,7 +9891,7 @@ async function refreshLimitsUpdate() {
|
|
|
9774
9891
|
async function markLimitsSeen(updatedAt) {
|
|
9775
9892
|
try {
|
|
9776
9893
|
const { mkdir, writeFile } = await import("node:fs/promises");
|
|
9777
|
-
await mkdir(join(homedir(), ".
|
|
9894
|
+
await mkdir(join(homedir(), ".gu"), { recursive: true });
|
|
9778
9895
|
await writeFile(limitsSeenFile(), JSON.stringify({ seenAt: updatedAt }) + "\n");
|
|
9779
9896
|
} catch {
|
|
9780
9897
|
/* not remembering only means the notice comes back */
|
|
@@ -9806,7 +9923,83 @@ async function runLimitsSeen() {
|
|
|
9806
9923
|
let logsBytes = 0; // what the notice shows; only the logs are measured for it (a handful of stats)
|
|
9807
9924
|
let clearLogsBusy = false;
|
|
9808
9925
|
|
|
9926
|
+
let gudbSize = 0; // GH #594: the local database's size, when this computer uses gudb (else 0)
|
|
9927
|
+
let diskFree = null; // GH #597: free bytes where ~/.gu lives; null = not measured
|
|
9928
|
+
async function refreshGudbSize() {
|
|
9929
|
+
try {
|
|
9930
|
+
const { readLocalDb } = await import("./client-expert-api.mjs");
|
|
9931
|
+
const was = gudbSize;
|
|
9932
|
+
const gs = await import("./gudb-size.mjs");
|
|
9933
|
+
gudbSize = readLocalDb() === "gudb" ? gs.gudbBytes() : 0;
|
|
9934
|
+
// GH #597: free disk where gu keeps its data — on every computer, a full disk stops everything.
|
|
9935
|
+
const wasDisk = lowDiskNotice(diskFree)?.text;
|
|
9936
|
+
diskFree = gs.freeDiskBytes();
|
|
9937
|
+
if ((gs.gudbNotice(was)?.text !== gs.gudbNotice(gudbSize)?.text || wasDisk !== lowDiskNotice(diskFree)?.text) && barPinned()) paintBar();
|
|
9938
|
+
} catch {
|
|
9939
|
+
/* a housekeeping notice is never worth an error */
|
|
9940
|
+
}
|
|
9941
|
+
}
|
|
9942
|
+
|
|
9943
|
+
/**
|
|
9944
|
+
* /backup-db (GH #598): a copy made by SQLite itself (VACUUM INTO) — a plain file copy of a running
|
|
9945
|
+
* database can be broken or miss what is still in its WAL file. ~/.gu/gudb/backups, newest 3 kept.
|
|
9946
|
+
*/
|
|
9947
|
+
async function runBackupDb() {
|
|
9948
|
+
const { readLocalDb } = await import("./client-expert-api.mjs");
|
|
9949
|
+
if (readLocalDb() !== "gudb") {
|
|
9950
|
+
console.log(GUTTER + dim("This computer doesn't use gu's built-in database — nothing to back up here.") + "\n");
|
|
9951
|
+
return;
|
|
9952
|
+
}
|
|
9953
|
+
const gs = await import("./gudb-size.mjs");
|
|
9954
|
+
const r = await withPendingStatus("backing up the database", async () => gs.backupGudb());
|
|
9955
|
+
const tilde = (p) => (p.startsWith(homedir()) ? "~" + p.slice(homedir().length) : p);
|
|
9956
|
+
if (r.error) console.log(GUTTER + red(`couldn't back up: ${r.error}`) + "\n");
|
|
9957
|
+
else {
|
|
9958
|
+
console.log(GUTTER + accent(`✓ backed up — ${tilde(r.file)} (${gs.gudbHuman(r.bytes)})`) +
|
|
9959
|
+
(r.removed.length ? dim(` · ${r.removed.length} older backup${r.removed.length === 1 ? "" : "s"} removed, the last ${gs.KEEP_BACKUPS} kept`) : ""));
|
|
9960
|
+
console.log(GUTTER + dim("To restore: quit gu, then put that file in place of ~/.gu/gudb/gu.db (and delete gu.db-wal and gu.db-shm).") + "\n");
|
|
9961
|
+
}
|
|
9962
|
+
paintBar();
|
|
9963
|
+
}
|
|
9964
|
+
|
|
9965
|
+
/**
|
|
9966
|
+
* "Clean old data" (GH #594, the owner's suggestion): ONE click on the database notice, no
|
|
9967
|
+
* questions — saved model prompts/replies older than 30 days go (rows and usage numbers stay),
|
|
9968
|
+
* then the file is compacted so the disk space comes back. /clear-logs keeps the step-by-step
|
|
9969
|
+
* version, which can go down to 14 days.
|
|
9970
|
+
*/
|
|
9971
|
+
let cleanOldDataBusy = false;
|
|
9972
|
+
async function runCleanOldData() {
|
|
9973
|
+
if (cleanOldDataBusy || listPickerActive || approvalActive) return;
|
|
9974
|
+
// Compacting locks the database: gu's API would wait on it in the middle of a turn.
|
|
9975
|
+
if (following) {
|
|
9976
|
+
console.log("\n" + GUTTER + dim("Clean old data waits for this turn to finish — click it again then.") + "\n");
|
|
9977
|
+
return;
|
|
9978
|
+
}
|
|
9979
|
+
cleanOldDataBusy = true;
|
|
9980
|
+
try {
|
|
9981
|
+
const gs = await import("./gudb-size.mjs");
|
|
9982
|
+
console.log("\n" + GUTTER + dim(`Cleaning saved model text older than ${gs.AUTO_KEEP_TEXT_DAYS} days and compacting — this can take a minute…`));
|
|
9983
|
+
const r = await withPendingStatus("cleaning old data", async () => gs.clearOldText({ days: gs.AUTO_KEEP_TEXT_DAYS }));
|
|
9984
|
+
if (r.error) {
|
|
9985
|
+
console.log(GUTTER + red(`couldn't clean: ${r.error}`) + "\n");
|
|
9986
|
+
} else {
|
|
9987
|
+
const size = `${gs.gudbHuman(r.before)} → ${gs.gudbHuman(r.after)}`;
|
|
9988
|
+
if (r.cleared) console.log(GUTTER + accent(`✓ old data cleaned — ${r.cleared} step${r.cleared === 1 ? "" : "s"}, ${size}`));
|
|
9989
|
+
else console.log(GUTTER + accent(`✓ compacted — ${size}`) + dim(` · nothing was older than ${gs.AUTO_KEEP_TEXT_DAYS} days`));
|
|
9990
|
+
if (!r.compacted) console.log(GUTTER + yellow("The file couldn't be compacted now (gu was busy or the disk is too full) — the space is reused for new data."));
|
|
9991
|
+
if (gs.gudbNotice(r.after)) console.log(GUTTER + dim(`Still big: it is mostly recent. /clear-logs can remove saved text older than ${gs.KEEP_TEXT_DAYS} days.`));
|
|
9992
|
+
console.log("");
|
|
9993
|
+
}
|
|
9994
|
+
} finally {
|
|
9995
|
+
cleanOldDataBusy = false;
|
|
9996
|
+
await refreshGudbSize();
|
|
9997
|
+
paintBar();
|
|
9998
|
+
}
|
|
9999
|
+
}
|
|
10000
|
+
|
|
9809
10001
|
async function refreshLogsSize() {
|
|
10002
|
+
void refreshGudbSize();
|
|
9810
10003
|
try {
|
|
9811
10004
|
const { surveyLogs } = await import("./clear-logs.mjs");
|
|
9812
10005
|
const was = clearLogsNoticeText(logsBytes);
|
|
@@ -9908,7 +10101,7 @@ async function runClearLogs() {
|
|
|
9908
10101
|
const cl = await import("./clear-logs.mjs");
|
|
9909
10102
|
const { LOCAL_API_PORT } = await import("./client-expert-api.mjs");
|
|
9910
10103
|
const width = Math.max(20, process.stdout.columns || 80);
|
|
9911
|
-
console.log("\n" + GUTTER + dim("Measuring ~/.
|
|
10104
|
+
console.log("\n" + GUTTER + dim("Measuring ~/.gu…"));
|
|
9912
10105
|
// Which API version is ANSWERING decides what "old" means — ask it, do not infer it.
|
|
9913
10106
|
const runningVersion = await fetch(`http://127.0.0.1:${LOCAL_API_PORT}/api/health`, { signal: AbortSignal.timeout(2000) })
|
|
9914
10107
|
.then((r) => r.json())
|
|
@@ -9989,6 +10182,32 @@ async function runClearLogs() {
|
|
|
9989
10182
|
}
|
|
9990
10183
|
}
|
|
9991
10184
|
|
|
10185
|
+
// 4. THE DATABASE (GH #594) — the saved prompt/response text of older steps; the rows and the
|
|
10186
|
+
// usage numbers stay. Only on a gudb computer, and only when there is old text to remove.
|
|
10187
|
+
const gs = await import("./gudb-size.mjs");
|
|
10188
|
+
const { readLocalDb } = await import("./client-expert-api.mjs");
|
|
10189
|
+
const dbs = readLocalDb() === "gudb" ? gs.surveyGudb() : null;
|
|
10190
|
+
if (dbs?.oldText.rows) {
|
|
10191
|
+
question(`Also remove saved model prompts and replies older than ${dbs.days} days from gu's database — ${cl.humanSize(dbs.oldText.bytes)} in ${dbs.oldText.rows} step${dbs.oldText.rows === 1 ? "" : "s"}? (database: ${cl.humanSize(dbs.bytes)})`);
|
|
10192
|
+
// Can't be undone (like RAG and the API above), so No is the first row.
|
|
10193
|
+
const go = await pickFromList(["No — keep it", "Yes — remove that text" + dim(" · usage numbers, jobs and settings stay")], 0);
|
|
10194
|
+
if (go < 0) return cancelled();
|
|
10195
|
+
if (go === 1) {
|
|
10196
|
+
console.log(GUTTER + dim("Removing and compacting the database…"));
|
|
10197
|
+
const r = gs.clearOldText();
|
|
10198
|
+
if (r.error) console.log(GUTTER + red(`couldn't clean the database — ${r.error}`));
|
|
10199
|
+
else {
|
|
10200
|
+
freed.push({ what: "gudb", freed: r.freed });
|
|
10201
|
+
console.log(GUTTER + accent(`✓ text removed from ${r.cleared} step${r.cleared === 1 ? "" : "s"} — ${cl.humanSize(r.freed)} freed`) +
|
|
10202
|
+
(r.compacted ? "" : yellow(" (the file couldn't be compacted now — gu was busy or the disk is full; it shrinks on the next cleanup)")));
|
|
10203
|
+
}
|
|
10204
|
+
} else {
|
|
10205
|
+
console.log(GUTTER + dim("database text kept"));
|
|
10206
|
+
}
|
|
10207
|
+
} else if (dbs) {
|
|
10208
|
+
console.log("\n" + GUTTER + dim(`gu's database: ${cl.humanSize(dbs.bytes)} — no saved text older than ${dbs.days} days.`));
|
|
10209
|
+
}
|
|
10210
|
+
|
|
9992
10211
|
const total = freed.reduce((n, f) => n + f.freed, 0);
|
|
9993
10212
|
console.log("\n" + GUTTER + (freed.length ? bold(`${cl.humanSize(total)} freed in all.`) : dim("Nothing removed.")) + "\n");
|
|
9994
10213
|
} catch (e) {
|
|
@@ -11090,7 +11309,7 @@ const OTHER_AGENTS_MS = 20000;
|
|
|
11090
11309
|
|
|
11091
11310
|
/**
|
|
11092
11311
|
* BACKGROUND SHELLS (task #360, GitHub #140). The agent leaves a long command — a 7-minute build —
|
|
11093
|
-
* running instead of killing it at its deadline, and records it in ~/.
|
|
11312
|
+
* running instead of killing it at its deadline, and records it in ~/.gu/shells.json. Read
|
|
11094
11313
|
* here once a second (a local file, no API), so the notice row can say it is still running and
|
|
11095
11314
|
* a click can show it. Repaints only when the row's text changes.
|
|
11096
11315
|
*/
|
|
@@ -11237,7 +11456,7 @@ async function browserCleanup() {
|
|
|
11237
11456
|
stopBridge();
|
|
11238
11457
|
await new Promise((res) => setTimeout(res, 300));
|
|
11239
11458
|
const gone = removeLocalFiles();
|
|
11240
|
-
if (gone.length) out(accent(`✓ Deleted ${gone.length} of gu's file(s) in ~/.
|
|
11459
|
+
if (gone.length) out(accent(`✓ Deleted ${gone.length} of gu's file(s) in ~/.gu.`));
|
|
11241
11460
|
const still = [...findDevInstalls().filter((f) => !(devConnected && f.id === st.id)).map((f) => `${f.browser} — ${f.profile}`), ...localLeftovers()];
|
|
11242
11461
|
out(still.length ? yellow(`Still there: ${still.join(", ")}`) : accent("✓ The developer install is gone. Install the Chrome Web Store copy, then /browser."));
|
|
11243
11462
|
out();
|
|
@@ -11319,8 +11538,8 @@ async function showShells() {
|
|
|
11319
11538
|
},
|
|
11320
11539
|
});
|
|
11321
11540
|
}
|
|
11322
|
-
async function refreshOtherAgents() {
|
|
11323
|
-
if (!barPinned() || following) return;
|
|
11541
|
+
async function refreshOtherAgents({ force = false } = {}) {
|
|
11542
|
+
if (!force && (!barPinned() || following)) return;
|
|
11324
11543
|
try {
|
|
11325
11544
|
const r = await fetch(`${apiBase}/api/worker/jobs`, {
|
|
11326
11545
|
headers: { "X-Worker-Key": workerKey },
|
|
@@ -11362,7 +11581,10 @@ async function showOtherAgents() {
|
|
|
11362
11581
|
// `listResolve`, stranding the first promise forever with the keyboard still routed to a
|
|
11363
11582
|
// picker nobody can finish. Also refused during a turn: acting on another agent means
|
|
11364
11583
|
// starting a follow, and this terminal can only run one turn.
|
|
11365
|
-
if (listPickerActive || approvalActive
|
|
11584
|
+
if (listPickerActive || approvalActive) return;
|
|
11585
|
+
// GH #586: during this terminal's own turn the click used to return here and do nothing.
|
|
11586
|
+
// The pickers can't run then (switching is a turn of its own) — a panel can.
|
|
11587
|
+
if (following) return void showOtherAgentsPanel();
|
|
11366
11588
|
const width = Math.max(20, process.stdout.columns || 80);
|
|
11367
11589
|
const agents = otherAgents; // …the snapshot this list is about; the poller may replace it
|
|
11368
11590
|
// THE PICKER IS THE LIST. It used to print the agents and stop there, so now that each one
|
|
@@ -11419,6 +11641,56 @@ async function showOtherAgents() {
|
|
|
11419
11641
|
submitSyntheticLine(ATTACH_PREFIX + agent.id);
|
|
11420
11642
|
}
|
|
11421
11643
|
|
|
11644
|
+
/**
|
|
11645
|
+
* GH #586: the other agents IN PLACE OF THE INPUT BOX, while this terminal's turn runs — the same
|
|
11646
|
+
* kind of panel as a shell's details (#384). ↑↓ choose, s twice stops one, Esc closes. Switching
|
|
11647
|
+
* to one is a turn, so it waits for this one to end (a click then opens the picker).
|
|
11648
|
+
*/
|
|
11649
|
+
async function showOtherAgentsPanel() {
|
|
11650
|
+
if (zonePanel) return;
|
|
11651
|
+
await refreshOtherAgents({ force: true }); // the 20s poll skips during a turn: the count may be old
|
|
11652
|
+
let sel = 0;
|
|
11653
|
+
let note = "";
|
|
11654
|
+
let armed = ""; // the id "s" was pressed on once
|
|
11655
|
+
const items = () => agentPickerItems(otherAgents, { width: Math.max(20, process.stdout.columns || 80) });
|
|
11656
|
+
openZonePanel({
|
|
11657
|
+
refreshMs: 1000,
|
|
11658
|
+
rows: (width, room) => agentsPanelRows({
|
|
11659
|
+
items: items(), sel, width, rows: Math.min(room, items().length + 2), note, gutter: GUTTER,
|
|
11660
|
+
style: { title: (t) => bold(accent(t)), mark: accent, dim },
|
|
11661
|
+
}),
|
|
11662
|
+
onKey: (key) => {
|
|
11663
|
+
const list = items();
|
|
11664
|
+
if (!list.length) return;
|
|
11665
|
+
if (key?.name === "up" || key?.name === "down") {
|
|
11666
|
+
sel = Math.min(list.length - 1, Math.max(0, sel + (key.name === "up" ? -1 : 1)));
|
|
11667
|
+
armed = "";
|
|
11668
|
+
note = "";
|
|
11669
|
+
} else if (key?.name === "s" && !key.ctrl && !key.meta) {
|
|
11670
|
+
const it = list[Math.min(sel, list.length - 1)];
|
|
11671
|
+
// Stopping can't be undone: the first s asks, the second does it.
|
|
11672
|
+
if (armed !== it.id) {
|
|
11673
|
+
armed = it.id;
|
|
11674
|
+
note = "press s again to stop it — its unsaved work is lost · any other key: no";
|
|
11675
|
+
} else {
|
|
11676
|
+
armed = "";
|
|
11677
|
+
note = "stopping…";
|
|
11678
|
+
const title = String((otherAgents.find((a) => a.id === it.id)?.title) ?? "that agent");
|
|
11679
|
+
void stopOtherAgent(it.id, title.length > 60 ? title.slice(0, 60) + "…" : title).then(() => {
|
|
11680
|
+
note = "";
|
|
11681
|
+
sel = Math.max(0, Math.min(sel, items().length - 1));
|
|
11682
|
+
paintBar();
|
|
11683
|
+
});
|
|
11684
|
+
}
|
|
11685
|
+
} else {
|
|
11686
|
+
armed = "";
|
|
11687
|
+
note = "";
|
|
11688
|
+
}
|
|
11689
|
+
paintBar();
|
|
11690
|
+
},
|
|
11691
|
+
});
|
|
11692
|
+
}
|
|
11693
|
+
|
|
11422
11694
|
/**
|
|
11423
11695
|
* Stop one of the account's other agents — the same POST Ctrl+C makes for this terminal's turn.
|
|
11424
11696
|
*
|
|
@@ -12294,11 +12566,11 @@ const COMPACT_PREFIX = "__COMPACT__::";
|
|
|
12294
12566
|
// save the file on this computer. Allow = S3 is now set up AND passed its test.
|
|
12295
12567
|
const S3SETUP_PREFIX = "__S3SETUP__::";
|
|
12296
12568
|
// An MCP tool about to run for the first time (task #269): "<server>\t<tool>\t<args preview>".
|
|
12297
|
-
// "Always" writes an allow rule to ~/.
|
|
12569
|
+
// "Always" writes an allow rule to ~/.gu/mcp.json — the agent re-reads that file before every
|
|
12298
12570
|
// call, so it counts from the next call of this same turn, and for every turn after.
|
|
12299
12571
|
const MCPTOOL_PREFIX = "__MCPTOOL__::";
|
|
12300
12572
|
// The agent's first use of the browser in a turn (#150): "<folder>\t<what it is about to do>".
|
|
12301
|
-
// "Always" puts the folder on ~/.
|
|
12573
|
+
// "Always" puts the folder on ~/.gu/browser-allow.json, which the agent reads before asking.
|
|
12302
12574
|
const BROWSER_PREFIX = "__BROWSER__::";
|
|
12303
12575
|
// GH #540: the agent edited a file whose language has a server gu could use — offer it.
|
|
12304
12576
|
const LSP_PREFIX = "__LSP__::";
|
|
@@ -12377,7 +12649,7 @@ async function approvalPrompt(command) {
|
|
|
12377
12649
|
? " It is already on this computer — nothing to download."
|
|
12378
12650
|
: lang.tool
|
|
12379
12651
|
? ` gu runs \`${lang.tool.what}\` (${size || lang.size}). It is open source (${lang.licence}).`
|
|
12380
|
-
: ` gu installs it from npm (${size || lang.size}, into ~/.
|
|
12652
|
+
: ` gu installs it from npm (${size || lang.size}, into ~/.gu/lsp — no admin rights). It is open source (${lang.licence}).`;
|
|
12381
12653
|
process.stdout.write(
|
|
12382
12654
|
// GH #554: on the gutter like every other line of the turn — it sat two columns to the left.
|
|
12383
12655
|
"\n" + GUTTER + accent(`${name} code intelligence`) + dim(` (no answer in ${LSP_OFFER_MS / 1000}s = not now)`) + "\n" +
|
|
@@ -13110,7 +13382,7 @@ async function tryStartLocalApi() {
|
|
|
13110
13382
|
const ce = await import("./client-expert-api.mjs");
|
|
13111
13383
|
if ((await ce.probeLocalApi()).ok) return true;
|
|
13112
13384
|
const { readdir } = await import("node:fs/promises");
|
|
13113
|
-
const base = join(homedir(), ".
|
|
13385
|
+
const base = join(homedir(), ".gu", "api");
|
|
13114
13386
|
const versions = (await readdir(base).catch(() => [])).sort((a, b) =>
|
|
13115
13387
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" })
|
|
13116
13388
|
);
|
|
@@ -13368,7 +13640,7 @@ function announceScaffold() {
|
|
|
13368
13640
|
async function ensureTokenForTurn() {
|
|
13369
13641
|
if (!isClientExpert()) return true;
|
|
13370
13642
|
const ct = await import("./cli-token.mjs");
|
|
13371
|
-
const dir = join(homedir(), ".
|
|
13643
|
+
const dir = join(homedir(), ".gu");
|
|
13372
13644
|
const state = await ct.readState(dir);
|
|
13373
13645
|
if (!ct.turnNeedsToken({ privateMode: true, token: state.token })) return true;
|
|
13374
13646
|
// The FALLBACK (#314): the token is normally settled at the first ">>" (askTokenAtStart); this
|
|
@@ -13495,7 +13767,7 @@ async function askTokenAtStart() {
|
|
|
13495
13767
|
// The background refresh started at launch renews and WRITES the token: let it finish, or it
|
|
13496
13768
|
// could overwrite a token pasted here with the old one — and its answer is the freshest anyway.
|
|
13497
13769
|
await startupTokenRefresh?.catch(() => undefined);
|
|
13498
|
-
const dir = join(homedir(), ".
|
|
13770
|
+
const dir = join(homedir(), ".gu");
|
|
13499
13771
|
const state = await ct.readState(dir);
|
|
13500
13772
|
if (ct.turnNeedsToken({ privateMode: true, token: state.token })) {
|
|
13501
13773
|
await askForCliToken(ct, dir);
|
|
@@ -15974,7 +16246,7 @@ async function main() {
|
|
|
15974
16246
|
dim(`${API_CALL_TIMEOUT_MS / 1000}s, so the API is running and stuck` + (onGudb ? "." : " —")) +
|
|
15975
16247
|
dim(onGudb ? "\n Check, in this order:" : "\n usually on MongoDB. Check, in this order:") +
|
|
15976
16248
|
dim("\n gu-cli api status does it answer at all?") +
|
|
15977
|
-
dim("\n ~/.
|
|
16249
|
+
dim("\n ~/.gu/local-api.log what it was doing when it stopped answering") +
|
|
15978
16250
|
(onGudb ? "" : dim("\n is mongod running? the API waits on it and never times out itself")) +
|
|
15979
16251
|
dim("\n Then restart it: gu-cli api stop && gu-cli api start\n")
|
|
15980
16252
|
);
|
|
@@ -15997,7 +16269,7 @@ async function main() {
|
|
|
15997
16269
|
started
|
|
15998
16270
|
? dim(" Started it — run `gu` again.\n")
|
|
15999
16271
|
: dim(" Start it with: gu-cli api start") +
|
|
16000
|
-
dim("\n If that fails, check MongoDB is running and see ~/.
|
|
16272
|
+
dim("\n If that fails, check MongoDB is running and see ~/.gu/local-api.log\n")
|
|
16001
16273
|
);
|
|
16002
16274
|
}
|
|
16003
16275
|
} else if (err?.code === "KEY_REJECTED") {
|
|
@@ -16059,6 +16331,7 @@ async function main() {
|
|
|
16059
16331
|
archivedUpTo = await seedArchive(cwd, history).catch(() => history.length);
|
|
16060
16332
|
// A new gu session (task #270): the agent runs onStart hooks on the first turn it sees this id.
|
|
16061
16333
|
await startHookSession(cwd);
|
|
16334
|
+
void refreshMemoryTask(); // GH #595: which task this session's work goes to, on the bar
|
|
16062
16335
|
if (history.length > 0) {
|
|
16063
16336
|
const turns = history.filter((m) => m.role === "user").length;
|
|
16064
16337
|
console.log(
|
|
@@ -16638,6 +16911,7 @@ async function main() {
|
|
|
16638
16911
|
const where = await startNewConversation(cwd, history);
|
|
16639
16912
|
history.length = 0;
|
|
16640
16913
|
await startHookSession(cwd); // a fresh session: onStart hooks run again (#270)
|
|
16914
|
+
void refreshMemoryTask(); // GH #595: a new session has no task of its own yet
|
|
16641
16915
|
console.log(
|
|
16642
16916
|
GUTTER + dim("New conversation started — this folder's settings are unchanged.") + "\n" +
|
|
16643
16917
|
GUTTER + dim(kept
|
|
@@ -16659,6 +16933,14 @@ async function main() {
|
|
|
16659
16933
|
await runClearLogs();
|
|
16660
16934
|
continue;
|
|
16661
16935
|
}
|
|
16936
|
+
if (line === "/task" || line === "/tasks") {
|
|
16937
|
+
await runTaskCommand();
|
|
16938
|
+
continue;
|
|
16939
|
+
}
|
|
16940
|
+
if (line === "/backup-db") {
|
|
16941
|
+
await runBackupDb();
|
|
16942
|
+
continue;
|
|
16943
|
+
}
|
|
16662
16944
|
if (line === "/support") {
|
|
16663
16945
|
await runSupport();
|
|
16664
16946
|
continue;
|
|
@@ -16670,7 +16952,7 @@ async function main() {
|
|
|
16670
16952
|
const bv = await import("./budget-view.mjs");
|
|
16671
16953
|
const ct = await import("./cli-token.mjs");
|
|
16672
16954
|
const { DEFAULT_API_BASE } = await import("./device-login.mjs");
|
|
16673
|
-
const state = await ct.readState(join(homedir(), ".
|
|
16955
|
+
const state = await ct.readState(join(homedir(), ".gu"));
|
|
16674
16956
|
const result = await bv.fetchProvidersBudget({
|
|
16675
16957
|
apiBase,
|
|
16676
16958
|
workerKey,
|
|
@@ -16985,6 +17267,7 @@ async function main() {
|
|
|
16985
17267
|
if (fellBack) printFallbackLine(fellBack);
|
|
16986
17268
|
// GH #536: maybe a suggested next message — not when a queued question runs next anyway.
|
|
16987
17269
|
if (turnQueue.size === 0 && _lineQueue.length === 0) offerNextHint(taskLine, answer);
|
|
17270
|
+
void refreshMemoryTask(); // GH #595: the turn may have created or switched the task
|
|
16988
17271
|
} else {
|
|
16989
17272
|
// A turn that ended WITHOUT an answer (Ctrl+C cancel, or an abort/failure) must not
|
|
16990
17273
|
// silently launch another turn. Any keystrokes the user typed DURING the dead turn
|