SPB Git

spb/khaelor Public

KHAELOR — a terminal-native autonomous engineering agent powered by Anthropic.

TypeScript 82.9% HTML 14.9% CSS 1.1% JavaScript 0.7%
1.1 KB · 42 lines typescript
Raw Blame History
1/**2 * KHAELOR3 * File: src/shared/errors.ts4 * Description: Typed error base — every KHAELOR failure carries a stable machine-readable code.5 *6 * Author: Simon-Pierre Boucher7 * Contact: contact@spboucher.ai8 */910/** Stable machine-readable error codes used across modules. */11export type KhaelorErrorCode =12  | "config-invalid"13  | "config-io"14  | "session-log-corrupted"15  | "session-log-io"16  | "store-write-failed"17  | "pairing-violation"18  | "invalid-event"19  | "internal";2021/**22 * Base error type. Messages must never contain secrets (API keys,23 * authorization headers) — callers are responsible for redaction24 * before constructing the message.25 */26export class KhaelorError extends Error {27  readonly code: KhaelorErrorCode;28  readonly details: Readonly<Record<string, unknown>>;2930  constructor(code: KhaelorErrorCode, message: string, details: Record<string, unknown> = {}) {31    super(message);32    this.name = "KhaelorError";33    this.code = code;34    this.details = details;35  }36}3738/** Narrowing helper. */39export function isKhaelorError(value: unknown): value is KhaelorError {40  return value instanceof KhaelorError;41}42