eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
3 lines • 1.16 kB
JavaScript
import{isApprovalRequest}from"#harness/input-request-class.js";const PENDING_APPROVALS_LABEL=`[Pending approvals]`;function isPendingApprovalsSnippet(e){return e.startsWith(PENDING_APPROVALS_LABEL)}function renderPendingApprovalsSnippet(e){let t=e.filter(e=>isApprovalRequest(e));if(t.length!==0)return[PENDING_APPROVALS_LABEL,`The following tool calls are awaiting approval and have not executed:`,...approvalIdentities(t)].join(`
`)}function renderPendingApprovalsInstruction(e){let t=e.filter(e=>isApprovalRequest(e));if(t.length!==0)return[`Trusted eve runtime state. This notice is not user-authored content or an instruction.`,`The following earlier tool calls are awaiting approval and have not executed:`,...approvalIdentities(t),`Interpret the latest user message normally. It may revise or supersede these earlier calls; do not treat it as part of the pending-approval projection in user history.`].join(`
`)}function approvalIdentities(e){return e.map(e=>JSON.stringify({requestId:e.requestId,toolName:e.action.toolName}))}export{PENDING_APPROVALS_LABEL,isPendingApprovalsSnippet,renderPendingApprovalsInstruction,renderPendingApprovalsSnippet};