#!/usr/bin/env node /** * Forgen — PostToolUse Hook * * 도구 실행 후 결과 검증 + 파일 변경 추적. * Compound/workflow 핸들러는 ./post-tool-handlers.ts에 분리. */ import { type DriftState } from '../core/drift-score.js'; interface ModifiedFilesState { sessionId: string; files: Record; toolCallCount: number; /** Track recent write content hashes for revert detection */ recentWrites?: Record; /** Drift detection state */ drift?: DriftState; /** * TEST-2 support: 최근 N개 tool 이름 (가장 최근이 마지막). 세션 시작 이래 누적된 * 도구 이름을 그대로 끝까지 보관하면 메모리 낭비이므로 slice window. * stop-guard 가 "측정 도구 호출 수" 를 빠르게 계산. */ recentToolNames?: string[]; } export declare const ERROR_PATTERNS: Array<{ pattern: RegExp; description: string; }>; export declare function detectErrorPattern(text: string): { pattern: RegExp; description: string; } | null; export interface AgentValidationResult { signal: string; severity: 'info' | 'warning' | 'error'; message: string; } export declare function validateAgentOutput(toolResponse: unknown): AgentValidationResult | null; export declare function trackModifiedFile(state: ModifiedFilesState, filePath: string, toolName: string): { state: ModifiedFilesState; count: number; }; export {};