@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
18 lines • 990 B
JavaScript
import { SessionPendingInputs } from "../pending-input-session.js";
import { SessionManager } from "../session-manager.js";
/**
* Puts input a move took out of a session back into its pending-input journal, as follow-ups in their original
* order. Each gets the id `move:<moveId>:<index>`, so running this twice admits each input once: the second pass is
* answered from the journal (`replayed`). The session restores them to its queue when it is next opened.
*/
export async function requeueInput(sessionFile, moveId, texts) {
if (texts.length === 0)
return;
const sessionManager = await SessionManager.openAsync(sessionFile);
let next = 0;
const inputs = new SessionPendingInputs({ sessionManager, nextQueuedId: () => `move-${moveId}-${next++}` });
for (const [index, text] of texts.entries()) {
await inputs.admit({ clientMessageId: `move:${moveId}:${index}`, text, mode: "followUp" }, () => undefined);
}
}
//# sourceMappingURL=requeue.js.map