UNPKG

@code-yeongyu/senpi

Version:

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

114 lines • 4.64 kB
import { z } from "zod"; import type { RpcCommand } from "./rpc-types.ts"; export declare const CLIENT_ADMISSION_ENTRY = "rpc_client_message_admission"; /** Prefix of a `clientMessageId` the host minted for an id-less queued input; never shown to a client as its own. */ export declare const HOST_MINTED_ID_PREFIX = "host:"; export declare function isHostMintedId(id: string | undefined): boolean; /** The identity a client may see: a host-minted `clientMessageId` is internal and dropped. */ export declare function clientFacingIdentity<T extends { readonly clientMessageId?: string; }>(value: T): T; export declare const DURABLE_CLIENT_MESSAGE_ID_CAPABILITY = "durable_client_message_id"; export type RpcClientInput = Extract<RpcCommand, { type: "prompt" | "steer" | "follow_up"; }>; export declare const clientAdmissionRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ clientTurnId: z.ZodOptional<z.ZodString>; clientMessageId: z.ZodString; durableSessionId: z.ZodString; fingerprint: z.ZodString; disposition: z.ZodEnum<{ handled: "handled"; queued: "queued"; started: "started"; }>; turnId: z.ZodOptional<z.ZodString>; hostMinted: z.ZodOptional<z.ZodLiteral<true>>; state: z.ZodLiteral<"queued">; prepared: z.ZodObject<{ clientMessageId: z.ZodOptional<z.ZodString>; clientTurnId: z.ZodOptional<z.ZodString>; text: z.ZodString; images: z.ZodOptional<z.ZodArray<z.ZodObject<{ type: z.ZodLiteral<"image">; data: z.ZodString; mimeType: z.ZodString; }, z.core.$strip>>>; mode: z.ZodEnum<{ followUp: "followUp"; steer: "steer"; }>; enqueueOrder: z.ZodNumber; source: z.ZodOptional<z.ZodEnum<{ extension: "extension"; interactive: "interactive"; rpc: "rpc"; }>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ clientTurnId: z.ZodOptional<z.ZodString>; clientMessageId: z.ZodString; durableSessionId: z.ZodString; fingerprint: z.ZodString; disposition: z.ZodEnum<{ handled: "handled"; queued: "queued"; started: "started"; }>; turnId: z.ZodOptional<z.ZodString>; hostMinted: z.ZodOptional<z.ZodLiteral<true>>; state: z.ZodLiteral<"running">; prepared: z.ZodOptional<z.ZodUndefined>; }, z.core.$strip>, z.ZodObject<{ clientTurnId: z.ZodOptional<z.ZodString>; clientMessageId: z.ZodString; durableSessionId: z.ZodString; fingerprint: z.ZodString; disposition: z.ZodEnum<{ handled: "handled"; queued: "queued"; started: "started"; }>; turnId: z.ZodOptional<z.ZodString>; hostMinted: z.ZodOptional<z.ZodLiteral<true>>; state: z.ZodLiteral<"completed">; prepared: z.ZodOptional<z.ZodUndefined>; outcome: z.ZodOptional<z.ZodObject<{ kind: z.ZodEnum<{ aborted: "aborted"; already_delivered: "already_delivered"; cleared: "cleared"; cleared_by_abort: "cleared_by_abort"; completed: "completed"; conflict: "conflict"; context_budget: "context_budget"; deadline: "deadline"; dropped_by_replace: "dropped_by_replace"; error: "error"; interrupted_by_reopen: "interrupted_by_reopen"; not_found: "not_found"; provider_unavailable: "provider_unavailable"; refused: "refused"; superseded: "superseded"; unknown_model: "unknown_model"; unsupported_thinking_level: "unsupported_thinking_level"; }>; reason: z.ZodOptional<z.ZodString>; detail: z.ZodOptional<z.ZodString>; action: z.ZodOptional<z.ZodString>; abortSource: z.ZodOptional<z.ZodString>; abortedBy: z.ZodOptional<z.ZodObject<{ connectionId: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>], "state">; export type ClientAdmissionRecord = z.infer<typeof clientAdmissionRecordSchema>; export type ClientMessageAdmission = Omit<ClientAdmissionRecord, "fingerprint" | "prepared">; export declare function admissionSnapshot(record: ClientAdmissionRecord): ClientMessageAdmission; export declare class ClientMessageIdConflict extends Error { readonly code = "client_message_id_conflict"; readonly clientMessageId: string; constructor(clientMessageId: string); } export declare function clientInputFingerprint(command: RpcClientInput): string; //# sourceMappingURL=client-admission-record.d.ts.map