@tiens.nguyen/gu-cli 1.0.849 → 1.0.850
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/gu-repl.mjs +7 -6
- package/package.json +1 -1
- package/shell-details.mjs +23 -6
package/gu-repl.mjs
CHANGED
|
@@ -141,7 +141,7 @@ import { completedFlush, splitLiveStream } from "./completed-flush.mjs";
|
|
|
141
141
|
import { isScaffoldStep, isGroupableStep, stepGroupMark, stepGroupRows, relativizePaths } from "./step-group.mjs";
|
|
142
142
|
import { clearLogsNoticeText } from "./clear-logs.mjs";
|
|
143
143
|
import { allowIn, allowedIn, bridgeCommand, browserReport, bridgeStatus, extensionDir, findDevInstalls, helpInstall, installExtensionFiles, installSteps, localLeftovers, openExtensionsPage, removeLocalFiles, STORE_URL, stopBridge } from "./browser-command.mjs";
|
|
144
|
-
import { commandLogFile, killShell, logTail, markAnnounced, readShells, recapQuestion, shellsToRecap, statusText as shellStatusText, renderShellDetails, shellPanelRows, shellPickerLabel, shellState, shellsNotice } from "./shell-details.mjs";
|
|
144
|
+
import { commandLogFile, killShell, logTail, markAnnounced, readShells, recapQuestion, runningShells, shellsToRecap, statusText as shellStatusText, renderShellDetails, shellPanelRows, shellPickerLabel, shellState, shellsNotice } from "./shell-details.mjs";
|
|
145
145
|
import { discoverSkills, matchSkillCommand } from "./skills.mjs";
|
|
146
146
|
import { appendNew, archivePathFor, archivedWorkspaceKey, markReset, seedArchive } from "./conversation-archive.mjs";
|
|
147
147
|
import { addAllowRule, listServers as listMcpServers } from "./mcp-config.mjs";
|
|
@@ -2993,7 +2993,7 @@ function zoneNotice(width) {
|
|
|
2993
2993
|
if (tokenNotice?.text) items.push({ key: "token", paint: tokenNotice.urgent ? yellow : dim, text: tokenNotice.text });
|
|
2994
2994
|
const agents = agentsIndicator(otherAgents);
|
|
2995
2995
|
if (agents) items.push({ key: "agents", clickable: true, paint: accent, text: `${agents} running (click)` });
|
|
2996
|
-
const shells = shellsNotice(shellEntries, {
|
|
2996
|
+
const shells = shellsNotice(shellEntries, { cwd: process.cwd() });
|
|
2997
2997
|
if (shells) items.push({ key: "shells", clickable: true, paint: shells.tone === "warn" ? yellow : accent, text: shells.text });
|
|
2998
2998
|
// LAST, so it is the first to give way on a narrow window: housekeeping, never urgent (#329).
|
|
2999
2999
|
const logs = clearLogsNoticeText(logsBytes);
|
|
@@ -9589,9 +9589,9 @@ const shellsViewed = new Set();
|
|
|
9589
9589
|
const SHELLS_SINCE = Date.now() / 1000; // a shell that ended before this terminal opened is old news
|
|
9590
9590
|
const SHELLS_MS = 1000;
|
|
9591
9591
|
function refreshShells() {
|
|
9592
|
-
const before = shellsNotice(shellEntries, {
|
|
9592
|
+
const before = shellsNotice(shellEntries, { cwd: process.cwd() })?.text ?? "";
|
|
9593
9593
|
shellEntries = readShells().map((rec) => ({ rec, st: shellState(rec) }));
|
|
9594
|
-
const after = shellsNotice(shellEntries, {
|
|
9594
|
+
const after = shellsNotice(shellEntries, { cwd: process.cwd() })?.text ?? "";
|
|
9595
9595
|
if (after !== before) paintBar();
|
|
9596
9596
|
wakeForShells();
|
|
9597
9597
|
}
|
|
@@ -9738,9 +9738,10 @@ async function showShells() {
|
|
|
9738
9738
|
if (listPickerActive || approvalActive) return;
|
|
9739
9739
|
const width = Math.max(20, process.stdout.columns || 80);
|
|
9740
9740
|
refreshShells();
|
|
9741
|
-
|
|
9741
|
+
// RUNNING ONES ONLY, the same list the header counts (#405/#406) — finished shells are not listed.
|
|
9742
|
+
const entries = runningShells(shellEntries, { cwd: process.cwd() }).reverse(); // newest first
|
|
9742
9743
|
if (!entries.length) {
|
|
9743
|
-
console.log("\n" + GUTTER + dim("No background shells. A long command the agent runs moves here instead of being stopped.\n"));
|
|
9744
|
+
console.log("\n" + GUTTER + dim("No running background shells. A long command the agent runs moves here instead of being stopped.\n"));
|
|
9744
9745
|
paintBar();
|
|
9745
9746
|
return;
|
|
9746
9747
|
}
|
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.850",
|
|
4
4
|
"description": "Gu CLI — the gu terminal plus the local worker that runs agent / OCR / PDF / embedding jobs on your Mac (Ollama / MLX / OpenAI-compatible).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/shell-details.mjs
CHANGED
|
@@ -117,13 +117,24 @@ export function statusText(st) {
|
|
|
117
117
|
return "ended (exit code unknown)";
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* THE ONE "WHICH SHELLS COUNT" PREDICATE (#405/#406, GitHub #196/#197): still running, and — when a
|
|
122
|
+
* `cwd` is given — this project's (shells.json is shared by every folder). The header count
|
|
123
|
+
* ("N shells running") and the shells list both come from this, so they cannot disagree and the
|
|
124
|
+
* list never shows exited / killed ones.
|
|
125
|
+
*/
|
|
126
|
+
export function runningShells(entries, { cwd } = {}) {
|
|
127
|
+
const mine = cwd ? sameProject(cwd) : () => true;
|
|
128
|
+
return entries.filter((e) => e.st.state === "running" && mine(e.rec?.workdir));
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
/** The bottom notice row's shell control while a shell is running, else null. */
|
|
121
|
-
export function shellsNotice(entries) {
|
|
132
|
+
export function shellsNotice(entries, { cwd } = {}) {
|
|
122
133
|
// ONLY WHILE SOMETHING RUNS (#376, GitHub #157). A finished shell used to keep "shell exited 0
|
|
123
134
|
// (click)" on the row until it was opened — a done build still asking for attention. When one
|
|
124
135
|
// finishes, the agent hears about it (a recap turn, or the next step of the turn it is in), and
|
|
125
136
|
// /shells still lists every shell with its output.
|
|
126
|
-
const running = entries
|
|
137
|
+
const running = runningShells(entries, { cwd });
|
|
127
138
|
if (!running.length) return null;
|
|
128
139
|
const one = running.length === 1;
|
|
129
140
|
// No runtime here: it would change the row every second, and the bar repaints on change.
|
|
@@ -320,6 +331,15 @@ export async function killShell(rec, { path = shellsPath(), platform = process.p
|
|
|
320
331
|
* and never one you stopped yourself.
|
|
321
332
|
*/
|
|
322
333
|
export function shellsToRecap(entries, { cwd = process.cwd(), since = 0 } = {}) {
|
|
334
|
+
const under = sameProject(cwd);
|
|
335
|
+
return entries
|
|
336
|
+
.filter(({ rec, st }) => st.state !== "running" && st.state !== "killed" && !rec.seen && !rec.announced
|
|
337
|
+
&& st.ended >= since && under(rec.workdir))
|
|
338
|
+
.map((e) => e.rec);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** (workdir) => is it inside the project this `cwd` belongs to. */
|
|
342
|
+
export function sameProject(cwd) {
|
|
323
343
|
// The nearest folder that still exists, resolved (macOS: /var → /private/var), plus the rest —
|
|
324
344
|
// a build may have deleted the folder it ran in.
|
|
325
345
|
const real = (p) => {
|
|
@@ -338,10 +358,7 @@ export function shellsToRecap(entries, { cwd = process.cwd(), since = 0 } = {})
|
|
|
338
358
|
const w = real(wd).replace(/\/+$/, "");
|
|
339
359
|
return Boolean(w) && (w === base || w.startsWith(base + "/"));
|
|
340
360
|
};
|
|
341
|
-
return
|
|
342
|
-
.filter(({ rec, st }) => st.state !== "running" && st.state !== "killed" && !rec.seen && !rec.announced
|
|
343
|
-
&& st.ended >= since && under(rec.workdir))
|
|
344
|
-
.map((e) => e.rec);
|
|
361
|
+
return under;
|
|
345
362
|
}
|
|
346
363
|
|
|
347
364
|
/** The nearest folder at or above `dir` holding .git — or `dir` itself when there is none. */
|