UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 3.04 kB
import{h as readRuntimeConfig}from"./runtime-snapshot-Bg5K4JNu.mjs";import{At as operationsByUpstreamAbortSignal,vt as getSessionControllerEntryForOperation,xt as isCurrentSessionControllerOperation}from"./session-controller.state-BIDbpLPn.mjs";import{d as getControllerEmbeddedAttachment,r as ACTIVE_EMBEDDED_RUNS_BY_RUN_ID,u as getActiveNativeAttempt}from"./run-state-Bd0P0LYH.mjs";import"./config-DkZ8y8Gv.mjs";import{i as getRpcSourceForSignal}from"./session-controller.rpc-sources-IDCkO6sT.mjs";import{i as captureSessionControllerStop,r as stopSession}from"./session-controller.stop-DE-wTVTx.mjs";import{c as resolveActiveSessionRunId,s as resolveActiveReplyOperationForSessionId}from"./session-controller.queries-CBzzV0sx.mjs";import{i as getDiagnosticSessionActivitySnapshot}from"./diagnostic-run-activity-D_NQZV7c.mjs";import{a as resolveActiveReplyRunOwnerForSignal}from"./session-controller.barriers-Dc-Qsape.mjs";import{i as steerSessionControllerOperation}from"./session-controller.steer-BUP3NUvG.mjs";import{h as resolveActiveEmbeddedRunOwnerByRunId}from"./runs-CZphmRD3.mjs";import{t as abortControlledSubagents}from"./chat-abort-descendants-CfGWZ0QV.mjs"; //!src/talk/agent-run-control.runtime.ts function resolveSourceRunOwner(e,t){if(t.aborted)return;const n=getRpcSourceForSignal(e,t)?.input;const r=n?n.claim?.released?void 0:n.claim?.operation:operationsByUpstreamAbortSignal.get(t);if(!n&&!r){const t=resolveActiveEmbeddedRunOwnerByRunId(e);return t?{...t,operation:ACTIVE_EMBEDDED_RUNS_BY_RUN_ID.get(e.trim())?.operation}:void 0}if(!r||r.result||!isCurrentSessionControllerOperation(r))return;const i=ACTIVE_EMBEDDED_RUNS_BY_RUN_ID.get(e.trim());if(i&&i.operation!==r)return;const a=resolveActiveEmbeddedRunOwnerByRunId(e)??(getControllerEmbeddedAttachment(r)?void 0:resolveActiveReplyRunOwnerForSignal(r.abortSignal));return a?{...a,operation:r}:void 0}async function stopRealtimeVoiceSessionRun(e){const t=resolveActiveReplyOperationForSessionId(e.sessionId);if(!t||t.key!==e.sessionKey)return false;const n=getSessionControllerEntryForOperation(t);const r=captureSessionControllerStop({inputs:n.mailbox?.entries.filter(e=>e.claim?.operation===t),operations:[t]});const i=getActiveNativeAttempt(e.sessionId)?.runId;return(await stopSession({source:`talk`,capture:r,assertCurrent:e.assertCurrent,hookContext:{sessionKey:e.sessionKey,sessionId:e.sessionId,commandSource:`talk`},stopChildren:async n=>{if(!i){await n();return{stopped:0,failed:0}}const r=await abortControlledSubagents({cfg:readRuntimeConfig(),sessionKey:e.sessionKey,agentId:t.agentId,requesterTurnRunId:i,beforeKill:n,assertCurrent:e.assertCurrent});return{stopped:r?.killed??0,failed:r?.status===`error`?r.failed:0}}}).completed).aborted}const realtimeVoiceControlRuntime={stopRealtimeVoiceSessionRun,steerActiveRun:(e,t,n)=>steerSessionControllerOperation({operation:e,text:t,options:n,abortOnUnconfirmedTranscript:false}),resolveSourceRunOwner,resolveActiveSessionRunId,getDiagnosticSessionActivitySnapshot};export{realtimeVoiceControlRuntime};