@sekuire/sdk 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -5
- package/dist/a2a-client.d.ts +95 -0
- package/dist/a2a-delegator.d.ts +58 -0
- package/dist/a2a-server.d.ts +84 -0
- package/dist/agent.d.ts +1 -1
- package/dist/beacon.d.ts +100 -0
- package/dist/compliance.d.ts +3 -3
- package/dist/config/loader.d.ts +38 -1
- package/dist/crypto.d.ts +0 -3
- package/dist/http/base-client.d.ts +25 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/identity.d.ts +11 -2
- package/dist/index.d.ts +1315 -175
- package/dist/index.esm.js +16151 -5209
- package/dist/index.js +16178 -5207
- package/dist/llm/anthropic.d.ts +4 -12
- package/dist/llm/base-provider.d.ts +13 -0
- package/dist/llm/google.d.ts +4 -12
- package/dist/llm/index.d.ts +0 -12
- package/dist/llm/ollama.d.ts +4 -11
- package/dist/llm/openai.d.ts +4 -12
- package/dist/llm/types.d.ts +19 -12
- package/dist/logger.d.ts +4 -0
- package/dist/memory/base.d.ts +7 -0
- package/dist/memory/cloudflare-d1.d.ts +24 -0
- package/dist/memory/cloudflare-kv.d.ts +25 -0
- package/dist/memory/convex.d.ts +21 -0
- package/dist/memory/dynamodb.d.ts +28 -0
- package/dist/memory/in-memory.d.ts +1 -0
- package/dist/memory/index.d.ts +28 -1
- package/dist/memory/postgres.d.ts +5 -1
- package/dist/memory/redis.d.ts +5 -1
- package/dist/memory/registry.d.ts +12 -0
- package/dist/memory/sqlite.d.ts +22 -0
- package/dist/memory/turso.d.ts +23 -0
- package/dist/memory/upstash.d.ts +22 -0
- package/dist/new-agent.d.ts +2 -2
- package/dist/platform-url.d.ts +1 -0
- package/dist/registry-client.d.ts +171 -0
- package/dist/sdk.d.ts +117 -0
- package/dist/telemetry/exporter.d.ts +21 -0
- package/dist/telemetry/index.d.ts +22 -0
- package/dist/tools/agent-invocation.d.ts +16 -68
- package/dist/tools/remote.d.ts +1 -1
- package/dist/types/a2a-types.d.ts +194 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +0 -4
- package/dist/worker.d.ts +104 -0
- package/package.json +40 -2
package/dist/llm/anthropic.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports Claude models (Claude 3, Claude 3.5, etc.)
|
|
5
|
-
*/
|
|
6
|
-
export declare class AnthropicProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class AnthropicProvider extends BaseLLMProvider {
|
|
7
4
|
private client;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
17
|
-
private getMaxTokensForModel;
|
|
9
|
+
protected getMaxTokensForModel(model: string): number;
|
|
18
10
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProvider, LLMProviderConfig, Message } from './types';
|
|
2
|
+
export declare abstract class BaseLLMProvider implements LLMProvider {
|
|
3
|
+
protected model: string;
|
|
4
|
+
protected maxTokens: number;
|
|
5
|
+
constructor(config: LLMProviderConfig);
|
|
6
|
+
abstract chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
7
|
+
abstract chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
8
|
+
abstract getProviderName(): string;
|
|
9
|
+
protected abstract getMaxTokensForModel(model: string): number;
|
|
10
|
+
countTokens(text: string): number;
|
|
11
|
+
getMaxTokens(): number;
|
|
12
|
+
getModelName(): string;
|
|
13
|
+
}
|
package/dist/llm/google.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports Gemini Pro, Gemini Pro Vision, and other Google models
|
|
5
|
-
*/
|
|
6
|
-
export declare class GoogleProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class GoogleProvider extends BaseLLMProvider {
|
|
7
4
|
private client;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
17
|
-
private getMaxTokensForModel;
|
|
9
|
+
protected getMaxTokensForModel(model: string): number;
|
|
18
10
|
}
|
package/dist/llm/index.d.ts
CHANGED
|
@@ -16,27 +16,15 @@ export declare function createLLMProvider(provider: string, config: LLMProviderC
|
|
|
16
16
|
* Factory functions for easy LLM instantiation
|
|
17
17
|
*/
|
|
18
18
|
export declare const llm: {
|
|
19
|
-
/**
|
|
20
|
-
* Create OpenAI provider (GPT-4, GPT-3.5, etc.)
|
|
21
|
-
*/
|
|
22
19
|
openai: (config: Omit<LLMProviderConfig, "model"> & {
|
|
23
20
|
model?: string;
|
|
24
21
|
}) => OpenAIProvider;
|
|
25
|
-
/**
|
|
26
|
-
* Create Anthropic provider (Claude 3, Claude 3.5, etc.)
|
|
27
|
-
*/
|
|
28
22
|
anthropic: (config: Omit<LLMProviderConfig, "model"> & {
|
|
29
23
|
model?: string;
|
|
30
24
|
}) => AnthropicProvider;
|
|
31
|
-
/**
|
|
32
|
-
* Create Google provider (Gemini Pro, Gemini 1.5, etc.)
|
|
33
|
-
*/
|
|
34
25
|
google: (config: Omit<LLMProviderConfig, "model"> & {
|
|
35
26
|
model?: string;
|
|
36
27
|
}) => GoogleProvider;
|
|
37
|
-
/**
|
|
38
|
-
* Create Ollama provider (local models: Llama 2, Mistral, etc.)
|
|
39
|
-
*/
|
|
40
28
|
ollama: (config: Omit<LLMProviderConfig, "model"> & {
|
|
41
29
|
model?: string;
|
|
42
30
|
}) => OllamaProvider;
|
package/dist/llm/ollama.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports local models via Ollama (Llama 2, Mistral, CodeLlama, etc.)
|
|
5
|
-
*/
|
|
6
|
-
export declare class OllamaProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class OllamaProvider extends BaseLLMProvider {
|
|
7
4
|
private baseUrl;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
9
|
+
protected getMaxTokensForModel(_model: string): number;
|
|
17
10
|
}
|
package/dist/llm/openai.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports GPT-3.5, GPT-4, and other OpenAI models
|
|
5
|
-
*/
|
|
6
|
-
export declare class OpenAIProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class OpenAIProvider extends BaseLLMProvider {
|
|
7
4
|
private client;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
17
|
-
private getMaxTokensForModel;
|
|
9
|
+
protected getMaxTokensForModel(model: string): number;
|
|
18
10
|
}
|
package/dist/llm/types.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface ToolDefinition {
|
|
2
|
+
type: 'function';
|
|
3
|
+
function: {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
parameters?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface ToolCallFunction {
|
|
10
|
+
id: string;
|
|
11
|
+
type: 'function';
|
|
12
|
+
function: {
|
|
13
|
+
name: string;
|
|
14
|
+
arguments: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
4
17
|
export interface Message {
|
|
5
18
|
role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
|
|
6
19
|
content: string | null;
|
|
7
20
|
name?: string;
|
|
8
21
|
tool_call_id?: string;
|
|
9
|
-
tool_calls?:
|
|
22
|
+
tool_calls?: ToolCallFunction[];
|
|
10
23
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Options for chat completion
|
|
13
|
-
*/
|
|
14
24
|
export interface ChatOptions {
|
|
15
25
|
temperature?: number;
|
|
16
26
|
max_tokens?: number;
|
|
@@ -19,16 +29,13 @@ export interface ChatOptions {
|
|
|
19
29
|
presence_penalty?: number;
|
|
20
30
|
stop?: string[];
|
|
21
31
|
stream?: boolean;
|
|
22
|
-
tools?:
|
|
32
|
+
tools?: ToolDefinition[];
|
|
23
33
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Response from chat completion
|
|
26
|
-
*/
|
|
27
34
|
export interface ChatResponse {
|
|
28
35
|
content: string;
|
|
29
36
|
model: string;
|
|
30
37
|
finish_reason?: string;
|
|
31
|
-
tool_calls?:
|
|
38
|
+
tool_calls?: ToolCallFunction[];
|
|
32
39
|
usage?: {
|
|
33
40
|
prompt_tokens: number;
|
|
34
41
|
completion_tokens: number;
|
package/dist/logger.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export interface LoggerConfig {
|
|
|
15
15
|
enabled?: boolean;
|
|
16
16
|
batchSize?: number;
|
|
17
17
|
flushInterval?: number;
|
|
18
|
+
onError?: (error: Error, context: {
|
|
19
|
+
operation: string;
|
|
20
|
+
eventsLost?: number;
|
|
21
|
+
}) => void;
|
|
18
22
|
}
|
|
19
23
|
export interface EventLog {
|
|
20
24
|
sekuire_id: string;
|
package/dist/memory/base.d.ts
CHANGED
|
@@ -10,11 +10,18 @@ export interface MemoryStorage {
|
|
|
10
10
|
clear(sessionId: string): Promise<void>;
|
|
11
11
|
delete(sessionId: string): Promise<void>;
|
|
12
12
|
exists(sessionId: string): Promise<boolean>;
|
|
13
|
+
connect?(): Promise<void>;
|
|
14
|
+
disconnect?(): Promise<void>;
|
|
15
|
+
isConnected?(): boolean;
|
|
13
16
|
}
|
|
14
17
|
export declare abstract class BaseMemoryStorage implements MemoryStorage {
|
|
18
|
+
protected _connected: boolean;
|
|
15
19
|
abstract add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
16
20
|
abstract get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
17
21
|
abstract clear(sessionId: string): Promise<void>;
|
|
18
22
|
abstract delete(sessionId: string): Promise<void>;
|
|
19
23
|
abstract exists(sessionId: string): Promise<boolean>;
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
disconnect(): Promise<void>;
|
|
26
|
+
isConnected(): boolean;
|
|
20
27
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface CloudflareD1Config {
|
|
3
|
+
binding?: any;
|
|
4
|
+
accountId?: string;
|
|
5
|
+
databaseId?: string;
|
|
6
|
+
apiToken?: string;
|
|
7
|
+
tableName?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class CloudflareD1Storage extends BaseMemoryStorage {
|
|
10
|
+
private binding;
|
|
11
|
+
private config;
|
|
12
|
+
private tableName;
|
|
13
|
+
private useRestApi;
|
|
14
|
+
private tableInitialized;
|
|
15
|
+
constructor(config: CloudflareD1Config);
|
|
16
|
+
private executeQuery;
|
|
17
|
+
private ensureTableExists;
|
|
18
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
19
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
20
|
+
clear(sessionId: string): Promise<void>;
|
|
21
|
+
delete(sessionId: string): Promise<void>;
|
|
22
|
+
exists(sessionId: string): Promise<boolean>;
|
|
23
|
+
disconnect(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface CloudflareKVConfig {
|
|
3
|
+
binding?: any;
|
|
4
|
+
accountId?: string;
|
|
5
|
+
namespaceId?: string;
|
|
6
|
+
apiToken?: string;
|
|
7
|
+
keyPrefix?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class CloudflareKVStorage extends BaseMemoryStorage {
|
|
10
|
+
private binding;
|
|
11
|
+
private config;
|
|
12
|
+
private keyPrefix;
|
|
13
|
+
private useRestApi;
|
|
14
|
+
constructor(config: CloudflareKVConfig);
|
|
15
|
+
private getKey;
|
|
16
|
+
private kvGet;
|
|
17
|
+
private kvPut;
|
|
18
|
+
private kvDelete;
|
|
19
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
20
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
21
|
+
clear(sessionId: string): Promise<void>;
|
|
22
|
+
delete(sessionId: string): Promise<void>;
|
|
23
|
+
exists(sessionId: string): Promise<boolean>;
|
|
24
|
+
disconnect(): Promise<void>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface ConvexConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
adminKey?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ConvexStorage extends BaseMemoryStorage {
|
|
7
|
+
private client;
|
|
8
|
+
private config;
|
|
9
|
+
private connectionPromise;
|
|
10
|
+
constructor(config: ConvexConfig);
|
|
11
|
+
connect(): Promise<void>;
|
|
12
|
+
private ensureConnected;
|
|
13
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
14
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
15
|
+
clear(sessionId: string): Promise<void>;
|
|
16
|
+
delete(sessionId: string): Promise<void>;
|
|
17
|
+
exists(sessionId: string): Promise<boolean>;
|
|
18
|
+
disconnect(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare const CONVEX_SCHEMA_TEMPLATE = "\n// convex/schema.ts\nimport { defineSchema, defineTable } from \"convex/server\";\nimport { v } from \"convex/values\";\n\nexport default defineSchema({\n sekuireMemory: defineTable({\n sessionId: v.string(),\n role: v.union(v.literal(\"user\"), v.literal(\"assistant\"), v.literal(\"system\")),\n content: v.string(),\n timestamp: v.number(),\n metadata: v.optional(v.any()),\n }).index(\"by_session\", [\"sessionId\", \"timestamp\"]),\n});\n";
|
|
21
|
+
export declare const CONVEX_FUNCTIONS_TEMPLATE = "\n// convex/sekuireMemory.ts\nimport { mutation, query } from \"./_generated/server\";\nimport { v } from \"convex/values\";\n\nexport const add = mutation({\n args: {\n sessionId: v.string(),\n role: v.union(v.literal(\"user\"), v.literal(\"assistant\"), v.literal(\"system\")),\n content: v.string(),\n timestamp: v.number(),\n metadata: v.optional(v.any()),\n },\n handler: async (ctx, args) => {\n await ctx.db.insert(\"sekuireMemory\", args);\n },\n});\n\nexport const get = query({\n args: {\n sessionId: v.string(),\n limit: v.optional(v.number()),\n },\n handler: async (ctx, args) => {\n let query = ctx.db\n .query(\"sekuireMemory\")\n .withIndex(\"by_session\", (q) => q.eq(\"sessionId\", args.sessionId))\n .order(\"asc\");\n\n const messages = await query.collect();\n\n if (args.limit) {\n return messages.slice(-args.limit);\n }\n return messages;\n },\n});\n\nexport const clear = mutation({\n args: {\n sessionId: v.string(),\n },\n handler: async (ctx, args) => {\n const messages = await ctx.db\n .query(\"sekuireMemory\")\n .withIndex(\"by_session\", (q) => q.eq(\"sessionId\", args.sessionId))\n .collect();\n\n for (const message of messages) {\n await ctx.db.delete(message._id);\n }\n },\n});\n\nexport const exists = query({\n args: {\n sessionId: v.string(),\n },\n handler: async (ctx, args) => {\n const message = await ctx.db\n .query(\"sekuireMemory\")\n .withIndex(\"by_session\", (q) => q.eq(\"sessionId\", args.sessionId))\n .first();\n return message !== null;\n },\n});\n";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface DynamoDBConfig {
|
|
3
|
+
tableName: string;
|
|
4
|
+
region?: string;
|
|
5
|
+
endpoint?: string;
|
|
6
|
+
credentials?: {
|
|
7
|
+
accessKeyId: string;
|
|
8
|
+
secretAccessKey: string;
|
|
9
|
+
};
|
|
10
|
+
createTable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class DynamoDBStorage extends BaseMemoryStorage {
|
|
13
|
+
private client;
|
|
14
|
+
private docClient;
|
|
15
|
+
private config;
|
|
16
|
+
private connectionPromise;
|
|
17
|
+
private tableReady;
|
|
18
|
+
constructor(config: DynamoDBConfig);
|
|
19
|
+
connect(): Promise<void>;
|
|
20
|
+
private ensureTableExists;
|
|
21
|
+
private ensureConnected;
|
|
22
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
23
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
24
|
+
clear(sessionId: string): Promise<void>;
|
|
25
|
+
delete(sessionId: string): Promise<void>;
|
|
26
|
+
exists(sessionId: string): Promise<boolean>;
|
|
27
|
+
disconnect(): Promise<void>;
|
|
28
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
2
|
export declare class InMemoryStorage extends BaseMemoryStorage {
|
|
3
3
|
private storage;
|
|
4
|
+
constructor();
|
|
4
5
|
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
5
6
|
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
6
7
|
clear(sessionId: string): Promise<void>;
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -2,13 +2,40 @@ export * from './base';
|
|
|
2
2
|
export * from './in-memory';
|
|
3
3
|
export * from './postgres';
|
|
4
4
|
export * from './redis';
|
|
5
|
+
export * from './sqlite';
|
|
6
|
+
export * from './upstash';
|
|
7
|
+
export * from './cloudflare-kv';
|
|
8
|
+
export * from './cloudflare-d1';
|
|
9
|
+
export * from './dynamodb';
|
|
10
|
+
export * from './turso';
|
|
11
|
+
export * from './convex';
|
|
12
|
+
export * from './registry';
|
|
5
13
|
import type { MemoryStorage } from './base';
|
|
6
14
|
import { type PostgresConfig } from './postgres';
|
|
7
15
|
import { type RedisConfig } from './redis';
|
|
8
|
-
|
|
16
|
+
import { type SQLiteConfig } from './sqlite';
|
|
17
|
+
import { type UpstashConfig } from './upstash';
|
|
18
|
+
import { type CloudflareKVConfig } from './cloudflare-kv';
|
|
19
|
+
import { type CloudflareD1Config } from './cloudflare-d1';
|
|
20
|
+
import { type DynamoDBConfig } from './dynamodb';
|
|
21
|
+
import { type TursoConfig } from './turso';
|
|
22
|
+
import { type ConvexConfig } from './convex';
|
|
23
|
+
import { registerStorage, hasStorage, listStorageTypes, getStorageInfo } from './registry';
|
|
24
|
+
export type BuiltInMemoryType = 'in-memory' | 'buffer' | 'redis' | 'postgres' | 'sqlite' | 'upstash' | 'cloudflare-kv' | 'cloudflare-d1' | 'dynamodb' | 'turso' | 'convex';
|
|
25
|
+
export type MemoryType = BuiltInMemoryType | string;
|
|
9
26
|
export interface MemoryFactoryConfig {
|
|
10
27
|
type: MemoryType;
|
|
11
28
|
redis?: RedisConfig;
|
|
12
29
|
postgres?: PostgresConfig;
|
|
30
|
+
sqlite?: SQLiteConfig;
|
|
31
|
+
upstash?: UpstashConfig;
|
|
32
|
+
cloudflareKV?: CloudflareKVConfig;
|
|
33
|
+
cloudflareD1?: CloudflareD1Config;
|
|
34
|
+
dynamodb?: DynamoDBConfig;
|
|
35
|
+
turso?: TursoConfig;
|
|
36
|
+
convex?: ConvexConfig;
|
|
37
|
+
options?: Record<string, unknown>;
|
|
38
|
+
instance?: MemoryStorage;
|
|
13
39
|
}
|
|
14
40
|
export declare function createMemoryStorage(config: MemoryFactoryConfig): MemoryStorage;
|
|
41
|
+
export { registerStorage, hasStorage, listStorageTypes, getStorageInfo, };
|
|
@@ -7,13 +7,17 @@ export interface PostgresConfig {
|
|
|
7
7
|
user?: string;
|
|
8
8
|
password?: string;
|
|
9
9
|
tableName?: string;
|
|
10
|
+
lazyConnect?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare class PostgresStorage extends BaseMemoryStorage {
|
|
12
13
|
private pool;
|
|
13
14
|
private tableName;
|
|
14
|
-
private
|
|
15
|
+
private config;
|
|
16
|
+
private connectionPromise;
|
|
15
17
|
constructor(config: PostgresConfig);
|
|
18
|
+
connect(): Promise<void>;
|
|
16
19
|
private initPool;
|
|
20
|
+
private ensureConnected;
|
|
17
21
|
private createTableIfNotExists;
|
|
18
22
|
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
19
23
|
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
package/dist/memory/redis.d.ts
CHANGED
|
@@ -6,13 +6,17 @@ export interface RedisConfig {
|
|
|
6
6
|
db?: number;
|
|
7
7
|
url?: string;
|
|
8
8
|
keyPrefix?: string;
|
|
9
|
+
lazyConnect?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare class RedisStorage extends BaseMemoryStorage {
|
|
11
12
|
private client;
|
|
12
13
|
private keyPrefix;
|
|
13
|
-
private
|
|
14
|
+
private config;
|
|
15
|
+
private connectionPromise;
|
|
14
16
|
constructor(config: RedisConfig);
|
|
17
|
+
connect(): Promise<void>;
|
|
15
18
|
private initClient;
|
|
19
|
+
private ensureConnected;
|
|
16
20
|
private getKey;
|
|
17
21
|
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
18
22
|
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MemoryStorage } from './base';
|
|
2
|
+
export type StorageFactory = (config: any) => MemoryStorage;
|
|
3
|
+
export declare function registerStorage(type: string, factory: StorageFactory, description?: string): void;
|
|
4
|
+
export declare function getStorageFactory(type: string): StorageFactory | undefined;
|
|
5
|
+
export declare function hasStorage(type: string): boolean;
|
|
6
|
+
export declare function listStorageTypes(): string[];
|
|
7
|
+
export declare function getStorageInfo(): Array<{
|
|
8
|
+
type: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function unregisterStorage(type: string): boolean;
|
|
12
|
+
export declare function clearRegistry(): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface SQLiteConfig {
|
|
3
|
+
filename: string;
|
|
4
|
+
tableName?: string;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class SQLiteStorage extends BaseMemoryStorage {
|
|
8
|
+
private db;
|
|
9
|
+
private config;
|
|
10
|
+
private tableName;
|
|
11
|
+
private connectionPromise;
|
|
12
|
+
constructor(config: SQLiteConfig);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
private ensureTableExists;
|
|
15
|
+
private ensureConnected;
|
|
16
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
17
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
18
|
+
clear(sessionId: string): Promise<void>;
|
|
19
|
+
delete(sessionId: string): Promise<void>;
|
|
20
|
+
exists(sessionId: string): Promise<boolean>;
|
|
21
|
+
disconnect(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface TursoConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
authToken?: string;
|
|
5
|
+
tableName?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class TursoStorage extends BaseMemoryStorage {
|
|
8
|
+
private client;
|
|
9
|
+
private config;
|
|
10
|
+
private tableName;
|
|
11
|
+
private connectionPromise;
|
|
12
|
+
private tableInitialized;
|
|
13
|
+
constructor(config: TursoConfig);
|
|
14
|
+
connect(): Promise<void>;
|
|
15
|
+
private ensureTableExists;
|
|
16
|
+
private ensureConnected;
|
|
17
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
18
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
19
|
+
clear(sessionId: string): Promise<void>;
|
|
20
|
+
delete(sessionId: string): Promise<void>;
|
|
21
|
+
exists(sessionId: string): Promise<boolean>;
|
|
22
|
+
disconnect(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseMemoryStorage, type MemoryMessage } from './base';
|
|
2
|
+
export interface UpstashConfig {
|
|
3
|
+
url: string;
|
|
4
|
+
token: string;
|
|
5
|
+
keyPrefix?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class UpstashStorage extends BaseMemoryStorage {
|
|
8
|
+
private client;
|
|
9
|
+
private keyPrefix;
|
|
10
|
+
private config;
|
|
11
|
+
private connectionPromise;
|
|
12
|
+
constructor(config: UpstashConfig);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
private ensureConnected;
|
|
15
|
+
private getKey;
|
|
16
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
17
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
18
|
+
clear(sessionId: string): Promise<void>;
|
|
19
|
+
delete(sessionId: string): Promise<void>;
|
|
20
|
+
exists(sessionId: string): Promise<boolean>;
|
|
21
|
+
disconnect(): Promise<void>;
|
|
22
|
+
}
|
package/dist/new-agent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ToolDefinition } from './config/loader';
|
|
2
|
-
import type { LLMProvider, Message
|
|
3
|
-
import { PolicyEnforcer } from './policy-enforcer';
|
|
2
|
+
import type { ChatOptions, LLMProvider, Message } from './llm/types';
|
|
4
3
|
import { type MemoryStorage } from './memory';
|
|
4
|
+
import { PolicyEnforcer } from './policy-enforcer';
|
|
5
5
|
/**
|
|
6
6
|
* Options for overriding agent configuration
|
|
7
7
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectDeploymentUrl(): string | undefined;
|