Plugin System
What Are Plugins?
Plugins are standard npm packages that add channel adapters to OpenACP. A plugin exports an AdapterFactory object, which OpenACP uses to instantiate and register your adapter at startup. Installing a plugin does not require modifying the OpenACP source code or rebuilding anything — the CLI handles discovery, installation, and loading automatically.
Examples of what a plugin might add:
A Discord adapter (
@openacp/adapter-discord)A Slack adapter (
@openacp/adapter-slack)An internal chat platform connector
Plugin Directory
All plugins are installed into a dedicated local directory:
~/.openacp/plugins/This directory contains its own package.json so npm can manage plugin dependencies independently of your global Node environment. OpenACP creates this directory automatically the first time you install a plugin.
Installing a Plugin
openacp install <package-name>Example:
Under the hood, this runs npm install <package-name> --prefix ~/.openacp/plugins/. The plugin is immediately available on the next startup.
Listing Installed Plugins
This reads the dependencies field from ~/.openacp/plugins/package.json and prints each installed package name and version.
Uninstalling a Plugin
Example:
This runs npm uninstall <package-name> --prefix ~/.openacp/plugins/ and removes the entry from the plugins package.json.
How Plugins Are Loaded
At startup, OpenACP reads the dependencies map from ~/.openacp/plugins/package.json. For each listed package, it calls loadAdapterFactory(packageName):
Resolves the package path using a
requirerooted in the plugins directory.Dynamically
import()s the resolved module.Looks for an
adapterFactorynamed export, falling back to thedefaultexport.Validates that the export has a
createAdapterfunction.If valid, registers the factory so the adapter can be used by
OpenACPCore.
If a plugin fails to load (missing file, invalid export), OpenACP logs an error and continues — a broken plugin does not prevent other adapters from starting.
Package Requirements
A valid plugin package must:
Export a named
adapterFactory(or adefaultexport) that conforms to theAdapterFactoryinterface:
The
createAdapterfunction receives:core: OpenACPCore— the running core instanceconfig: ChannelConfig— the adapter's config block from~/.openacp/config.json
It must return a
ChannelAdapterinstance (see Building Adapters).
Minimal Plugin package.json
package.jsonExample Plugin Structure
src/index.ts:
Last updated
Was this helpful?
