import { i as formatErrorMessage } from "../errors-DtoeWeWg.js";
import { m as resolveUserPath } from "../utils-BrVIyjFt.js";
import { n as VERSION } from "../version-Crcn9X9T.js";
import { y as resolveSessionAgentIds } from "../agent-scope-CMwhTQTF.js";
import { a as isSubagentSessionKey } from "../session-key-utils-Bx3apsJ3.js";
import { a as resolveAgentDir, s as resolveDefaultAgentDir } from "../agent-scope-config-Di1rn1p5.js";
import { o as resolveEmbeddedAgentRuntime } from "../agent-runtime-id-DiL2DId7.js";
import { n as disposeRegisteredAgentHarnesses } from "../registry-D9M0v1gC.js";
import { s as resolveContextEngineOwnerPluginId } from "../registry-FVXu8-6B.js";
import { g as resetAgentEventsForTest, p as onAgentEvent, s as emitAgentEvent } from "../agent-events-7y1r8HOP.js";
import { t as emitSessionTranscriptUpdate } from "../transcript-events-DTn-thXR.js";
import { c as appendSessionTranscriptMessage } from "../transcript-C1il4qyl.js";
import { d as resolveSessionWriteLockOptions, i as acquireSessionWriteLock, l as resolveSessionWriteLockAcquireTimeoutMs } from "../session-write-lock-DqmQbSMk.js";
import { f as resolveModelAuthMode } from "../model-auth-C2C7Tgol.js";
import { p as resolveActiveEmbeddedRunSessionId } from "../run-state-S-hqob7C.js";
import { n as abortEmbeddedAgentRun, r as clearActiveEmbeddedRun, t as abortAndDrainEmbeddedAgentRun, v as setActiveEmbeddedRun } from "../runs-OVHV3O38.js";
import { o as normalizeUsage } from "../usage-C67Kbb7n.js";
import { M as getChannelAgentToolMeta, N as consumeAdjustedParamsForToolCall, P as consumePreExecutionBlockedToolCall, a as getBeforeToolCallPolicyDiagnosticState, c as isToolWrappedWithBeforeToolCallHook, d as requestDeferredPluginToolApproval, h as wrapToolWithBeforeToolCallHook, i as finalizeToolTerminalPresentation, m as setBeforeToolCallDiagnosticsEnabled, o as hasBeforeToolCallPolicy, p as runBeforeToolCallHook } from "../agent-tools.before-tool-call-BQcZDU2z.js";
import { i as getPluginToolMeta } from "../tools-Dur1z1Xf.js";
import { t as callGatewayTool } from "../gateway-BlkWlqbg.js";
import { n as runAgentHarnessBeforeMessageWriteHook, t as runAgentHarnessAfterToolCallHook } from "../hook-helpers-BGgotq7f.js";
import { r as assertContextEngineHostSupport, t as CODEX_APP_SERVER_CONTEXT_ENGINE_HOST } from "../host-compat-BibWlia2.js";
import { o as normalizeHeartbeatToolResponse, t as HEARTBEAT_RESPONSE_TOOL_NAME } from "../heartbeat-tool-response-D6-_RNEN.js";
import { _ as supportsModelTools } from "../openai-transport-stream-C1akQxtM.js";
import { t as log } from "../logger-C2vuTylC.js";
import { n as projectRuntimeToolInputSchema } from "../headers-BTPwoHcI.js";
import { t as buildAgentHookContextChannelFields } from "../hook-agent-context-52t6V0oE.js";
import { a as selectDefaultNodeFromList, i as resolveNodeIdFromList, t as listNodes } from "../nodes-utils-CmJhuX3X.js";
import { M as formatToolAggregate } from "../streaming-m2vv-xoZ.js";
import { c as hasSandboxBindReadonlyHostShadows, l as resolveWritableSandboxBindHostRoots, o as resolveSandboxContext, s as hasSandboxBindContainerPathAliases } from "../sandbox-CXTnAQ1t.js";
import { a as resolveBootstrapContextForRun, n as buildBootstrapContextForFiles, o as resolveBootstrapFilesForRun } from "../bootstrap-files-B7rbupxU.js";
import { a as isMessagingToolSendAction, r as isMessagingTool } from "../embedded-agent-messaging-nFT7JKhh.js";
import { t as isToolResultError } from "../tool-result-error-uNkd9wHz.js";
import { a as extractMessagingToolSendResult, d as filterToolResultMediaUrls, i as extractMessagingToolSend, l as extractToolResultMediaArtifact, m as sanitizeToolResult } from "../embedded-agent-subscribe.tools-Cd3J5mMp.js";
import { i as isReplaySafeToolCall } from "../tool-mutation-PCZVqoCy.js";
import { a as runAgentHarnessLlmInputHook, i as runAgentHarnessBeforeAgentFinalizeHook, n as getAgentHarnessHookRunner, o as runAgentHarnessLlmOutputHook, r as runAgentHarnessAgentEndHook, t as awaitAgentHarnessAgentEndHook } from "../lifecycle-hook-helpers-CurAscZ5.js";
import { a as normalizeProviderToolSchemas, r as inspectRuntimeToolInputSchemas, t as filterProviderNormalizableTools } from "../tool-schema-projection-CZjwv0_R.js";
import { n as normalizeAgentRuntimeTools, t as logAgentRuntimeToolDiagnostics } from "../tools-B0nBPkNM.js";
import { c as shouldPreemptivelyCompactBeforePrompt, n as runAgentCleanupStep, o as estimateRenderedLlmBoundaryTokenPressure, r as PREEMPTIVE_OVERFLOW_ERROR_TEXT, s as formatPrePromptPrecheckLog, t as buildEmbeddedAttemptToolRunContext, u as isAgentToolReplaySafe } from "../attempt.tool-run-context-LbZoVtTR.js";
import { c as resolveCompactionTimeoutMs, o as compactContextEngineWithSafetyTimeout, s as compactWithSafetyTimeout, t as createAgentToolResultMiddlewareRunner } from "../tool-result-middleware-DoyduIZh.js";
import { o as resolveAttemptFsWorkspaceOnly } from "../attempt.prompt-helpers-CPKt3Pi9.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-xs_Mc3fn.js";
import { r as resolveEmbeddedAttemptToolConstructionPlan, t as applyEmbeddedAttemptToolsAllow } from "../attempt-tool-construction-plan-CxpW5zll.js";
import { r as resolveAttemptSpawnWorkspaceDir } from "../attempt.thread-helpers-Bjw9bUVi.js";
import { t as classifyEmbeddedAgentRunResultForModelFallback } from "../result-fallback-classifier-CX1YNS6d.js";
import { r as buildAgentRuntimePlan } from "../build-DxjaGR4g.js";
import { t as resolveOpenClawAgentDir } from "../agent-dir-compat-DNLZI1Xl.js";
import { t as formatApprovalDisplayPath } from "../approval-display-paths-DlQSsCnq.js";
import { a as inferToolMetaFromArgs, c as createCodexAppServerToolResultExtensionRunner, d as runAgentHarnessBeforeCompactionHook, f as SKILL_WORKSHOP_TOOL_NAME, i as formatToolProgressOutput, l as resolveAgentHarnessBeforePromptBuildResult, n as classifyAgentHarnessTerminalOutcome, o as loadCodexBundleMcpThreadConfig, p as buildSkillWorkshopPromptSection, r as detectAndLoadAgentHarnessPromptImages, s as queueAgentHarnessMessage, t as TOOL_PROGRESS_OUTPUT_MAX_CHARS, u as runAgentHarnessAfterCompactionHook } from "../agent-harness-runtime-CRecQ-AD.js";
import { c as resolveNativeHookRelayDeferredToolApproval, l as testing, n as hasNativeHookRelayInvocation, o as registerNativeHookRelay, r as invokeNativeHookRelay, t as buildNativeHookRelayCommand } from "../native-hook-relay-CEUUIuwN.js";
export { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, HEARTBEAT_RESPONSE_TOOL_NAME, VERSION as OPENCLAW_VERSION, PREEMPTIVE_OVERFLOW_ERROR_TEXT, SKILL_WORKSHOP_TOOL_NAME, TOOL_PROGRESS_OUTPUT_MAX_CHARS, abortEmbeddedAgentRun as abortAgentHarnessRun, abortAndDrainEmbeddedAgentRun as abortAndDrainAgentHarnessRun, acquireSessionWriteLock, appendSessionTranscriptMessage, applyEmbeddedAttemptToolsAllow, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildAgentRuntimePlan, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, buildNativeHookRelayCommand, buildSkillWorkshopPromptSection, callGatewayTool, classifyAgentHarnessTerminalOutcome, classifyEmbeddedAgentRunResultForModelFallback, classifyEmbeddedAgentRunResultForModelFallback as classifyEmbeddedPiRunResultForModelFallback, clearActiveEmbeddedRun, compactContextEngineWithSafetyTimeout, compactWithSafetyTimeout, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, detectAndLoadAgentHarnessPromptImages, disposeRegisteredAgentHarnesses, log as embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, estimateRenderedLlmBoundaryTokenPressure, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeHarnessContextEngineTurn, finalizeToolTerminalPresentation, formatApprovalDisplayPath, formatErrorMessage, formatPrePromptPrecheckLog, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, getChannelAgentToolMeta, getPluginToolMeta, hasBeforeToolCallPolicy, hasNativeHookRelayInvocation, hasSandboxBindContainerPathAliases, hasSandboxBindReadonlyHostShadows, inferToolMetaFromArgs, inspectRuntimeToolInputSchemas, invokeNativeHookRelay, isActiveHarnessContextEngine, isAgentToolReplaySafe, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, listNodes, loadCodexBundleMcpThreadConfig, logAgentRuntimeToolDiagnostics, testing as nativeHookRelayTesting, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, normalizeProviderToolSchemas, normalizeUsage, onAgentEvent, projectRuntimeToolInputSchema, queueAgentHarnessMessage, registerNativeHookRelay, requestDeferredPluginToolApproval, resetAgentEventsForTest, resolveActiveEmbeddedRunSessionId, resolveAgentDir, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptFsWorkspaceOnly, resolveAttemptSpawnWorkspaceDir, resolveBootstrapContextForRun, resolveBootstrapFilesForRun, resolveCompactionTimeoutMs, resolveContextEngineOwnerPluginId, resolveDefaultAgentDir, resolveEmbeddedAgentRuntime, resolveEmbeddedAttemptToolConstructionPlan, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, resolveNodeIdFromList, resolveOpenClawAgentDir, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockAcquireTimeoutMs, resolveSessionWriteLockOptions, resolveUserPath, resolveWritableSandboxBindHostRoots, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeAgentFinalizeHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runBeforeToolCallHook, runHarnessContextEngineMaintenance, sanitizeToolResult, selectDefaultNodeFromList, setActiveEmbeddedRun, setBeforeToolCallDiagnosticsEnabled, shouldPreemptivelyCompactBeforePrompt, supportsModelTools, wrapToolWithBeforeToolCallHook };
