UNPKG

eve

Version:

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

2 lines 4.05 kB
import{createCliTheme,renderCliSection}from"#cli/ui/output.js";import{inspectApplication}from"#services/inspect-application.js";function formatInstructions(e){return e.map(e=>`${e.logicalPath} (${e.role})`).join(`, `)}function buildApplicationInfoJson(e){let{application:t,compiledState:n,messaging:r}=e;return{appRoot:t.appRoot,agentRoot:n?.project.agentRoot??null,layout:n?.project.layout??null,status:n?.metadata.status??`unavailable`,diagnostics:n?{errors:n.metadata.discovery.summary.errors,warnings:n.metadata.discovery.summary.warnings}:null,model:n?.manifest.config.model?.id??null,instructions:n===null||n.manifest.instructions.length===0?null:formatInstructions(n.manifest.instructions),skills:(n?.manifest.skills??[]).map(e=>e.name),tools:(n?.manifest.tools??[]).map(e=>e.name),subagents:(n?.manifest.subagents??[]).map(e=>e.name),schedules:(n?.manifest.schedules??[]).map(e=>e.name),channels:(n?.manifest.channelRoutes.effective??[]).map(e=>({name:e.name,kind:e.adapterKind??null,method:e.method,urlPath:e.urlPath})),messaging:{create:r.createSessionRoutePath,messages:r.sessionMessagesRoutePattern,stream:r.streamRoutePattern},artifacts:n?{compiledManifest:n.paths.compiledManifestPath,discoveryManifest:n.paths.discoveryManifestPath,diagnostics:n.paths.diagnosticsPath,moduleMap:n.paths.moduleMapPath,metadata:n.paths.compileMetadataPath}:null}}function pluralize(e,t){return`${e} ${t}${e===1?``:`s`}`}function formatDiscoverySummary(e,t){return`${pluralize(e,`error`)}, ${pluralize(t,`warning`)}`}function resolveCompileTone(e){switch(e){case`ready`:return`success`;case`failed`:return`danger`;default:return`warning`}}async function printApplicationInfo(e,t,n={}){let r=await inspectApplication(t);if(n.json){e.log(JSON.stringify(buildApplicationInfoJson(r),null,2));return}e.log(renderApplicationInfo(r))}function renderApplicationInfo(e){let t=e.compiledState,n=e.application,r=createCliTheme(),i=[{label:`App Root`,value:n.appRoot}],a=[{label:`Workflow Build`,value:n.workflowBuildDir},{label:`Output`,value:n.outputDir}],o=[];return t===null?i.push({label:`Compile`,tone:`warning`,value:`unavailable`}):(i.push({label:`Agent Root`,value:t.project.agentRoot},{label:`Layout`,value:t.project.layout},{label:`Compile`,tone:resolveCompileTone(t.metadata.status),value:t.metadata.status},{label:`Diagnostics`,tone:t.metadata.discovery.summary.errors>0?`danger`:t.metadata.discovery.summary.warnings>0?`warning`:`success`,value:formatDiscoverySummary(t.metadata.discovery.summary.errors,t.metadata.discovery.summary.warnings)},{label:`Instructions`,value:t.manifest.instructions.length===0?`none`:formatInstructions(t.manifest.instructions)},{label:`Skills`,value:pluralize(t.manifest.skills.length,`skill`)},{label:`Tools`,value:pluralize(t.manifest.tools.length,`tool`)},{label:`Subagents`,value:pluralize(t.manifest.subagents.length,`subagent`)},{label:`Schedules`,value:pluralize(t.manifest.schedules.length,`schedule`)}),a.unshift({label:`Compiled Manifest`,value:t.paths.compiledManifestPath},{label:`Discovery Manifest`,value:t.paths.discoveryManifestPath},{label:`Diagnostics`,value:t.paths.diagnosticsPath},{label:`Module Map`,value:t.paths.moduleMapPath},{label:`Metadata`,value:t.paths.compileMetadataPath}),o.push(t.manifest.instructions.length===0?{label:`Instructions`,value:`No instructions prompt discovered.`}:{label:`Instructions`,value:formatInstructions(t.manifest.instructions)})),[renderCliSection(r,{rows:i,title:`Application`}),``,renderCliSection(r,{rows:a,title:`Artifacts`}),...t===null?[]:[``,renderCliSection(r,{rows:o,title:`Instructions`})],``,renderCliSection(r,{rows:[{label:`Workflow ID`,value:n.workflowId},{label:`Source Dir`,value:n.workflowSourceDir},{label:`Create`,tone:`info`,value:`POST ${e.messaging.createSessionRoutePath}`},{label:`Messages`,tone:`info`,value:`POST ${e.messaging.sessionMessagesRoutePattern}`},{label:`Stream`,tone:`info`,value:`GET ${e.messaging.streamRoutePattern}`}],title:`Messaging`})].join(` `)}export{buildApplicationInfoJson,printApplicationInfo,renderApplicationInfo};