- Hybrid BM25 + HNSW vector search with context enrichment - Knowledge graph with entities, relations, and community detection - Host-following LLM route with fallback backends - 3-tier lint system (static + HNSW dup + contradiction detection) - Q&A Synthesis (Karpathy LLM Wiki pattern) - 16 MCP tools for agent-driven workflows - Incremental wiki generation with checkpointing - SQLite-backed item store with FTS5 + vector indexes
118 lines
2.8 KiB
TypeScript
118 lines
2.8 KiB
TypeScript
/**
|
|
* Base project error with a stable code.
|
|
*/
|
|
export class WikiEngineError extends Error {
|
|
public readonly code: string;
|
|
public override readonly cause?: Error;
|
|
|
|
/**
|
|
* Creates a typed project error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param code Stable machine-readable error code.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, code: string, cause?: Error) {
|
|
super(message);
|
|
this.name = "WikiEngineError";
|
|
this.code = code;
|
|
this.cause = cause;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error thrown when vault initialization fails.
|
|
*/
|
|
export class VaultInitError extends WikiEngineError {
|
|
/**
|
|
* Creates a vault initialization error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, cause?: Error) {
|
|
super(message, "VAULT_INIT_FAILED", cause);
|
|
this.name = "VaultInitError";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error thrown when reading the MemPalace database fails.
|
|
*/
|
|
export class DbReadError extends WikiEngineError {
|
|
/**
|
|
* Creates a database read error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, cause?: Error) {
|
|
super(message, "DB_READ_FAILED", cause);
|
|
this.name = "DbReadError";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error thrown when the LLM backend call fails.
|
|
*/
|
|
export class LlmCallError extends WikiEngineError {
|
|
/**
|
|
* Creates an LLM call error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, cause?: Error) {
|
|
super(message, "LLM_CALL_FAILED", cause);
|
|
this.name = "LlmCallError";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error thrown when git synchronization fails.
|
|
*/
|
|
export class GitSyncError extends WikiEngineError {
|
|
/**
|
|
* Creates a git sync error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, cause?: Error) {
|
|
super(message, "GIT_SYNC_FAILED", cause);
|
|
this.name = "GitSyncError";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error thrown when vault linting fails.
|
|
*/
|
|
export class LintError extends WikiEngineError {
|
|
/**
|
|
* Creates a lint error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, cause?: Error) {
|
|
super(message, "LINT_FAILED", cause);
|
|
this.name = "LintError";
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Error thrown when configuration loading fails.
|
|
*/
|
|
export class ConfigError extends WikiEngineError {
|
|
/**
|
|
* Creates a configuration error.
|
|
*
|
|
* @param message Human-readable error message.
|
|
* @param cause Optional underlying cause.
|
|
*/
|
|
constructor(message: string, cause?: Error) {
|
|
super(message, "CONFIG_LOAD_FAILED", cause);
|
|
this.name = "ConfigError";
|
|
}
|
|
}
|