Skip to content

PluginLoader

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/agent-core/src/plugins/plugin-loader.ts

Methods

MethodSignatureReturns
loadFromDirectoryloadFromDirectory(pluginsDir: string)Promise<LoadedPlugin[]>
loadPluginloadPlugin(pluginDir: string)Promise<LoadedPlugin>

Where it refuses work

  • PluginLoader stops the work with Error when !manifest || typeof manifest !== 'object' — “Manifest must be a JSON object”.
  • PluginLoader stops the work with Error when typeof manifest.name !== 'string' || !manifest.name — “Manifest must have a "name" string field”.
  • PluginLoader stops the work with Error when !KEBAB_CASE_RE.test(manifest.name).
  • PluginLoader stops the work with Error when typeof manifest.version !== 'string' — “"version" must be a string”.
  • PluginLoader stops the work with an early return when !fs.existsSync(pluginsDir).
  • PluginLoader stops the work with an early return when !fs.existsSync(skillsDir).

When something fails

  • PluginLoader handles failure in 2 places: it logs it and continues in 1, and discards it silently in 1. A failure discarded silently leaves no trace for whoever debugs this later.

Was this page helpful?

Download as PDF