eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
1 lines • 1.6 kB
JavaScript
import{z}from"#compiled/zod/index.js";const compilerDiagnosticSeveritySchema=z.enum([`error`,`warning`]),compilerDiagnosticSourceSchema=z.object({logicalPath:z.string().optional(),nodeId:z.string().min(1),sourceId:z.string().optional(),sourcePath:z.string().optional()}).strict().refine(e=>e.logicalPath!==void 0||e.sourceId!==void 0||e.sourcePath!==void 0,`Compiler diagnostic source must identify a logical, compiled, or physical source.`),compilerDiagnosticSchema=z.object({code:z.string().min(1),message:z.string().min(1),severity:compilerDiagnosticSeveritySchema,sources:z.array(compilerDiagnosticSourceSchema).min(1).readonly()}).strict();function projectDiscoverDiagnostic(e,t){return{code:e.code,message:e.message,severity:e.severity,sources:[{nodeId:t,sourcePath:e.sourcePath}]}}function createChannelRouteShadowedDiagnostic(e){return{code:`compile/channel-route-shadowed`,message:`${e.method} ${e.urlPath} from "${e.loser.logicalPath}" is shadowed by "${e.winner.logicalPath}".`,severity:`warning`,sources:[toDiagnosticSource(e.nodeId,e.loser),toDiagnosticSource(e.nodeId,e.winner)]}}function summarizeCompilerDiagnostics(e){let t=0,n=0;for(let r of e)r.severity===`error`?t+=1:n+=1;return{errors:t,warnings:n}}function toDiagnosticSource(e,t){return{logicalPath:t.logicalPath,nodeId:e,sourceId:t.sourceId,...t.backing.kind===`filesystem`||t.backing.kind===`resource`?{sourcePath:t.backing.sourcePath}:{}}}export{compilerDiagnosticSchema,compilerDiagnosticSeveritySchema,compilerDiagnosticSourceSchema,createChannelRouteShadowedDiagnostic,projectDiscoverDiagnostic,summarizeCompilerDiagnostics};