UNPKG

eve

Version:

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

1 lines 894 B
function formatAssertionName(e,t){let n=t.trim();if(n.length===0)throw Error(`Assertion labels must be non-empty.`);return`${e} [${n}]`}function formatDiagnosticValue(e,t=160){let n;try{n=JSON.stringify(e)??String(e)}catch{n=String(e)}return truncateDiagnostic(n,t)}function toDiagnosticMetadataValue(e){let t=[];try{let n=JSON.stringify(e,function(e,n){if(typeof n==`bigint`)return`${String(n)}n`;if(typeof n==`function`||typeof n==`symbol`)return String(n);if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(typeof n==`object`&&n){for(;t.length>0&&t.at(-1)!==this;)t.pop();if(t.includes(n))return`[Circular]`;t.push(n)}return n});return n===void 0?String(e):JSON.parse(n)}catch{return String(e)}}function truncateDiagnostic(e,t){return e.length<=t?e:`${e.slice(0,t)}…`}export{formatAssertionName,formatDiagnosticValue,toDiagnosticMetadataValue,truncateDiagnostic};