UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 2.63 kB
import{r as createLazyRuntimeModule}from"./lazy-runtime-Ds6M7vp4.mjs";import{t as warnPluginSdkDeprecation}from"./sdk-deprecation-BDUCyBrU.mjs";import{n as finalizeInboundContextForSdk,r as isFinalizedInboundContext}from"./inbound-context-DhAQpGu-.mjs";import{t as hasExplicitCommandContextText}from"./context-text-0KLy58TB.mjs"; //!src/auto-reply/reply/dispatch-acp-sdk.ts const loadDispatchAcpRuntime=createLazyRuntimeModule(()=>import(`./dispatch-acp.runtime-DFkZXKWH.mjs`));async function tryDispatchAcpReplyHookCore(e,t){const n=isFinalizedInboundContext(e.ctx)?e.ctx:finalizeInboundContextForSdk(e.ctx);if(e.sendPolicy===`deny`&&!e.suppressUserDelivery&&!hasExplicitCommandContextText(n)&&!e.isTailDispatch)return;const r=await loadDispatchAcpRuntime();const i=await r.shouldBypassAcpDispatchForCommand(n,t.cfg);if(e.sendPolicy===`deny`&&!e.suppressUserDelivery&&!i&&!e.isTailDispatch)return;if(!e.shouldSendToolSummariesAsync||!e.shouldSendFullToolDetailsAsync)warnPluginSdkDeprecation({family:`reply-visibility`,method:`tryDispatchAcpReplyHook boolean visibility inputs`,replacement:`shouldSendToolSummariesAsync and shouldSendFullToolDetailsAsync predicates`});const a=e.shouldSendFullToolDetailsAsync?void 0:e.shouldSendFullToolDetails;const o=await r.tryDispatchAcpReply({ctx:n,cfg:t.cfg,dispatcher:t.dispatcher,runId:e.runId,sessionKey:e.sessionKey,toolsAllow:e.toolsAllow,images:e.images,abortSignal:t.abortSignal,inboundAudio:e.inboundAudio,sessionTtsAuto:e.sessionTtsAuto,ttsChannel:e.ttsChannel,suppressUserDelivery:e.suppressUserDelivery,suppressReplyLifecycle:e.suppressReplyLifecycle===true||e.sendPolicy===`deny`,sourceReplyDeliveryMode:e.sourceReplyDeliveryMode,shouldRouteToOriginating:e.shouldRouteToOriginating,originatingChannel:e.originatingChannel,originatingTo:e.originatingTo,originatingAccountId:e.originatingAccountId,originatingThreadId:e.originatingThreadId,originatingChatType:e.originatingChatType,shouldSendToolSummaries:async()=>e.shouldSendToolSummariesAsync?await e.shouldSendToolSummariesAsync():e.shouldSendToolSummaries,shouldSendFullToolDetails:async()=>e.shouldSendFullToolDetailsAsync?await e.shouldSendFullToolDetailsAsync():a===true,bypassForCommand:i,onReplyStart:t.onReplyStart,onAgentRunStart:t.onAgentRunStart,onPreparedAgentRunStart:t.onPreparedAgentRunStart,turnAdoption:t.turnAdoption,userTurnTranscriptRecorder:t.userTurnTranscriptRecorder,prepareAssistantTranscriptMessage:t.prepareAssistantTranscriptMessage,recordProcessed:t.recordProcessed,markIdle:t.markIdle});if(!o)return;return{handled:true,queuedFinal:o.queuedFinal,counts:o.counts}}export{tryDispatchAcpReplyHookCore};