@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
20 lines • 883 B
JavaScript
/** Appends a rung failure unless it repeats the last one (one failure can be offered to the walk twice). */
export function recordRungFailure(failures, failure) {
const last = failures.at(-1);
if (last && last.model === failure.model && last.error === failure.error)
return;
failures.push(failure);
}
/**
* The exhaustion text every surface shows: the failure that started the walk first, then each later rung
* (senpi#4084). Without recorded rungs it falls back to the last error, as older events carried only that.
*/
export function describeFallbackExhaustion(event) {
const failures = event.failures ?? [];
if (failures.length === 0)
return event.lastError;
return failures
.map((failure, index) => `${index === 0 ? "" : "then "}${failure.model}: ${failure.error}`)
.join("\n");
}
//# sourceMappingURL=exhaustion.js.map