/** * src/core/SafetyGuard.ts * * Enforces safety limits on agent execution. Every tool invocation, stream * event, and session duration is counted and capped. Loop detection prevents * runaway edits to the same file. * * Implements docs/architecture/built-in-tools.md safety caps and * docs/architecture/operating-modes.md permission profiles. */ import type { PermissionProfile } from '../members/types.ts'; export interface SafetyCaps { maxStreamEvents: number; maxToolInvocations: number; maxSessionRuntimeMs: number; maxFileEditsPerFile: number; maxTerminalCommands: number; maxWebSearches: number; } export declare class SafetyLimitError extends Error { constructor(limit: string, current: number, max: number); } export declare class LoopDetectedError extends Error { constructor(filePath: string, edits: number); } export declare class CatastrophicCommandError extends Error { constructor(command: string); } export declare class SafetyGuard { private profile; private caps; private sessionStart; private streamEvents; private toolInvocations; private terminalCommands; private webSearches; private fileEditCounts; private loopThreshold; constructor(caps?: Partial, profile?: PermissionProfile); /** Check whether a terminal command is permitted given the profile. */ checkCommand(command: string): void; /** Count a tool invocation and check the cap. */ countToolInvocation(): void; /** Count a stream event and check the cap. */ countStreamEvent(): void; /** Check session runtime. */ checkSessionRuntime(): void; /** Register a file edit for loop detection. */ registerFileEdit(filePath: string): void; /** Register a web search. */ registerWebSearch(): void; /** Whether a file has exceeded the loop threshold. */ hasLoop(filePath: string): boolean; /** Remaining budget summary. */ remainingBudget(): Record; /** Reset all counters for a new session. */ reset(): void; } //# sourceMappingURL=SafetyGuard.d.ts.map