@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
21 lines • 943 B
JavaScript
export async function checkSessionReloadVeto(runner, isPromptStartPending, isSessionStartDispatching = () => false) {
if (isPromptStartPending()) {
return { cancelled: true, reason: "A prompt is being admitted." };
}
if (isSessionStartDispatching()) {
return { cancelled: true, reason: "A session is starting." };
}
const result = runner.hasHandlers("session_before_reload")
? await runner.emit({ type: "session_before_reload" })
: undefined;
if (isPromptStartPending()) {
return { cancelled: true, reason: "A prompt is being admitted." };
}
if (isSessionStartDispatching()) {
return { cancelled: true, reason: "A session is starting." };
}
if (result?.cancel !== true)
return { cancelled: false };
return result.reason === undefined ? { cancelled: true } : { cancelled: true, reason: result.reason };
}
//# sourceMappingURL=reload-veto.js.map