Implements persistent storage for historical session analytics: - Add HistoricalStore class using better-sqlite3 - Schema includes sessions, task_metrics, and error_history tables - Session management: start/end sessions with worker/task/cost metrics - Task metrics: record per-bead completion times, costs, tokens - Error history: track errors with resolution status - Historical queries: worker comparison across sessions - Learned recoveries: extract patterns from historical error resolutions - Integration with EventStore for automatic session persistence - Historical query methods in WorkerAnalytics - Enhanced recovery suggestions using historical data in RecoveryManager - Comprehensive unit tests (20 passing tests) Database stored at ~/.needle/fabric.db for cross-session persistence. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Worker <noreply@anthropic.com>
39 lines
1,014 B
TypeScript
39 lines
1,014 B
TypeScript
/**
|
|
* FABRIC - Flow Analysis & Bead Reporting Interface Console
|
|
*
|
|
* A live display for NEEDLE worker activity.
|
|
*/
|
|
|
|
export const VERSION = '0.1.0';
|
|
|
|
export interface LogEvent {
|
|
ts: number;
|
|
worker: string;
|
|
level: 'debug' | 'info' | 'warn' | 'error';
|
|
msg: string;
|
|
[key: string]: unknown;
|
|
}
|
|
|
|
export interface WorkerState {
|
|
id: string;
|
|
status: 'active' | 'idle' | 'error';
|
|
lastEvent?: LogEvent;
|
|
beadsCompleted: number;
|
|
}
|
|
|
|
// Re-export submodules
|
|
export * from './types.js';
|
|
export { SessionDigestGenerator, formatDigestAsMarkdown } from './sessionDigest.js';
|
|
export { WorkerAnalytics, getWorkerAnalytics, resetWorkerAnalytics } from './workerAnalytics.js';
|
|
export { SemanticNarrativeGenerator, getSemanticNarrativeManager } from './semanticNarrative.js';
|
|
export {
|
|
HistoricalStore,
|
|
getHistoricalStore,
|
|
resetHistoricalStore,
|
|
SessionRecord,
|
|
TaskMetricsRecord,
|
|
ErrorHistoryRecord,
|
|
HistoricalQueryOptions,
|
|
WorkerComparisonMetrics,
|
|
LearnedRecoveryEntry,
|
|
} from './historicalStore.js';
|