Standalone npm package (@mosaicstack/telemetry-client) for reporting task-completion telemetry and querying predictions from the Mosaic Stack Telemetry server. - TelemetryClient with setInterval-based background flush - EventQueue (bounded FIFO array) - BatchSubmitter with native fetch, exponential backoff, Retry-After - PredictionCache (Map + TTL) - EventBuilder with auto-generated event_id/timestamp - Zero runtime dependencies (Node 18+ native APIs) - 43 tests, 86% branch coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
95 lines
2.0 KiB
TypeScript
95 lines
2.0 KiB
TypeScript
export enum TaskType {
|
|
PLANNING = 'planning',
|
|
IMPLEMENTATION = 'implementation',
|
|
CODE_REVIEW = 'code_review',
|
|
TESTING = 'testing',
|
|
DEBUGGING = 'debugging',
|
|
REFACTORING = 'refactoring',
|
|
DOCUMENTATION = 'documentation',
|
|
CONFIGURATION = 'configuration',
|
|
SECURITY_AUDIT = 'security_audit',
|
|
UNKNOWN = 'unknown',
|
|
}
|
|
|
|
export enum Complexity {
|
|
LOW = 'low',
|
|
MEDIUM = 'medium',
|
|
HIGH = 'high',
|
|
CRITICAL = 'critical',
|
|
}
|
|
|
|
export enum Harness {
|
|
CLAUDE_CODE = 'claude_code',
|
|
OPENCODE = 'opencode',
|
|
KILO_CODE = 'kilo_code',
|
|
AIDER = 'aider',
|
|
API_DIRECT = 'api_direct',
|
|
OLLAMA_LOCAL = 'ollama_local',
|
|
CUSTOM = 'custom',
|
|
UNKNOWN = 'unknown',
|
|
}
|
|
|
|
export enum Provider {
|
|
ANTHROPIC = 'anthropic',
|
|
OPENAI = 'openai',
|
|
OPENROUTER = 'openrouter',
|
|
OLLAMA = 'ollama',
|
|
GOOGLE = 'google',
|
|
MISTRAL = 'mistral',
|
|
CUSTOM = 'custom',
|
|
UNKNOWN = 'unknown',
|
|
}
|
|
|
|
export enum QualityGate {
|
|
BUILD = 'build',
|
|
LINT = 'lint',
|
|
TEST = 'test',
|
|
COVERAGE = 'coverage',
|
|
TYPECHECK = 'typecheck',
|
|
SECURITY = 'security',
|
|
}
|
|
|
|
export enum Outcome {
|
|
SUCCESS = 'success',
|
|
FAILURE = 'failure',
|
|
PARTIAL = 'partial',
|
|
TIMEOUT = 'timeout',
|
|
}
|
|
|
|
export enum RepoSizeCategory {
|
|
TINY = 'tiny',
|
|
SMALL = 'small',
|
|
MEDIUM = 'medium',
|
|
LARGE = 'large',
|
|
HUGE = 'huge',
|
|
}
|
|
|
|
export interface TaskCompletionEvent {
|
|
instance_id: string;
|
|
event_id: string;
|
|
schema_version: string;
|
|
timestamp: string;
|
|
task_duration_ms: number;
|
|
task_type: TaskType;
|
|
complexity: Complexity;
|
|
harness: Harness;
|
|
model: string;
|
|
provider: Provider;
|
|
estimated_input_tokens: number;
|
|
estimated_output_tokens: number;
|
|
actual_input_tokens: number;
|
|
actual_output_tokens: number;
|
|
estimated_cost_usd_micros: number;
|
|
actual_cost_usd_micros: number;
|
|
quality_gate_passed: boolean;
|
|
quality_gates_run: QualityGate[];
|
|
quality_gates_failed: QualityGate[];
|
|
context_compactions: number;
|
|
context_rotations: number;
|
|
context_utilization_final: number;
|
|
outcome: Outcome;
|
|
retry_count: number;
|
|
language?: string | null;
|
|
repo_size_category?: RepoSizeCategory | null;
|
|
}
|