mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
Split 1,443-line types.ts into 14 focused domain files under src/types/: common.ts, session.ts, task.ts, app-state.ts, respawn.ts, ralph.ts, api.ts, lifecycle.ts, run-summary.ts, tools.ts, teams.ts, push.ts, plan.ts, and index.ts barrel. Moved PlanItem interface from plan-orchestrator.ts into types/plan.ts to break circular dependency. Original types.ts replaced with barrel re-export — zero changes to 36 import sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
117 lines
2.9 KiB
TypeScript
117 lines
2.9 KiB
TypeScript
/**
|
|
* @fileoverview Run summary type definitions
|
|
*/
|
|
|
|
/**
|
|
* Types of events tracked in the run summary.
|
|
* These provide a historical view of what happened during a session.
|
|
*/
|
|
export type RunSummaryEventType =
|
|
| 'session_started'
|
|
| 'session_stopped'
|
|
| 'respawn_cycle_started'
|
|
| 'respawn_cycle_completed'
|
|
| 'respawn_state_change'
|
|
| 'error'
|
|
| 'warning'
|
|
| 'token_milestone'
|
|
| 'auto_compact'
|
|
| 'auto_clear'
|
|
| 'idle_detected'
|
|
| 'working_detected'
|
|
| 'ralph_completion'
|
|
| 'ai_check_result'
|
|
| 'hook_event'
|
|
| 'state_stuck';
|
|
|
|
/**
|
|
* Severity levels for run summary events.
|
|
*/
|
|
export type RunSummaryEventSeverity = 'info' | 'warning' | 'error' | 'success';
|
|
|
|
/**
|
|
* A single event in the run summary timeline.
|
|
*/
|
|
export interface RunSummaryEvent {
|
|
/** Unique event identifier */
|
|
id: string;
|
|
/** Timestamp when event occurred */
|
|
timestamp: number;
|
|
/** Type of event */
|
|
type: RunSummaryEventType;
|
|
/** Severity level for display */
|
|
severity: RunSummaryEventSeverity;
|
|
/** Short title for the event */
|
|
title: string;
|
|
/** Optional detailed description */
|
|
details?: string;
|
|
/** Optional additional metadata */
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
/**
|
|
* Statistics aggregated from run summary events.
|
|
*/
|
|
export interface RunSummaryStats {
|
|
/** Number of respawn cycles completed */
|
|
totalRespawnCycles: number;
|
|
/** Total tokens used during this run */
|
|
totalTokensUsed: number;
|
|
/** Peak token count observed */
|
|
peakTokens: number;
|
|
/** Total time Claude was actively working (ms) */
|
|
totalTimeActiveMs: number;
|
|
/** Total time Claude was idle (ms) */
|
|
totalTimeIdleMs: number;
|
|
/** Number of errors encountered */
|
|
errorCount: number;
|
|
/** Number of warnings encountered */
|
|
warningCount: number;
|
|
/** Number of AI idle checks performed */
|
|
aiCheckCount: number;
|
|
/** Timestamp when last became idle */
|
|
lastIdleAt: number | null;
|
|
/** Timestamp when last started working */
|
|
lastWorkingAt: number | null;
|
|
/** Total number of state transitions */
|
|
stateTransitions: number;
|
|
}
|
|
|
|
/**
|
|
* Complete run summary for a session.
|
|
* Provides a historical view of session activity for users returning after absence.
|
|
*/
|
|
export interface RunSummary {
|
|
/** Session ID this summary belongs to */
|
|
sessionId: string;
|
|
/** Session display name */
|
|
sessionName: string;
|
|
/** Timestamp when tracking started */
|
|
startedAt: number;
|
|
/** Timestamp of last update */
|
|
lastUpdatedAt: number;
|
|
/** Timeline of events (most recent last) */
|
|
events: RunSummaryEvent[];
|
|
/** Aggregated statistics */
|
|
stats: RunSummaryStats;
|
|
}
|
|
|
|
/**
|
|
* Creates initial run summary stats.
|
|
*/
|
|
export function createInitialRunSummaryStats(): RunSummaryStats {
|
|
return {
|
|
totalRespawnCycles: 0,
|
|
totalTokensUsed: 0,
|
|
peakTokens: 0,
|
|
totalTimeActiveMs: 0,
|
|
totalTimeIdleMs: 0,
|
|
errorCount: 0,
|
|
warningCount: 0,
|
|
aiCheckCount: 0,
|
|
lastIdleAt: null,
|
|
lastWorkingAt: null,
|
|
stateTransitions: 0,
|
|
};
|
|
}
|