eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.14 kB
JavaScript
import{createLogger,formatError}from"#internal/logging.js";import{createSessionFailedEvent}from"#protocol/message.js";import{summarizeKnownError}from"#harness/semantic-errors/index.js";import{emitTerminalSessionEvent}from"#execution/terminal-session-event.js";const log=createLogger(`execution.workflow-entry`);async function emitTerminalSessionFailureStep(e){"use step";let t=formatError(e.error),n=summarizeKnownError(e.error),r=t;if(n!==null){let e={...t,message:n.message,name:n.name,semanticErrorId:n.id};r=n.hint===void 0?e:{...e,hint:n.hint}}let i=typeof r.name==`string`?r.name:`WORKFLOW_EXECUTION_FAILED`,a=typeof r.message==`string`?r.message:String(e.error),o=e.serializedContext[`eve.sessionId`]??``;log.error(`workflow loop threw — emitting terminal session.failed`,{sessionId:o,errorId:typeof r.errorId==`string`?r.errorId:void 0,code:i}),await emitTerminalSessionEvent({errorId:typeof r.errorId==`string`?r.errorId:void 0,event:createSessionFailedEvent({code:i,details:r,message:a,sessionId:o}),parentWritable:e.parentWritable,serializedContext:e.serializedContext,turnId:e.turnId})}export{emitTerminalSessionFailureStep};