/** * G3 (2026-08-13): 操作级审计日志(借鉴 devtool audit.jsonl,附录 F.3)。 * * 修复 devtool 的 writeFile read-modify-write 并发竞态(workflowAutomation.ts:267) * ——改用 fs/promises.appendFile(O_APPEND 内核原子,; }): boolean; /** audit 条目(对齐 devtool AuditEntry 5 字段 + enhanced 适配 trace_id/risk/ok)。 */ export interface AuditEntry { timestamp: string; trace_id: string; tool: string; action: string; risk: RiskLevel; ok: boolean; project_path: string; changed_files: string[]; duration_ms: number; details?: { before_values?: Record; batch?: boolean; truncated?: boolean; confirmed?: boolean; [key: string]: unknown; }; } /** * 原子追加一条 audit(appendFile O_APPEND,修复 devtool writeFile 竞态)。 * 审计失败应由调用方 catch(不影响工具结果,对齐 G2 catch 哲学)。 */ export declare function appendAuditLine(projectPath: string, entry: AuditEntry): Promise; /** audit 回放只读统计(不真重放执行,对齐 devtool buildAuditReplay)。 */ export interface AuditReplaySummary { totalEntries: number; timeRange: { first?: string; last?: string; }; operationCounts: Record; changedFileCounts: Record; riskHighlights: { index: number; entry: AuditEntry; reason: string; }[]; parseErrors: number; entries: (AuditEntry & { index: number; })[]; } /** 读 audit.jsonl + 只读统计。limit 取末尾 N 条;since 过滤时间。 */ export declare function readAuditLog(projectPath: string, opts?: { limit?: number; since?: string; }): Promise; /** * 从 args 推断 changed_files(阶段1 MVP)。 * 限制:project_replace/create_project 批量场景只能给主路径 + batch 标记, * 完整文件集要阶段2(工具显式上报 ToolContext.audit 收集器)。 */ export declare function inferChangedFiles(tool: string, action: string, args: Record, projectPath?: string): { files: string[]; batch: boolean; }; export interface RollbackSuggestion { supported: boolean; suggestions: string[]; } /** 对单条 audit entry 生成诚实回滚建议(不自动执行,对齐 devtool suggestRollback)。 */ export declare function suggestRollback(entry: AuditEntry): RollbackSuggestion; /** 机器级审计文件:~/.godot-mcp/machine-audit.jsonl(机器级目录惯例)。 */ export declare function getMachineAuditFile(): string; /** 追加一条机器级审计行(timestamp 由本函数补)。 */ export declare function appendMachineAuditLine(entry: Omit): Promise;