UNPKG

@code-yeongyu/senpi

Version:

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

25 lines • 887 B
/** An error raised by the operation layer itself; filesystem and spawn errors pass through unchanged. */ export class MachineOpError extends Error { constructor(code, message, options) { super(message, options); this.name = "MachineOpError"; this.code = code; } } const ERRNO_CODES = { ENOENT: "not_found", ENOTDIR: "not_found", EACCES: "permission_denied", EPERM: "permission_denied", ABORT_ERR: "aborted", }; /** Classify any error an operation rejected with, so a wire answer can carry one code. */ export function opErrorCode(error) { if (error instanceof MachineOpError) return error.code; if (typeof error === "object" && error !== null && "code" in error && typeof error.code === "string") { return ERRNO_CODES[error.code] ?? "io_error"; } return "io_error"; } //# sourceMappingURL=errors.js.map