UNPKG

@code-yeongyu/senpi

Version:

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

56 lines • 2.51 kB
import type { AssistantMessage, AssistantProgress } from "@earendil-works/pi-ai"; import type { JsonAgentSessionEvent } from "../json-event.ts"; import type { RpcCommand, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcQuestionResolvedEvent, RpcQuestionUpdatedEvent, RpcSecretInputSettledEvent, RpcResponse, RpcSessionStatusEvent } from "../rpc/rpc-types.ts"; export type AttachRecord = (Exclude<JsonAgentSessionEvent, { type: "message_update"; }> | (Extract<JsonAgentSessionEvent, { type: "message_update"; }> & { readonly message?: AssistantMessage | null; }) | Extract<AssistantProgress, { type: "message_tool_arguments_reset"; }> | RpcExtensionUIRequest | RpcSessionStatusEvent | RpcQuestionResolvedEvent | RpcQuestionUpdatedEvent | RpcSecretInputSettledEvent) & { readonly sessionId?: string; readonly entryId?: string; }; type Answer = Extract<RpcResponse, { success: true; }>; /** The endpoint refused an attachment the presentation asked for; `code` is machine-readable. */ export declare class AttachRefusedError extends Error { readonly code: "session_not_retained"; constructor(code: "session_not_retained", message: string); } /** The endpoint answered a dialog response with a refusal; `code` is the endpoint's error. */ export declare class AnswerRefusedError extends Error { readonly code: string; constructor(code: string); } /** A presentation-only socket client: it cannot spawn or fall back to an in-process runtime. */ export declare class AttachClient { private socket; private stopReading; private readonly pending; private closed; private failure; private readonly onRecord; private readonly onDisconnect; private readonly answerDeadlineMs; constructor(onRecord: (record: AttachRecord) => void, onDisconnect: (reason?: string) => void, options?: { readonly answerDeadlineMs?: number; }); connect(path: string): Promise<void>; request(command: RpcCommand & { readonly observe?: boolean; }): Promise<Answer>; /** Sends a dialog answer and settles when the endpoint accepts it; a refusal rejects with its code. */ answer(sessionId: string, response: RpcExtensionUIResponse): Promise<void>; close(): void; private track; /** One endpoint line. A record it cannot read or render ends the connection; it never throws to the socket. */ private receive; private fail; private rejectPending; } export {}; //# sourceMappingURL=attach-client.d.ts.map