Skip to main content

@maiar-ai/core / Plugin

Class: abstract Plugin

Defined in: packages/core/src/runtime/providers/plugin.ts:13

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:75

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​

Plugin

Properties​

id​

readonly id: string

Defined in: packages/core/src/runtime/providers/plugin.ts:15

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:18

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:24

Triggers associated with the plugin.


executors​

executors: Executor[]

Defined in: packages/core/src/runtime/providers/plugin.ts:27

Executors associated with the plugin.


promptsDir?​

readonly optional promptsDir: string | string[]

Defined in: packages/core/src/runtime/providers/plugin.ts:33

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:42

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:51

Retrieves the assigned runtime instance with automatic plugin context injection.

Throws​

If the runtime is not available.

Returns​

Runtime

The plugin's scoped runtime wrapper.


requiredCapabilities​

Get Signature​

get requiredCapabilities(): "text-generation"[]

Defined in: packages/core/src/runtime/providers/plugin.ts:63

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:102

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:108

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:114

Internal

Sets the runtime for the plugin to be used internally by the runtime only.

Parameters​

runtime​

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:128

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.