@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/mcp-config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MCP SERVERS — where they are configured, and who may call their tools (task #269).
|
|
3
3
|
*
|
|
4
|
-
* ~/.
|
|
4
|
+
* ~/.gu/mcp.json yours: { mcpServers, disabled, permissions: { allow, deny }, approvedProjects }
|
|
5
5
|
* <project>/.mcp.json the project's — Claude Code's own file and format, so one file serves both
|
|
6
6
|
*
|
|
7
7
|
* The shapes are Claude Code's: `mcpServers: { name: { type: "stdio", command, args, env } }`, and
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* as untrusted, and a hostile server would simply claim it.
|
|
20
20
|
*
|
|
21
21
|
* CLAUDE CODE'S SERVERS (#325). A folder that chose "Claude's skills" (/switch-skill) takes YOUR
|
|
22
|
-
* servers from Claude Code's own file instead of ~/.
|
|
22
|
+
* servers from Claude Code's own file instead of ~/.gu/mcp.json:
|
|
23
23
|
* ~/.claude.json projects["<this folder>"].mcpServers (Claude's "local" scope — this folder only)
|
|
24
24
|
* ~/.claude.json mcpServers (Claude's "user" scope — every folder)
|
|
25
25
|
* The project's .mcp.json is the same file either way. Yours still win over the project's. gu's own
|
|
26
26
|
* bookkeeping — disabled, the allow/deny rules, which project servers you approved — stays in
|
|
27
|
-
* ~/.
|
|
27
|
+
* ~/.gu/mcp.json whichever source is chosen: Claude Code's file has no place for it, and gu
|
|
28
28
|
* reads Claude's setup without Claude ever having to read gu's.
|
|
29
29
|
*
|
|
30
30
|
* ~/.claude.json IS CLAUDE CODE'S WHOLE STATE FILE, not a config file of ours. It is only written
|
|
@@ -43,7 +43,7 @@ import { resolveSkillSource } from "./skill-source.mjs";
|
|
|
43
43
|
export const SERVER_NAME_RE = /^[A-Za-z0-9_-]{1,64}$/;
|
|
44
44
|
|
|
45
45
|
export function userConfigPath(home = homedir()) {
|
|
46
|
-
return join(home, ".
|
|
46
|
+
return join(home, ".gu", "mcp.json");
|
|
47
47
|
}
|
|
48
48
|
export function projectConfigPath(cwd) {
|
|
49
49
|
return join(cwd, ".mcp.json");
|
|
@@ -122,7 +122,7 @@ export function updateClaudeConfig(mutate, home = homedir()) {
|
|
|
122
122
|
return raw;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
/** Write ~/.
|
|
125
|
+
/** Write ~/.gu/mcp.json atomically: a crash mid-write leaves the old file, never half of one. */
|
|
126
126
|
function writeUserRaw(raw, home) {
|
|
127
127
|
const file = userConfigPath(home);
|
|
128
128
|
mkdirSync(dirname(file), { recursive: true });
|
package/memory-task.mjs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GH #595: WHICH TASK the memory skill is recording this session's work under — on gu's bar, so a
|
|
3
|
+
* misfiling is seen before the work is done, not after. Reported 2026-12-04: a morning's laggy-call
|
|
4
|
+
* investigation in meetings was filed under the open JBL task, and nothing on screen said so.
|
|
5
|
+
*
|
|
6
|
+
* gu and Claude Code share ONE memory (the same skill runtime, the same .claude-memory in the
|
|
7
|
+
* project), so the question is never "which skill" — it is "which task". The memory's own CLI
|
|
8
|
+
* answers it (current-task: what a message naming no task would be filed under), and /task
|
|
9
|
+
* switches it (set-task).
|
|
10
|
+
*/
|
|
11
|
+
import { execFile } from "node:child_process";
|
|
12
|
+
import { existsSync } from "node:fs";
|
|
13
|
+
import { dirname, join } from "node:path";
|
|
14
|
+
|
|
15
|
+
/** The memory runtime gu's hooks run, from the hooks config → { python, cli } or null when not installed. */
|
|
16
|
+
export function memoryRuntime(hooks) {
|
|
17
|
+
for (const groups of Object.values(hooks ?? {})) {
|
|
18
|
+
for (const g of Array.isArray(groups) ? groups : []) {
|
|
19
|
+
for (const h of g?.hooks ?? []) {
|
|
20
|
+
const script = (h?.args ?? []).find((a) => /memory_hook\.py$/.test(String(a)));
|
|
21
|
+
if (!script || !h.command) continue;
|
|
22
|
+
const cli = join(dirname(dirname(String(script))), "memory_cli.py");
|
|
23
|
+
if (existsSync(cli)) return { python: String(h.command), cli };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function run(runtime, args, { timeoutMs = 8000, execImpl = execFile } = {}) {
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
execImpl(runtime.python, [runtime.cli, ...args], { timeout: timeoutMs, encoding: "utf8" }, (err, stdout) => {
|
|
33
|
+
if (err) return resolve(null);
|
|
34
|
+
try {
|
|
35
|
+
resolve(JSON.parse(String(stdout)));
|
|
36
|
+
} catch {
|
|
37
|
+
resolve(null);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** → { project, task: {id,title,status}|null, chosen, open: [...] } or null (no memory here / not readable). */
|
|
44
|
+
export async function currentTask({ runtime, cwd, session = "", execImpl } = {}) {
|
|
45
|
+
if (!runtime || !cwd) return null;
|
|
46
|
+
const r = await run(runtime, ["current-task", "--cwd", cwd, "--session", session], { execImpl });
|
|
47
|
+
return r?.current ?? null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** File this session's next steps under task `id`. → { id, title } or null. */
|
|
51
|
+
export async function setTask({ runtime, cwd, session, id, execImpl } = {}) {
|
|
52
|
+
if (!runtime || !cwd || !session) return null;
|
|
53
|
+
const r = await run(runtime, ["set-task", "--cwd", cwd, "--session", session, "--task", String(id)], { execImpl });
|
|
54
|
+
return r?.task ?? null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const clip = (s, n) => {
|
|
58
|
+
const a = Array.from(String(s ?? "").replace(/\s+/g, " ").trim());
|
|
59
|
+
return a.length <= n ? a.join("") : a.slice(0, Math.max(1, n - 1)).join("") + "…";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The bar's text, in `room` columns, or "" when there is nothing to say (no memory here).
|
|
64
|
+
* `guess`: the task was NOT chosen for this session — it is only the project's newest open one,
|
|
65
|
+
* which is exactly how work gets misfiled; the caller paints that yellow.
|
|
66
|
+
*/
|
|
67
|
+
export function memoryBarText(cur, room = 40) {
|
|
68
|
+
if (!cur) return { text: "", guess: false };
|
|
69
|
+
const tail = " (/task)";
|
|
70
|
+
if (!cur.task) return { text: clip("◆ memory: no task yet", room - tail.length) + tail, guess: false };
|
|
71
|
+
const head = `◆ memory → #${cur.task.id} `;
|
|
72
|
+
const titleRoom = room - head.length - tail.length;
|
|
73
|
+
if (titleRoom < 6) return { text: clip(`◆ #${cur.task.id}`, Math.max(4, room - tail.length)) + tail, guess: !cur.chosen };
|
|
74
|
+
return { text: head + clip(cur.task.title, titleRoom) + tail, guess: !cur.chosen };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The /task picker's rows: the open tasks, the current one marked. */
|
|
78
|
+
export function taskPickerLabels(cur, width = 80) {
|
|
79
|
+
const rows = Array.isArray(cur?.open) ? cur.open : [];
|
|
80
|
+
return rows.map((t) => {
|
|
81
|
+
const mark = cur?.task && t.id === cur.task.id ? "● " : " ";
|
|
82
|
+
const status = t.status === "in_progress" ? "" : ` · ${t.status}`;
|
|
83
|
+
return mark + clip(`#${t.id} ${t.title}`, Math.max(20, width - 12 - status.length)) + status;
|
|
84
|
+
});
|
|
85
|
+
}
|
package/model-doctor.mjs
CHANGED
|
@@ -42,7 +42,7 @@ const EMBED_SCRIPT = fileURLToPath(new URL("./gonext_mlx_embed.py", import.meta.
|
|
|
42
42
|
function python3Bin() {
|
|
43
43
|
const explicit = (process.env.GONEXT_PROBE_PYTHON ?? process.env.GONEXT_MLX_LM_PYTHON ?? "").trim();
|
|
44
44
|
if (explicit) return explicit;
|
|
45
|
-
// gu's OWN environment, when it has one (~/.
|
|
45
|
+
// gu's OWN environment, when it has one (~/.gu/venv): the agent's packages were installed INTO it, so a new
|
|
46
46
|
// process must look there, not in the system Python — or it asks to install them at every start (GH #308).
|
|
47
47
|
const own = ownVenvPython();
|
|
48
48
|
if (own) return own;
|
|
@@ -95,7 +95,7 @@ export function resolvePythonPath() {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* Persist that interpreter into ~/.
|
|
98
|
+
* Persist that interpreter into ~/.gu/worker.env as GONEXT_PROBE_PYTHON, so every future
|
|
99
99
|
* daemon uses it regardless of the PATH it happens to start with. Merges — never rewrites the
|
|
100
100
|
* file from scratch. Returns the path written, or "" when nothing needed doing.
|
|
101
101
|
*/
|
|
@@ -153,7 +153,7 @@ export function isPipMissing(output) {
|
|
|
153
153
|
/** How long one pip run may take before gu stops waiting (GU_PIP_TIMEOUT_MS overrides; a slow line needs more). */
|
|
154
154
|
export const PIP_TIMEOUT_MS = Number(process.env.GU_PIP_TIMEOUT_MS ?? "") || 600_000;
|
|
155
155
|
/** Where a pip run's whole output is kept, so a failure can be read afterwards. */
|
|
156
|
-
export const PIP_LOG_FILE = join(homedir(), ".
|
|
156
|
+
export const PIP_LOG_FILE = join(homedir(), ".gu", "pip-install.log");
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Run pip once. Resolves { code, err, timedOut } — never rejects, so the caller owns the policy.
|
|
@@ -223,7 +223,7 @@ function runPip(python, pkgs, extraArgs = [], { log = () => {}, timeoutMs = PIP_
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
|
-
* A private virtualenv at ~/.
|
|
226
|
+
* A private virtualenv at ~/.gu/venv, created on demand. → its python, or "".
|
|
227
227
|
*
|
|
228
228
|
* THE RIGHT ANSWER TO PEP 668, and the machinery for it already existed: the daemon's
|
|
229
229
|
* interpreter is pinned through GONEXT_PROBE_PYTHON precisely so the packages and the process
|
|
@@ -287,7 +287,7 @@ async function pipInstall(pkgs, log) {
|
|
|
287
287
|
return venvPy;
|
|
288
288
|
};
|
|
289
289
|
|
|
290
|
-
// WINDOWS: gu's OWN environment (~/.
|
|
290
|
+
// WINDOWS: gu's OWN environment (~/.gu/venv) from the start. The system Python is somebody else's: writing
|
|
291
291
|
// into it needs an administrator, can clash with their packages, and cannot be undone with one folder delete.
|
|
292
292
|
// (GU_PIP_SYSTEM=1 keeps the old behaviour.)
|
|
293
293
|
if (process.platform === "win32" && process.env.GU_PIP_SYSTEM !== "1") {
|
|
@@ -349,7 +349,7 @@ export function chatRamWarningLines(repo, totalBytes) {
|
|
|
349
349
|
return out;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
const DIR = join(homedir(), ".
|
|
352
|
+
const DIR = join(homedir(), ".gu");
|
|
353
353
|
export const MODEL_PID_FILE = join(DIR, "model.pid");
|
|
354
354
|
export const MODEL_LOG_FILE = join(DIR, "model.log");
|
|
355
355
|
const EMBED_PID_FILE = join(DIR, "embed.pid");
|
|
@@ -854,7 +854,7 @@ export async function testEmbeddings(baseUrl, model, { timeoutMs = 20000 } = {})
|
|
|
854
854
|
*/
|
|
855
855
|
export async function listLocalRagIndexes() {
|
|
856
856
|
const { readdir, readFile: rf, stat: st } = await import("node:fs/promises");
|
|
857
|
-
const root = join(homedir(), ".
|
|
857
|
+
const root = join(homedir(), ".gu", "rag");
|
|
858
858
|
const out = [];
|
|
859
859
|
let folders = [];
|
|
860
860
|
try {
|
|
@@ -1410,9 +1410,9 @@ export async function ensureSkillsLibs({ log, confirm, agreed = [], pip = pipIns
|
|
|
1410
1410
|
|
|
1411
1411
|
/** npm packages the docx and pptx skills `require()`; they were documented as preinstalled but nothing installed them. */
|
|
1412
1412
|
export const SKILLS_NODE_PACKAGES = ["docx", "pptxgenjs"];
|
|
1413
|
-
/** Where they go: ~/.
|
|
1413
|
+
/** Where they go: ~/.gu/node-libs/node_modules (the agent shell gets it as NODE_PATH). */
|
|
1414
1414
|
export function skillsNodeDir() {
|
|
1415
|
-
return join(homedir(), ".
|
|
1415
|
+
return join(homedir(), ".gu", "node-libs");
|
|
1416
1416
|
}
|
|
1417
1417
|
function npmInstallInto(dir, pkgs) {
|
|
1418
1418
|
const win = platform() === "win32";
|
|
@@ -1476,7 +1476,7 @@ export async function ensureAgentDeps({ log, confirm, modelHost = canHostMlxMode
|
|
|
1476
1476
|
if (!usable.ok && build && (await confirm(pu.pythonOfferText(usable, build), true))) {
|
|
1477
1477
|
log(` Installing Python ${pu.PYTHON_UNIX.version} …`);
|
|
1478
1478
|
const r = await (installPython ?? pu.installPythonUnix)({ build, log });
|
|
1479
|
-
if (r.ok) log(` ✓ Python ${pu.PYTHON_UNIX.version} installed for your user (~/.
|
|
1479
|
+
if (r.ok) log(` ✓ Python ${pu.PYTHON_UNIX.version} installed for your user (~/.gu/python)`);
|
|
1480
1480
|
else log(yellow(` could not install Python: ${r.error ?? "unknown error"}`));
|
|
1481
1481
|
}
|
|
1482
1482
|
}
|
package/mongo-mac.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 8.0.5 is the last release built for older Macs (minos 10.14 on Intel, 11.0 on Apple Silicon).
|
|
8
8
|
*
|
|
9
9
|
* So on those Macs gu runs its own mongod 8.0.5, like the Windows one (#210): no Homebrew, no
|
|
10
|
-
* service, no sudo. Everything lives under ~/.
|
|
10
|
+
* service, no sudo. Everything lives under ~/.gu/mongodb and goes away with that folder:
|
|
11
11
|
* bin/mongod data/ mongod.log launch.log version.txt
|
|
12
12
|
*
|
|
13
13
|
* The .tgz is gzip, so unlike the Windows zip one file cannot be fetched on its own: the whole
|
|
@@ -58,7 +58,7 @@ export function macNeedsOwnMongo(major) {
|
|
|
58
58
|
|
|
59
59
|
/** Where gu keeps its own mongod on a Mac — the same layout as Windows. `home` for tests. */
|
|
60
60
|
export function mongoMacPaths(home = homedir()) {
|
|
61
|
-
const dir = join(home, ".
|
|
61
|
+
const dir = join(home, ".gu", "mongodb");
|
|
62
62
|
return {
|
|
63
63
|
dir,
|
|
64
64
|
exe: join(dir, "bin", "mongod"),
|
package/mongo-windows.mjs
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* MB). The server answers HTTP Range requests (checked: 206, accept-ranges: bytes), so this
|
|
8
8
|
* module reads the zip's central directory over the wire and downloads ONLY the mongod.exe entry.
|
|
9
9
|
*
|
|
10
|
-
* Everything lives under ~/.
|
|
10
|
+
* Everything lives under ~/.gu/mongodb — no service, no admin, removed by deleting the folder:
|
|
11
11
|
* bin/mongod.exe data/ mongod.log launch.log
|
|
12
12
|
*
|
|
13
13
|
* Pure parts (zip parsing, paths, the command line) are separate from the network and process
|
|
@@ -25,7 +25,7 @@ export const MONGO_WIN_ZIP_URL = `https://fastdl.mongodb.org/windows/mongodb-win
|
|
|
25
25
|
|
|
26
26
|
/** Where gu keeps its own mongod. `home` is injectable for tests. */
|
|
27
27
|
export function mongoWinPaths(home = homedir()) {
|
|
28
|
-
const dir = join(home, ".
|
|
28
|
+
const dir = join(home, ".gu", "mongodb");
|
|
29
29
|
return {
|
|
30
30
|
dir,
|
|
31
31
|
exe: join(dir, "bin", "mongod.exe"),
|
|
@@ -285,7 +285,7 @@ export function vcRedistInstalled(code) {
|
|
|
285
285
|
* started with `-Verb RunAs` (one Windows permission prompt); a non-elevated child_process could not ask.
|
|
286
286
|
* → { ok, code, error? }. `download` and `run` are injectable so tests never touch the net or the machine.
|
|
287
287
|
*/
|
|
288
|
-
export async function installVcRuntime({ dir = join(homedir(), ".
|
|
288
|
+
export async function installVcRuntime({ dir = join(homedir(), ".gu"), fetchFn = fetch, run = null } = {}) {
|
|
289
289
|
const exe = join(dir, "vc_redist.x64.exe");
|
|
290
290
|
try {
|
|
291
291
|
await mkdir(dir, { recursive: true });
|
package/next-suggestion.mjs
CHANGED
|
@@ -28,7 +28,9 @@ export const SUGGESTION_MAX_CHARS = 80;
|
|
|
28
28
|
/** Shorter than this, an answer is a greeting or a one-liner: nothing follows from it. */
|
|
29
29
|
export const MIN_ANSWER_CHARS = 40;
|
|
30
30
|
/** The side call waits this long at most; after that there is simply no suggestion. */
|
|
31
|
-
|
|
31
|
+
// GH #587: a reasoning coder (deepseek-v4-pro) thinks first — 8s was often over before it answered.
|
|
32
|
+
// Nothing waits on it: a late suggestion is still shown if the prompt is still empty.
|
|
33
|
+
export const SUGGEST_TIMEOUT_MS = 20_000;
|
|
32
34
|
|
|
33
35
|
/** Gate 1: is this turn worth asking about at all? */
|
|
34
36
|
export function shouldSuggest({ question = "", answer = "", enabled = true } = {}) {
|
|
@@ -41,12 +43,15 @@ export function shouldSuggest({ question = "", answer = "", enabled = true } = {
|
|
|
41
43
|
|
|
42
44
|
const SYSTEM =
|
|
43
45
|
"You predict the user's NEXT message to a coding assistant in a terminal. You are shown the " +
|
|
44
|
-
"user's last request and the end of the assistant's answer. If the answer
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"user would type it: 2 to 12 words, an instruction or a short
|
|
48
|
-
"
|
|
49
|
-
"
|
|
46
|
+
"user's last request and the end of the assistant's answer. If the answer leads to a next " +
|
|
47
|
+
"message — it asks the user to confirm or choose (for example \"Shall I merge?\"), offers a " +
|
|
48
|
+
"next step, or lists what is \"left for you\" / waits for the user's go-ahead — reply with ONLY " +
|
|
49
|
+
"that message, written as the user would type it: 2 to 12 words, an instruction or a short " +
|
|
50
|
+
"reply such as \"yes, merge it\" or \"go ahead, upload the DMG\", in the language the user " +
|
|
51
|
+
"writes in. When it offers SEVERAL options, pick the one the answer recommends, else the " +
|
|
52
|
+
"simplest one, and name it (\"just upload the notarized DMG\") — never a bare \"yes\" that " +
|
|
53
|
+
"could mean either. Reply with exactly NONE only when the answer leads nowhere (a plain fact, " +
|
|
54
|
+
"an explanation, a finished task with nothing offered). No quotes, no explanation, never a question.";
|
|
50
55
|
|
|
51
56
|
const tail = (s, n) => {
|
|
52
57
|
const chars = Array.from(String(s ?? ""));
|
|
@@ -58,7 +63,7 @@ export function suggestionRequest(model, { question = "", answer = "" } = {}) {
|
|
|
58
63
|
return {
|
|
59
64
|
model,
|
|
60
65
|
stream: false,
|
|
61
|
-
max_tokens:
|
|
66
|
+
max_tokens: 800, // GH #587: room for a reasoning model to think and still answer (300 could run out first)
|
|
62
67
|
messages: [
|
|
63
68
|
{ role: "system", content: SYSTEM },
|
|
64
69
|
{ role: "user", content: `User's request:\n${q}\n\nEnd of the assistant's answer:\n${tail(answer, ANSWER_TAIL_MAX)}` },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiens.nguyen/gu-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.941",
|
|
4
4
|
"description": "gu: the coding agent in your terminal. It reads your repo, makes the change and runs the tests, with your own models (Ollama or any OpenAI-compatible provider). Free installs keep the agent, its API and its database on your machine. macOS, Linux and Windows.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -121,6 +121,8 @@
|
|
|
121
121
|
"support-bundle.mjs",
|
|
122
122
|
"support-command.mjs",
|
|
123
123
|
"clear-logs.mjs",
|
|
124
|
+
"gudb-size.mjs",
|
|
125
|
+
"memory-task.mjs",
|
|
124
126
|
"platform-tools.mjs",
|
|
125
127
|
"job-pools.mjs",
|
|
126
128
|
"agent-stop.mjs",
|
|
@@ -156,6 +158,7 @@
|
|
|
156
158
|
"hints.mjs",
|
|
157
159
|
"terminal-title.mjs",
|
|
158
160
|
"gu-relaunch.mjs",
|
|
161
|
+
"gu-home-move.mjs",
|
|
159
162
|
"server-keys.mjs",
|
|
160
163
|
"add-server.mjs",
|
|
161
164
|
"powershell-alias.mjs",
|
|
@@ -200,6 +203,7 @@
|
|
|
200
203
|
"gu_free_budget.py",
|
|
201
204
|
"turn-notes.mjs",
|
|
202
205
|
"gu_hooks.py",
|
|
206
|
+
"gu_turn_trail.py",
|
|
203
207
|
"prompt_scaffold_check.py",
|
|
204
208
|
"gonext_transcribe.py",
|
|
205
209
|
"gonext_mlx_embed.py",
|
package/platform-tools.mjs
CHANGED
|
@@ -225,13 +225,13 @@ let _python = null;
|
|
|
225
225
|
* Cached: otherwise this probes a subprocess on every job.
|
|
226
226
|
*/
|
|
227
227
|
/**
|
|
228
|
-
* The interpreter of gu's own private virtualenv (~/.
|
|
228
|
+
* The interpreter of gu's own private virtualenv (~/.gu/venv), or "" when there is none. Pure apart from one
|
|
229
229
|
* file check. The agent's packages are installed INTO it on Windows (GH #308), so everything that runs the agent —
|
|
230
230
|
* the terminal's checks AND the background worker — must look there, whatever worker.env did or did not pin.
|
|
231
231
|
*/
|
|
232
232
|
export function ownVenvPython(home = homedir(), exists = existsSync, platform = process.platform) {
|
|
233
233
|
const win = platform === "win32";
|
|
234
|
-
const py = join(home, ".
|
|
234
|
+
const py = join(home, ".gu", "venv", win ? "Scripts" : "bin", win ? "python.exe" : "python");
|
|
235
235
|
return exists(py) ? py : "";
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -581,7 +581,7 @@ export async function spawnSurviving({ cmd, args = [], cwd, env = {}, logFile, t
|
|
|
581
581
|
|
|
582
582
|
// THE SCHEDULER'S ENVIRONMENT IS NOT YOURS. A task launched this way starts with a minimal
|
|
583
583
|
// environment — no USERPROFILE among it — so `os.homedir()` does not resolve to the user's
|
|
584
|
-
// profile and anything that reads ~/.
|
|
584
|
+
// profile and anything that reads ~/.gu (worker.env, the sessions, the RAG index) fails.
|
|
585
585
|
// The daemon exited 1 that way, silently, with "Last Result: 1" the only trace.
|
|
586
586
|
//
|
|
587
587
|
// Carried EXPLICITLY, and only these: passing the whole of process.env is what put names cmd
|
package/poll-errors.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Friendly poll-failure reporting for the worker daemon.
|
|
2
2
|
//
|
|
3
3
|
// The poll loop runs every ~500ms, so a failure that lasts (an API outage, a rotated key)
|
|
4
|
-
// used to fill ~/.
|
|
4
|
+
// used to fill ~/.gu/worker.log with THOUSANDS of identical 4-line stack traces — which
|
|
5
5
|
// says nothing about what's wrong or whether the user can fix it. This turns each failure
|
|
6
6
|
// into ONE plain sentence plus an actionable hint, and collapses repeats of the same failure
|
|
7
7
|
// into a periodic "still failing" line.
|
|
@@ -53,7 +53,7 @@ export function describePollError(err, { apiBase = "the API" } = {}) {
|
|
|
53
53
|
return {
|
|
54
54
|
key: "api-404",
|
|
55
55
|
line: `${apiBase} has no /api/worker/jobs/next endpoint (404).`,
|
|
56
|
-
hint: "The API base URL may point at the wrong deployment — check GONEXT_API_BASE in ~/.
|
|
56
|
+
hint: "The API base URL may point at the wrong deployment — check GONEXT_API_BASE in ~/.gu/worker.env.",
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
if (status >= 500) {
|
package/prompt_scaffold_check.py
CHANGED
|
@@ -18,7 +18,7 @@ import sys
|
|
|
18
18
|
# A scaffold YOU put here wins over the database version, on this machine only. gu never WRITES this
|
|
19
19
|
# file — the scaffold stays off users' disks unless they put it there themselves — so it is an
|
|
20
20
|
# override for trying a wording before inserting it into production, not a cache.
|
|
21
|
-
LOCAL_SCAFFOLD_PATH = os.path.join(os.path.expanduser("~"), ".
|
|
21
|
+
LOCAL_SCAFFOLD_PATH = os.path.join(os.path.expanduser("~"), ".gu", "prompt-scaffolds", "code-agent.txt")
|
|
22
22
|
# How the file is NAMED in anything a person reads: never its location. Asked for: "dont say out loud
|
|
23
23
|
# where is the location of the scaffold file … not say anything". The deploy app's own Commands
|
|
24
24
|
# window is the one place the path is written down, for its owner.
|
package/proxy-store.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { homedir } from "node:os";
|
|
|
17
17
|
import { join } from "node:path";
|
|
18
18
|
import { normalizeProxy } from "./proxy-config.mjs";
|
|
19
19
|
|
|
20
|
-
const GONEXT_DIR = join(homedir(), ".
|
|
20
|
+
const GONEXT_DIR = join(homedir(), ".gu");
|
|
21
21
|
export const PROXY_FILE = join(GONEXT_DIR, "proxy.json");
|
|
22
22
|
|
|
23
23
|
/**
|
package/python-unix.mjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* package). On all three the agent could not run, and gu could only say "install Python".
|
|
8
8
|
*
|
|
9
9
|
* Like the Windows path (python-windows.mjs: python.org, for this user), gu now offers to bring its own: a standalone
|
|
10
|
-
* CPython build (python-build-standalone — the builds uv and others install), unpacked into ~/.
|
|
11
|
-
* administrator, no sudo, nothing outside ~/.
|
|
10
|
+
* CPython build (python-build-standalone — the builds uv and others install), unpacked into ~/.gu/python. No
|
|
11
|
+
* administrator, no sudo, nothing outside ~/.gu. The archive is checked against a SHA-256 pinned HERE, so a changed
|
|
12
12
|
* file on the server is refused, never run. Bump the release on purpose, with its four hashes.
|
|
13
13
|
*
|
|
14
14
|
* Pure parts are separate; the download and the shell are injected so tests never fetch or unpack anything.
|
|
@@ -75,7 +75,7 @@ export function pythonOfferText(usable, build) {
|
|
|
75
75
|
usable.why === "no-venv" ? `this computer's Python ${usable.version} cannot make gu's own environment (no venv)` :
|
|
76
76
|
"this computer has none gu can use";
|
|
77
77
|
return `The agent runs on Python 3.10 or newer, and ${have}. Install Python ${PYTHON_UNIX.version} for your user only? ` +
|
|
78
|
-
`(about ${build.mb} MB, into ~/.
|
|
78
|
+
`(about ${build.mb} MB, into ~/.gu/python; no password, nothing system-wide)`;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
const sh = (file, args) =>
|
|
@@ -84,10 +84,10 @@ const sh = (file, args) =>
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* Download, check, unpack, and make gu's own environment (~/.
|
|
88
|
-
* An older ~/.
|
|
87
|
+
* Download, check, unpack, and make gu's own environment (~/.gu/venv) from it. → { ok, python?, error? }
|
|
88
|
+
* An older ~/.gu/venv (made from a Python the agent cannot use) is moved aside, never deleted.
|
|
89
89
|
*/
|
|
90
|
-
export async function installPythonUnix({ dir = join(homedir(), ".
|
|
90
|
+
export async function installPythonUnix({ dir = join(homedir(), ".gu"), build = pythonBuildFor(), fetchFn = fetch, run = sh, log = () => {} } = {}) {
|
|
91
91
|
if (!build) return { ok: false, error: "there is no standalone Python build for this computer" };
|
|
92
92
|
const archive = join(dir, build.name);
|
|
93
93
|
try {
|
package/python-windows.mjs
CHANGED
|
@@ -66,7 +66,7 @@ export function pythonInstallerEnv(env = process.env) {
|
|
|
66
66
|
* Download, verify, install. → { ok, folders?, error? }. `fetchFn` and `run` (file → { code }) are injectable.
|
|
67
67
|
* On success the process PATH is updated so the very next `py -3` in this run finds it.
|
|
68
68
|
*/
|
|
69
|
-
export async function installPythonWindows({ dir = join(homedir(), ".
|
|
69
|
+
export async function installPythonWindows({ dir = join(homedir(), ".gu"), version = PYTHON_WIN_VERSION, fetchFn = fetch, run = null, env = process.env } = {}) {
|
|
70
70
|
const file = join(dir, `python-${version}-amd64.exe`);
|
|
71
71
|
try {
|
|
72
72
|
await mkdir(dir, { recursive: true });
|
package/rag-selftest.mjs
CHANGED
|
@@ -107,7 +107,7 @@ export function cosine(a, b) {
|
|
|
107
107
|
|
|
108
108
|
/** Read the API base + worker key exactly as the CLI does. */
|
|
109
109
|
async function workerEnv() {
|
|
110
|
-
const txt = await readFile(join(homedir(), ".
|
|
110
|
+
const txt = await readFile(join(homedir(), ".gu", "worker.env"), "utf8").catch(() => "");
|
|
111
111
|
const get = (k) => (new RegExp(`^${k}=(.*)$`, "m").exec(txt)?.[1] ?? "").trim();
|
|
112
112
|
return { apiBase: get("GONEXT_API_BASE").replace(/\/+$/, ""), key: get("GONEXT_WORKER_KEY") };
|
|
113
113
|
}
|
|
@@ -135,7 +135,7 @@ export async function runRagSelfTest({ onStep = () => {} } = {}) {
|
|
|
135
135
|
|
|
136
136
|
await step("read the embedder from this machine's settings", async () => {
|
|
137
137
|
const { apiBase, key } = await workerEnv();
|
|
138
|
-
if (!apiBase || !key) throw new Error("no ~/.
|
|
138
|
+
if (!apiBase || !key) throw new Error("no ~/.gu/worker.env — run `gu` first");
|
|
139
139
|
const res = await fetch(`${apiBase}/api/worker/settings`, {
|
|
140
140
|
headers: { "X-Worker-Key": key },
|
|
141
141
|
signal: AbortSignal.timeout(10_000),
|
package/resume-memory.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export function findMemoryCli({ cwd = process.cwd(), home = homedir(), hooksFor
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
for (const dir of [join(home, ".
|
|
36
|
+
for (const dir of [join(home, ".gu", "skill-runtime", SKILL), join(home, ".claude", "skill-runtime", SKILL), join(home, ".claude", "memory")]) {
|
|
37
37
|
const cli = join(dir, "memory_cli.py");
|
|
38
38
|
if (existsSync(cli)) {return { python: pythonFor(cli), cli };}
|
|
39
39
|
}
|
|
@@ -50,7 +50,7 @@ writeFileSync(shot, PNG);
|
|
|
50
50
|
const spelled = process.platform === "win32" ? `"${shot}"` : shot.replace(/ /g, "\\ ");
|
|
51
51
|
check("a dropped path with spaces is recognised", imagePathFromPaste(spelled) === shot, `${spelled} → ${imagePathFromPaste(spelled)}`);
|
|
52
52
|
|
|
53
|
-
// 2. It is copied into ~/.
|
|
53
|
+
// 2. It is copied into ~/.gu/images.
|
|
54
54
|
const stored = storeImageFile(shot);
|
|
55
55
|
if (stored.path) made.push(stored.path);
|
|
56
56
|
check("copied into the images folder", Boolean(stored.path?.startsWith(imagesDir())) && isPng(stored.path), stored.path ?? stored.error);
|
package/setup-fixes.mjs
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Runs from three places, all with the same words:
|
|
17
17
|
* 1. npm's postinstall (install-path.mjs) — npm hides its output, so what it did is also saved
|
|
18
|
-
* to ~/.
|
|
18
|
+
* to ~/.gu/setup-done.json and gu says it at its next start;
|
|
19
19
|
* 2. gu's first start on a computer — npm 11.21+ can skip install scripts entirely, so gu checks
|
|
20
|
-
* once itself (marker ~/.
|
|
20
|
+
* once itself (marker ~/.gu/setup-checked);
|
|
21
21
|
* 3. the Windows installer (install.ps1), which has its own PowerShell copy of these steps.
|
|
22
22
|
*
|
|
23
23
|
* Never fails anything: a step that cannot be done is reported with the command to do it by hand.
|
|
@@ -27,8 +27,8 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
|
|
|
27
27
|
import { homedir } from "node:os";
|
|
28
28
|
import { dirname, join } from "node:path";
|
|
29
29
|
|
|
30
|
-
export const NOTES_FILE = (home = homedir()) => join(home, ".
|
|
31
|
-
export const CHECKED_FILE = (home = homedir()) => join(home, ".
|
|
30
|
+
export const NOTES_FILE = (home = homedir()) => join(home, ".gu", "setup-done.json");
|
|
31
|
+
export const CHECKED_FILE = (home = homedir()) => join(home, ".gu", "setup-checked");
|
|
32
32
|
|
|
33
33
|
export const UNDO_POLICY = "Set-ExecutionPolicy -Scope CurrentUser Undefined";
|
|
34
34
|
|
package/shell-details.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// BACKGROUND SHELLS IN THE TERMINAL (task #360, GitHub #140) — Claude Code's "Shell details".
|
|
2
2
|
//
|
|
3
3
|
// The agent hands a long command (a 7-minute `fastlane ios beta`) off to the background instead
|
|
4
|
-
// of killing it at its deadline, and records it in ~/.
|
|
4
|
+
// of killing it at its deadline, and records it in ~/.gu/shells.json (gonext_agent_chat.py,
|
|
5
5
|
// BACKGROUND SHELLS). This module is the terminal's half: it reads that file, says on the bottom
|
|
6
6
|
// notice row that something is still running (a click target, like the other notice controls),
|
|
7
7
|
// and renders the details view — Status, Runtime, Command, Output — the way Claude Code does.
|
|
@@ -19,7 +19,7 @@ import { procStart } from "./proc-identity.mjs";
|
|
|
19
19
|
|
|
20
20
|
export { procStart };
|
|
21
21
|
|
|
22
|
-
export const shellsPath = (home = homedir()) => join(home, ".
|
|
22
|
+
export const shellsPath = (home = homedir()) => join(home, ".gu", "shells.json");
|
|
23
23
|
|
|
24
24
|
export function readShells(path = shellsPath()) {
|
|
25
25
|
try {
|
package/skill-install.mjs
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* env?: [names asked for at install], notes?: [ … ] }
|
|
20
20
|
*
|
|
21
21
|
* Paths in the manifest and in the packed text files are placeholders, filled in here:
|
|
22
|
-
* {{SKILL}} the skill's folder (one per tool: ~/.
|
|
23
|
-
* {{RUNTIME}} <base>/skill-runtime/<name>, <base> = ~/.
|
|
22
|
+
* {{SKILL}} the skill's folder (one per tool: ~/.gu/skills/<name>, ~/.claude/skills/<name>)
|
|
23
|
+
* {{RUNTIME}} <base>/skill-runtime/<name>, <base> = ~/.gu if gu is a target, else ~/.claude
|
|
24
24
|
* {{PYTHON}} the runtime's own venv python (built here from requirements.txt), else python3
|
|
25
25
|
* {{HOME}} the home folder; {{ENV:NAME}} NAME from the terminal's environment (never packed)
|
|
26
26
|
*
|
|
@@ -290,10 +290,10 @@ function sameTree(files, dir, vars) {
|
|
|
290
290
|
export function planInstall(pkg, { home = homedir(), targets, platform = process.platform, env = process.env } = {}) {
|
|
291
291
|
const { manifest: m } = pkg;
|
|
292
292
|
const name = m.name;
|
|
293
|
-
const found = TARGETS.filter((t) => existsSync(join(home, t === "gu" ? ".
|
|
293
|
+
const found = TARGETS.filter((t) => existsSync(join(home, t === "gu" ? ".gu" : ".claude")));
|
|
294
294
|
const use = targets?.length ? targets : found;
|
|
295
|
-
if (!use.length) throw new Error("neither gu (~/.
|
|
296
|
-
const base = join(home, use.includes("gu") ? ".
|
|
295
|
+
if (!use.length) throw new Error("neither gu (~/.gu) nor Claude Code (~/.claude) is set up here — pass --gu or --claude");
|
|
296
|
+
const base = join(home, use.includes("gu") ? ".gu" : ".claude");
|
|
297
297
|
const runtime = join(base, "skill-runtime", name);
|
|
298
298
|
// platform-ok: only for a package whose command is {{PYTHON}} with no venv — "python" on Windows (not the Store stub's name).
|
|
299
299
|
const python = m.python ? venvPython(runtime, platform) : platform === "win32" ? "python" : "python3";
|
|
@@ -305,20 +305,20 @@ export function planInstall(pkg, { home = homedir(), targets, platform = process
|
|
|
305
305
|
}
|
|
306
306
|
const warnings = [];
|
|
307
307
|
const items = [];
|
|
308
|
-
const runtimeVars = { skill: join(home, ".
|
|
308
|
+
const runtimeVars = { skill: join(home, ".gu", "skills", name), runtime, python, home, env: envValues };
|
|
309
309
|
const runtimeStatus = !pkg.runtime.size ? "same" : sameTree(pkg.runtime, runtime, runtimeVars) ? "same" : existsSync(runtime) ? "differs" : "new";
|
|
310
310
|
if (pkg.runtime.size) items.push({ kind: "runtime", to: runtime, status: runtimeStatus, files: pkg.runtime.size });
|
|
311
311
|
// The venv is (re)built when it is missing or the runtime (so maybe requirements.txt) changed.
|
|
312
312
|
if (m.python) items.push({ kind: "python", to: runtime, requirements: m.python.requirements, status: runtimeStatus === "same" && existsSync(python) ? "same" : "new" });
|
|
313
313
|
for (const t of use) {
|
|
314
|
-
const dot = t === "gu" ? ".
|
|
314
|
+
const dot = t === "gu" ? ".gu" : ".claude";
|
|
315
315
|
const skillDir = join(home, dot, "skills", name);
|
|
316
316
|
const vars = { skill: skillDir, runtime, python, home, env: envValues };
|
|
317
317
|
items.push({ kind: "skill", target: t, to: skillDir, vars, status: sameTree(pkg.skill, skillDir, vars) ? "same" : existsSync(skillDir) ? "differs" : "new" });
|
|
318
318
|
|
|
319
319
|
const servers = isObj(m.mcpServers) ? m.mcpServers : {};
|
|
320
320
|
if (Object.keys(servers).length) {
|
|
321
|
-
const file = t === "gu" ? join(home, ".
|
|
321
|
+
const file = t === "gu" ? join(home, ".gu", "mcp.json") : join(home, ".claude.json");
|
|
322
322
|
const cur = readJsonFile(file);
|
|
323
323
|
if (cur.error) warnings.push(`${file} is ${cur.error} — its MCP servers are left alone`);
|
|
324
324
|
for (const [sname, entry] of Object.entries(servers)) {
|
|
@@ -413,7 +413,7 @@ export function applyInstall(plan, { say = () => {}, run = spawnSync, now = new
|
|
|
413
413
|
try {
|
|
414
414
|
if (it.kind === "runtime" && it.status !== "same") {
|
|
415
415
|
backup(it.to, "runtime");
|
|
416
|
-
writeFiles(it.to, plan.pkg.runtime, { skill: join(plan.home, ".
|
|
416
|
+
writeFiles(it.to, plan.pkg.runtime, { skill: join(plan.home, ".gu", "skills", plan.name), runtime: plan.runtime, python: plan.python, home: plan.home, env: {} });
|
|
417
417
|
done.push(`runtime → ${it.to}`);
|
|
418
418
|
} else if (it.kind === "python" && it.status !== "same") {
|
|
419
419
|
const py = findPython({ run });
|