Files
AgentHub/client/src/lib/runWorktree.ts
T
nntrivi2001 198fbb7980 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
2026-10-05 17:01:05 +07:00

30 lines
1016 B
TypeScript

/**
* @file runWorktree.ts
* @description Which `claude --worktree` session the Workspace's Changes panel
* follows for the URL's `?run=` pane. A poll that misses the run (one bad read
* lists no runs) keeps the last answer instead of moving the panel to the main
* folder — which, while it holds an unsaved edit, asked to discard it out of
* nowhere.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
export interface RunWorktree {
run: string;
session: string;
}
/**
* @param prev The previous answer.
* @param runParam The URL's `?run=`.
* @param opened That run in the latest list, if the list had it.
*/
export function runWorktreeSession(
prev: RunWorktree | null,
runParam: string | null,
opened: { worktree?: boolean; sessionId: string | null } | undefined
): RunWorktree | null {
if (!runParam) return null;
if (!opened) return prev?.run === runParam ? prev : null;
return opened.worktree && opened.sessionId ? { run: runParam, session: opened.sessionId } : null;
}