@iqai/adk 0.0.4 → 0.0.6
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 +4 -10
- package/LICENSE.md +9 -0
- package/dist/index.d.mts +57 -166
- package/dist/index.d.ts +57 -166
- package/dist/index.js +1102 -550
- package/dist/index.mjs +988 -436
- package/package.json +6 -31
- package/LICENSE +0 -21
- package/README.md +0 -260
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
# @iqai/adk
|
|
2
2
|
|
|
3
|
-
## 0.0.
|
|
3
|
+
## 0.0.6
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 54902c8: Adds debug logs
|
|
8
8
|
|
|
9
|
-
## 0.0.
|
|
9
|
+
## 0.0.5
|
|
10
10
|
|
|
11
11
|
### Patch Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
## 0.0.2
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- 961fdd6: Updates package json to bundle correct files
|
|
13
|
+
- 5448661: Updates pglite session to take pglite instance as input instead of drizzle
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 IQAI.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,8 @@ import { AxiosInstance } from 'axios';
|
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
5
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
6
6
|
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
7
|
-
import {
|
|
7
|
+
import { PGlite } from '@electric-sql/pglite';
|
|
8
|
+
import Database from 'better-sqlite3';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Function call result from LLM
|
|
@@ -1781,10 +1782,10 @@ declare class ToolContext implements IToolContext {
|
|
|
1781
1782
|
get sessionId(): string;
|
|
1782
1783
|
get messages(): Message[];
|
|
1783
1784
|
get config(): RunConfig;
|
|
1784
|
-
get userId(): string
|
|
1785
|
-
get appName(): string
|
|
1786
|
-
get memoryService(): BaseMemoryService
|
|
1787
|
-
get sessionService(): SessionService
|
|
1785
|
+
get userId(): string;
|
|
1786
|
+
get appName(): string;
|
|
1787
|
+
get memoryService(): BaseMemoryService;
|
|
1788
|
+
get sessionService(): SessionService;
|
|
1788
1789
|
get metadata(): Record<string, any>;
|
|
1789
1790
|
get variables(): Map<string, any>;
|
|
1790
1791
|
setVariable(name: string, value: any): void;
|
|
@@ -3079,7 +3080,7 @@ declare class InMemorySessionService implements SessionService {
|
|
|
3079
3080
|
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3080
3081
|
}
|
|
3081
3082
|
|
|
3082
|
-
declare const sessionsSchema
|
|
3083
|
+
declare const sessionsSchema: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3083
3084
|
name: "sessions";
|
|
3084
3085
|
schema: undefined;
|
|
3085
3086
|
columns: {
|
|
@@ -3215,27 +3216,27 @@ declare const sessionsSchema$1: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
3215
3216
|
};
|
|
3216
3217
|
dialect: "pg";
|
|
3217
3218
|
}>;
|
|
3218
|
-
type SessionsTable
|
|
3219
|
+
type SessionsTable = typeof sessionsSchema;
|
|
3219
3220
|
/**
|
|
3220
3221
|
* Configuration for DatabaseSessionService with Drizzle
|
|
3221
3222
|
*/
|
|
3222
|
-
interface DatabaseSessionServiceConfig
|
|
3223
|
+
interface DatabaseSessionServiceConfig {
|
|
3223
3224
|
/**
|
|
3224
3225
|
* An initialized Drizzle ORM database client instance.
|
|
3225
3226
|
* Example: drizzle(new Pool({ connectionString: '...' }), { schema: { sessions: sessionsSchema } })
|
|
3226
3227
|
*/
|
|
3227
3228
|
db: NodePgDatabase<{
|
|
3228
|
-
sessions: SessionsTable
|
|
3229
|
+
sessions: SessionsTable;
|
|
3229
3230
|
}>;
|
|
3230
3231
|
/**
|
|
3231
3232
|
* Optional: Pass the sessions schema table directly if not attached to db client's schema property
|
|
3232
3233
|
*/
|
|
3233
|
-
sessionsTable?: SessionsTable
|
|
3234
|
+
sessionsTable?: SessionsTable;
|
|
3234
3235
|
}
|
|
3235
3236
|
declare class PostgresSessionService implements SessionService {
|
|
3236
3237
|
private db;
|
|
3237
3238
|
private sessionsTable;
|
|
3238
|
-
constructor(config: DatabaseSessionServiceConfig
|
|
3239
|
+
constructor(config: DatabaseSessionServiceConfig);
|
|
3239
3240
|
private generateSessionId;
|
|
3240
3241
|
createSession(userId: string, metadata?: Record<string, any>): Promise<Session>;
|
|
3241
3242
|
getSession(sessionId: string): Promise<Session | undefined>;
|
|
@@ -3251,158 +3252,15 @@ declare class PostgresSessionService implements SessionService {
|
|
|
3251
3252
|
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3252
3253
|
}
|
|
3253
3254
|
|
|
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
|
-
type SessionsTable = typeof sessionsSchema;
|
|
3391
3255
|
/**
|
|
3392
|
-
* Configuration for
|
|
3256
|
+
* Configuration for PgLiteSessionService
|
|
3393
3257
|
*/
|
|
3394
|
-
interface
|
|
3258
|
+
interface PgLiteSessionServiceConfig {
|
|
3395
3259
|
/**
|
|
3396
|
-
* An initialized
|
|
3397
|
-
*
|
|
3260
|
+
* An initialized PGlite instance.
|
|
3261
|
+
* The service will handle all Drizzle ORM setup internally.
|
|
3398
3262
|
*/
|
|
3399
|
-
|
|
3400
|
-
sessions: SessionsTable;
|
|
3401
|
-
}>;
|
|
3402
|
-
/**
|
|
3403
|
-
* Optional: Pass the sessions schema table directly if not attached to db client's schema property
|
|
3404
|
-
*/
|
|
3405
|
-
sessionsTable?: SessionsTable;
|
|
3263
|
+
pglite: PGlite;
|
|
3406
3264
|
/**
|
|
3407
3265
|
* Optional: Skip automatic table creation if you handle migrations externally
|
|
3408
3266
|
*/
|
|
@@ -3412,7 +3270,7 @@ declare class PgLiteSessionService implements SessionService {
|
|
|
3412
3270
|
private db;
|
|
3413
3271
|
private sessionsTable;
|
|
3414
3272
|
private initialized;
|
|
3415
|
-
constructor(config:
|
|
3273
|
+
constructor(config: PgLiteSessionServiceConfig);
|
|
3416
3274
|
/**
|
|
3417
3275
|
* Initialize the database by creating required tables if they don't exist
|
|
3418
3276
|
*/
|
|
@@ -3427,12 +3285,43 @@ declare class PgLiteSessionService implements SessionService {
|
|
|
3427
3285
|
updateSession(session: Session): Promise<void>;
|
|
3428
3286
|
listSessions(userId: string, options?: ListSessionOptions): Promise<Session[]>;
|
|
3429
3287
|
deleteSession(sessionId: string): Promise<void>;
|
|
3288
|
+
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
/**
|
|
3292
|
+
* Configuration for SqliteSessionService
|
|
3293
|
+
*/
|
|
3294
|
+
interface SqliteSessionServiceConfig {
|
|
3430
3295
|
/**
|
|
3431
|
-
*
|
|
3432
|
-
*
|
|
3433
|
-
* @param event The event to append
|
|
3434
|
-
* @returns The appended event
|
|
3296
|
+
* An initialized better-sqlite3 Database instance.
|
|
3297
|
+
* The service will handle all Drizzle ORM setup internally.
|
|
3435
3298
|
*/
|
|
3299
|
+
sqlite: Database.Database;
|
|
3300
|
+
/**
|
|
3301
|
+
* Optional: Skip automatic table creation if you handle migrations externally
|
|
3302
|
+
*/
|
|
3303
|
+
skipTableCreation?: boolean;
|
|
3304
|
+
}
|
|
3305
|
+
declare class SqliteSessionService implements SessionService {
|
|
3306
|
+
private db;
|
|
3307
|
+
private sessionsTable;
|
|
3308
|
+
private initialized;
|
|
3309
|
+
private sqliteInstance;
|
|
3310
|
+
constructor(config: SqliteSessionServiceConfig);
|
|
3311
|
+
/**
|
|
3312
|
+
* Initialize the database by creating required tables if they don't exist
|
|
3313
|
+
*/
|
|
3314
|
+
private initializeDatabase;
|
|
3315
|
+
/**
|
|
3316
|
+
* Ensure database is initialized before any operation
|
|
3317
|
+
*/
|
|
3318
|
+
private ensureInitialized;
|
|
3319
|
+
private generateSessionId;
|
|
3320
|
+
createSession(userId: string, metadata?: Record<string, any>): Promise<Session>;
|
|
3321
|
+
getSession(sessionId: string): Promise<Session | undefined>;
|
|
3322
|
+
updateSession(session: Session): Promise<void>;
|
|
3323
|
+
listSessions(userId: string, options?: ListSessionOptions): Promise<Session[]>;
|
|
3324
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
3436
3325
|
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3437
3326
|
}
|
|
3438
3327
|
|
|
@@ -3473,11 +3362,13 @@ type index_Session = Session;
|
|
|
3473
3362
|
type index_SessionService = SessionService;
|
|
3474
3363
|
type index_SessionState = SessionState;
|
|
3475
3364
|
declare const index_SessionState: typeof SessionState;
|
|
3365
|
+
type index_SqliteSessionService = SqliteSessionService;
|
|
3366
|
+
declare const index_SqliteSessionService: typeof SqliteSessionService;
|
|
3476
3367
|
declare const index_cloneSession: typeof cloneSession;
|
|
3477
3368
|
declare const index_generateSessionId: typeof generateSessionId;
|
|
3478
3369
|
declare const index_validateSession: typeof validateSession;
|
|
3479
3370
|
declare namespace index {
|
|
3480
|
-
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_validateSession as validateSession };
|
|
3371
|
+
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 };
|
|
3481
3372
|
}
|
|
3482
3373
|
|
|
3483
3374
|
/**
|
|
@@ -3543,4 +3434,4 @@ declare class InMemoryRunner extends Runner {
|
|
|
3543
3434
|
|
|
3544
3435
|
declare const VERSION = "0.1.0";
|
|
3545
3436
|
|
|
3546
|
-
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, validateSession };
|
|
3437
|
+
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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { AxiosInstance } from 'axios';
|
|
|
4
4
|
import OpenAI from 'openai';
|
|
5
5
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
6
6
|
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
7
|
-
import {
|
|
7
|
+
import { PGlite } from '@electric-sql/pglite';
|
|
8
|
+
import Database from 'better-sqlite3';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Function call result from LLM
|
|
@@ -1781,10 +1782,10 @@ declare class ToolContext implements IToolContext {
|
|
|
1781
1782
|
get sessionId(): string;
|
|
1782
1783
|
get messages(): Message[];
|
|
1783
1784
|
get config(): RunConfig;
|
|
1784
|
-
get userId(): string
|
|
1785
|
-
get appName(): string
|
|
1786
|
-
get memoryService(): BaseMemoryService
|
|
1787
|
-
get sessionService(): SessionService
|
|
1785
|
+
get userId(): string;
|
|
1786
|
+
get appName(): string;
|
|
1787
|
+
get memoryService(): BaseMemoryService;
|
|
1788
|
+
get sessionService(): SessionService;
|
|
1788
1789
|
get metadata(): Record<string, any>;
|
|
1789
1790
|
get variables(): Map<string, any>;
|
|
1790
1791
|
setVariable(name: string, value: any): void;
|
|
@@ -3079,7 +3080,7 @@ declare class InMemorySessionService implements SessionService {
|
|
|
3079
3080
|
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3080
3081
|
}
|
|
3081
3082
|
|
|
3082
|
-
declare const sessionsSchema
|
|
3083
|
+
declare const sessionsSchema: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3083
3084
|
name: "sessions";
|
|
3084
3085
|
schema: undefined;
|
|
3085
3086
|
columns: {
|
|
@@ -3215,27 +3216,27 @@ declare const sessionsSchema$1: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
3215
3216
|
};
|
|
3216
3217
|
dialect: "pg";
|
|
3217
3218
|
}>;
|
|
3218
|
-
type SessionsTable
|
|
3219
|
+
type SessionsTable = typeof sessionsSchema;
|
|
3219
3220
|
/**
|
|
3220
3221
|
* Configuration for DatabaseSessionService with Drizzle
|
|
3221
3222
|
*/
|
|
3222
|
-
interface DatabaseSessionServiceConfig
|
|
3223
|
+
interface DatabaseSessionServiceConfig {
|
|
3223
3224
|
/**
|
|
3224
3225
|
* An initialized Drizzle ORM database client instance.
|
|
3225
3226
|
* Example: drizzle(new Pool({ connectionString: '...' }), { schema: { sessions: sessionsSchema } })
|
|
3226
3227
|
*/
|
|
3227
3228
|
db: NodePgDatabase<{
|
|
3228
|
-
sessions: SessionsTable
|
|
3229
|
+
sessions: SessionsTable;
|
|
3229
3230
|
}>;
|
|
3230
3231
|
/**
|
|
3231
3232
|
* Optional: Pass the sessions schema table directly if not attached to db client's schema property
|
|
3232
3233
|
*/
|
|
3233
|
-
sessionsTable?: SessionsTable
|
|
3234
|
+
sessionsTable?: SessionsTable;
|
|
3234
3235
|
}
|
|
3235
3236
|
declare class PostgresSessionService implements SessionService {
|
|
3236
3237
|
private db;
|
|
3237
3238
|
private sessionsTable;
|
|
3238
|
-
constructor(config: DatabaseSessionServiceConfig
|
|
3239
|
+
constructor(config: DatabaseSessionServiceConfig);
|
|
3239
3240
|
private generateSessionId;
|
|
3240
3241
|
createSession(userId: string, metadata?: Record<string, any>): Promise<Session>;
|
|
3241
3242
|
getSession(sessionId: string): Promise<Session | undefined>;
|
|
@@ -3251,158 +3252,15 @@ declare class PostgresSessionService implements SessionService {
|
|
|
3251
3252
|
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3252
3253
|
}
|
|
3253
3254
|
|
|
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
|
-
type SessionsTable = typeof sessionsSchema;
|
|
3391
3255
|
/**
|
|
3392
|
-
* Configuration for
|
|
3256
|
+
* Configuration for PgLiteSessionService
|
|
3393
3257
|
*/
|
|
3394
|
-
interface
|
|
3258
|
+
interface PgLiteSessionServiceConfig {
|
|
3395
3259
|
/**
|
|
3396
|
-
* An initialized
|
|
3397
|
-
*
|
|
3260
|
+
* An initialized PGlite instance.
|
|
3261
|
+
* The service will handle all Drizzle ORM setup internally.
|
|
3398
3262
|
*/
|
|
3399
|
-
|
|
3400
|
-
sessions: SessionsTable;
|
|
3401
|
-
}>;
|
|
3402
|
-
/**
|
|
3403
|
-
* Optional: Pass the sessions schema table directly if not attached to db client's schema property
|
|
3404
|
-
*/
|
|
3405
|
-
sessionsTable?: SessionsTable;
|
|
3263
|
+
pglite: PGlite;
|
|
3406
3264
|
/**
|
|
3407
3265
|
* Optional: Skip automatic table creation if you handle migrations externally
|
|
3408
3266
|
*/
|
|
@@ -3412,7 +3270,7 @@ declare class PgLiteSessionService implements SessionService {
|
|
|
3412
3270
|
private db;
|
|
3413
3271
|
private sessionsTable;
|
|
3414
3272
|
private initialized;
|
|
3415
|
-
constructor(config:
|
|
3273
|
+
constructor(config: PgLiteSessionServiceConfig);
|
|
3416
3274
|
/**
|
|
3417
3275
|
* Initialize the database by creating required tables if they don't exist
|
|
3418
3276
|
*/
|
|
@@ -3427,12 +3285,43 @@ declare class PgLiteSessionService implements SessionService {
|
|
|
3427
3285
|
updateSession(session: Session): Promise<void>;
|
|
3428
3286
|
listSessions(userId: string, options?: ListSessionOptions): Promise<Session[]>;
|
|
3429
3287
|
deleteSession(sessionId: string): Promise<void>;
|
|
3288
|
+
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
/**
|
|
3292
|
+
* Configuration for SqliteSessionService
|
|
3293
|
+
*/
|
|
3294
|
+
interface SqliteSessionServiceConfig {
|
|
3430
3295
|
/**
|
|
3431
|
-
*
|
|
3432
|
-
*
|
|
3433
|
-
* @param event The event to append
|
|
3434
|
-
* @returns The appended event
|
|
3296
|
+
* An initialized better-sqlite3 Database instance.
|
|
3297
|
+
* The service will handle all Drizzle ORM setup internally.
|
|
3435
3298
|
*/
|
|
3299
|
+
sqlite: Database.Database;
|
|
3300
|
+
/**
|
|
3301
|
+
* Optional: Skip automatic table creation if you handle migrations externally
|
|
3302
|
+
*/
|
|
3303
|
+
skipTableCreation?: boolean;
|
|
3304
|
+
}
|
|
3305
|
+
declare class SqliteSessionService implements SessionService {
|
|
3306
|
+
private db;
|
|
3307
|
+
private sessionsTable;
|
|
3308
|
+
private initialized;
|
|
3309
|
+
private sqliteInstance;
|
|
3310
|
+
constructor(config: SqliteSessionServiceConfig);
|
|
3311
|
+
/**
|
|
3312
|
+
* Initialize the database by creating required tables if they don't exist
|
|
3313
|
+
*/
|
|
3314
|
+
private initializeDatabase;
|
|
3315
|
+
/**
|
|
3316
|
+
* Ensure database is initialized before any operation
|
|
3317
|
+
*/
|
|
3318
|
+
private ensureInitialized;
|
|
3319
|
+
private generateSessionId;
|
|
3320
|
+
createSession(userId: string, metadata?: Record<string, any>): Promise<Session>;
|
|
3321
|
+
getSession(sessionId: string): Promise<Session | undefined>;
|
|
3322
|
+
updateSession(session: Session): Promise<void>;
|
|
3323
|
+
listSessions(userId: string, options?: ListSessionOptions): Promise<Session[]>;
|
|
3324
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
3436
3325
|
appendEvent(session: Session, event: Event): Promise<Event>;
|
|
3437
3326
|
}
|
|
3438
3327
|
|
|
@@ -3473,11 +3362,13 @@ type index_Session = Session;
|
|
|
3473
3362
|
type index_SessionService = SessionService;
|
|
3474
3363
|
type index_SessionState = SessionState;
|
|
3475
3364
|
declare const index_SessionState: typeof SessionState;
|
|
3365
|
+
type index_SqliteSessionService = SqliteSessionService;
|
|
3366
|
+
declare const index_SqliteSessionService: typeof SqliteSessionService;
|
|
3476
3367
|
declare const index_cloneSession: typeof cloneSession;
|
|
3477
3368
|
declare const index_generateSessionId: typeof generateSessionId;
|
|
3478
3369
|
declare const index_validateSession: typeof validateSession;
|
|
3479
3370
|
declare namespace index {
|
|
3480
|
-
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_validateSession as validateSession };
|
|
3371
|
+
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 };
|
|
3481
3372
|
}
|
|
3482
3373
|
|
|
3483
3374
|
/**
|
|
@@ -3543,4 +3434,4 @@ declare class InMemoryRunner extends Runner {
|
|
|
3543
3434
|
|
|
3544
3435
|
declare const VERSION = "0.1.0";
|
|
3545
3436
|
|
|
3546
|
-
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, validateSession };
|
|
3437
|
+
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, 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 };
|