mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-16 03:09:33 +01:00
fix(copilot): codeman agent read returns the last answer
`/api/sessions/:id/last-response` fell through to the Claude transcript scan for copilot (not in the external-CLI list), so `codeman agent read` answered empty even with an answer on screen. Copilot is a repainting full-screen TUI whose stream is absolute cursor moves, so the buffer cannot be cut into lines either; the route now reads the pane's visible screen (tmux capture-pane) for such modes and falls back to the buffer where there is no pane. The segmenter gets a small per-CLI "pane dialect" row instead of another branch in the Codex-oriented loop: `❯ <prompt> HH:MM`, `● <answer>` with indented continuation, the cwd / `Session: N AIC used` row, composer, footer and the `┃` scrollbar gutter are chrome, and everything before the first prompt (banner, trust dialog) is dropped so a session that has not been asked anything answers nothing rather than serving its logo. Fixture is a real Copilot 1.0.95 pane. Tool-call rows are not modelled and read as answer text.
This commit is contained in:
1 parent
d7c7564415
commit
89a82c68d1
3 files changed
+199
-2
No files matched your search
@@ -190,6 +190,7 @@ import { findLatestOmpSessionId } from '../../utils/omp-session-resolver.js';
|
||||
import { scanOmpSessionsHistory } from '../../omp-transcript.js';
|
||||
import { scanCodexSessionsHistory, codexThreadBySessionId } from '../../codex-transcript.js';
|
||||
import {
|
||||
transcriptNeedsScreenCapture,
|
||||
getLastTranscriptResponse,
|
||||
isExternalCliTranscriptMode,
|
||||
parseExternalCliTranscript,
|
||||
@@ -2818,7 +2819,14 @@ export function registerSessionRoutes(
|
||||
// where a real rollout file is the better source.
|
||||
if (isExternalCliTranscriptMode(session.mode)) {
|
||||
const externalQuery = req.query as { context?: string };
|
||||
const blocks = parseExternalCliTranscript(session.terminalBuffer, session.mode);
|
||||
// A repainting full-screen TUI (copilot) streams absolute cursor moves, not lines, so the
|
||||
// buffer cannot be segmented; read the pane's visible screen instead, and fall back to the
|
||||
// buffer when there is no tmux pane to ask (direct PTY, tests).
|
||||
const screen =
|
||||
transcriptNeedsScreenCapture(session.mode) && session.muxName
|
||||
? (ctx.mux.capturePaneText?.(session.muxName) ?? null)
|
||||
: null;
|
||||
const blocks = parseExternalCliTranscript(screen ?? session.terminalBuffer, session.mode);
|
||||
return {
|
||||
text: getLastTranscriptResponse(blocks),
|
||||
timestamp: '',
|
||||
|
||||
Reference in new issue
Block a user