Replace assistant-prose heuristic with explicit turn lifecycle markers

Extract provider-authored turn boundaries (completion, interruption) directly
from Claude/Codex transcripts so the chat view knows when work ends without
guessing from message presence. Reconciles live hook state with transcript
lifecycle: when a terminal boundary lands, it settles a dropped Stop hook
instead of letting prose mislead the UI into showing 'working' after done.
This commit is contained in:
Jinjing
2026-07-16 20:51:20 -07:00
parent cc1ad064d7
commit c717bcaec8
32 changed files with 1551 additions and 206 deletions
+10 -2
View File
@@ -1,5 +1,9 @@
import { createReadStream } from 'node:fs'
import type { AgentType, NativeChatMessage } from '../../shared/native-chat-types'
import type {
AgentType,
NativeChatMessage,
NativeChatTurnLifecycle
} from '../../shared/native-chat-types'
import { resolveNativeChatTranscriptAgent } from '../../shared/native-chat-agent-support'
import { errorMessage } from '../ai-vault/session-scanner-values'
import { resolveSessionFilePath, type ResolveSessionFileOptions } from './session-file-resolver'
@@ -11,7 +15,11 @@ import {
import { decodeTranscriptStream } from './transcript-stream-lines'
export type ReadTranscriptResult =
| { messages: NativeChatMessage[] }
| {
messages: NativeChatMessage[]
lifecycle?: NativeChatTurnLifecycle
turnLifecycleCapable?: boolean
}
// notFound marks a retry-worthy miss (transcript not flushed to disk yet,
// #8401) as opposed to a real parse/IO error callers surface immediately.
| { error: string; notFound?: true }