arela
Version:
AI-powered CTO with multi-agent orchestration, code summarization, visual testing (web + mobile) for blazing fast development.
86 lines • 2.61 kB
TypeScript
export interface EventFilters {
type?: string;
agent?: string;
startDate?: number;
endDate?: number;
limit?: number;
}
export interface AuditEvent {
id: string;
timestamp: number;
type: string;
agent: string;
data: Record<string, any>;
}
export interface Decision {
id: string;
title: string;
description: string;
rationale: string;
timestamp: number;
tags: string[];
}
export interface Change {
id: string;
file: string;
author: string;
timestamp: number;
description: string;
linesAdded: number;
linesRemoved: number;
}
export interface GovernanceStats {
totalEvents: number;
totalDecisions: number;
totalChanges: number;
eventsByType: Record<string, number>;
lastUpdated: number;
}
/**
* GovernanceMemory (Hexi-006)
*
* Thin wrapper over the existing audit log database (`.arela/memory/audit.db`)
* that exposes a higher-level query surface for governance / historical queries.
*
* NOTE: This does not modify the underlying audit schema; it simply reads from
* the existing `audit_log` table created by `AuditMemory`.
*/
export declare class GovernanceMemory {
private readonly cwd;
private dbPath;
constructor(cwd?: string);
/**
* Initialize governance memory for a project path.
* Ensures the underlying audit database exists and schema is ready.
*/
init(projectPath: string): Promise<void>;
/**
* Get raw events from the audit log with optional filtering.
* Filtering is done in memory for simplicity and to keep schema-agnostic.
*/
getEvents(filters?: EventFilters): Promise<AuditEvent[]>;
getEventsByType(type: string): Promise<AuditEvent[]>;
getEventsByAgent(agent: string): Promise<AuditEvent[]>;
getRecentEvents(limit: number): Promise<AuditEvent[]>;
/**
* Governance decisions derived from audit events with type === "decision".
* The event's metadata is expected to carry decision-specific fields.
*/
getDecisions(): Promise<Decision[]>;
getDecisionsByTag(tag: string): Promise<Decision[]>;
/**
* Change events derived from audit events with type === "change".
*/
getChanges(filePath?: string): Promise<Change[]>;
getChangesByAuthor(author: string): Promise<Change[]>;
/**
* Aggregate governance statistics from the audit log.
*/
getStats(): Promise<GovernanceStats>;
private openDb;
private rowToEvent;
private parseTimestamp;
private safeParseJson;
private normalizePath;
}
//# sourceMappingURL=governance.d.ts.map