@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
17 lines • 856 B
JavaScript
import { isContextOverflow } from "@earendil-works/pi-ai";
/**
* A turn that context size prevented from producing anything usable: the
* provider rejected the request outright, or it accepted the request but had no
* room left for output (truncating providers report a zero-output "length" stop).
* Such a session cannot move by re-sending the same context, so its recovery
* runs even when the user switched proactive auto-compaction off (#1422).
* A completed answer whose usage merely exceeds the window is not stuck.
*/
export function isTurnStuckOnContextOverflow(message, contextWindow) {
if (!isContextOverflow(message, contextWindow))
return false;
if (message.stopReason === "error")
return true;
return message.stopReason === "length" && message.usage.output === 0;
}
//# sourceMappingURL=stuck-overflow.js.map