UNPKG

eve

Version:

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

1 lines • 694 B
import{createHash}from"node:crypto";import{posix}from"node:path";import{ContextKey}from"#context/key.js";const ReadFileStateKey=new ContextKey(`eve.readFile`);function normalizeModelPath(e){return posix.normalize(e)}function buildReadFileTargetKey(e){return e}function createReadFileStamp(e){let t=createHash(`sha256`).update(e.content,`utf8`).digest(`hex`);return{byteLength:Buffer.byteLength(e.content,`utf8`),contentHash:t,filePath:e.filePath}}function setReadFileStamp(e,t,n){let r=e.ensure(ReadFileStateKey,()=>({byTarget:{}}));e.set(ReadFileStateKey,{byTarget:{...r.byTarget,[t]:n}})}export{ReadFileStateKey,buildReadFileTargetKey,createReadFileStamp,normalizeModelPath,setReadFileStamp};