> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# PluginSpec<TConfig>

> Interface exported by @botmesh/core.

Defined in: [core/types.ts:238](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L238)

A plugin: a name, a version and a synchronous `install()` that registers handlers
through `ctx.bot`. Build one with [definePlugin](https://botmesh.afaya.com.co/api/core/functions/definePlugin.md) and plug it with `bot.plug(plugin, config)`.

## Type Parameters

| Type Parameter | Default type |
| - | - |
|  `TConfig` | `Record`\<`string`, `unknown`> |

## Properties

### name

```ts theme={null}
name: string;
```

Defined in: [core/types.ts:239](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L239)

***

### version

```ts theme={null}
version: string;
```

Defined in: [core/types.ts:240](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L240)

***

### description?

```ts theme={null}
description?: string;
```

Defined in: [core/types.ts:241](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L241)

***

### requires?

```ts theme={null}
requires?: string[];
```

Defined in: [core/types.ts:246](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L246)

Names of plugins that must already be plugged (`bot.plug()` throws a descriptive
error before `install()` runs otherwise). Checked at plug time only.

***

### multiple?

```ts theme={null}
multiple?: boolean;
```

Defined in: [core/types.ts:253](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L253)

Allow several instances of this plugin (same [name](#name)) on one bot at a time, each
with its own config and unplugged on its own. Default `false`: plugging a name that is
already plugged throws, so a plugin registered twice by mistake never runs its handlers
twice. Every instance must set it.

## Methods

### install()

```ts theme={null}
install(ctx, config?): 
  | void
  | "Plugin.install() must be synchronous and return nothing: bot.plug() does not await it. Do async setup lazily on first use (LazyProvider in @botmesh/ai).";
```

Defined in: [core/types.ts:262](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L262)

Register the plugin's handlers, hooks and tools. It must be **synchronous and return
nothing**: `bot.plug()` does not await it. An `async install` (or one that returns a
promise) does not compile ([SyncInstallError](https://botmesh.afaya.com.co/api/core/type-aliases/SyncInstallError.md) names the reason); at runtime a
rejected promise is still reported on the bot's `'error'` event, but the plugin is
already considered installed and nothing is rolled back. Do async setup lazily on first
use (the `LazyProvider` pattern in `@botmesh/ai`).

#### Parameters

| Parameter | Type |
| - | - |
| `ctx` | [`PluginContext`](https://botmesh.afaya.com.co/api/core/interfaces/PluginContext) |
| `config?` | `TConfig` |

#### Returns

\| `void`
\| `"Plugin.install() must be synchronous and return nothing: bot.plug() does not await it. Do async setup lazily on first use (LazyProvider in @botmesh/ai)."`

***

### uninstall()?

```ts theme={null}
uninstall?(ctx): void | Promise<void>;
```

Defined in: [core/types.ts:263](https://github.com/andresayac/botmesh/blob/main/packages/core/src/core/types.ts#L263)

#### Parameters

| Parameter | Type |
| - | - |
| `ctx` | [`PluginContext`](https://botmesh.afaya.com.co/api/core/interfaces/PluginContext) |

#### Returns

`void` | `Promise`\<`void`>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.