/** * Main AgentLoop + AgentLoopClient initialization. * * Extracted from cli/commands/start.ts to keep the orchestrator thin. * All logic and function signatures are unchanged. * * Responsibilities: * 1. Sets up closure-scoped reasoning state (reasoningLog, turnCount, autoRecallUsed) * 2. Checks persona completion and logs onboarding status * 3. Determines OS Agent mode and loads capabilities * 4. Resolves Code-Act config from conductor agent * 5. Creates the main AgentLoop with all options * 6. Creates buildReasoningHeader() helper (closure-scoped) * 7. Creates agentLoopClient wrapper with run() and runWithContent() methods */ import type { MAMAConfig } from '../config/types.js'; import type { OAuthManager } from '../../auth/index.js'; import { AgentLoop } from '../../agent/index.js'; import type { GatewayToolExecutorOptions } from '../../agent/types.js'; import type { AgentLoopClient } from './types.js'; import type { EnvelopeIssuanceMode } from './envelope-bootstrap.js'; import type { MetricsStore } from '../../observability/metrics-store.js'; import type { SQLiteDatabase } from '../../sqlite.js'; /** * Result returned by initMainAgentLoop. */ export interface AgentLoopInitResult { agentLoop: AgentLoop; agentLoopClient: AgentLoopClient; /** Whether Code-Act is enabled (derived from conductor agent config) */ useCodeAct: boolean; } /** * Initialize the main AgentLoop and AgentLoopClient. * * The reasoning state (reasoningLog, turnCount, autoRecallUsed) lives as * closure-scoped variables inside this function — they are not exposed on * the return value. buildReasoningHeader() is also a local helper. */ export declare function initMainAgentLoop(config: MAMAConfig, oauthManager: OAuthManager, db: SQLiteDatabase, metricsStore: MetricsStore | null, runtimeBackend: 'claude' | 'codex-mcp', options?: { osAgentMode?: boolean; envelopeIssuanceMode?: EnvelopeIssuanceMode; contextCompileService?: GatewayToolExecutorOptions['contextCompileService']; }): AgentLoopInitResult; //# sourceMappingURL=agent-loop-init.d.ts.map