@maiar-ai/core / Plugin
Class: abstract
Plugin
Defined in: packages/core/src/runtime/providers/plugin.ts:12
Abstract base class for defining a plugin. A plugin consists of triggers, executors, and required capabilities.
Constructors​
new Plugin()​
new Plugin(
params
):Plugin
Defined in: packages/core/src/runtime/providers/plugin.ts:71
Creates a new plugin instance.
Parameters​
params​
The plugin initialization parameters.
id​
string
Unique identifier for the plugin.
description​
Resolvable
<string
>
Description of the plugin.
requiredCapabilities​
"text-generation"
[]
Capabilities required by the plugin.
promptsDir​
string
| string
[]
Optional absolute path(s) to a directory containing Liquid prompt templates.
Returns​
Properties​
id​
readonly
id:string
Defined in: packages/core/src/runtime/providers/plugin.ts:14
Unique identifier for the plugin. Must be static as it's used to identify the plugin in the runtime.
description​
readonly
description:Resolvable
<string
>
Defined in: packages/core/src/runtime/providers/plugin.ts:17
Description of what the plugin does. Used by the agent harness to give the agent context about the plugin and its capabilities.
triggers​
triggers:
Trigger
[]
Defined in: packages/core/src/runtime/providers/plugin.ts:23
Triggers associated with the plugin.
executors​
executors:
Executor
[]
Defined in: packages/core/src/runtime/providers/plugin.ts:26
Executors associated with the plugin.
promptsDir?​
readonly
optional
promptsDir:string
|string
[]
Defined in: packages/core/src/runtime/providers/plugin.ts:32
Optional absolute path(s) to a directory containing Liquid prompt templates. These will be auto-registered by the Runtime when the plugin is registered.
Accessors​
logger​
Get Signature​
get logger():
Logger
Defined in: packages/core/src/runtime/providers/plugin.ts:41
Retrieves a scoped logger instance for the plugin.
Returns​
Logger
A logger with a plugin.<id>
scope.
runtime​
Get Signature​
get runtime():
Runtime
Defined in: packages/core/src/runtime/providers/plugin.ts:50
Retrieves the assigned runtime instance.
Throws​
If the runtime is not available.
Returns​
The plugin's assigned runtime.
requiredCapabilities​
Get Signature​
get requiredCapabilities():
"text-generation"
[]
Defined in: packages/core/src/runtime/providers/plugin.ts:59
Retrieves the capabilities required by the plugin.
Returns​
"text-generation"
[]
The array of required capabilities.
Methods​
init()​
abstract
init():void
|Promise
<void
>
Defined in: packages/core/src/runtime/providers/plugin.ts:98
Initializes the plugin. Must be implemented by subclasses.
Returns​
void
| Promise
<void
>
A promise that resolves when initialization is complete.
shutdown()​
abstract
shutdown():void
|Promise
<void
>
Defined in: packages/core/src/runtime/providers/plugin.ts:104
Shuts down the plugin. Must be implemented by subclasses.
Returns​
void
| Promise
<void
>
A promise that resolves when shutdown is complete.
__setRuntime()​
__setRuntime(
runtime
):void
Defined in: packages/core/src/runtime/providers/plugin.ts:110
Internal
Sets the runtime for the plugin to be used internally by the runtime only.
Parameters​
runtime​
The runtime instance to associate with the plugin.
Returns​
void
resolveField()​
resolveField<
T
>(field
):Promise
<T
>
Defined in: packages/core/src/runtime/providers/plugin.ts:124
Resolve a lazy-evaluated field into a concrete string.
If the value is a function it will be invoked with the plugin instance as
this
, allowing access to runtime or other instance members.
The function may return a string synchronously or resolve to a string.
Type Parameters​
• T
Parameters​
field​
Resolvable
<T
>
The lazy string (static or function) to resolve.
Returns​
Promise
<T
>
The resolved string value.