eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 877 B
JavaScript
import{createLogger,logError}from"#internal/logging.js";import{cancelRun,getWorld,resumeHook}from"#internal/workflow/runtime.js";import{isTaskWorkflowTargetGone}from"#execution/tasks/workflow-target.js";const log=createLogger(`execution.workflow-tool-run`);async function cancelWorkflowToolRun(e,t){let n={kind:`cancel`,reason:t};try{await resumeHook(e.hookToken,n);return}catch(t){isTaskWorkflowTargetGone(t)||logError(log,`failed to signal a workflow tool run to cancel; cancelling it outright`,t,{runId:e.runId})}try{await cancelRun(await getWorld(),e.runId,{cancelReason:t})}catch(t){if(isTaskWorkflowTargetGone(t))return;logError(log,`failed to cancel workflow tool run; it may run to completion`,t,{runId:e.runId})}}async function cancelWorkflowToolRunStep(e){"use step";await cancelWorkflowToolRun(e.run,e.reason)}export{cancelWorkflowToolRun,cancelWorkflowToolRunStep};