UNPKG

pi-decider

Version:

Decision backends for pi and omp — TypeSafe Jev, OpenRouter's Decisions API, or an OpenAI-compatible chat proxy — exposed as one typed tool (noul / choice / score)

19 lines (16 loc) • 704 B
/** Shared error type so every failure path carries a status/hint the tool and command can print. */ export class JevError extends Error { readonly status: number | undefined; readonly hint: string | undefined; readonly body: string | undefined; constructor(message: string, options: { status?: number; hint?: string; body?: string; cause?: unknown } = {}) { super(message, options.cause === undefined ? undefined : { cause: options.cause }); this.name = "JevError"; this.status = options.status; this.hint = options.hint; this.body = options.body; } } export function messageOf(error: unknown): string { return error instanceof Error ? error.message : String(error); }