UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

20 lines • 820 B
/** Process-local cursors spread new affinity keys; remembered choices keep their prompt caches local. */ class RoundRobinState { #providers = new Map(); session(provider, affinityKey) { let state = this.#providers.get(provider); if (state === undefined) { state = { next: 0, sessions: new Map() }; this.#providers.set(provider, state); } const held = affinityKey === undefined ? undefined : state.sessions.get(affinityKey); if (held !== undefined) return held; const session = { offset: state.next++ }; if (affinityKey !== undefined) state.sessions.set(affinityKey, session); return session; } } export const roundRobinState = new RoundRobinState(); //# sourceMappingURL=round-robin-state.js.map