import { i as formatErrorMessage } from "../errors-DhAg7YZN.js";
import { p as resolveUserPath } from "../utils-CAlaTZzU.js";
import { n as VERSION } from "../version-CQfgAE7_.js";
import { v as resolveSessionAgentIds } from "../agent-scope-Bhq7_AN5.js";
import { a as isSubagentSessionKey } from "../session-key-utils-Ce_xWkNq.js";
import { a as resolveAgentDir, s as resolveDefaultAgentDir } from "../agent-scope-config-D9D1mdqC.js";
import { p as resolveEmbeddedAgentRuntime } from "../openai-codex-routing-DESJGCZn.js";
import { n as disposeRegisteredAgentHarnesses } from "../registry-CgmijdED.js";
import { o as resolveContextEngineOwnerPluginId } from "../registry-DxH_0Os-.js";
import { d as resetAgentEventsForTest, i as emitAgentEvent, l as onAgentEvent } from "../agent-events-BuYtWSh4.js";
import { c as appendSessionTranscriptMessage } from "../transcript-D8YMqy3P.js";
import { t as emitSessionTranscriptUpdate } from "../transcript-events-ClYG_P1o.js";
import { d as resolveSessionWriteLockOptions, i as acquireSessionWriteLock, l as resolveSessionWriteLockAcquireTimeoutMs } from "../session-write-lock-BRp_rwNi.js";
import { m as setActiveEmbeddedRun, n as abortEmbeddedPiRun, p as resolveActiveEmbeddedRunSessionId, r as clearActiveEmbeddedRun } from "../runs-CLCX_ZDl.js";
import { o as normalizeUsage } from "../usage-DKNTRfvn.js";
import { r as assertContextEngineHostSupport, t as CODEX_APP_SERVER_CONTEXT_ENGINE_HOST } from "../host-compat-DMtVtGSr.js";
import { o as normalizeHeartbeatToolResponse, t as HEARTBEAT_RESPONSE_TOOL_NAME } from "../heartbeat-tool-response-LkIZr9UH.js";
import { _ as buildAgentHookContextChannelFields } from "../attempt.prompt-helpers-CXTtocDs.js";
import { a as resolveBootstrapContextForRun } from "../bootstrap-files-CFasfl5r.js";
import { a as hasBeforeToolCallPolicy, c as isToolWrappedWithBeforeToolCallHook, d as setBeforeToolCallDiagnosticsEnabled, p as wrapToolWithBeforeToolCallHook, u as runBeforeToolCallHook } from "../pi-tools.before-tool-call-LPKYDHoE.js";
import { t as callGatewayTool } from "../gateway-XYyqZftj.js";
import { t as createOpenClawCodingTools } from "../pi-tools-C3mG7T1V.js";
import { d as resolveModelAuthMode } from "../model-auth-bW2MZ72T.js";
import { O as supportsModelTools } from "../openai-transport-stream-CXgZGFSw.js";
import { K as isMessagingTool, L as extractToolResultMediaArtifact, M as runAgentCleanupStep, O as logAgentRuntimeToolDiagnostics, _ as resolveCompactionTimeoutMs, a as formatPrePromptPrecheckLog, h as compactContextEngineWithSafetyTimeout, i as estimateRenderedLlmBoundaryTokenPressure, j as normalizeProviderToolSchemas, k as normalizeAgentRuntimeTools, m as createAgentToolResultMiddlewareRunner, n as PREEMPTIVE_OVERFLOW_ERROR_TEXT, o as shouldPreemptivelyCompactBeforePrompt, q as isMessagingToolSendAction, t as buildEmbeddedAttemptToolRunContext, z as filterToolResultMediaUrls } from "../attempt.tool-run-context-3JPTZ1kQ.js";
import { N as formatToolAggregate } from "../channel-streaming-BkSd7rK-.js";
import { t as log } from "../logger-9UZbkU63.js";
import { a as selectDefaultNodeFromList, i as resolveNodeIdFromList, t as listNodes } from "../nodes-utils-C-SEP4xD.js";
import { c as hasSandboxBindReadonlyHostShadows, l as resolveWritableSandboxBindHostRoots, o as resolveSandboxContext, s as hasSandboxBindContainerPathAliases } from "../sandbox-DBFWHq3S.js";
import { a as finalizeHarnessContextEngineTurn, i as buildHarnessContextEngineRuntimeContextFromUsage, n as bootstrapHarnessContextEngine, o as isActiveHarnessContextEngine, r as buildHarnessContextEngineRuntimeContext, s as runHarnessContextEngineMaintenance, t as assembleHarnessContextEngine } from "../context-engine-lifecycle-AyFyzcdd.js";
import { r as resolveAttemptSpawnWorkspaceDir } from "../attempt.thread-helpers-D6owt2Lr.js";
import { t as classifyEmbeddedPiRunResultForModelFallback } from "../result-fallback-classifier-boi6sx0-.js";
import { r as buildAgentRuntimePlan } from "../build-3HOGyoSR.js";
import { a as runAgentHarnessLlmOutputHook, i as runAgentHarnessLlmInputHook, n as runAgentHarnessAgentEndHook, r as runAgentHarnessBeforeAgentFinalizeHook, t as awaitAgentHarnessAgentEndHook } from "../lifecycle-hook-helpers-BxsglQNk.js";
import { t as resolveOpenClawAgentDir } from "../agent-dir-compat-lVAf47RT.js";
import { t as formatApprovalDisplayPath } from "../approval-display-paths-BqRczx-P.js";
import { a as loadCodexBundleMcpThreadConfig, c as resolveAgentHarnessBeforePromptBuildResult, i as inferToolMetaFromArgs, l as runAgentHarnessAfterCompactionHook, n as classifyAgentHarnessTerminalOutcome, o as queueAgentHarnessMessage, r as formatToolProgressOutput, s as createCodexAppServerToolResultExtensionRunner, t as TOOL_PROGRESS_OUTPUT_MAX_CHARS, u as runAgentHarnessBeforeCompactionHook } from "../agent-harness-runtime-C7dJyKWh.js";
import { a as registerNativeHookRelay, c as runAgentHarnessAfterToolCallHook, l as runAgentHarnessBeforeMessageWriteHook, n as hasNativeHookRelayInvocation, r as invokeNativeHookRelay, s as testing, t as buildNativeHookRelayCommand } from "../native-hook-relay-BHJ0n618.js";
export { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, HEARTBEAT_RESPONSE_TOOL_NAME, VERSION as OPENCLAW_VERSION, PREEMPTIVE_OVERFLOW_ERROR_TEXT, TOOL_PROGRESS_OUTPUT_MAX_CHARS, abortEmbeddedPiRun as abortAgentHarnessRun, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildAgentRuntimePlan, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, buildNativeHookRelayCommand, callGatewayTool, classifyAgentHarnessTerminalOutcome, classifyEmbeddedPiRunResultForModelFallback, clearActiveEmbeddedRun, compactContextEngineWithSafetyTimeout, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, createOpenClawCodingTools, disposeRegisteredAgentHarnesses, log as embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, estimateRenderedLlmBoundaryTokenPressure, extractToolResultMediaArtifact, filterToolResultMediaUrls, finalizeHarnessContextEngineTurn, formatApprovalDisplayPath, formatErrorMessage, formatPrePromptPrecheckLog, formatToolAggregate, formatToolProgressOutput, hasBeforeToolCallPolicy, hasNativeHookRelayInvocation, hasSandboxBindContainerPathAliases, hasSandboxBindReadonlyHostShadows, inferToolMetaFromArgs, invokeNativeHookRelay, isActiveHarnessContextEngine, isMessagingTool, isMessagingToolSendAction, isSubagentSessionKey, isToolWrappedWithBeforeToolCallHook, listNodes, loadCodexBundleMcpThreadConfig, logAgentRuntimeToolDiagnostics, testing as nativeHookRelayTesting, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, normalizeProviderToolSchemas, normalizeUsage, onAgentEvent, queueAgentHarnessMessage, registerNativeHookRelay, resetAgentEventsForTest, resolveActiveEmbeddedRunSessionId, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveCompactionTimeoutMs, resolveContextEngineOwnerPluginId, resolveDefaultAgentDir, resolveEmbeddedAgentRuntime, resolveModelAuthMode, resolveNodeIdFromList, resolveOpenClawAgentDir, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockAcquireTimeoutMs, resolveSessionWriteLockOptions, resolveUserPath, resolveWritableSandboxBindHostRoots, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeAgentFinalizeHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runBeforeToolCallHook, runHarnessContextEngineMaintenance, selectDefaultNodeFromList, setActiveEmbeddedRun, setBeforeToolCallDiagnosticsEnabled, shouldPreemptivelyCompactBeforePrompt, supportsModelTools, wrapToolWithBeforeToolCallHook };
