@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
56 lines • 2.05 kB
TypeScript
import { z } from "zod";
import type { RpcCommand, RpcResponse } from "./rpc-types.ts";
export type RpcOpenOptions = Omit<Extract<RpcCommand, {
type: "open_session";
}>, "type" | "id">;
export type LegacyOpenResult = Extract<RpcResponse, {
command: "open_session";
success: true;
}>["data"];
declare const routeSchema: z.ZodObject<{
sessionId: z.ZodString;
admissionId: z.ZodString;
generation: z.ZodNumber;
token: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type CompactOpenResult = z.infer<typeof routeSchema> & {
readonly recovery: {
readonly token: string;
readonly componentRef: string;
};
};
type Send = (command: RpcCommand) => Promise<RpcResponse>;
/** Pre-send admission routes and event-driven repair. No prompt, mutable-root fallback, timer or retry loop. */
export declare class RpcClientAdmissions {
private readonly routes;
/**
* Admission IDs this client instance sent, kept across reconnects (RULING-125): a re-send is a C4.4 retry and
* carries `retry: true`, so a new socket that does not know the ID answers admission_unknown instead of opening.
*/
private readonly sent;
private readonly send;
private serial;
constructor(send: Send);
clear(): void;
/** Record a send of `admissionId` as the most recent one; true when this client sent it before. */
private remember;
receive(input: unknown): void;
private accept;
open(options: RpcOpenOptions & {
admissionId: string;
}): Promise<CompactOpenResult>;
page(admissionId: string, componentRef: string, cursor?: string): Promise<{
readonly action: "wait";
readonly retryAfterMs: number;
} | {
readonly action: "ready";
readonly response: RpcResponse;
readonly identity?: undefined;
} | {
readonly action: "restart_from_catalog";
readonly response: RpcResponse;
readonly identity: CompactOpenResult;
}>;
}
export {};
//# sourceMappingURL=rpc-client-admissions.d.ts.map