mirror of
https://github.com/stablyai/orca.git
synced 2026-10-28 16:02:55 +00:00
Explicit transcript turn-lifecycle markers now fully replace the prose-fallback settlement path. Remove the now-unused `turnLifecycleCapable` flag and wire lifecycle to suppress spinner even when hook status lingers. Refine Claude lifecycle detection to distinguish terminal stops from mid-turn tool_use rows, exclude harness noise from new-generation detection, and apply clock-skew slack over SSH/relay. Serialize PTY sends per line to prevent rapid prompts from gluing before Enter, clearing unsubmitted input on cancel. Update working suppression to detect epoch rollovers so interrupt+next-turn without a ready gap resets the spinner correctly.
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
// Shared detection of provider-authored turn boundaries. The message decoders
|
|
// render a visible status row from these lines; the lifecycle decoders settle
|
|
// the chat spinner from the same lines. Keeping the predicates here means the
|
|
// two consumers can never disagree about which JSONL line is an interrupt/abort
|
|
// or a turn boundary — updating a provider's format touches one place, so a
|
|
// rename can't leave a visible "interrupted" row that never settles (or vice
|
|
// versa).
|
|
|
|
import { extractString } from '../ai-vault/session-scanner-values'
|
|
|
|
/**
|
|
* The `interruptedMessageId` on a Claude user row when that row is Claude's
|
|
* injected interrupt notice rather than a real user prompt. Returns undefined
|
|
* for genuine user turns.
|
|
*/
|
|
export function claudeInterruptedMessageId(record: Record<string, unknown>): string | undefined {
|
|
if (record.type !== 'user') {
|
|
return undefined
|
|
}
|
|
return extractString(record.interruptedMessageId) ?? undefined
|
|
}
|
|
|
|
/** Codex `event_msg` payload types that bound a turn's lifecycle. */
|
|
export const CODEX_EVENT_TURN_STARTED = 'task_started'
|
|
export const CODEX_EVENT_TURN_COMPLETE = 'task_complete'
|
|
export const CODEX_EVENT_TURN_ABORTED = 'turn_aborted'
|