@agentforge/tools 0.16.39 → 0.16.41

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/dist/index.d.cts CHANGED
@@ -4984,20 +4984,8 @@ interface ReconnectionConfig {
4984
4984
  maxDelayMs: number;
4985
4985
  }
4986
4986
 
4987
- /**
4988
- * Connection manager for relational databases using Drizzle ORM
4989
- * @module connection/connection-manager
4990
- */
4991
-
4992
- /**
4993
- * Connection lifecycle events
4994
- */
4995
4987
  type ConnectionEvent = 'connected' | 'disconnected' | 'error' | 'reconnecting';
4996
4988
 
4997
- /**
4998
- * Connection manager that handles database connections for PostgreSQL, MySQL, and SQLite
4999
- * using Drizzle ORM with lifecycle management and automatic reconnection
5000
- */
5001
4989
  declare class ConnectionManager extends EventEmitter implements DatabaseConnection {
5002
4990
  private vendor;
5003
4991
  private db;
@@ -5009,139 +4997,26 @@ declare class ConnectionManager extends EventEmitter implements DatabaseConnecti
5009
4997
  private reconnectionTimer;
5010
4998
  private connectPromise;
5011
4999
  private connectionGeneration;
5012
- /**
5013
- * Create a new ConnectionManager instance
5014
- * @param config - Connection configuration
5015
- * @param reconnectionConfig - Optional reconnection configuration
5016
- */
5017
5000
  constructor(config: ConnectionConfig, reconnectionConfig?: Partial<ReconnectionConfig>);
5018
- /**
5019
- * Connect to the database
5020
- * Initializes the connection and sets up automatic reconnection if configured
5021
- * @throws {Error} If connection fails or configuration is invalid
5022
- */
5023
5001
  connect(): Promise<void>;
5024
- /**
5025
- * Disconnect from the database
5026
- * Closes the connection and cancels any pending reconnection attempts
5027
- *
5028
- * Note: Event listeners are NOT removed by this method. If you need to dispose
5029
- * of the ConnectionManager instance entirely, call dispose() instead.
5030
- */
5031
5002
  disconnect(): Promise<void>;
5032
- /**
5033
- * Dispose of the ConnectionManager instance
5034
- * Disconnects and removes all event listeners
5035
- * Call this when you're done with the ConnectionManager and won't reuse it
5036
- */
5037
5003
  dispose(): Promise<void>;
5038
- /**
5039
- * Check if the connection is currently connected
5040
- * @returns true if connected, false otherwise
5041
- */
5042
5004
  isConnected(): boolean;
5043
- /**
5044
- * Get the current connection state
5045
- * @returns Current connection state
5046
- */
5047
5005
  getState(): ConnectionState;
5048
- /**
5049
- * Get the configured database vendor.
5050
- */
5051
5006
  getVendor(): DatabaseVendor;
5052
- /**
5053
- * Initialize the database connection
5054
- *
5055
- * This method is public to maintain compatibility with the DatabaseConnection interface
5056
- * and existing code (e.g., relational-query.ts). For new code, prefer using connect()
5057
- * which provides lifecycle management and automatic reconnection.
5058
- *
5059
- * @throws {Error} If connection fails or configuration is invalid
5060
- */
5061
5007
  initialize(): Promise<void>;
5062
- /**
5063
- * Set the connection state and log the change
5064
- * @param newState - New connection state
5065
- * @private
5066
- */
5067
5008
  private setState;
5068
- /**
5069
- * Schedule a reconnection attempt with exponential backoff
5070
- * @private
5071
- */
5072
5009
  private scheduleReconnection;
5073
- /**
5074
- * Determine whether an error thrown by drizzle-orm's better-sqlite3 adapter
5075
- * `.all()` indicates the statement does not return data (i.e. it is DML/DDL,
5076
- * not a SELECT).
5077
- *
5078
- * The adapter may surface this as either a native `SqliteError` or a
5079
- * `TypeError` depending on the drizzle-orm / better-sqlite3 version, so we
5080
- * accept both types while still requiring the distinctive message substring
5081
- * to avoid false positives from unrelated errors.
5082
- */
5083
- private isSqliteNonQueryError;
5084
- /**
5085
- * Execute a SQL query
5086
- *
5087
- * Executes a parameterized SQL query using Drizzle's SQL template objects.
5088
- * This method provides safe parameter binding to prevent SQL injection.
5089
- *
5090
- * @param query - Drizzle SQL template object with parameter binding
5091
- * @returns Query result
5092
- *
5093
- * @example
5094
- * ```typescript
5095
- * import { sql } from 'drizzle-orm';
5096
- *
5097
- * const result = await manager.execute(
5098
- * sql`SELECT * FROM users WHERE id = ${userId}`
5099
- * );
5100
- * ```
5101
- */
5010
+ private createRuntimeAdapter;
5102
5011
  execute(query: SQL): Promise<unknown>;
5103
- /**
5104
- * Execute a callback with a single dedicated database connection/session.
5105
- *
5106
- * This is required for multi-statement transactions so all statements run on
5107
- * the same underlying connection.
5108
- */
5109
5012
  executeInConnection<T>(callback: (execute: (query: SQL) => Promise<unknown>) => Promise<T>): Promise<T>;
5110
- /**
5111
- * Get connection pool metrics
5112
- *
5113
- * Returns information about the current state of the connection pool.
5114
- * For SQLite, returns basic connection status since it uses a single connection.
5115
- *
5116
- * @returns Pool metrics including total, active, idle, and waiting connections
5117
- */
5118
5013
  getPoolMetrics(): {
5119
5014
  totalCount: number;
5120
5015
  activeCount: number;
5121
5016
  idleCount: number;
5122
5017
  waitingCount: number;
5123
5018
  };
5124
- /**
5125
- * Close the database connection
5126
- *
5127
- * This method is public to maintain compatibility with the DatabaseConnection interface
5128
- * and existing code (e.g., relational-query.ts). For new code, prefer using disconnect()
5129
- * for connection lifecycle management. Note that disconnect() does NOT clean up event
5130
- * listeners; call dispose() if you need full cleanup including listener removal.
5131
- *
5132
- * Note: This method coordinates with in-flight connect()/initialize() operations
5133
- * and cancels pending reconnection timers to prevent unexpected reconnections.
5134
- */
5135
5019
  close(): Promise<void>;
5136
- /**
5137
- * Clean up resources when a connection is cancelled during initialization
5138
- * This prevents connection leaks when disconnect() is called while initialize() is in-flight
5139
- */
5140
- private cleanupCancelledConnection;
5141
- /**
5142
- * Check if the connection is healthy
5143
- * @returns true if connection is healthy, false otherwise
5144
- */
5145
5020
  isHealthy(): Promise<boolean>;
5146
5021
  }
5147
5022
 
package/dist/index.d.ts CHANGED
@@ -4984,20 +4984,8 @@ interface ReconnectionConfig {
4984
4984
  maxDelayMs: number;
4985
4985
  }
4986
4986
 
4987
- /**
4988
- * Connection manager for relational databases using Drizzle ORM
4989
- * @module connection/connection-manager
4990
- */
4991
-
4992
- /**
4993
- * Connection lifecycle events
4994
- */
4995
4987
  type ConnectionEvent = 'connected' | 'disconnected' | 'error' | 'reconnecting';
4996
4988
 
4997
- /**
4998
- * Connection manager that handles database connections for PostgreSQL, MySQL, and SQLite
4999
- * using Drizzle ORM with lifecycle management and automatic reconnection
5000
- */
5001
4989
  declare class ConnectionManager extends EventEmitter implements DatabaseConnection {
5002
4990
  private vendor;
5003
4991
  private db;
@@ -5009,139 +4997,26 @@ declare class ConnectionManager extends EventEmitter implements DatabaseConnecti
5009
4997
  private reconnectionTimer;
5010
4998
  private connectPromise;
5011
4999
  private connectionGeneration;
5012
- /**
5013
- * Create a new ConnectionManager instance
5014
- * @param config - Connection configuration
5015
- * @param reconnectionConfig - Optional reconnection configuration
5016
- */
5017
5000
  constructor(config: ConnectionConfig, reconnectionConfig?: Partial<ReconnectionConfig>);
5018
- /**
5019
- * Connect to the database
5020
- * Initializes the connection and sets up automatic reconnection if configured
5021
- * @throws {Error} If connection fails or configuration is invalid
5022
- */
5023
5001
  connect(): Promise<void>;
5024
- /**
5025
- * Disconnect from the database
5026
- * Closes the connection and cancels any pending reconnection attempts
5027
- *
5028
- * Note: Event listeners are NOT removed by this method. If you need to dispose
5029
- * of the ConnectionManager instance entirely, call dispose() instead.
5030
- */
5031
5002
  disconnect(): Promise<void>;
5032
- /**
5033
- * Dispose of the ConnectionManager instance
5034
- * Disconnects and removes all event listeners
5035
- * Call this when you're done with the ConnectionManager and won't reuse it
5036
- */
5037
5003
  dispose(): Promise<void>;
5038
- /**
5039
- * Check if the connection is currently connected
5040
- * @returns true if connected, false otherwise
5041
- */
5042
5004
  isConnected(): boolean;
5043
- /**
5044
- * Get the current connection state
5045
- * @returns Current connection state
5046
- */
5047
5005
  getState(): ConnectionState;
5048
- /**
5049
- * Get the configured database vendor.
5050
- */
5051
5006
  getVendor(): DatabaseVendor;
5052
- /**
5053
- * Initialize the database connection
5054
- *
5055
- * This method is public to maintain compatibility with the DatabaseConnection interface
5056
- * and existing code (e.g., relational-query.ts). For new code, prefer using connect()
5057
- * which provides lifecycle management and automatic reconnection.
5058
- *
5059
- * @throws {Error} If connection fails or configuration is invalid
5060
- */
5061
5007
  initialize(): Promise<void>;
5062
- /**
5063
- * Set the connection state and log the change
5064
- * @param newState - New connection state
5065
- * @private
5066
- */
5067
5008
  private setState;
5068
- /**
5069
- * Schedule a reconnection attempt with exponential backoff
5070
- * @private
5071
- */
5072
5009
  private scheduleReconnection;
5073
- /**
5074
- * Determine whether an error thrown by drizzle-orm's better-sqlite3 adapter
5075
- * `.all()` indicates the statement does not return data (i.e. it is DML/DDL,
5076
- * not a SELECT).
5077
- *
5078
- * The adapter may surface this as either a native `SqliteError` or a
5079
- * `TypeError` depending on the drizzle-orm / better-sqlite3 version, so we
5080
- * accept both types while still requiring the distinctive message substring
5081
- * to avoid false positives from unrelated errors.
5082
- */
5083
- private isSqliteNonQueryError;
5084
- /**
5085
- * Execute a SQL query
5086
- *
5087
- * Executes a parameterized SQL query using Drizzle's SQL template objects.
5088
- * This method provides safe parameter binding to prevent SQL injection.
5089
- *
5090
- * @param query - Drizzle SQL template object with parameter binding
5091
- * @returns Query result
5092
- *
5093
- * @example
5094
- * ```typescript
5095
- * import { sql } from 'drizzle-orm';
5096
- *
5097
- * const result = await manager.execute(
5098
- * sql`SELECT * FROM users WHERE id = ${userId}`
5099
- * );
5100
- * ```
5101
- */
5010
+ private createRuntimeAdapter;
5102
5011
  execute(query: SQL): Promise<unknown>;
5103
- /**
5104
- * Execute a callback with a single dedicated database connection/session.
5105
- *
5106
- * This is required for multi-statement transactions so all statements run on
5107
- * the same underlying connection.
5108
- */
5109
5012
  executeInConnection<T>(callback: (execute: (query: SQL) => Promise<unknown>) => Promise<T>): Promise<T>;
5110
- /**
5111
- * Get connection pool metrics
5112
- *
5113
- * Returns information about the current state of the connection pool.
5114
- * For SQLite, returns basic connection status since it uses a single connection.
5115
- *
5116
- * @returns Pool metrics including total, active, idle, and waiting connections
5117
- */
5118
5013
  getPoolMetrics(): {
5119
5014
  totalCount: number;
5120
5015
  activeCount: number;
5121
5016
  idleCount: number;
5122
5017
  waitingCount: number;
5123
5018
  };
5124
- /**
5125
- * Close the database connection
5126
- *
5127
- * This method is public to maintain compatibility with the DatabaseConnection interface
5128
- * and existing code (e.g., relational-query.ts). For new code, prefer using disconnect()
5129
- * for connection lifecycle management. Note that disconnect() does NOT clean up event
5130
- * listeners; call dispose() if you need full cleanup including listener removal.
5131
- *
5132
- * Note: This method coordinates with in-flight connect()/initialize() operations
5133
- * and cancels pending reconnection timers to prevent unexpected reconnections.
5134
- */
5135
5019
  close(): Promise<void>;
5136
- /**
5137
- * Clean up resources when a connection is cancelled during initialization
5138
- * This prevents connection leaks when disconnect() is called while initialize() is in-flight
5139
- */
5140
- private cleanupCancelledConnection;
5141
- /**
5142
- * Check if the connection is healthy
5143
- * @returns true if connection is healthy, false otherwise
5144
- */
5145
5020
  isHealthy(): Promise<boolean>;
5146
5021
  }
5147
5022