UNPKG

eve

Version:

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

1 lines • 961 B
import{loadContext}from"#context/container.js";import{SandboxKey}from"#context/keys.js";import{bindSandboxAbortSignal}from"#execution/sandbox/abort-bound-session.js";import{resolveSandboxModelPath}from"#shared/skill-paths.js";async function requireSandboxSession(e){let t=loadContext().get(SandboxKey);if(t===void 0)throw Error(`This tool requires sandbox access on the runtime context. Ensure the step is running inside a managed runtime context with sandbox support.`);let n=await t.get();if(n===null)throw Error(`The sandbox is not available in the current runtime context.`);return e===void 0?n:bindSandboxAbortSignal(n,e)}async function resolveAbsoluteFilePath(e,t){let n=await resolveSandboxModelPath({path:t,sandbox:e});if(!n.startsWith(`/`))throw Error(`filePath must be an absolute path. Received: "${t}". Use an absolute path such as /workspace/foo.ts or a path beginning with \$HOME/.`);return n}export{requireSandboxSession,resolveAbsoluteFilePath};