UNPKG

eve

Version:

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

1 lines 1.73 kB
import{join}from"node:path";import{compileInstructionsEntry}from"#compiler/normalize-instructions.js";import{compileSkillSource}from"#compiler/normalize-skill.js";import{compileToolEntry}from"#compiler/normalize-tool.js";import{loadAuthoredModuleNamespace}from"#internal/authored-module-loader.js";import{EXTENSION_CAPABILITY_VERSIONS}from"#compiler/extension-compatibility.js";import{extensionUsesState}from"#internal/nitro/host/extension-state-usage.js";async function deriveExtensionCapabilityRequirements(t){let n=new Set([`extension`]),r={externalDependencies:t.runtimeDependencies},[i,a,o,s,c]=await Promise.all([Promise.all(t.manifest.tools.map(e=>compileToolEntry(t.sourceRoot,e,r))),Promise.all(t.manifest.skills.map(e=>compileSkillSource(t.sourceRoot,e,r))),Promise.all(t.manifest.instructions.map(e=>compileInstructionsEntry(t.sourceRoot,e,r))),loadAuthoredModuleNamespace(join(t.sourceRoot,t.declarationModule.logicalPath),{externalDependencies:t.runtimeDependencies}),extensionUsesState(t.sourceRoot)]);i.length>0&&n.add(`tool`),i.some(e=>e.kind===`dynamic-tool`)&&n.add(`dynamicTool`),t.manifest.connections.length>0&&n.add(`connection`),t.manifest.hooks.length>0&&n.add(`hook`),a.length>0&&n.add(`skill`),a.some(e=>e.kind===`dynamic-skill`)&&n.add(`dynamicSkill`),o.length>0&&n.add(`instructions`),o.some(e=>e.kind===`dynamic-instructions`)&&n.add(`dynamicInstructions`);let l=s[t.declarationModule.exportName??`default`];return(typeof l==`function`||typeof l==`object`&&l)&&`schema`in l&&l.schema!==void 0&&n.add(`config`),c&&n.add(`state`),Object.fromEntries(Object.keys(EXTENSION_CAPABILITY_VERSIONS).filter(e=>n.has(e)).map(e=>[e,EXTENSION_CAPABILITY_VERSIONS[e]]))}export{deriveExtensionCapabilityRequirements};