@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
22 lines • 1.33 kB
TypeScript
import type { UserMessage } from "@earendil-works/pi-ai";
export type UserEditReason = "empty" | "not-user" | "not-found" | "stale-leaf";
/** Wire-level code for a user-edit failure; stable across transports. */
export type UserEditCode = "empty" | "not_user" | "not_found" | "stale_leaf";
export declare class UserEditError extends Error {
readonly reason: UserEditReason;
constructor(reason: UserEditReason, message: string);
get code(): UserEditCode;
}
/**
* Optimistic-concurrency guard for the user-edit surface: the caller's leaf token must equal the
* session's current leaf. Mirrors `assertExpectedLeaf` so a user edit reports its own error type.
*/
export declare function assertExpectedUserLeaf(expectedLeafId: string | undefined, currentLeafId: string | null): void;
export declare function userTextEquals(original: UserMessage, text: string): boolean;
/**
* Text replaces every text block; every other block is carried over untouched. Unlike an edited
* assistant response - whose thinking and tool calls belong to the abandoned branch - a prompt's
* attachments are the user's own input, so dropping them would destroy data the model still needs.
*/
export declare function buildEditedUserMessage(original: UserMessage, text: string): UserMessage;
//# sourceMappingURL=edited-user-message.d.ts.map