fix: event-loop freezes, plugin-install boot crash, tmux attach/scrollbar, Codex transcripts

- GET /api/workflows: one LEAD() window pass in a read worker (read-pool.js,
  workflow-stats.js); idx_events_session restored, idx_events_tool added
- compat-sqlite gains function/pluck/readonly so a plugin install without a
  better-sqlite3 build boots again; antigravity-usage uses db.js's Database
- install-hooks adds no checkout hooks while the agenthub plugin is enabled
  (events were doubled)
- terminal attach runs the live tmux server's own binary; the pane scrollbar
  gets a visible 2-column style, and claude panes start with
  CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 so tmux keeps history to scroll
- Codex sessions' conversation in GET /api/sessions/:id/transcript
- Codex/Antigravity sessions claimed by their workspace without hooks
- UI-audit follow-ups, docs and OpenAPI
This commit is contained in:
2026-10-05 17:01:05 +07:00
parent 442f133930
commit 198fbb7980
78 changed files with 2716 additions and 873 deletions
+53 -3
View File
@@ -49,6 +49,16 @@ function hasSession(name) {
}
}
/** The running tmux server's pid, or null when none answers. */
function serverPid() {
try {
const pid = String(execImpl(["display-message", "-p", "#{pid}"])).trim();
return /^\d+$/.test(pid) ? pid : null;
} catch {
return null;
}
}
/** `-e NAME=value` pairs for tmux, in a stable order. */
function envFlags(env) {
const flags = [];
@@ -77,8 +87,29 @@ function newSession({ name, cwd, argv, env }) {
// Called on every attach (not just at creation) so a session started before
// this option existed — or before a server restart picked up the change —
// still gets it; `set-option` is idempotent, so re-running it is harmless.
// The status bar goes off here too: the dashboard's tab bar already names the
// pane, and tmux's green line only eats a row of the terminal.
function enableMouse(name) {
execImpl(["set-option", "-t", pane(name), "mouse", "on"]);
execImpl(["set-option", "-t", pane(name), "status", "off"]);
// A draggable scrollbar beside the pane (mouse mode makes it drag). Only a
// tmux SERVER of 3.7+ knows the option; an older one refuses it, which is
// fine — the pane just has none (`/agenthub-doctor` says how to upgrade).
try {
execImpl(["set-option", "-t", pane(name), "pane-scrollbars", "on"]);
// tmux's default (`fg=white,bg=black,width=1`) is a one-column track in
// ANSI black — the terminal theme's border colour, almost the background —
// so it reads as no scrollbar at all. Two columns, bright slider.
execImpl([
"set-option",
"-t",
pane(name),
"pane-scrollbars-style",
"fg=brightwhite,bg=black,width=2,pad=0",
]);
} catch {
/* tmux < 3.7 */
}
}
/**
@@ -174,11 +205,27 @@ function listSessions(prefix) {
}
function isTmuxAvailable() {
return clientVersion() !== null;
}
/** The tmux binary's version (`3.7c`, `next-3.8`), null when it is absent. */
function clientVersion() {
try {
execImpl(["-V"]);
return true;
return execImpl(["-V"])
.trim()
.replace(/^tmux\s+/, "");
} catch {
return false;
return null;
}
}
/** The RUNNING server's version, null when none runs. A server started before
* an upgrade keeps its old version until every tmux session has closed. */
function serverVersion() {
try {
return execImpl(["display-message", "-p", "#{version}"]).trim() || null;
} catch {
return null;
}
}
@@ -193,6 +240,9 @@ module.exports = {
killSession,
listSessions,
isTmuxAvailable,
clientVersion,
serverVersion,
serverPid,
__setExecImpl,
__reset,
};