workmatic 1.1.2 → 1.2.0

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
@@ -1,5 +1,5 @@
1
- import * as better_sqlite3 from 'better-sqlite3';
2
- import better_sqlite3__default from 'better-sqlite3';
1
+ import * as Database from 'better-sqlite3';
2
+ import Database__default from 'better-sqlite3';
3
3
  import * as http from 'http';
4
4
  import { Kysely, Generated } from 'kysely';
5
5
 
@@ -97,9 +97,11 @@ interface AddManyResult {
97
97
  */
98
98
  interface DatabaseOptions {
99
99
  /** Existing better-sqlite3 Database instance */
100
- db?: better_sqlite3.Database;
100
+ db?: Database.Database;
101
101
  /** Path to SQLite database file (ignored if db is provided) */
102
102
  filename?: string;
103
+ /** Maximum number of prepared statements to cache. Default: 1000. Set to 0 to disable. */
104
+ statementCacheSize?: number;
103
105
  }
104
106
  /**
105
107
  * Options for creating a client
@@ -109,6 +111,10 @@ interface ClientOptions {
109
111
  db: WorkmaticDb;
110
112
  /** Queue name. Default: 'default' */
111
113
  queue?: string;
114
+ /** Optional callback to notify immediately when a ready job is added */
115
+ onJobAdded?: () => void;
116
+ /** Optional worker instance to wake up immediately when a ready job is added */
117
+ worker?: WorkmaticWorker;
112
118
  }
113
119
  /**
114
120
  * Backoff function type
@@ -152,6 +158,11 @@ interface WorkerOptions {
152
158
  requeueExpiredIntervalMs?: number;
153
159
  /** Called when the pump loop catches an error (after optional default logging) */
154
160
  onPumpError?: (error: unknown) => void;
161
+ /**
162
+ * Maximum number of completions to batch before flushing to the database.
163
+ * Default: 50. Set to 0 to disable completion micro-batching.
164
+ */
165
+ completionBatchSize?: number;
155
166
  }
156
167
  /**
157
168
  * Job processor function type
@@ -207,6 +218,12 @@ interface WorkmaticWorker {
207
218
  clear(options?: {
208
219
  status?: JobStatus;
209
220
  }): Promise<number>;
221
+ /** Wake up the worker immediately to check for jobs without waiting for pollMs */
222
+ wakeUp(): void;
223
+ /** Flush any pending buffered completion updates to the database */
224
+ flushCompletions(): Promise<void>;
225
+ /** Attach OS signal handlers (SIGINT, SIGTERM) for graceful shutdown */
226
+ attachSignalHandlers(options?: GracefulShutdownOptions): () => void;
210
227
  /** Check if worker is running */
211
228
  readonly isRunning: boolean;
212
229
  /** Check if worker is paused */
@@ -320,6 +337,29 @@ interface WorkmaticOrchestrator {
320
337
  stats(queue?: string): Promise<Record<string, JobStats>>;
321
338
  transfer(options: TransferOptions): Promise<TransferResult>;
322
339
  moveJob(publicId: string, toQueue: string, options?: MoveJobOptions): Promise<void>;
340
+ /** Attach OS signal handlers (SIGINT, SIGTERM) for graceful shutdown of all workers */
341
+ attachSignalHandlers(options?: GracefulShutdownOptions): () => void;
342
+ }
343
+ /**
344
+ * Options for configuring graceful shutdown signal listeners
345
+ */
346
+ interface GracefulShutdownOptions {
347
+ /** OS signals to listen for. Default: ['SIGINT', 'SIGTERM'] */
348
+ signals?: NodeJS.Signals[];
349
+ /** Maximum time in ms to wait for jobs to drain before forced exit. Default: 30000 */
350
+ timeoutMs?: number;
351
+ /** Whether to call process.exit when shutdown finishes or times out. Default: true */
352
+ exitOnComplete?: boolean;
353
+ /** Process exit code on clean shutdown. Default: 0 */
354
+ exitCode?: number;
355
+ /** Process exit code when shutdown times out or errors. Default: 1 */
356
+ timeoutExitCode?: number;
357
+ /** Callback triggered when shutdown begins */
358
+ onShutdownStart?: (signal: NodeJS.Signals) => void;
359
+ /** Callback triggered after shutdown finishes successfully */
360
+ onShutdownComplete?: () => void;
361
+ /** Callback triggered if shutdown times out or fails */
362
+ onShutdownError?: (error: unknown) => void;
323
363
  }
324
364
  /**
325
365
  * Internal job representation from database
@@ -335,6 +375,61 @@ interface ClaimedJob {
335
375
  created_at: number;
336
376
  last_error: string | null;
337
377
  }
378
+ /**
379
+ * Event emitted when a job status is updated
380
+ */
381
+ interface JobStatusChangeEvent {
382
+ publicId: string;
383
+ queue: string;
384
+ previousStatus: JobStatus;
385
+ status: JobStatus;
386
+ timestamp: number;
387
+ error?: string | null;
388
+ }
389
+ /**
390
+ * Options for creating an MCP server
391
+ */
392
+ interface McpServerOptions {
393
+ /** Kysely database instance */
394
+ db: WorkmaticDb;
395
+ /** Input readable stream (default: process.stdin) */
396
+ input?: NodeJS.ReadableStream;
397
+ /** Output writable stream (default: process.stdout) */
398
+ output?: NodeJS.WritableStream;
399
+ /** Optional orchestrator instance to wake up workers on status change */
400
+ orchestrator?: WorkmaticOrchestrator;
401
+ /** Optional worker instances to wake up on status change */
402
+ workers?: WorkmaticWorker[];
403
+ /** Optional callback invoked whenever a job status changes */
404
+ onJobStatusChanged?: (event: JobStatusChangeEvent) => void;
405
+ }
406
+ /**
407
+ * Tool definition for Model Context Protocol (MCP)
408
+ */
409
+ interface McpToolDefinition$1 {
410
+ name: string;
411
+ description: string;
412
+ inputSchema: {
413
+ type: 'object';
414
+ properties: Record<string, unknown>;
415
+ required?: string[];
416
+ };
417
+ }
418
+ /**
419
+ * MCP Server interface
420
+ */
421
+ interface WorkmaticMcpServer {
422
+ /** Start listening for JSON-RPC messages */
423
+ start(): void;
424
+ /** Stop listening and close streams */
425
+ stop(): void;
426
+ /** Handle a raw JSON-RPC string message */
427
+ handleMessage(raw: string): Promise<string | null>;
428
+ /** Register event listener for job status changes */
429
+ on(event: 'jobStatusChanged', listener: (event: JobStatusChangeEvent) => void): this;
430
+ /** Remove event listener for job status changes */
431
+ off(event: 'jobStatusChanged', listener: (event: JobStatusChangeEvent) => void): this;
432
+ }
338
433
 
339
434
  /**
340
435
  * Create and initialize the workmatic database
@@ -362,7 +457,16 @@ declare function createDatabase(options?: DatabaseOptions): WorkmaticDb;
362
457
  * created with {@link createDatabase}. For manually constructed `Kysely` instances,
363
458
  * falls back to reading the dialect adapter (may break across Kysely versions).
364
459
  */
365
- declare function getUnderlyingDb(db: WorkmaticDb): better_sqlite3__default.Database;
460
+ declare function getUnderlyingDb(db: WorkmaticDb): Database__default.Database;
461
+ /**
462
+ * Enable prepared statement caching on a better-sqlite3 database instance.
463
+ * Reuses compiled statements across queries, bypassing SQLite SQL parsing
464
+ * and bytecode recompilation on repeated queries.
465
+ *
466
+ * @param db - better-sqlite3 database instance
467
+ * @param maxStatements - Maximum cached statements (default: 1000). Set <= 0 to disable.
468
+ */
469
+ declare function enableStatementCache(db: Database__default.Database, maxStatements?: number): Database__default.Database;
366
470
 
367
471
  /**
368
472
  * Create a job queue client for adding jobs
@@ -470,6 +574,52 @@ declare function createDashboard(options: DashboardOptions): WorkmaticDashboard;
470
574
  */
471
575
  declare function createDashboardMiddleware(options: DashboardMiddlewareOptions): DashboardMiddleware;
472
576
 
577
+ type GracefulShutdownTarget = WorkmaticWorker | WorkmaticOrchestrator | WorkmaticWorker[];
578
+ /**
579
+ * Attach OS signal listeners (SIGINT, SIGTERM) to gracefully stop a worker,
580
+ * an orchestrator, or a group of workers before the process exits.
581
+ *
582
+ * @param target - Worker, orchestrator, or array of workers to stop
583
+ * @param options - Graceful shutdown options
584
+ * @returns Detach function that unregisters the signal listeners
585
+ *
586
+ * @example
587
+ * ```ts
588
+ * const worker = createWorker({ db });
589
+ * worker.start();
590
+ *
591
+ * const detach = attachGracefulShutdown(worker, {
592
+ * timeoutMs: 15000,
593
+ * onShutdownComplete: () => console.log('All jobs finished, shutting down'),
594
+ * });
595
+ * ```
596
+ */
597
+ declare function attachGracefulShutdown(target: GracefulShutdownTarget, options?: GracefulShutdownOptions): () => void;
598
+
599
+ /**
600
+ * Creates a lightweight stdio JSON-RPC 2.0 MCP server for Workmatic.
601
+ * Conforms to the MCP Specification (protocol version 2024-11-05).
602
+ */
603
+ declare function createMcpServer(options: McpServerOptions): WorkmaticMcpServer;
604
+
605
+ interface ToolExecutionContext {
606
+ onJobStatusChanged?: (event: JobStatusChangeEvent) => void;
607
+ }
608
+ interface McpToolDefinition {
609
+ name: string;
610
+ description: string;
611
+ inputSchema: {
612
+ type: 'object';
613
+ properties: Record<string, unknown>;
614
+ required?: string[];
615
+ };
616
+ }
617
+ declare const MCP_TOOL_DEFINITIONS: McpToolDefinition[];
618
+ /**
619
+ * Execute an MCP tool invocation against a Workmatic database
620
+ */
621
+ declare function executeTool(db: WorkmaticDb, name: string, args?: Record<string, unknown>, context?: ToolExecutionContext): Promise<unknown>;
622
+
473
623
  /**
474
624
  * Default exponential backoff function
475
625
  * Returns delay in milliseconds: 1000 * 2^attempts
@@ -495,4 +645,4 @@ declare const defaultBackoff: BackoffFunction;
495
645
  */
496
646
  declare function validatePayload(payload: unknown): string;
497
647
 
498
- export { type AddJobOptions, type AddJobResult, type AddManyResult, type BackoffFunction, type ClaimedJob, type ClientOptions, DEFAULT_WORKER_TIMEOUT_MS, type DashboardMiddleware, type DashboardMiddlewareOptions, type DashboardOptions, type DatabaseOptions, type Job, type JobProcessor, type JobStats, type JobStatus, type MoveJobOptions, type OrchestratorOptions, type RegisterQueueOptions, type TransferOptions, type TransferResult, type WorkerOptions, type WorkerState, type WorkmaticClient, type WorkmaticDashboard, type WorkmaticDatabase, type WorkmaticDb, type WorkmaticJobsTable, type WorkmaticOrchestrator, type WorkmaticWorker, createClient, createDashboard, createDashboardMiddleware, createDatabase, createOrchestrator, createWorker, defaultBackoff, getUnderlyingDb, validatePayload };
648
+ export { type AddJobOptions, type AddJobResult, type AddManyResult, type BackoffFunction, type ClaimedJob, type ClientOptions, DEFAULT_WORKER_TIMEOUT_MS, type DashboardMiddleware, type DashboardMiddlewareOptions, type DashboardOptions, type DatabaseOptions, type GracefulShutdownOptions, type Job, type JobProcessor, type JobStats, type JobStatus, type JobStatusChangeEvent, MCP_TOOL_DEFINITIONS, type McpServerOptions, type McpToolDefinition$1 as McpToolDefinition, type MoveJobOptions, type OrchestratorOptions, type RegisterQueueOptions, type TransferOptions, type TransferResult, type WorkerOptions, type WorkerState, type WorkmaticClient, type WorkmaticDashboard, type WorkmaticDatabase, type WorkmaticDb, type WorkmaticJobsTable, type WorkmaticMcpServer, type WorkmaticOrchestrator, type WorkmaticWorker, attachGracefulShutdown, createClient, createDashboard, createDashboardMiddleware, createDatabase, createMcpServer, createOrchestrator, createWorker, defaultBackoff, enableStatementCache, executeTool, getUnderlyingDb, validatePayload };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as better_sqlite3 from 'better-sqlite3';
2
- import better_sqlite3__default from 'better-sqlite3';
1
+ import * as Database from 'better-sqlite3';
2
+ import Database__default from 'better-sqlite3';
3
3
  import * as http from 'http';
4
4
  import { Kysely, Generated } from 'kysely';
5
5
 
@@ -97,9 +97,11 @@ interface AddManyResult {
97
97
  */
98
98
  interface DatabaseOptions {
99
99
  /** Existing better-sqlite3 Database instance */
100
- db?: better_sqlite3.Database;
100
+ db?: Database.Database;
101
101
  /** Path to SQLite database file (ignored if db is provided) */
102
102
  filename?: string;
103
+ /** Maximum number of prepared statements to cache. Default: 1000. Set to 0 to disable. */
104
+ statementCacheSize?: number;
103
105
  }
104
106
  /**
105
107
  * Options for creating a client
@@ -109,6 +111,10 @@ interface ClientOptions {
109
111
  db: WorkmaticDb;
110
112
  /** Queue name. Default: 'default' */
111
113
  queue?: string;
114
+ /** Optional callback to notify immediately when a ready job is added */
115
+ onJobAdded?: () => void;
116
+ /** Optional worker instance to wake up immediately when a ready job is added */
117
+ worker?: WorkmaticWorker;
112
118
  }
113
119
  /**
114
120
  * Backoff function type
@@ -152,6 +158,11 @@ interface WorkerOptions {
152
158
  requeueExpiredIntervalMs?: number;
153
159
  /** Called when the pump loop catches an error (after optional default logging) */
154
160
  onPumpError?: (error: unknown) => void;
161
+ /**
162
+ * Maximum number of completions to batch before flushing to the database.
163
+ * Default: 50. Set to 0 to disable completion micro-batching.
164
+ */
165
+ completionBatchSize?: number;
155
166
  }
156
167
  /**
157
168
  * Job processor function type
@@ -207,6 +218,12 @@ interface WorkmaticWorker {
207
218
  clear(options?: {
208
219
  status?: JobStatus;
209
220
  }): Promise<number>;
221
+ /** Wake up the worker immediately to check for jobs without waiting for pollMs */
222
+ wakeUp(): void;
223
+ /** Flush any pending buffered completion updates to the database */
224
+ flushCompletions(): Promise<void>;
225
+ /** Attach OS signal handlers (SIGINT, SIGTERM) for graceful shutdown */
226
+ attachSignalHandlers(options?: GracefulShutdownOptions): () => void;
210
227
  /** Check if worker is running */
211
228
  readonly isRunning: boolean;
212
229
  /** Check if worker is paused */
@@ -320,6 +337,29 @@ interface WorkmaticOrchestrator {
320
337
  stats(queue?: string): Promise<Record<string, JobStats>>;
321
338
  transfer(options: TransferOptions): Promise<TransferResult>;
322
339
  moveJob(publicId: string, toQueue: string, options?: MoveJobOptions): Promise<void>;
340
+ /** Attach OS signal handlers (SIGINT, SIGTERM) for graceful shutdown of all workers */
341
+ attachSignalHandlers(options?: GracefulShutdownOptions): () => void;
342
+ }
343
+ /**
344
+ * Options for configuring graceful shutdown signal listeners
345
+ */
346
+ interface GracefulShutdownOptions {
347
+ /** OS signals to listen for. Default: ['SIGINT', 'SIGTERM'] */
348
+ signals?: NodeJS.Signals[];
349
+ /** Maximum time in ms to wait for jobs to drain before forced exit. Default: 30000 */
350
+ timeoutMs?: number;
351
+ /** Whether to call process.exit when shutdown finishes or times out. Default: true */
352
+ exitOnComplete?: boolean;
353
+ /** Process exit code on clean shutdown. Default: 0 */
354
+ exitCode?: number;
355
+ /** Process exit code when shutdown times out or errors. Default: 1 */
356
+ timeoutExitCode?: number;
357
+ /** Callback triggered when shutdown begins */
358
+ onShutdownStart?: (signal: NodeJS.Signals) => void;
359
+ /** Callback triggered after shutdown finishes successfully */
360
+ onShutdownComplete?: () => void;
361
+ /** Callback triggered if shutdown times out or fails */
362
+ onShutdownError?: (error: unknown) => void;
323
363
  }
324
364
  /**
325
365
  * Internal job representation from database
@@ -335,6 +375,61 @@ interface ClaimedJob {
335
375
  created_at: number;
336
376
  last_error: string | null;
337
377
  }
378
+ /**
379
+ * Event emitted when a job status is updated
380
+ */
381
+ interface JobStatusChangeEvent {
382
+ publicId: string;
383
+ queue: string;
384
+ previousStatus: JobStatus;
385
+ status: JobStatus;
386
+ timestamp: number;
387
+ error?: string | null;
388
+ }
389
+ /**
390
+ * Options for creating an MCP server
391
+ */
392
+ interface McpServerOptions {
393
+ /** Kysely database instance */
394
+ db: WorkmaticDb;
395
+ /** Input readable stream (default: process.stdin) */
396
+ input?: NodeJS.ReadableStream;
397
+ /** Output writable stream (default: process.stdout) */
398
+ output?: NodeJS.WritableStream;
399
+ /** Optional orchestrator instance to wake up workers on status change */
400
+ orchestrator?: WorkmaticOrchestrator;
401
+ /** Optional worker instances to wake up on status change */
402
+ workers?: WorkmaticWorker[];
403
+ /** Optional callback invoked whenever a job status changes */
404
+ onJobStatusChanged?: (event: JobStatusChangeEvent) => void;
405
+ }
406
+ /**
407
+ * Tool definition for Model Context Protocol (MCP)
408
+ */
409
+ interface McpToolDefinition$1 {
410
+ name: string;
411
+ description: string;
412
+ inputSchema: {
413
+ type: 'object';
414
+ properties: Record<string, unknown>;
415
+ required?: string[];
416
+ };
417
+ }
418
+ /**
419
+ * MCP Server interface
420
+ */
421
+ interface WorkmaticMcpServer {
422
+ /** Start listening for JSON-RPC messages */
423
+ start(): void;
424
+ /** Stop listening and close streams */
425
+ stop(): void;
426
+ /** Handle a raw JSON-RPC string message */
427
+ handleMessage(raw: string): Promise<string | null>;
428
+ /** Register event listener for job status changes */
429
+ on(event: 'jobStatusChanged', listener: (event: JobStatusChangeEvent) => void): this;
430
+ /** Remove event listener for job status changes */
431
+ off(event: 'jobStatusChanged', listener: (event: JobStatusChangeEvent) => void): this;
432
+ }
338
433
 
339
434
  /**
340
435
  * Create and initialize the workmatic database
@@ -362,7 +457,16 @@ declare function createDatabase(options?: DatabaseOptions): WorkmaticDb;
362
457
  * created with {@link createDatabase}. For manually constructed `Kysely` instances,
363
458
  * falls back to reading the dialect adapter (may break across Kysely versions).
364
459
  */
365
- declare function getUnderlyingDb(db: WorkmaticDb): better_sqlite3__default.Database;
460
+ declare function getUnderlyingDb(db: WorkmaticDb): Database__default.Database;
461
+ /**
462
+ * Enable prepared statement caching on a better-sqlite3 database instance.
463
+ * Reuses compiled statements across queries, bypassing SQLite SQL parsing
464
+ * and bytecode recompilation on repeated queries.
465
+ *
466
+ * @param db - better-sqlite3 database instance
467
+ * @param maxStatements - Maximum cached statements (default: 1000). Set <= 0 to disable.
468
+ */
469
+ declare function enableStatementCache(db: Database__default.Database, maxStatements?: number): Database__default.Database;
366
470
 
367
471
  /**
368
472
  * Create a job queue client for adding jobs
@@ -470,6 +574,52 @@ declare function createDashboard(options: DashboardOptions): WorkmaticDashboard;
470
574
  */
471
575
  declare function createDashboardMiddleware(options: DashboardMiddlewareOptions): DashboardMiddleware;
472
576
 
577
+ type GracefulShutdownTarget = WorkmaticWorker | WorkmaticOrchestrator | WorkmaticWorker[];
578
+ /**
579
+ * Attach OS signal listeners (SIGINT, SIGTERM) to gracefully stop a worker,
580
+ * an orchestrator, or a group of workers before the process exits.
581
+ *
582
+ * @param target - Worker, orchestrator, or array of workers to stop
583
+ * @param options - Graceful shutdown options
584
+ * @returns Detach function that unregisters the signal listeners
585
+ *
586
+ * @example
587
+ * ```ts
588
+ * const worker = createWorker({ db });
589
+ * worker.start();
590
+ *
591
+ * const detach = attachGracefulShutdown(worker, {
592
+ * timeoutMs: 15000,
593
+ * onShutdownComplete: () => console.log('All jobs finished, shutting down'),
594
+ * });
595
+ * ```
596
+ */
597
+ declare function attachGracefulShutdown(target: GracefulShutdownTarget, options?: GracefulShutdownOptions): () => void;
598
+
599
+ /**
600
+ * Creates a lightweight stdio JSON-RPC 2.0 MCP server for Workmatic.
601
+ * Conforms to the MCP Specification (protocol version 2024-11-05).
602
+ */
603
+ declare function createMcpServer(options: McpServerOptions): WorkmaticMcpServer;
604
+
605
+ interface ToolExecutionContext {
606
+ onJobStatusChanged?: (event: JobStatusChangeEvent) => void;
607
+ }
608
+ interface McpToolDefinition {
609
+ name: string;
610
+ description: string;
611
+ inputSchema: {
612
+ type: 'object';
613
+ properties: Record<string, unknown>;
614
+ required?: string[];
615
+ };
616
+ }
617
+ declare const MCP_TOOL_DEFINITIONS: McpToolDefinition[];
618
+ /**
619
+ * Execute an MCP tool invocation against a Workmatic database
620
+ */
621
+ declare function executeTool(db: WorkmaticDb, name: string, args?: Record<string, unknown>, context?: ToolExecutionContext): Promise<unknown>;
622
+
473
623
  /**
474
624
  * Default exponential backoff function
475
625
  * Returns delay in milliseconds: 1000 * 2^attempts
@@ -495,4 +645,4 @@ declare const defaultBackoff: BackoffFunction;
495
645
  */
496
646
  declare function validatePayload(payload: unknown): string;
497
647
 
498
- export { type AddJobOptions, type AddJobResult, type AddManyResult, type BackoffFunction, type ClaimedJob, type ClientOptions, DEFAULT_WORKER_TIMEOUT_MS, type DashboardMiddleware, type DashboardMiddlewareOptions, type DashboardOptions, type DatabaseOptions, type Job, type JobProcessor, type JobStats, type JobStatus, type MoveJobOptions, type OrchestratorOptions, type RegisterQueueOptions, type TransferOptions, type TransferResult, type WorkerOptions, type WorkerState, type WorkmaticClient, type WorkmaticDashboard, type WorkmaticDatabase, type WorkmaticDb, type WorkmaticJobsTable, type WorkmaticOrchestrator, type WorkmaticWorker, createClient, createDashboard, createDashboardMiddleware, createDatabase, createOrchestrator, createWorker, defaultBackoff, getUnderlyingDb, validatePayload };
648
+ export { type AddJobOptions, type AddJobResult, type AddManyResult, type BackoffFunction, type ClaimedJob, type ClientOptions, DEFAULT_WORKER_TIMEOUT_MS, type DashboardMiddleware, type DashboardMiddlewareOptions, type DashboardOptions, type DatabaseOptions, type GracefulShutdownOptions, type Job, type JobProcessor, type JobStats, type JobStatus, type JobStatusChangeEvent, MCP_TOOL_DEFINITIONS, type McpServerOptions, type McpToolDefinition$1 as McpToolDefinition, type MoveJobOptions, type OrchestratorOptions, type RegisterQueueOptions, type TransferOptions, type TransferResult, type WorkerOptions, type WorkerState, type WorkmaticClient, type WorkmaticDashboard, type WorkmaticDatabase, type WorkmaticDb, type WorkmaticJobsTable, type WorkmaticMcpServer, type WorkmaticOrchestrator, type WorkmaticWorker, attachGracefulShutdown, createClient, createDashboard, createDashboardMiddleware, createDatabase, createMcpServer, createOrchestrator, createWorker, defaultBackoff, enableStatementCache, executeTool, getUnderlyingDb, validatePayload };