import type { Context } from "@/types"; import { Sandbox } from "../../sandbox/sandbox.js"; import type { UserHome } from "../users/userHome.js"; import type { AgentSystem } from "./agentSystem.js"; import type { AgentDescriptor } from "./ops/agentDescriptorTypes.js"; import type { AgentInbox } from "./ops/agentInbox.js"; import type { AgentState } from "./ops/agentTypes.js"; export declare class Agent { readonly ctx: Context; readonly descriptor: AgentDescriptor; readonly inbox: AgentInbox; readonly state: AgentState; private readonly agentSystem; private providerId; private processing; private started; private inferenceAbortController; private readonly userHome; private readonly files; readonly sandbox: Sandbox; private endTurnCount; private constructor(); /** * Creates a new agent and persists descriptor + state + initial session row. * Expects: ctx.agentId is a cuid2 value; descriptor is validated. */ static create(ctx: Context, descriptor: AgentDescriptor, inbox: AgentInbox, agentSystem: AgentSystem, userHome: UserHome): Promise; /** * Rehydrates an agent from persisted descriptor + state. * Rebuilds permissions from userHome to avoid stale legacy paths. * Expects: state and descriptor already validated. */ static restore(ctx: Context, descriptor: AgentDescriptor, state: AgentState, inbox: AgentInbox, agentSystem: AgentSystem, userHome: UserHome): Agent; get id(): string; get userId(): string; start(): void; isProcessing(): boolean; /** * Aborts the currently running inference call for this agent. * Returns false when no active inference is in flight. */ abortInference(): boolean; private runLoop; /** * Attempts to put the agent to sleep after processing a message or reset. * Expects: inbox item handled successfully. */ private sleepAfterItem; /** * Increments end turn counter and invalidates the session when threshold exceeded. * Runtime-only — no persistence needed for the counter. */ private invalidateSessionIfNeeded; private handleInboxItem; private sendUnexpectedError; private handleMessage; private handleSystemMessage; private handleSignal; private handleReset; private handleCompaction; /** * Resets the session when the emergency context limit is exceeded. * Expects: reset record written and state persisted before notifying users. */ private handleEmergencyReset; private handleRestore; private runManualCompaction; private compactionResultText; /** * Completes dangling tool calls from persisted history with a synthetic result. * Expects: called before rebuilding context or starting a new inference loop. */ private completePendingToolCalls; private rlmRestoreContextBuild; /** * Notifies a parent agent when a child background agent fails. * Expects: parent agent exists. */ notifySubagentFailure(reason: string, error?: unknown): Promise; private messageFilesNormalize; private listContextTools; private resolveAgentKind; private resolveAgentProvider; /** * Starts typing indication for foreground user agents during long compaction operations. * Expects: connector supports startTyping for the active target. */ private startCompactionTypingIndicator; private buildHistoryContext; private applyCompactionSummary; } //# sourceMappingURL=agent.d.ts.map