@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
39 lines • 1.9 kB
TypeScript
import type { CredentialStore } from "@earendil-works/pi-ai";
import { type CursorCliAccountSlot } from "./accounts.ts";
import { type CursorAffinityOptions } from "./affinity.ts";
import { type CursorCliErrorClassification, type CursorCliErrorInput } from "./errors.ts";
export type CursorCliFailoverNotice = {
type: "cursor_account_changed";
message: string;
fromAccount: string;
toAccount: string;
freshChat: true;
priorContextCarriedOver: false;
};
export type CursorCliAttemptOptions = {
/** Cross-account Cursor chats cannot be resumed because each account has its own HOME. */
freshChat: boolean;
};
export type CursorCliFailoverOptions<TEvent> = {
store: CredentialStore;
providerId: string;
affinity?: CursorAffinityOptions;
runAttempt: (account: CursorCliAccountSlot, options: CursorCliAttemptOptions) => AsyncIterable<TEvent> | Promise<AsyncIterable<TEvent>>;
now?: () => number;
classify?: (input: CursorCliErrorInput) => CursorCliErrorClassification;
errorFromEvent?: (event: TEvent) => CursorCliErrorInput | undefined;
isVisibleAssistantDelta?: (event: TEvent) => boolean;
};
export declare class CursorCliFailoverError extends Error {
readonly classification: CursorCliErrorClassification;
readonly original: unknown;
readonly visibleAssistantDeltaEmitted: boolean;
constructor(classification: CursorCliErrorClassification, original: unknown, visibleAssistantDeltaEmitted: boolean);
}
/**
* Runs one Cursor CLI stream at a time and rotates accounts only before any
* assistant text is visible. Replacement accounts always start a fresh chat;
* this module never accepts or transfers a chat id or transcript context.
*/
export declare function runCursorCliFailover<TEvent>(options: CursorCliFailoverOptions<TEvent>): AsyncGenerator<TEvent | CursorCliFailoverNotice>;
//# sourceMappingURL=failover.d.ts.map