UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 999 B
var ToolOutputSerializationError=class extends TypeError{toolCallId;toolName;constructor(e){super(formatToolOutputSerializationMessage(e)),this.name=`ToolOutputSerializationError`,this.toolCallId=e.toolCallId,this.toolName=e.toolName,e.cause!==void 0&&(this.cause=e.cause)}};function formatToolOutputSerializationMessage(e){return`${e.toolCallId===void 0?`Tool "${e.toolName}"`:`Tool "${e.toolName}" call "${e.toolCallId}"`} ${e.boundary===`execute`?`returned a non-JSON-serializable result`:e.boundary===`toModelOutput`?`returned a non-JSON-serializable model output`:`produced a non-JSON-serializable action result`}.${e.cause instanceof Error&&e.cause.message.length>0?` ${e.cause.message}`:``}`}function withToolOutputSerializationError(e,t){try{return t()}catch(t){throw t instanceof ToolOutputSerializationError?t:new ToolOutputSerializationError({boundary:e.boundary,cause:t,toolCallId:e.toolCallId,toolName:e.toolName})}}export{ToolOutputSerializationError,withToolOutputSerializationError};