export declare const AGENT_LOOP_SETTINGS_KEY = "agent-loop"; /** * Now that the budget is terminal rather than self-resetting, this has to clear * real deep work: production contains a legitimate 117-tool-call analysis, so * the old 100 would have cut it off. Runaway turns are caught by repetition * detection (`MAX_IDENTICAL_TOOL_CALLS`), not by this ceiling. */ export declare const DEFAULT_AGENT_MAX_ITERATIONS = 400; export declare const MIN_AGENT_MAX_ITERATIONS = 1; export declare const MAX_AGENT_MAX_ITERATIONS = 1000; /** * Per-TURN input-token ceiling. Iteration count and wall clock alone do not * bound spend: cost grows quadratically with tool-call count because every * retained tool result is re-sent on each iteration. A measured worst-case * production chunk consumed 16.06M input tokens; a normal turn is well under * 150k. * * Deliberately set ABOVE that worst case: this is a runaway backstop, not a * work limit. A deep multi-source analysis is allowed to be expensive — the * cheap-query-that-spirals case it was meant to catch is caught earlier and * more precisely by repetition detection. */ export declare const DEFAULT_AGENT_MAX_RUN_INPUT_TOKENS = 20000000; export declare const MIN_AGENT_MAX_RUN_INPUT_TOKENS = 10000; export declare const MAX_AGENT_MAX_RUN_INPUT_TOKENS = 200000000; export type AgentLoopSettingsScope = "org" | "user" | "default"; export type AgentLoopSettingsSource = "org" | "user" | "env" | "default"; export interface AgentLoopSettings { maxIterations: number; defaultMaxIterations: number; minMaxIterations: number; maxMaxIterations: number; /** Per-turn input-token ceiling — see DEFAULT_AGENT_MAX_RUN_INPUT_TOKENS. */ maxRunInputTokens: number; defaultMaxRunInputTokens: number; scope: AgentLoopSettingsScope; source: AgentLoopSettingsSource; } export declare function normalizeMaxIterations(value: unknown, fallback?: number): number; export declare function validateMaxIterationsInput(value: unknown): { ok: true; value: number; } | { ok: false; error: string; }; export declare function normalizeMaxRunInputTokens(value: unknown, fallback?: number): number; export declare function validateMaxRunInputTokensInput(value: unknown): { ok: true; value: number; } | { ok: false; error: string; }; export declare function getDefaultMaxRunInputTokens(): number; export declare function getDefaultMaxIterations(): number; export declare function readAgentLoopSettings(ctx: { userEmail?: string | null; orgId?: string | null; }): Promise; export declare function writeAgentLoopSettings(ctx: { userEmail?: string | null; orgId?: string | null; }, maxIterations: number, maxRunInputTokens?: number): Promise; export declare function resetAgentLoopSettings(ctx: { userEmail?: string | null; orgId?: string | null; }): Promise; export declare function canUpdateAgentLoopSettings(userEmail: string | null | undefined, orgId: string | null | undefined): Promise; //# sourceMappingURL=loop-settings.d.ts.map