@iqai/adk 0.0.5 → 0.0.7

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/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @iqai/adk
2
2
 
3
- ## 0.0.5
3
+ ## 0.0.7
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 5448661: Updates pglite session to take pglite instance as input instead of drizzle
7
+ - 35cb95d: Adds MCP Sampling request handling
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # @iqai/adk - Agent Development Kit Core
2
+
3
+ `@iqai/adk` is the core TypeScript library for the Agent Development Kit, providing the foundational tools and abstractions to build sophisticated AI agents. It enables seamless integration with multiple Large Language Models (LLMs), advanced tool usage, and persistent memory capabilities.
4
+
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/@iqai/adk">
7
+ <img src="https://img.shields.io/npm/v/@iqai/adk" alt="NPM Version" />
8
+ </a>
9
+ <a href="https://www.npmjs.com/package/@iqai/adk">
10
+ <img src="https://img.shields.io/npm/dm/@iqai/adk" alt="NPM Downloads" />
11
+ </a>
12
+ <a href="https://github.com/IQAIcom/adk-ts/blob/main/LICENSE.md">
13
+ <img src="https://img.shields.io/npm/l/@iqai/adk" alt="License" />
14
+ </a>
15
+ <a href="https://github.com/IQAIcom/adk-ts">
16
+ <img src="https://img.shields.io/github/stars/IQAIcom/adk-ts?style=social" alt="GitHub Stars" />
17
+ </a>
18
+ </p>
19
+
20
+ ## 🚀 Core Features
21
+
22
+ The `@iqai/adk` package empowers your AI agent development with:
23
+
24
+ * **Multi-Provider LLM Support:** Flexibly integrate and switch between leading LLM providers like OpenAI, Anthropic, and Google.
25
+ * **Extensible Tool System:** Define and utilize custom tools with declarative schemas, allowing LLMs to intelligently leverage external functionalities.
26
+ * **Advanced Agent Reasoning Loop:** A complete reasoning loop implementation for complex task execution and iterative problem-solving.
27
+ * **Real-Time Streaming:** Support for streaming responses from LLMs for dynamic user interactions.
28
+ * **Flexible Authentication:** Mechanisms for securing agent API access.
29
+ * **Persistent Memory Systems:** Capabilities for agents to retain context and learn from past interactions.
30
+
31
+ ## 🚦 Installation
32
+
33
+ Install the `@iqai/adk` package using your preferred package manager:
34
+
35
+ ```bash
36
+ # Using npm
37
+ npm install @iqai/adk
38
+
39
+ # Using yarn
40
+ yarn add @iqai/adk
41
+
42
+ # Using pnpm
43
+ pnpm add @iqai/adk
44
+ ```
45
+
46
+ ## ⚙️ Environment Configuration
47
+
48
+ For the library to connect to LLM providers, you need to set up API keys. Create a `.env` file in the root of your project and add your keys:
49
+
50
+ ```env
51
+ OPENAI_API_KEY=your_openai_api_key
52
+ ANTHROPIC_API_KEY=your_anthropic_api_key
53
+ GOOGLE_API_KEY=your_google_api_key
54
+ ```
55
+ The library uses `dotenv` to load these variables automatically if `dotenv.config()` is called in your application.
56
+
57
+ ## 📖 Basic Usage
58
+
59
+ Here's a fundamental example of creating and running an agent:
60
+
61
+ ```typescript
62
+ import { Agent } from '@iqai/adk';
63
+ import dotenv from 'dotenv';
64
+
65
+ // Load environment variables
66
+ dotenv.config();
67
+
68
+ // Instantiate the agent
69
+ const myAgent = new Agent({
70
+ name: "simple_query_assistant",
71
+ model: "gemini-2.5-flash-preview-05-20", // Or "gpt-4-turbo", "claude-3-opus"
72
+ description: "A basic assistant to answer questions.",
73
+ instructions: "You are a helpful AI. Respond clearly and concisely."
74
+ });
75
+
76
+ // Asynchronously run the agent
77
+ async function runQuery() {
78
+ try {
79
+ const query = "What is the capital of France?";
80
+ console.log(`User: ${query}`);
81
+
82
+ const response = await myAgent.run({
83
+ messages: [{ role: 'user', content: query }]
84
+ });
85
+
86
+ console.log(`Agent: ${response.content}`);
87
+ } catch (error) {
88
+ console.error("Error during agent execution:", error);
89
+ }
90
+ }
91
+
92
+ runQuery();
93
+ ```
94
+
95
+ ## 🛠️ Using Tools with an Agent
96
+
97
+ Extend your agent's capabilities by defining and integrating custom tools.
98
+
99
+ ```typescript
100
+ import { Agent, BaseTool } from '@iqai/adk';
101
+ import dotenv from 'dotenv';
102
+
103
+ dotenv.config();
104
+
105
+ // Define a simple calculator tool
106
+ class CalculatorTool extends BaseTool {
107
+ constructor() {
108
+ super({
109
+ name: 'calculator',
110
+ description: 'Performs basic arithmetic operations: add, subtract, multiply, divide.'
111
+ });
112
+ }
113
+
114
+ getDeclaration() {
115
+ return {
116
+ name: this.name,
117
+ description: this.description,
118
+ parameters: {
119
+ type: 'object',
120
+ properties: {
121
+ operation: {
122
+ type: 'string',
123
+ enum: ['add', 'subtract', 'multiply', 'divide']
124
+ },
125
+ operand1: { type: 'number' },
126
+ operand2: { type: 'number' }
127
+ },
128
+ required: ['operation', 'operand1', 'operand2']
129
+ }
130
+ };
131
+ }
132
+
133
+ async runAsync(args: { operation: string; operand1: number; operand2: number }) {
134
+ const { operation, operand1, operand2 } = args;
135
+ switch (operation) {
136
+ case 'add': return { result: operand1 + operand2 };
137
+ case 'subtract': return { result: operand1 - operand2 };
138
+ case 'multiply': return { result: operand1 * operand2 };
139
+ case 'divide':
140
+ if (operand2 === 0) return { error: 'Cannot divide by zero.' };
141
+ return { result: operand1 / operand2 };
142
+ default: return { error: `Unknown operation: ${operation}` };
143
+ }
144
+ }
145
+ }
146
+
147
+ // Create an agent equipped with the calculator tool
148
+ const mathAgent = new Agent({
149
+ name: "math_assistant_agent",
150
+ model: "gpt-4-turbo", // Choose a model proficient with tool usage
151
+ instructions:
152
+ "You are a helpful assistant. Use the calculator tool for any mathematical calculations requested.",
153
+ tools: [new CalculatorTool()]
154
+ });
155
+
156
+ async function performCalculation() {
157
+ const response = await mathAgent.run({
158
+ messages: [
159
+ { role: 'user', content: 'What is 15 multiplied by 4?' }
160
+ ]
161
+ });
162
+ // The response.content will likely include the thought process and the tool's output.
163
+ console.log(JSON.stringify(response, null, 2));
164
+ }
165
+
166
+ performCalculation().catch(console.error);
167
+ ```
168
+
169
+ More detailed examples and advanced usage patterns can be found in the `apps/examples` directory of the main [ADK TypeScript repository](https://github.com/IQAIcom/adk-ts).
170
+
171
+ ## 🤝 Contributing
172
+
173
+ While this README focuses on the `@iqai/adk` package, contributions to the overall ADK TypeScript project are welcome. Please see the [Contributing Guide](https://github.com/IQAIcom/adk-ts/blob/main/CONTRIBUTING.md) in the main repository for details on how to contribute.
174
+
175
+ ## 📜 License
176
+
177
+ This package is licensed under the [MIT License](https://github.com/IQAIcom/adk-ts/blob/main/LICENSE.md).
package/dist/index.d.mts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
- import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
+ import { CreateMessageRequestSchema, CreateMessageResultSchema, Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import { z } from 'zod';
3
4
  import { AxiosInstance } from 'axios';
4
5
  import OpenAI from 'openai';
5
6
  import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
6
7
  import { NodePgDatabase } from 'drizzle-orm/node-postgres';
7
8
  import { PGlite } from '@electric-sql/pglite';
9
+ import Database from 'better-sqlite3';
8
10
 
9
11
  /**
10
12
  * Function call result from LLM
@@ -439,6 +441,7 @@ declare class AnthropicLLM extends BaseLLM {
439
441
  * Default parameters for requests
440
442
  */
441
443
  private defaultParams;
444
+ private logger;
442
445
  /**
443
446
  * Constructor for AnthropicLLM
444
447
  */
@@ -515,6 +518,7 @@ declare class AnthropicLLMConnection extends BaseLLMConnection {
515
518
  private responseCallback?;
516
519
  private errorCallback?;
517
520
  private endCallback?;
521
+ private logger;
518
522
  /**
519
523
  * Constructor
520
524
  */
@@ -711,6 +715,7 @@ declare class OpenAILLM extends BaseLLM {
711
715
  * Default parameters for requests
712
716
  */
713
717
  private defaultParams;
718
+ private logger;
714
719
  /**
715
720
  * Constructor for OpenAILLM
716
721
  */
@@ -1994,6 +1999,7 @@ declare class Agent extends BaseAgent {
1994
1999
  * The minimum relevance score for memory augmentation (0-1)
1995
2000
  */
1996
2001
  private memoryRelevanceThreshold;
2002
+ private logger;
1997
2003
  /**
1998
2004
  * Constructor for Agent
1999
2005
  */
@@ -2068,6 +2074,7 @@ interface EnhancedLLMResponse extends LLMResponse {
2068
2074
  * Each sub-agent's output becomes input to the next agent
2069
2075
  */
2070
2076
  declare class SequentialAgent extends BaseAgent {
2077
+ private logger;
2071
2078
  /**
2072
2079
  * Constructor for SequentialAgent
2073
2080
  */
@@ -2112,6 +2119,7 @@ interface ParallelAgentConfig {
2112
2119
  * All sub-agents execute independently with the same input
2113
2120
  */
2114
2121
  declare class ParallelAgent extends BaseAgent {
2122
+ private logger;
2115
2123
  /**
2116
2124
  * Constructor for ParallelAgent
2117
2125
  */
@@ -2180,6 +2188,7 @@ declare class LoopAgent extends BaseAgent {
2180
2188
  * Custom condition check function
2181
2189
  */
2182
2190
  private conditionCheck?;
2191
+ private logger;
2183
2192
  /**
2184
2193
  * Constructor for LoopAgent
2185
2194
  */
@@ -2277,6 +2286,7 @@ declare class LangGraphAgent extends BaseAgent {
2277
2286
  * Results from node executions
2278
2287
  */
2279
2288
  private results;
2289
+ private logger;
2280
2290
  /**
2281
2291
  * Constructor for LangGraphAgent
2282
2292
  */
@@ -2438,6 +2448,7 @@ declare function createFunctionTool(func: (...args: any[]) => any, options?: {
2438
2448
  * Simple GoogleSearch tool implementation
2439
2449
  */
2440
2450
  declare class GoogleSearch extends BaseTool {
2451
+ private logger;
2441
2452
  /**
2442
2453
  * Constructor for GoogleSearch
2443
2454
  */
@@ -2590,6 +2601,7 @@ declare module "./tool-context" {
2590
2601
  * Tool that allows an agent to exit the current execution loop
2591
2602
  */
2592
2603
  declare class ExitLoopTool extends BaseTool {
2604
+ private logger;
2593
2605
  /**
2594
2606
  * Constructor for ExitLoopTool
2595
2607
  */
@@ -2608,6 +2620,7 @@ declare class ExitLoopTool extends BaseTool {
2608
2620
  * Tool that allows an agent to get a choice from the user
2609
2621
  */
2610
2622
  declare class GetUserChoiceTool extends BaseTool {
2623
+ private logger;
2611
2624
  /**
2612
2625
  * Constructor for GetUserChoiceTool
2613
2626
  */
@@ -2631,6 +2644,7 @@ declare class GetUserChoiceTool extends BaseTool {
2631
2644
  * Tool that allows an agent to transfer control to another agent
2632
2645
  */
2633
2646
  declare class TransferToAgentTool extends BaseTool {
2647
+ private logger;
2634
2648
  /**
2635
2649
  * Constructor for TransferToAgentTool
2636
2650
  */
@@ -2651,6 +2665,7 @@ declare class TransferToAgentTool extends BaseTool {
2651
2665
  * Tool that allows an agent to load memories relevant to a query
2652
2666
  */
2653
2667
  declare class LoadMemoryTool extends BaseTool {
2668
+ private logger;
2654
2669
  /**
2655
2670
  * Constructor for LoadMemoryTool
2656
2671
  */
@@ -2684,6 +2699,7 @@ type McpConfig = {
2684
2699
  maxSize?: number;
2685
2700
  };
2686
2701
  debug?: boolean;
2702
+ samplingHandler?: SamplingHandler;
2687
2703
  };
2688
2704
  type McpTransportType = {
2689
2705
  mode: "stdio";
@@ -2703,7 +2719,9 @@ declare enum McpErrorType {
2703
2719
  TOOL_EXECUTION_ERROR = "tool_execution_error",
2704
2720
  RESOURCE_CLOSED_ERROR = "resource_closed_error",
2705
2721
  TIMEOUT_ERROR = "timeout_error",
2706
- INVALID_SCHEMA_ERROR = "invalid_schema_error"
2722
+ INVALID_SCHEMA_ERROR = "invalid_schema_error",
2723
+ SAMPLING_ERROR = "SAMPLING_ERROR",
2724
+ INVALID_REQUEST_ERROR = "INVALID_REQUEST_ERROR"
2707
2725
  }
2708
2726
  /**
2709
2727
  * Custom error class for MCP-related errors
@@ -2713,12 +2731,17 @@ declare class McpError extends Error {
2713
2731
  originalError?: Error;
2714
2732
  constructor(message: string, type: McpErrorType, originalError?: Error);
2715
2733
  }
2734
+ type SamplingRequest = z.infer<typeof CreateMessageRequestSchema>;
2735
+ type SamplingResponse = z.infer<typeof CreateMessageResultSchema>;
2736
+ type SamplingHandler = (request: SamplingRequest) => Promise<SamplingResponse>;
2716
2737
 
2717
2738
  declare class McpClientService {
2718
2739
  private config;
2719
2740
  private client;
2720
2741
  private transport;
2721
2742
  private isClosing;
2743
+ private samplingHandler;
2744
+ private logger;
2722
2745
  constructor(config: McpConfig);
2723
2746
  /**
2724
2747
  * Initializes and returns an MCP client based on configuration.
@@ -2753,6 +2776,9 @@ declare class McpClientService {
2753
2776
  * Checks if the client is currently connected
2754
2777
  */
2755
2778
  isConnected(): boolean;
2779
+ private setupSamplingHandler;
2780
+ setSamplingHandler(handler: SamplingHandler): void;
2781
+ removeSamplingHandler(): void;
2756
2782
  }
2757
2783
 
2758
2784
  /**
@@ -2860,6 +2886,9 @@ declare const index$2_McpErrorType: typeof McpErrorType;
2860
2886
  type index$2_McpToolset = McpToolset;
2861
2887
  declare const index$2_McpToolset: typeof McpToolset;
2862
2888
  type index$2_McpTransportType = McpTransportType;
2889
+ type index$2_SamplingHandler = SamplingHandler;
2890
+ type index$2_SamplingRequest = SamplingRequest;
2891
+ type index$2_SamplingResponse = SamplingResponse;
2863
2892
  type index$2_ToolConfig = ToolConfig;
2864
2893
  type index$2_ToolContext = ToolContext;
2865
2894
  declare const index$2_ToolContext: typeof ToolContext;
@@ -2875,7 +2904,7 @@ declare const index$2_jsonSchemaToDeclaration: typeof jsonSchemaToDeclaration;
2875
2904
  declare const index$2_mcpSchemaToParameters: typeof mcpSchemaToParameters;
2876
2905
  declare const index$2_normalizeJsonSchema: typeof normalizeJsonSchema;
2877
2906
  declare namespace index$2 {
2878
- export { index$2_BaseTool as BaseTool, type index$2_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, index$2_ExitLoopTool as ExitLoopTool, index$2_FileOperationsTool as FileOperationsTool, index$2_FunctionTool as FunctionTool, index$2_GetUserChoiceTool as GetUserChoiceTool, index$2_GoogleSearch as GoogleSearch, index$2_HttpRequestTool as HttpRequestTool, type index$2_IToolContext as IToolContext, index$2_LoadMemoryTool as LoadMemoryTool, type index$2_McpConfig as McpConfig, index$2_McpError as McpError, index$2_McpErrorType as McpErrorType, index$2_McpToolset as McpToolset, type index$2_McpTransportType as McpTransportType, type index$2_ToolConfig as ToolConfig, index$2_ToolContext as ToolContext, index$2_TransferToAgentTool as TransferToAgentTool, index$2_UserInteractionTool as UserInteractionTool, index$2_adkToMcpToolType as adkToMcpToolType, index$2_buildFunctionDeclaration as buildFunctionDeclaration, index$2_createFunctionTool as createFunctionTool, index$2_getMcpTools as getMcpTools, index$2_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$2_mcpSchemaToParameters as mcpSchemaToParameters, index$2_normalizeJsonSchema as normalizeJsonSchema };
2907
+ export { index$2_BaseTool as BaseTool, type index$2_BuildFunctionDeclarationOptions as BuildFunctionDeclarationOptions, index$2_ExitLoopTool as ExitLoopTool, index$2_FileOperationsTool as FileOperationsTool, index$2_FunctionTool as FunctionTool, index$2_GetUserChoiceTool as GetUserChoiceTool, index$2_GoogleSearch as GoogleSearch, index$2_HttpRequestTool as HttpRequestTool, type index$2_IToolContext as IToolContext, index$2_LoadMemoryTool as LoadMemoryTool, type index$2_McpConfig as McpConfig, index$2_McpError as McpError, index$2_McpErrorType as McpErrorType, index$2_McpToolset as McpToolset, type index$2_McpTransportType as McpTransportType, type index$2_SamplingHandler as SamplingHandler, type index$2_SamplingRequest as SamplingRequest, type index$2_SamplingResponse as SamplingResponse, type index$2_ToolConfig as ToolConfig, index$2_ToolContext as ToolContext, index$2_TransferToAgentTool as TransferToAgentTool, index$2_UserInteractionTool as UserInteractionTool, index$2_adkToMcpToolType as adkToMcpToolType, index$2_buildFunctionDeclaration as buildFunctionDeclaration, index$2_createFunctionTool as createFunctionTool, index$2_getMcpTools as getMcpTools, index$2_jsonSchemaToDeclaration as jsonSchemaToDeclaration, index$2_mcpSchemaToParameters as mcpSchemaToParameters, index$2_normalizeJsonSchema as normalizeJsonSchema };
2879
2908
  }
2880
2909
 
2881
2910
  /**
@@ -2954,6 +2983,7 @@ declare class PersistentMemoryService implements BaseMemoryService {
2954
2983
  * File prefix for memory files
2955
2984
  */
2956
2985
  private filePrefix;
2986
+ private logger;
2957
2987
  /**
2958
2988
  * Constructor for PersistentMemoryService
2959
2989
  */
@@ -3079,7 +3109,7 @@ declare class InMemorySessionService implements SessionService {
3079
3109
  appendEvent(session: Session, event: Event): Promise<Event>;
3080
3110
  }
3081
3111
 
3082
- declare const sessionsSchema$1: drizzle_orm_pg_core.PgTableWithColumns<{
3112
+ declare const sessionsSchema: drizzle_orm_pg_core.PgTableWithColumns<{
3083
3113
  name: "sessions";
3084
3114
  schema: undefined;
3085
3115
  columns: {
@@ -3215,7 +3245,7 @@ declare const sessionsSchema$1: drizzle_orm_pg_core.PgTableWithColumns<{
3215
3245
  };
3216
3246
  dialect: "pg";
3217
3247
  }>;
3218
- type SessionsTable = typeof sessionsSchema$1;
3248
+ type SessionsTable = typeof sessionsSchema;
3219
3249
  /**
3220
3250
  * Configuration for DatabaseSessionService with Drizzle
3221
3251
  */
@@ -3251,142 +3281,6 @@ declare class PostgresSessionService implements SessionService {
3251
3281
  appendEvent(session: Session, event: Event): Promise<Event>;
3252
3282
  }
3253
3283
 
3254
- declare const sessionsSchema: drizzle_orm_pg_core.PgTableWithColumns<{
3255
- name: "sessions";
3256
- schema: undefined;
3257
- columns: {
3258
- id: drizzle_orm_pg_core.PgColumn<{
3259
- name: "id";
3260
- tableName: "sessions";
3261
- dataType: "string";
3262
- columnType: "PgVarchar";
3263
- data: string;
3264
- driverParam: string;
3265
- notNull: true;
3266
- hasDefault: false;
3267
- isPrimaryKey: true;
3268
- isAutoincrement: false;
3269
- hasRuntimeDefault: false;
3270
- enumValues: [string, ...string[]];
3271
- baseColumn: never;
3272
- identity: undefined;
3273
- generated: undefined;
3274
- }, {}, {
3275
- length: 255;
3276
- }>;
3277
- userId: drizzle_orm_pg_core.PgColumn<{
3278
- name: "user_id";
3279
- tableName: "sessions";
3280
- dataType: "string";
3281
- columnType: "PgVarchar";
3282
- data: string;
3283
- driverParam: string;
3284
- notNull: true;
3285
- hasDefault: false;
3286
- isPrimaryKey: false;
3287
- isAutoincrement: false;
3288
- hasRuntimeDefault: false;
3289
- enumValues: [string, ...string[]];
3290
- baseColumn: never;
3291
- identity: undefined;
3292
- generated: undefined;
3293
- }, {}, {
3294
- length: 255;
3295
- }>;
3296
- messages: drizzle_orm_pg_core.PgColumn<{
3297
- name: "messages";
3298
- tableName: "sessions";
3299
- dataType: "json";
3300
- columnType: "PgJsonb";
3301
- data: Message[];
3302
- driverParam: unknown;
3303
- notNull: false;
3304
- hasDefault: true;
3305
- isPrimaryKey: false;
3306
- isAutoincrement: false;
3307
- hasRuntimeDefault: false;
3308
- enumValues: undefined;
3309
- baseColumn: never;
3310
- identity: undefined;
3311
- generated: undefined;
3312
- }, {}, {
3313
- $type: Message[];
3314
- }>;
3315
- metadata: drizzle_orm_pg_core.PgColumn<{
3316
- name: "metadata";
3317
- tableName: "sessions";
3318
- dataType: "json";
3319
- columnType: "PgJsonb";
3320
- data: Record<string, any>;
3321
- driverParam: unknown;
3322
- notNull: false;
3323
- hasDefault: true;
3324
- isPrimaryKey: false;
3325
- isAutoincrement: false;
3326
- hasRuntimeDefault: false;
3327
- enumValues: undefined;
3328
- baseColumn: never;
3329
- identity: undefined;
3330
- generated: undefined;
3331
- }, {}, {
3332
- $type: Record<string, any>;
3333
- }>;
3334
- createdAt: drizzle_orm_pg_core.PgColumn<{
3335
- name: "created_at";
3336
- tableName: "sessions";
3337
- dataType: "date";
3338
- columnType: "PgTimestamp";
3339
- data: Date;
3340
- driverParam: string;
3341
- notNull: true;
3342
- hasDefault: true;
3343
- isPrimaryKey: false;
3344
- isAutoincrement: false;
3345
- hasRuntimeDefault: false;
3346
- enumValues: undefined;
3347
- baseColumn: never;
3348
- identity: undefined;
3349
- generated: undefined;
3350
- }, {}, {}>;
3351
- updatedAt: drizzle_orm_pg_core.PgColumn<{
3352
- name: "updated_at";
3353
- tableName: "sessions";
3354
- dataType: "date";
3355
- columnType: "PgTimestamp";
3356
- data: Date;
3357
- driverParam: string;
3358
- notNull: true;
3359
- hasDefault: true;
3360
- isPrimaryKey: false;
3361
- isAutoincrement: false;
3362
- hasRuntimeDefault: false;
3363
- enumValues: undefined;
3364
- baseColumn: never;
3365
- identity: undefined;
3366
- generated: undefined;
3367
- }, {}, {}>;
3368
- state: drizzle_orm_pg_core.PgColumn<{
3369
- name: "state";
3370
- tableName: "sessions";
3371
- dataType: "json";
3372
- columnType: "PgJsonb";
3373
- data: Record<string, any>;
3374
- driverParam: unknown;
3375
- notNull: false;
3376
- hasDefault: true;
3377
- isPrimaryKey: false;
3378
- isAutoincrement: false;
3379
- hasRuntimeDefault: false;
3380
- enumValues: undefined;
3381
- baseColumn: never;
3382
- identity: undefined;
3383
- generated: undefined;
3384
- }, {}, {
3385
- $type: Record<string, any>;
3386
- }>;
3387
- };
3388
- dialect: "pg";
3389
- }>;
3390
3284
  /**
3391
3285
  * Configuration for PgLiteSessionService
3392
3286
  */
@@ -3423,6 +3317,43 @@ declare class PgLiteSessionService implements SessionService {
3423
3317
  appendEvent(session: Session, event: Event): Promise<Event>;
3424
3318
  }
3425
3319
 
3320
+ /**
3321
+ * Configuration for SqliteSessionService
3322
+ */
3323
+ interface SqliteSessionServiceConfig {
3324
+ /**
3325
+ * An initialized better-sqlite3 Database instance.
3326
+ * The service will handle all Drizzle ORM setup internally.
3327
+ */
3328
+ sqlite: Database.Database;
3329
+ /**
3330
+ * Optional: Skip automatic table creation if you handle migrations externally
3331
+ */
3332
+ skipTableCreation?: boolean;
3333
+ }
3334
+ declare class SqliteSessionService implements SessionService {
3335
+ private db;
3336
+ private sessionsTable;
3337
+ private initialized;
3338
+ private sqliteInstance;
3339
+ constructor(config: SqliteSessionServiceConfig);
3340
+ /**
3341
+ * Initialize the database by creating required tables if they don't exist
3342
+ */
3343
+ private initializeDatabase;
3344
+ /**
3345
+ * Ensure database is initialized before any operation
3346
+ */
3347
+ private ensureInitialized;
3348
+ private generateSessionId;
3349
+ createSession(userId: string, metadata?: Record<string, any>): Promise<Session>;
3350
+ getSession(sessionId: string): Promise<Session | undefined>;
3351
+ updateSession(session: Session): Promise<void>;
3352
+ listSessions(userId: string, options?: ListSessionOptions): Promise<Session[]>;
3353
+ deleteSession(sessionId: string): Promise<void>;
3354
+ appendEvent(session: Session, event: Event): Promise<Event>;
3355
+ }
3356
+
3426
3357
  /**
3427
3358
  * Utility functions for working with sessions
3428
3359
  */
@@ -3460,12 +3391,13 @@ type index_Session = Session;
3460
3391
  type index_SessionService = SessionService;
3461
3392
  type index_SessionState = SessionState;
3462
3393
  declare const index_SessionState: typeof SessionState;
3394
+ type index_SqliteSessionService = SqliteSessionService;
3395
+ declare const index_SqliteSessionService: typeof SqliteSessionService;
3463
3396
  declare const index_cloneSession: typeof cloneSession;
3464
3397
  declare const index_generateSessionId: typeof generateSessionId;
3465
- declare const index_sessionsSchema: typeof sessionsSchema;
3466
3398
  declare const index_validateSession: typeof validateSession;
3467
3399
  declare namespace index {
3468
- export { index_InMemorySessionService as InMemorySessionService, type index_ListSessionOptions as ListSessionOptions, index_PgLiteSessionService as PgLiteSessionService, index_PostgresSessionService as PostgresSessionService, type index_Session as Session, type index_SessionService as SessionService, index_SessionState as SessionState, index_cloneSession as cloneSession, index_generateSessionId as generateSessionId, index_sessionsSchema as sessionsSchema, index_validateSession as validateSession };
3400
+ export { index_InMemorySessionService as InMemorySessionService, type index_ListSessionOptions as ListSessionOptions, index_PgLiteSessionService as PgLiteSessionService, index_PostgresSessionService as PostgresSessionService, type index_Session as Session, type index_SessionService as SessionService, index_SessionState as SessionState, index_SqliteSessionService as SqliteSessionService, index_cloneSession as cloneSession, index_generateSessionId as generateSessionId, index_validateSession as validateSession };
3469
3401
  }
3470
3402
 
3471
3403
  /**
@@ -3531,4 +3463,4 @@ declare class InMemoryRunner extends Runner {
3531
3463
 
3532
3464
  declare const VERSION = "0.1.0";
3533
3465
 
3534
- export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, sessionsSchema, validateSession };
3466
+ export { Agent, type AgentConfig, index$3 as Agents, AnthropicLLM, type AnthropicLLMConfig, AnthropicLLMConnection, ApiKeyCredential, ApiKeyScheme, type AudioTranscriptionConfig, AuthConfig, AuthCredential, AuthCredentialType, AuthHandler, AuthScheme, AuthSchemeType, BaseAgent, BaseLLM, BaseLLMConnection, type BaseMemoryService, BaseTool, BasicAuthCredential, BearerTokenCredential, type BuildFunctionDeclarationOptions, ExitLoopTool, FileOperationsTool, type FunctionCall, type FunctionDeclaration, FunctionTool, GetUserChoiceTool, GoogleLLM, type GoogleLLMConfig, GoogleSearch, HttpRequestTool, HttpScheme, type IToolContext, type ImageContent, InMemoryMemoryService, InMemoryRunner, InMemorySessionService, InvocationContext, type JSONSchema, LLMRegistry, LLMRequest, type LLMRequestConfig, LLMResponse, LangGraphAgent, type LangGraphAgentConfig, type LangGraphNode, type ListSessionOptions, LoadMemoryTool, LoopAgent, type LoopAgentConfig, type McpConfig, McpError, McpErrorType, McpToolset, type McpTransportType, index$1 as Memory, type MemoryResult, type Message, type MessageContent, type MessageRole, index$4 as Models, OAuth2Credential, OAuth2Scheme, type OAuthFlow, type OAuthFlows, OpenAILLM, type OpenAILLMConfig, OpenAILLMConnection, OpenIdConnectScheme, ParallelAgent, type ParallelAgentConfig, PersistentMemoryService, PgLiteSessionService, PostgresSessionService, RunConfig, Runner, type SamplingHandler, type SamplingRequest, type SamplingResponse, type SearchMemoryOptions, type SearchMemoryResponse, SequentialAgent, type SequentialAgentConfig, type Session, type SessionService, SessionState, index as Sessions, type SpeechConfig, SqliteSessionService, StreamingMode, type TextContent, type ToolCall, type ToolConfig, ToolContext, index$2 as Tools, TransferToAgentTool, UserInteractionTool, VERSION, adkToMcpToolType, buildFunctionDeclaration, cloneSession, createFunctionTool, generateSessionId, getMcpTools, jsonSchemaToDeclaration, mcpSchemaToParameters, normalizeJsonSchema, registerProviders, validateSession };