eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.21 kB
JavaScript
import{resolveAgentInvocationAction}from"./invoke-preparation.js";import{AuthKey}from"#context/keys.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{getDynamicSubagentSelection}from"#context/dynamic-subagent-lifecycle.js";import{dispatchToClaimedAgentAddress}from"#subagents/handle-dispatch.js";import{createAgentContinuationBundle}from"#subagents/continuation-bundle.js";import{normalizeRequestedOutputSchema}from"#subagents/invocation.js";async function steerBackgroundAgent(e){let t=resolveAgentInvocationAction({ctx:e.ctx,invocationId:e.callId,input:{agentId:e.handle.identity.id,message:typeof e.input.message==`string`?e.input.message:``,outputSchema:normalizeRequestedOutputSchema(e.input.outputSchema),target:e.handle.identity.name}}),n=getDynamicSubagentSelection(e.ctx,e.handle.identity.nodeId),r=await dispatchToClaimedAgentAddress({action:t,auth:e.ctx.get(AuthKey)??null,bundle:createAgentContinuationBundle({action:t,bundle:e.ctx.require(BundleKey),dynamicRemoteAgent:n?.kind===`remote`?n.remoteAgent:void 0}),currentSession:e.session,handle:e.handle,reply:{kind:`steer`}});if(r.kind===`error`)throw Error(JSON.stringify(r.result.output))}export{steerBackgroundAgent};