@elizaos/plugin-sql 1.0.0-alpha.62 → 1.0.0-alpha.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,15 +12,16 @@ bun add @elizaos/plugin-sql
12
12
  ## Vector Dimensions
13
13
 
14
14
  The adapter supports the following vector dimensions:
15
+
15
16
  ```typescript
16
17
  VECTOR_DIMS = {
17
- SMALL: 384,
18
- MEDIUM: 512,
19
- LARGE: 768,
20
- XL: 1024,
21
- XXL: 1536,
22
- XXXL: 3072
23
- }
18
+ SMALL: 384,
19
+ MEDIUM: 512,
20
+ LARGE: 768,
21
+ XL: 1024,
22
+ XXL: 1536,
23
+ XXXL: 3072,
24
+ };
24
25
  ```
25
26
 
26
27
  Important Note: Once an agent is initialized with a specific embedding dimension, it cannot be changed. Attempting to change the dimension will result in an error: "Cannot change embedding dimension for agent"
@@ -41,6 +42,7 @@ Important Note: Once an agent is initialized with a specific embedding dimension
41
42
  The plugin uses a structured schema with the following main tables:
42
43
 
43
44
  ### Core Tables
45
+
44
46
  - **Agent**: Stores agent information and configurations
45
47
  - **Room**: Manages conversation rooms and their settings
46
48
  - **Participant**: Tracks participants in rooms
@@ -62,27 +64,30 @@ The adapter is typically used as part of the ElizaOS runtime:
62
64
 
63
65
  ```typescript
64
66
  async function findDatabaseAdapter(runtime: IAgentRuntime) {
65
- let adapter = runtime;
66
-
67
+ let adapter = runtime;
68
+
69
+ if (!adapter) {
70
+ const drizzleAdapterPlugin = await import('@elizaos/plugin-sql');
71
+ const drizzleAdapterPluginDefault = drizzleAdapterPlugin.default;
72
+ adapter = drizzleAdapterPluginDefault.adapter;
67
73
  if (!adapter) {
68
- const drizzleAdapterPlugin = await import('@elizaos/plugin-sql');
69
- const drizzleAdapterPluginDefault = drizzleAdapterPlugin.default;
70
- adapter = drizzleAdapterPluginDefault.adapter;
71
- if (!adapter) {
72
- throw new Error("Internal error: No database adapter found for default plugin-sql");
73
- }
74
- } else if (!adapter) {
75
- throw new Error("Multiple database adapters found. You must have no more than one. Adjust your plugins configuration.");
74
+ throw new Error('Internal error: No database adapter found for default plugin-sql');
76
75
  }
77
-
78
- const adapterInterface = await adapter?.init(runtime);
79
- return adapterInterface;
76
+ } else if (!adapter) {
77
+ throw new Error(
78
+ 'Multiple database adapters found. You must have no more than one. Adjust your plugins configuration.'
79
+ );
80
+ }
81
+
82
+ const adapterInterface = await adapter?.init(runtime);
83
+ return adapterInterface;
80
84
  }
81
85
  ```
82
86
 
83
87
  ## Error Handling Configuration
84
88
 
85
89
  The adapter implements the following error handling configurations:
90
+
86
91
  ```typescript
87
92
  {
88
93
  failureThreshold: 5,
@@ -114,6 +119,7 @@ These variables should be defined in a `.env` file at the root of your project.
114
119
  ## Database Pool Configuration
115
120
 
116
121
  Default pool configuration:
122
+
117
123
  ```typescript
118
124
  {
119
125
  max: 20,
@@ -127,38 +133,45 @@ Default pool configuration:
127
133
  The adapter supports two approaches to managing database schema:
128
134
 
129
135
  ### 1. Initial Setup
136
+
130
137
  Migrations are automatically run during initialization if:
138
+
131
139
  - Database tables don't exist
132
140
  - Vector extension is not found
133
141
 
134
142
  This is handled internally by:
143
+
135
144
  ```typescript
136
145
  await runMigrations(pgPool);
137
146
  ```
138
147
 
139
148
  ### 2. Schema Updates
149
+
140
150
  To update the schema:
141
151
 
142
152
  1. Install drizzle-kit (if not already installed):
153
+
143
154
  ```bash
144
- pnpm add -D drizzle-kit
155
+ bun add -D drizzle-kit
145
156
  ```
146
157
 
147
158
  2. Create or update your schema files (e.g., `schema/account.ts`):
159
+
148
160
  ```typescript
149
- import { pgTable, text, uuid } from "drizzle-orm/pg-core";
150
- import { sql } from "drizzle-orm";
151
-
152
- export const accountTable = pgTable("accounts", {
153
- id: uuid("id").primaryKey().notNull(),
154
- name: text("name"),
155
- email: text("email").notNull(),
156
- // Add new fields here
157
- newField: text("newField"),
161
+ import { pgTable, text, uuid } from 'drizzle-orm/pg-core';
162
+ import { sql } from 'drizzle-orm';
163
+
164
+ export const accountTable = pgTable('accounts', {
165
+ id: uuid('id').primaryKey().notNull(),
166
+ name: text('name'),
167
+ email: text('email').notNull(),
168
+ // Add new fields here
169
+ newField: text('newField'),
158
170
  });
159
171
  ```
160
172
 
161
173
  3. Generate migrations:
174
+
162
175
  ```bash
163
176
  npx drizzle-kit generate:pg
164
177
  ```
@@ -168,25 +181,29 @@ This will create SQL migration files in your migrations directory.
168
181
  4. Apply migrations using one of these methods:
169
182
 
170
183
  a. Using drizzle-kit:
184
+
171
185
  ```bash
172
186
  npx drizzle-kit push:pg
173
187
  ```
174
188
 
175
189
  b. Through your application code:
190
+
176
191
  ```typescript
177
- import { migrate } from "drizzle-orm/node-postgres/migrator";
192
+ import { migrate } from 'drizzle-orm/node-postgres/migrator';
178
193
 
179
- await migrate(db, { migrationsFolder: "./drizzle" });
194
+ await migrate(db, { migrationsFolder: './drizzle' });
180
195
  ```
181
196
 
182
197
  c. Using the provided migration script:
198
+
183
199
  ```bash
184
200
  npm run migrate
185
201
  # or
186
- pnpm migrate
202
+ bun migrate
187
203
  ```
188
204
 
189
205
  d. Using drizzle-kit migrate command:
206
+
190
207
  ```bash
191
208
  npx drizzle-kit migrate
192
209
  ```
@@ -198,17 +215,17 @@ This command will read the configuration from `drizzle.config.ts` and pull the P
198
215
  The plugin uses a `drizzle.config.ts` file to configure migrations:
199
216
 
200
217
  ```typescript
201
- import { config } from "dotenv";
202
- import { defineConfig } from "drizzle-kit";
218
+ import { config } from 'dotenv';
219
+ import { defineConfig } from 'drizzle-kit';
203
220
 
204
- config({ path: "../../.env" });
221
+ config({ path: '../../.env' });
205
222
 
206
223
  export default defineConfig({
207
- dialect: "postgresql",
208
- schema: "./src/schema/index.ts",
209
- out: "./drizzle/migrations",
224
+ dialect: 'postgresql',
225
+ schema: './src/schema/index.ts',
226
+ out: './drizzle/migrations',
210
227
  dbCredentials: {
211
- url: process.env.POSTGRES_URL || "file://../../pglite",
228
+ url: process.env.POSTGRES_URL || 'file://../../pglite',
212
229
  },
213
230
  breakpoints: true,
214
231
  });
@@ -224,11 +241,13 @@ The plugin supports two database backends:
224
241
  Both backends use the same migration files, ensuring consistent schema across environments.
225
242
 
226
243
  ### Note on Vector Support
244
+
227
245
  Make sure the PostgreSQL vector extension is installed before running migrations. The adapter will validate vector setup during initialization.
228
246
 
229
247
  ## Clean Shutdown
230
248
 
231
249
  The adapter implements cleanup handlers for:
250
+
232
251
  - SIGINT
233
252
  - SIGTERM
234
253
  - beforeExit
@@ -253,7 +272,7 @@ This pattern is particularly important in monorepo setups or when the package is
253
272
 
254
273
  ```typescript
255
274
  // Example of the singleton pattern implementation
256
- const GLOBAL_SINGLETONS = Symbol.for("@elizaos/plugin-sql/global-singletons");
275
+ const GLOBAL_SINGLETONS = Symbol.for('@elizaos/plugin-sql/global-singletons');
257
276
 
258
277
  // Store managers in a global symbol registry
259
278
  if (!globalSymbols[GLOBAL_SINGLETONS]) {
@@ -59,9 +59,7 @@ var PGliteClientManager = class {
59
59
  this.shuttingDown = true;
60
60
  logger.info("Starting graceful shutdown of PGlite client...");
61
61
  const timeout = setTimeout(() => {
62
- logger.warn(
63
- "Shutdown timeout reached, forcing database connection closure..."
64
- );
62
+ logger.warn("Shutdown timeout reached, forcing database connection closure...");
65
63
  this.client.close().finally(() => {
66
64
  process.exit(1);
67
65
  });
@@ -126,7 +124,7 @@ var PGliteClientManager = class {
126
124
  }
127
125
  /**
128
126
  * Asynchronously runs database migrations using Drizzle.
129
- *
127
+ *
130
128
  * Drizzle will first check if the migrations are already applied.
131
129
  * If there is a diff between database schema and migrations, it will apply the migrations.
132
130
  * If they are already applied, it will skip them.
@@ -143,7 +141,6 @@ var PGliteClientManager = class {
143
141
  });
144
142
  } catch (error) {
145
143
  logger.error("Failed to run database migrations (pglite):", error);
146
- console.trace(error);
147
144
  }
148
145
  }
149
146
  };
@@ -223,9 +220,7 @@ var PostgresConnectionManager = class {
223
220
  return true;
224
221
  } catch (error) {
225
222
  logger2.error("Database connection test failed:", error);
226
- throw new Error(
227
- `Failed to connect to database: ${error.message}`
228
- );
223
+ throw new Error(`Failed to connect to database: ${error.message}`);
229
224
  } finally {
230
225
  if (client) client.release();
231
226
  }
@@ -285,7 +280,7 @@ var PostgresConnectionManager = class {
285
280
  async initialize() {
286
281
  try {
287
282
  await this.testConnection();
288
- logger2.info("PostgreSQL connection manager initialized successfully");
283
+ logger2.debug("PostgreSQL connection manager initialized successfully");
289
284
  } catch (error) {
290
285
  logger2.error("Failed to initialize connection manager:", error);
291
286
  throw error;
@@ -329,7 +324,6 @@ var PostgresConnectionManager = class {
329
324
  });
330
325
  } catch (error) {
331
326
  logger2.error("Failed to run database migrations (pg):", error);
332
- console.trace(error);
333
327
  }
334
328
  }
335
329
  };
@@ -339,4 +333,4 @@ export {
339
333
  PGliteClientManager,
340
334
  PostgresConnectionManager
341
335
  };
342
- //# sourceMappingURL=chunk-JA2K6HCO.js.map
336
+ //# sourceMappingURL=chunk-BB7AIHAE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pglite/manager.ts","../src/pg/manager.ts"],"sourceRoot":"./","sourcesContent":["import { dirname as pathDirname, resolve as pathResolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { PGlite, type PGliteOptions } from '@electric-sql/pglite';\nimport { fuzzystrmatch } from '@electric-sql/pglite/contrib/fuzzystrmatch';\nimport { vector } from '@electric-sql/pglite/vector';\nimport { logger } from '@elizaos/core';\nimport { drizzle } from 'drizzle-orm/pglite';\nimport { migrate } from 'drizzle-orm/pglite/migrator';\nimport type { IDatabaseClientManager } from '../types';\n\n/**\n * Class representing a database client manager for PGlite.\n * @implements { IDatabaseClientManager }\n */\nexport class PGliteClientManager implements IDatabaseClientManager<PGlite> {\n private client: PGlite;\n private shuttingDown = false;\n private readonly shutdownTimeout = 500;\n\n /**\n * Constructor for creating a new instance of PGlite with the provided options.\n * Initializes the PGlite client with additional extensions.\n * @param {PGliteOptions} options - The options to configure the PGlite client.\n */\n constructor(options: PGliteOptions) {\n this.client = new PGlite({\n ...options,\n extensions: {\n vector,\n fuzzystrmatch,\n },\n });\n this.setupShutdownHandlers();\n }\n\n /**\n * Retrieves the PostgreSQL lite connection.\n *\n * @returns {PGlite} The PostgreSQL lite connection.\n * @throws {Error} If the client manager is currently shutting down.\n */\n public getConnection(): PGlite {\n if (this.shuttingDown) {\n throw new Error('Client manager is shutting down');\n }\n return this.client;\n }\n\n /**\n * Initiates a graceful shutdown of the PGlite client.\n * Checks if the client is already in the process of shutting down.\n * Logs the start of shutdown process and sets shuttingDown flag to true.\n * Sets a timeout for the shutdown process and forces closure of database connection if timeout is reached.\n * Handles the shutdown process, closes the client connection, clears the timeout, and logs the completion of shutdown.\n * Logs any errors that occur during the shutdown process.\n */\n private async gracefulShutdown() {\n if (this.shuttingDown) {\n return;\n }\n\n this.shuttingDown = true;\n logger.info('Starting graceful shutdown of PGlite client...');\n\n const timeout = setTimeout(() => {\n logger.warn('Shutdown timeout reached, forcing database connection closure...');\n this.client.close().finally(() => {\n process.exit(1);\n });\n }, this.shutdownTimeout);\n\n try {\n await this.client.close();\n clearTimeout(timeout);\n logger.info('PGlite client shutdown completed successfully');\n process.exit(0);\n } catch (error) {\n logger.error('Error during graceful shutdown:', error);\n process.exit(1);\n }\n }\n\n /**\n * Sets up shutdown handlers for SIGINT, SIGTERM, and beforeExit events to gracefully shutdown the application.\n * @private\n */\n private setupShutdownHandlers() {\n process.on('SIGINT', async () => {\n await this.gracefulShutdown();\n });\n\n process.on('SIGTERM', async () => {\n await this.gracefulShutdown();\n });\n\n process.on('beforeExit', async () => {\n await this.gracefulShutdown();\n });\n }\n\n /**\n * Initializes the client for PGlite.\n *\n * @returns {Promise<void>} A Promise that resolves when the client is initialized successfully\n */\n public async initialize(): Promise<void> {\n try {\n await this.client.waitReady;\n logger.info('PGlite client initialized successfully');\n } catch (error) {\n logger.error('Failed to initialize PGlite client:', error);\n throw error;\n }\n }\n\n /**\n * Asynchronously closes the resource. If the resource is not already shutting down,\n * it performs a graceful shutdown before closing.\n *\n * @returns A promise that resolves once the resource has been closed.\n */\n public async close(): Promise<void> {\n if (!this.shuttingDown) {\n await this.gracefulShutdown();\n }\n }\n\n /**\n * Check if the system is currently shutting down.\n *\n * @returns {boolean} True if the system is shutting down, false otherwise.\n */\n public isShuttingDown(): boolean {\n return this.shuttingDown;\n }\n\n /**\n * Asynchronously runs database migrations using Drizzle.\n *\n * Drizzle will first check if the migrations are already applied.\n * If there is a diff between database schema and migrations, it will apply the migrations.\n * If they are already applied, it will skip them.\n *\n * @returns {Promise<void>} A Promise that resolves once the migrations are completed successfully.\n */\n async runMigrations(): Promise<void> {\n try {\n const db = drizzle(this.client);\n\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = pathDirname(__filename);\n\n await migrate(db, {\n migrationsFolder: pathResolve(__dirname, '../drizzle/migrations'),\n });\n } catch (error) {\n logger.error('Failed to run database migrations (pglite):', error);\n }\n }\n}\n","import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { logger } from '@elizaos/core';\nimport { drizzle } from 'drizzle-orm/node-postgres';\nimport { migrate } from 'drizzle-orm/node-postgres/migrator';\nimport pkg, { type Pool as PgPool } from 'pg';\nimport type { IDatabaseClientManager } from '../types';\n\nconst { Pool } = pkg;\n\n/**\n * Manages connections to a PostgreSQL database using a connection pool.\n * Implements IDatabaseClientManager interface.\n */\n\nexport class PostgresConnectionManager implements IDatabaseClientManager<PgPool> {\n private pool: PgPool;\n private isShuttingDown = false;\n private readonly connectionTimeout: number = 5000;\n\n /**\n * Constructor for creating a connection pool.\n * @param {string} connectionString - The connection string used to connect to the database.\n */\n constructor(connectionString: string) {\n const defaultConfig = {\n max: 20,\n idleTimeoutMillis: 30000,\n connectionTimeoutMillis: this.connectionTimeout,\n };\n\n this.pool = new Pool({\n ...defaultConfig,\n connectionString,\n });\n\n this.pool.on('error', (err) => {\n logger.error('Unexpected pool error', err);\n this.handlePoolError(err);\n });\n\n this.setupPoolErrorHandling();\n this.testConnection();\n }\n\n /**\n * Handles a pool error by attempting to reconnect the pool.\n *\n * @param {Error} error The error that occurred in the pool.\n * @throws {Error} If failed to reconnect the pool.\n */\n private async handlePoolError(error: Error) {\n logger.error('Pool error occurred, attempting to reconnect', {\n error: error.message,\n });\n\n try {\n await this.pool.end();\n\n this.pool = new Pool({\n ...this.pool.options,\n connectionTimeoutMillis: this.connectionTimeout,\n });\n\n await this.testConnection();\n logger.success('Pool reconnection successful');\n } catch (reconnectError) {\n logger.error('Failed to reconnect pool', {\n error: reconnectError instanceof Error ? reconnectError.message : String(reconnectError),\n });\n throw reconnectError;\n }\n }\n\n /**\n * Asynchronously tests the database connection by executing a query to get the current timestamp.\n *\n * @returns {Promise<boolean>} - A Promise that resolves to true if the database connection test is successful.\n */\n async testConnection(): Promise<boolean> {\n let client: pkg.PoolClient | null = null;\n try {\n client = await this.pool.connect();\n const result = await client.query('SELECT NOW()');\n logger.success('Database connection test successful:', result.rows[0]);\n return true;\n } catch (error) {\n logger.error('Database connection test failed:', error);\n throw new Error(`Failed to connect to database: ${(error as Error).message}`);\n } finally {\n if (client) client.release();\n }\n }\n\n /**\n * Sets up event listeners to handle pool cleanup on SIGINT, SIGTERM, and beforeExit events.\n */\n private setupPoolErrorHandling() {\n process.on('SIGINT', async () => {\n await this.cleanup();\n process.exit(0);\n });\n\n process.on('SIGTERM', async () => {\n await this.cleanup();\n process.exit(0);\n });\n\n process.on('beforeExit', async () => {\n await this.cleanup();\n });\n }\n\n /**\n * Get the connection pool.\n * @returns {PgPool} The connection pool\n * @throws {Error} If the connection manager is shutting down or an error occurs when trying to get the connection from the pool\n */\n public getConnection(): PgPool {\n if (this.isShuttingDown) {\n throw new Error('Connection manager is shutting down');\n }\n\n try {\n return this.pool;\n } catch (error) {\n logger.error('Failed to get connection from pool:', error);\n throw error;\n }\n }\n\n /**\n * Asynchronously acquires a database client from the connection pool.\n *\n * @returns {Promise<pkg.PoolClient>} A Promise that resolves with the acquired database client.\n * @throws {Error} If an error occurs while acquiring the database client.\n */\n public async getClient(): Promise<pkg.PoolClient> {\n try {\n return await this.pool.connect();\n } catch (error) {\n logger.error('Failed to acquire a database client:', error);\n throw error;\n }\n }\n\n /**\n * Initializes the PostgreSQL connection manager by testing the connection and logging the result.\n *\n * @returns {Promise<void>} A Promise that resolves once the manager is successfully initialized\n * @throws {Error} If there is an error initializing the connection manager\n */\n public async initialize(): Promise<void> {\n try {\n await this.testConnection();\n logger.debug('PostgreSQL connection manager initialized successfully');\n } catch (error) {\n logger.error('Failed to initialize connection manager:', error);\n throw error;\n }\n }\n\n /**\n * Asynchronously close the current process by executing a cleanup function.\n * @returns A promise that resolves once the cleanup is complete.\n */\n public async close(): Promise<void> {\n await this.cleanup();\n }\n\n /**\n * Cleans up and closes the database pool.\n * @returns {Promise<void>} A Promise that resolves when the database pool is closed.\n */\n async cleanup(): Promise<void> {\n try {\n await this.pool.end();\n logger.info('Database pool closed');\n } catch (error) {\n logger.error('Error closing database pool:', error);\n }\n }\n\n /**\n * Asynchronously runs database migrations using the Drizzle library.\n *\n * Drizzle will first check if the migrations are already applied.\n * If there is a diff between database schema and migrations, it will apply the migrations.\n * If they are already applied, it will skip them.\n *\n * @returns {Promise<void>} A Promise that resolves once the migrations are completed successfully.\n */\n async runMigrations(): Promise<void> {\n try {\n const db = drizzle(this.pool);\n\n const __filename = fileURLToPath(import.meta.url);\n const __dirname = path.dirname(__filename);\n\n await migrate(db, {\n migrationsFolder: path.resolve(__dirname, '../drizzle/migrations'),\n });\n } catch (error) {\n logger.error('Failed to run database migrations (pg):', error);\n }\n }\n}\n"],"mappings":";;;;AAAA,SAAS,WAAW,aAAa,WAAW,mBAAmB;AAC/D,SAAS,qBAAqB;AAC9B,SAAS,cAAkC;AAC3C,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,eAAe;AAOjB,IAAM,sBAAN,MAAoE;AAAA,EAd3E,OAc2E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