import type { AurixConfig } from './Config.js'; import { type PromptSurface } from './Context.js'; import type { Message } from '../providers/index.js'; import { TokenLedger } from './TokenCounter.js'; import type { ToolRegistry } from '../tools/Registry.js'; import { type ContextStats } from './ContextManager.js'; import { MemoryEngine } from './MemoryEngine.js'; import type { ResearchDepth } from './research/types.js'; import { type SessionSummary } from './SessionStore.js'; import type { SessionStore } from './SessionStore.js'; import { type ModelContextInfo, type ModelContextResolveOptions } from './ModelContext.js'; /** * Turns that are recognisably just talk, where sending the tool payload is wasted budget. * Kept narrow on purpose: a miss here only costs tokens, while a false positive strips every * tool from the request and leaves the agent unable to act at all. Covers English and * Indonesian, since the operator works in both. */ export declare const CONVERSATIONAL_TURN: RegExp; export interface AgentEvent { type: 'text' | 'tool_start' | 'tool_chunk' | 'tool_end' | 'error' | 'done' | 'route' | 'compact' | 'research'; data: string; toolName?: string; toolArgs?: Record; toolCallId?: string; turnId?: string; sessionId?: string; durationMs?: number; status?: 'running' | 'success' | 'error' | 'timeout' | 'cancelled'; errorType?: string; } export declare class AgentLoop { private provider; private registry; private config; private messages; private maxIterations; private multiAgentMode; private multiAgent?; private contextManager; private memoryManager; private memoryEngine; private researchPipeline?; private sessionKey; private sessionId; private sessionStore?; private interrupted; private ledger; private abortController; private brain; private cachedContextStats?; private modelContextInfo; private providerGeneration; /** Gates the gateway prompt layer. Set once at construction; Gateway passes 'gateway'. */ private readonly surface; constructor(config: AurixConfig, registry: ToolRegistry, options?: { surface?: PromptSurface; }); refreshSystemPrompt(configPatch?: Partial): void; getSystemPromptForTest(): string; getConversationMessageCountForTest(): number; getSessionStore(): Promise; private ensureDurableSession; private observe; private observeAgentEvent; private classifyVerificationCommand; private hasFailureOutput; private classifyToolResultError; private recordEvidenceFromToolResult; private buildEvidenceSummary; private withEvidenceSummary; private recordBrainToolResult; private resetBrain; getSessionId(): string; searchSessions(query: string, limit?: number): Promise; listDurableSessions(limit?: number): Promise; findLatestSession(query?: string): Promise; getToolUsageStats(limit?: number): Promise; detectWorkflowPatterns(limit?: number): Promise; listAgentJobs(limit?: number): Promise; getMemoryStatus(): import("./MemoryManager.js").MemoryLifecycleStatus; toggleMultiAgent(): boolean; isMultiAgent(): boolean; interrupt(): void; private autoLoadSkills; private autoCreateTodos; setMaxIterations(n: number): void; private invalidateContextStats; private contextStatsSignature; getContextStats(): ContextStats; getTokenStats(ctx?: ContextStats): { input: number; output: number; total: number; pct: number; ledger: Record; apiInput: number; apiOutput: number; }; getLedger(): TokenLedger; injectContext(text: string): void; setResearchMode(mode: ResearchDepth): void; private looksLikeResearchTask; private isGatewayMessage; private isShortConversationalTurn; private hasExplicitDeepResearchIntent; private hasLightResearchSignal; private shouldForceResearchRoute; private explicitlyRequestsMultiAgent; private looksLikeComplexTask; private shouldUseMultiAgent; private looksLikeExplicitMemoryRequest; /** * True when a turn is pure conversation, so the request can skip the tool payload. * * This must fail towards keeping tools. It used to do the opposite: it stripped every tool * unless the message matched a list of English verbs (read|edit|write|run|open|…). Anything * outside that list — including every non-English phrasing — was treated as small talk and * the model was handed zero tools, so it could only ask questions back and never act. * "ayo login langsung aja gass" matched nothing, got no tools, and the agent stalled. * * Recognising chit-chat is a much smaller and safer set to enumerate than recognising work, * so that is what is enumerated here. Anything unrecognised keeps its tools. */ private looksLikeSimpleNoToolTurn; private selectExecutionMode; private hasDistinctVisionFallback; private modelSupportsVision; private refreshModelContextLimit; refreshContextMetadata(options?: ModelContextResolveOptions): Promise; getContextDiagnostics(): { model: string; provider: "anthropic" | "openai" | "custom" | "custom-anthropic"; baseUrl: string | undefined; metadata: { context: number; input?: number; output?: number; source: import("./ModelContext.js").ModelContextSource; confidence: "explicit" | "high" | "medium" | "low"; endpoint?: string; updatedAt: number; }; budget: import("./ContextManager.js").ContextBudgetDiagnostics; stats: ContextStats; lastProviderInput: number; }; run(userMessage: string, images?: string[]): AsyncGenerator; private runMultiAgent; getResearchMode(): ResearchDepth; runResearch(query: string): AsyncGenerator; getMessages(): Message[]; setMessages(msgs: Message[]): void; clearHistory(): void; compactMessages(): Promise; setSessionKey(sessionKey: string): void; private commitProviderConfig; applyProviderConfig(patch: Partial, options?: ModelContextResolveOptions): Promise; setProvider(config: Partial): void; getModel(): string; getProviderName(): string; getMemoryEngine(): MemoryEngine; loadSession(sessionId: string): number; loadSessionAsync(sessionId: string): Promise; saveSessionAsync(sessionId?: string): Promise; saveSession(sessionId?: string): string; } //# sourceMappingURL=AgentLoop.d.ts.map