@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
149 lines • 6.09 kB
TypeScript
import { z } from "zod";
/** Custom transcript entry for every non-input effect; inputs keep `rpc_client_message_admission`. */
export declare const RPC_EFFECT_ENTRY = "rpc_effect";
export declare const EFFECT_LEDGER_CAPABILITY = "effect_ledger";
declare const actorSchema: z.ZodObject<{
connectionId: z.ZodString;
}, z.core.$strip>;
export type EffectActor = z.infer<typeof actorSchema>;
/**
* How an effect ended. `completed` needs no words; every other kind carries `reason` (the code) and
* `detail` (plain words), plus `action` whenever the caller can do something about it.
*/
export declare const effectOutcomeSchema: 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>;
export type EffectOutcome = z.infer<typeof effectOutcomeSchema>;
export interface QueuedChangeAnswer {
readonly text?: string;
readonly revision?: number;
readonly currentRevision?: number;
}
export type EffectKind = "input" | "abort" | "unload" | "set_model" | "set_thinking_level" | "dequeue" | "edit_queued";
export type EffectState = "accepted" | "applied" | "done" | "failed";
export declare const rpcEffectRecordSchema: z.ZodObject<{
effectId: z.ZodString;
kind: z.ZodEnum<{
abort: "abort";
dequeue: "dequeue";
edit_queued: "edit_queued";
set_model: "set_model";
set_thinking_level: "set_thinking_level";
unload: "unload";
}>;
state: z.ZodEnum<{
accepted: "accepted";
applied: "applied";
done: "done";
failed: "failed";
}>;
disposition: z.ZodOptional<z.ZodString>;
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>>;
answer: z.ZodOptional<z.ZodObject<{
text: z.ZodOptional<z.ZodString>;
revision: z.ZodOptional<z.ZodNumber>;
currentRevision: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
dropped: z.ZodOptional<z.ZodObject<{
deliveries: z.ZodArray<z.ZodString>;
}, z.core.$strip>>;
pending: z.ZodOptional<z.ZodObject<{
deliveries: z.ZodArray<z.ZodString>;
}, z.core.$strip>>;
by: z.ZodObject<{
connectionId: z.ZodString;
}, z.core.$strip>;
acceptedAt: z.ZodString;
updatedAt: z.ZodString;
durableSessionId: z.ZodString;
fingerprint: z.ZodString;
}, z.core.$strip>;
export type RpcEffectRecord = z.infer<typeof rpcEffectRecordSchema>;
/** The one answer `get_effect_status` and every effect command's response carry. */
export interface EffectStatus {
readonly effectId: string;
readonly kind: EffectKind;
readonly state: EffectState;
readonly disposition?: string;
readonly outcome?: EffectOutcome;
/** A queued-input change's answer fields (`text`/`revision` for edited, `currentRevision` for conflict). */
readonly answer?: QueuedChangeAnswer;
/** An interrupting unload's handed-back deliveries (`unload_session` `dropped`). */
readonly dropped?: {
readonly deliveries: readonly string[];
};
/** A refused unload's admitted deliveries not yet written (`unload_session` `pending`). */
readonly pending?: {
readonly deliveries: readonly string[];
};
readonly by?: EffectActor;
readonly acceptedAt?: string;
readonly updatedAt?: string;
/** The routing handle the effect is being answered on; absent when read from disk. */
readonly sessionId?: string;
readonly durableSessionId: string;
}
export declare function isTerminalEffectState(state: EffectState): boolean;
export declare class EffectIdConflict extends Error {
readonly code = "effect_id_conflict";
readonly effectId: string;
readonly reason = "effect_id_conflict: this effectId was already used for a different request";
readonly action = "send the request again with a new effectId";
constructor(effectId: string);
}
export type EffectCommandKind = "abort" | "set_model" | "set_thinking_level" | "unload" | "dequeue" | "edit_queued";
export declare function effectFingerprint(command: EffectCommandKind, payload: object): string;
export {};
//# sourceMappingURL=effect-record.d.ts.map