chat-agent-toolkit 1.2.1 → 1.2.3
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 +6 -6
- package/dist/config/config-manager.d.ts +23 -0
- package/dist/config/config-types.d.ts +58 -0
- package/dist/config/environment-variables.d.ts +6 -0
- package/dist/config/index.d.ts +18 -0
- package/dist/config/language-models-database.d.ts +93 -0
- package/dist/config/mcp-server-registry.d.ts +7 -0
- package/dist/config/model-registry.d.ts +69 -0
- package/dist/config/model-tester.d.ts +51 -0
- package/dist/config/model-utils.d.ts +44 -0
- package/dist/config/provider-ui-config.d.ts +6 -0
- package/dist/index.d.ts +23 -0
- package/dist/memory/agent-memory-manager.d.ts +125 -0
- package/dist/memory/example.d.ts +36 -0
- package/dist/memory/index.d.ts +18 -0
- package/dist/memory/mastra-integration.d.ts +146 -0
- package/dist/memory/storage/drizzle-storage.d.ts +82 -0
- package/dist/memory/storage/in-memory-storage.d.ts +75 -0
- package/dist/memory/storage/storage-interface.d.ts +37 -0
- package/dist/memory/types.d.ts +122 -0
- package/dist/models/providers.d.ts +5 -0
- package/dist/models/registry.d.ts +4 -0
- package/dist/models/types.d.ts +4 -0
- package/dist/research-agent.cjs.js +2 -0
- package/dist/research-agent.cjs.js.map +1 -0
- package/dist/research-agent.es.js +2 -0
- package/dist/research-agent.es.js.map +1 -0
- package/dist/search.d.ts +5 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/open-connector-mastra.d.ts +137 -0
- package/dist/tools/open-connector-mcp.d.ts +88 -0
- package/dist/tools/qwksearch-api-tools.d.ts +149 -0
- package/dist/tools/search/doc-utils.d.ts +11 -0
- package/dist/tools/search/document.d.ts +14 -0
- package/dist/tools/search/index.d.ts +12 -0
- package/dist/tools/search/link-summarizer.d.ts +7 -0
- package/dist/tools/search/meta-search-types.d.ts +50 -0
- package/dist/tools/search/metaSearchAgent.d.ts +21 -0
- package/dist/tools/search/search-handlers.d.ts +27 -0
- package/dist/tools/search/suggestionGeneratorAgent.d.ts +8 -0
- package/dist/types.d.ts +2 -0
- package/dist/utils/chat-helpers.d.ts +10 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/markdown-to-html.d.ts +5 -0
- package/dist/utils/outputParser.d.ts +22 -0
- package/dist/utils/provider-image-cropper.d.ts +120 -0
- package/package.json +16 -6
- package/src/config/config-manager.ts +0 -8
- package/src/config/environment-variables.ts +11 -3
- package/src/config/language-models-database.ts +50 -42
- package/src/config/model-registry.ts +20 -5
- package/src/config/model-tester.ts +2 -2
- package/src/connectors/{composio.json → open-connector.json} +21 -45
- package/src/index.ts +3 -0
- package/src/memory/ARCHITECTURE.md +1 -1
- package/src/memory/example.ts +6 -6
- package/src/memory/mastra-integration.ts +6 -11
- package/src/memory/storage/drizzle-storage.ts +60 -29
- package/src/memory/storage/in-memory-storage.ts +2 -2
- package/src/memory/storage/storage-interface.ts +1 -1
- package/src/models/types.ts +1 -1
- package/src/tools/{composio-mastra.ts → open-connector-mastra.ts} +58 -93
- package/src/tools/open-connector-mcp.ts +170 -0
- package/src/tools/search/doc-utils.ts +36 -8
- package/src/tools/search/metaSearchAgent.ts +11 -0
- package/src/tools/search/search-handlers.ts +13 -1
- package/src/tools/search/suggestionGeneratorAgent.ts +5 -3
- package/src/tools/composio-mcp.ts +0 -205
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
declare const PROVIDERS: {
|
|
2
|
+
readonly openrouter: {
|
|
3
|
+
readonly row: 0;
|
|
4
|
+
readonly col: 0;
|
|
5
|
+
};
|
|
6
|
+
readonly tongyi: {
|
|
7
|
+
readonly row: 0;
|
|
8
|
+
readonly col: 1;
|
|
9
|
+
};
|
|
10
|
+
readonly ollama: {
|
|
11
|
+
readonly row: 0;
|
|
12
|
+
readonly col: 2;
|
|
13
|
+
};
|
|
14
|
+
readonly huggingface: {
|
|
15
|
+
readonly row: 0;
|
|
16
|
+
readonly col: 3;
|
|
17
|
+
};
|
|
18
|
+
readonly localai: {
|
|
19
|
+
readonly row: 0;
|
|
20
|
+
readonly col: 4;
|
|
21
|
+
};
|
|
22
|
+
readonly openllm: {
|
|
23
|
+
readonly row: 0;
|
|
24
|
+
readonly col: 5;
|
|
25
|
+
};
|
|
26
|
+
readonly zhipu: {
|
|
27
|
+
readonly row: 1;
|
|
28
|
+
readonly col: 0;
|
|
29
|
+
};
|
|
30
|
+
readonly replicate: {
|
|
31
|
+
readonly row: 1;
|
|
32
|
+
readonly col: 1;
|
|
33
|
+
};
|
|
34
|
+
readonly azure: {
|
|
35
|
+
readonly row: 1;
|
|
36
|
+
readonly col: 2;
|
|
37
|
+
};
|
|
38
|
+
readonly anthropic: {
|
|
39
|
+
readonly row: 1;
|
|
40
|
+
readonly col: 3;
|
|
41
|
+
};
|
|
42
|
+
readonly groq: {
|
|
43
|
+
readonly row: 1;
|
|
44
|
+
readonly col: 4;
|
|
45
|
+
};
|
|
46
|
+
readonly sagemaker: {
|
|
47
|
+
readonly row: 1;
|
|
48
|
+
readonly col: 5;
|
|
49
|
+
};
|
|
50
|
+
readonly "01ai": {
|
|
51
|
+
readonly row: 2;
|
|
52
|
+
readonly col: 0;
|
|
53
|
+
};
|
|
54
|
+
readonly bedrock: {
|
|
55
|
+
readonly row: 2;
|
|
56
|
+
readonly col: 1;
|
|
57
|
+
};
|
|
58
|
+
readonly openai: {
|
|
59
|
+
readonly row: 2;
|
|
60
|
+
readonly col: 2;
|
|
61
|
+
};
|
|
62
|
+
readonly cohere: {
|
|
63
|
+
readonly row: 2;
|
|
64
|
+
readonly col: 3;
|
|
65
|
+
};
|
|
66
|
+
readonly together: {
|
|
67
|
+
readonly row: 2;
|
|
68
|
+
readonly col: 4;
|
|
69
|
+
};
|
|
70
|
+
readonly xorbits: {
|
|
71
|
+
readonly row: 2;
|
|
72
|
+
readonly col: 5;
|
|
73
|
+
};
|
|
74
|
+
readonly wenxin: {
|
|
75
|
+
readonly row: 3;
|
|
76
|
+
readonly col: 0;
|
|
77
|
+
};
|
|
78
|
+
readonly moonshot: {
|
|
79
|
+
readonly row: 3;
|
|
80
|
+
readonly col: 1;
|
|
81
|
+
};
|
|
82
|
+
readonly gemini: {
|
|
83
|
+
readonly row: 3;
|
|
84
|
+
readonly col: 2;
|
|
85
|
+
};
|
|
86
|
+
readonly mistral: {
|
|
87
|
+
readonly row: 3;
|
|
88
|
+
readonly col: 3;
|
|
89
|
+
};
|
|
90
|
+
readonly jina: {
|
|
91
|
+
readonly row: 3;
|
|
92
|
+
readonly col: 4;
|
|
93
|
+
};
|
|
94
|
+
readonly chatglm: {
|
|
95
|
+
readonly row: 3;
|
|
96
|
+
readonly col: 5;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export type Provider = keyof typeof PROVIDERS;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a cropped canvas containing just the provider box.
|
|
102
|
+
*/
|
|
103
|
+
export declare function cropProvider(image: HTMLImageElement | ImageBitmap, provider: Provider): Promise<HTMLCanvasElement>;
|
|
104
|
+
/**
|
|
105
|
+
* Returns the provider image as a Blob.
|
|
106
|
+
*/
|
|
107
|
+
export declare function cropProviderAsBlob(image: HTMLImageElement | ImageBitmap, provider: Provider, type?: "image/png" | "image/jpeg" | "image/webp", quality?: number): Promise<Blob>;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the provider image as a data URL.
|
|
110
|
+
*/
|
|
111
|
+
export declare function cropProviderAsDataURL(image: HTMLImageElement | ImageBitmap, provider: Provider, type?: "image/png" | "image/jpeg" | "image/webp", quality?: number): Promise<string>;
|
|
112
|
+
/**
|
|
113
|
+
* Helper to load and crop in one call.
|
|
114
|
+
*/
|
|
115
|
+
export declare function getProviderImage(spriteSheetUrl: string, provider: Provider): Promise<HTMLCanvasElement>;
|
|
116
|
+
/**
|
|
117
|
+
* Get all available provider names.
|
|
118
|
+
*/
|
|
119
|
+
export declare function getProviderNames(): Provider[];
|
|
120
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chat-agent-toolkit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Multi-provider AI agent toolkit: generate language responses, search the web, extract content, and manage memory across 10+ LLM providers.",
|
|
5
5
|
"author": "vtempest <grokthiscontact@gmail.com>",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/OpenSourceAGI/qwksearch-research-agent"
|
|
9
|
+
"url": "https://github.com/OpenSourceAGI/qwksearch-research-agent",
|
|
10
|
+
"directory": "packages/agent-toolkit"
|
|
10
11
|
},
|
|
11
12
|
"bugs": {
|
|
12
13
|
"url": "https://github.com/OpenSourceAGI/qwksearch-research-agent/issues"
|
|
@@ -58,6 +59,8 @@
|
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
62
|
+
"@cloudflare/workers-types": "^4.20241127.0",
|
|
63
|
+
"@types/node": "^22.0.0",
|
|
61
64
|
"@vitest/ui": "^4.0.18",
|
|
62
65
|
"terser": "^5.46.0",
|
|
63
66
|
"typedoc-plugin-markdown": "^4.10.0",
|
|
@@ -71,13 +74,20 @@
|
|
|
71
74
|
"@ai-sdk/anthropic": "^2.0.0",
|
|
72
75
|
"@ai-sdk/google": "^2.0.0",
|
|
73
76
|
"@ai-sdk/groq": "^2.0.0",
|
|
77
|
+
"@ai-sdk/mcp": "^2.0.9",
|
|
74
78
|
"@ai-sdk/openai": "^2.0.0",
|
|
75
|
-
"@
|
|
76
|
-
"@mastra/
|
|
77
|
-
"@mastra/
|
|
79
|
+
"@mastra/core": "^1.50.1",
|
|
80
|
+
"@mastra/mcp": "^1.13.1",
|
|
81
|
+
"@mastra/memory": "^1.22.2",
|
|
78
82
|
"ai": "^5.0.0",
|
|
79
83
|
"drizzle-orm": "^0.45.1",
|
|
84
|
+
"extract-webpage": "^1.2.5",
|
|
85
|
+
"highlight.js": "^11.11.1",
|
|
86
|
+
"html-entities": "^2.6.0",
|
|
87
|
+
"manage-storage": "^0.0.13",
|
|
88
|
+
"marked": "^17.0.4",
|
|
80
89
|
"qwksearch-api-client": "^0.0.12",
|
|
90
|
+
"write-language": "^0.1.4",
|
|
81
91
|
"zod": "^4.3.6"
|
|
82
92
|
},
|
|
83
93
|
"keywords": [
|
|
@@ -98,4 +108,4 @@
|
|
|
98
108
|
"publishConfig": {
|
|
99
109
|
"access": "public"
|
|
100
110
|
}
|
|
101
|
-
}
|
|
111
|
+
}
|
|
@@ -148,15 +148,7 @@ class ConfigManager {
|
|
|
148
148
|
|
|
149
149
|
const newProviders: ConfigModelProvider[] = [];
|
|
150
150
|
|
|
151
|
-
// Check if OPENROUTER_API_KEY exists - prioritize OpenRouter for guests
|
|
152
|
-
const hasOpenRouter = !!getEnv("OPENROUTER_API_KEY");
|
|
153
|
-
|
|
154
151
|
providerConfigSections.forEach((provider) => {
|
|
155
|
-
// If OpenRouter is configured, ONLY load OpenRouter for guests
|
|
156
|
-
// Skip all other providers (NVIDIA, DeepSeek, etc.)
|
|
157
|
-
if (hasOpenRouter && provider.key.toLowerCase() !== "openrouter") {
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
152
|
|
|
161
153
|
const tempConfig: Record<string, any> = {};
|
|
162
154
|
const required: string[] = [];
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Runtime env-var accessor.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Supports both local development (process.env) and Cloudflare Workers
|
|
4
|
+
* (cloudflare:workers virtual module) via dynamic import.
|
|
5
5
|
*/
|
|
6
6
|
export function getEnv(key: string): string | undefined {
|
|
7
|
-
|
|
7
|
+
// Try Cloudflare Workers context first (production)
|
|
8
|
+
try {
|
|
9
|
+
// @ts-ignore - cloudflare:workers is a virtual module provided by @cloudflare/vite-plugin
|
|
10
|
+
const cfWorkers = require("cloudflare:workers");
|
|
11
|
+
return cfWorkers.env?.[key];
|
|
12
|
+
} catch {
|
|
13
|
+
// Fallback to process.env for local development
|
|
14
|
+
return process.env[key];
|
|
15
|
+
}
|
|
8
16
|
}
|
|
@@ -56,20 +56,6 @@ export const LANGUAGE_MODELS = [
|
|
|
56
56
|
"free": true,
|
|
57
57
|
"type": "text-generation"
|
|
58
58
|
},
|
|
59
|
-
{
|
|
60
|
-
"name": "Kimi K2.5",
|
|
61
|
-
"id": "moonshotai/kimi-k2.5",
|
|
62
|
-
"contextLength": 256_000,
|
|
63
|
-
"free": true,
|
|
64
|
-
"type": "text-generation"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"name": "DeepSeek V3",
|
|
68
|
-
"id": "deepseek-ai/deepseek-v3",
|
|
69
|
-
"contextLength": 128_000,
|
|
70
|
-
"free": true,
|
|
71
|
-
"type": "text-generation"
|
|
72
|
-
},
|
|
73
59
|
{
|
|
74
60
|
"name": "Gemma 4 31B IT",
|
|
75
61
|
"id": "google/gemma-4-31b-it",
|
|
@@ -77,40 +63,12 @@ export const LANGUAGE_MODELS = [
|
|
|
77
63
|
"free": true,
|
|
78
64
|
"type": "text-generation"
|
|
79
65
|
},
|
|
80
|
-
{
|
|
81
|
-
"name": "GLM 4.5 Air",
|
|
82
|
-
"id": "z-ai/glm-4.5-air",
|
|
83
|
-
"contextLength": 128_000,
|
|
84
|
-
"free": true,
|
|
85
|
-
"type": "text-generation"
|
|
86
|
-
},
|
|
87
66
|
{
|
|
88
67
|
"name": "Mistral Large 2",
|
|
89
68
|
"id": "mistralai/mistral-large-2",
|
|
90
69
|
"contextLength": 131_072,
|
|
91
70
|
"free": false,
|
|
92
71
|
"type": "text-generation"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"name": "Mistral Nemo",
|
|
96
|
-
"id": "mistralai/mistral-nemo",
|
|
97
|
-
"contextLength": 131_072,
|
|
98
|
-
"free": true,
|
|
99
|
-
"type": "text-generation"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"name": "Qwen2.5 72B Instruct",
|
|
103
|
-
"id": "qwen/qwen2.5-72b-instruct",
|
|
104
|
-
"contextLength": 131_072,
|
|
105
|
-
"free": true,
|
|
106
|
-
"type": "text-generation"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"name": "CodeLlama 70B Instruct",
|
|
110
|
-
"id": "meta/llama-3.1-70b-code-instruct",
|
|
111
|
-
"contextLength": 131_072,
|
|
112
|
-
"free": true,
|
|
113
|
-
"type": "text-generation"
|
|
114
72
|
}
|
|
115
73
|
]
|
|
116
74
|
},
|
|
@@ -1424,3 +1382,53 @@ export const LANGUAGE_MODELS = [
|
|
|
1424
1382
|
export const LANGUAGE_PROVIDERS = LANGUAGE_MODELS.map((p) =>
|
|
1425
1383
|
p.provider.toLocaleLowerCase(),
|
|
1426
1384
|
);
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Guest-safe models that are known to work reliably.
|
|
1388
|
+
* Based on test results: only models with HTTP 200 status.
|
|
1389
|
+
*/
|
|
1390
|
+
export const GUEST_SAFE_MODELS = {
|
|
1391
|
+
openrouter: [
|
|
1392
|
+
"openrouter/free",
|
|
1393
|
+
"nvidia/nemotron-3-super-120b-a12b:free",
|
|
1394
|
+
"nvidia/nemotron-3-ultra-550b-a55b:free",
|
|
1395
|
+
"nvidia/nemotron-3-nano-30b-a3b:free",
|
|
1396
|
+
"nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free",
|
|
1397
|
+
"nvidia/nemotron-nano-9b-v2:free",
|
|
1398
|
+
"nvidia/nemotron-3.5-content-safety:free",
|
|
1399
|
+
"google/gemma-4-31b-it:free",
|
|
1400
|
+
"google/gemma-4-26b-a4b-it:free",
|
|
1401
|
+
"openai/gpt-oss-20b:free",
|
|
1402
|
+
"poolside/laguna-xs-2.1:free",
|
|
1403
|
+
"poolside/laguna-m.1:free",
|
|
1404
|
+
"cohere/north-mini-code:free",
|
|
1405
|
+
],
|
|
1406
|
+
nvidia: [
|
|
1407
|
+
"nvidia/nemotron-3-super-120b-a12b",
|
|
1408
|
+
"meta/llama-3.1-8b-instruct",
|
|
1409
|
+
],
|
|
1410
|
+
};
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Filter models to only those in the guest-safe list.
|
|
1414
|
+
* Returns models with `free: true` property.
|
|
1415
|
+
*/
|
|
1416
|
+
export function filterModelsForGuests(models: any[]): any[] {
|
|
1417
|
+
return models.filter((m) => m.free === true);
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* Get guest-safe provider list (only tested working models).
|
|
1422
|
+
* Uses GUEST_SAFE_MODELS whitelist to ensure reliability.
|
|
1423
|
+
*/
|
|
1424
|
+
export function getGuestSafeProviders(): typeof LANGUAGE_MODELS {
|
|
1425
|
+
return LANGUAGE_MODELS.map((provider) => ({
|
|
1426
|
+
...provider,
|
|
1427
|
+
models: provider.models.filter(
|
|
1428
|
+
(model: any) =>
|
|
1429
|
+
GUEST_SAFE_MODELS[provider.provider.toLowerCase() as keyof typeof GUEST_SAFE_MODELS]?.includes(
|
|
1430
|
+
model.id,
|
|
1431
|
+
) || false,
|
|
1432
|
+
),
|
|
1433
|
+
})).filter((p) => p.models.length > 0);
|
|
1434
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - provider/model CRUD passthroughs to {@link configManager}
|
|
9
9
|
*/
|
|
10
10
|
import configManager from "./config-manager";
|
|
11
|
-
import { LANGUAGE_MODELS } from "./language-models-database";
|
|
11
|
+
import { LANGUAGE_MODELS, getGuestSafeProviders } from "./language-models-database";
|
|
12
12
|
import { getModelProvidersUIConfigSection } from "./provider-ui-config";
|
|
13
13
|
import type { ConfigModelProvider, Model } from "./config-types";
|
|
14
14
|
|
|
@@ -59,13 +59,28 @@ export default class ModelRegistry {
|
|
|
59
59
|
* Providers with their full chat model lists (defaults merged with
|
|
60
60
|
* user-added models), shaped for the settings/providers UI.
|
|
61
61
|
*/
|
|
62
|
-
async getActiveProviders() {
|
|
63
|
-
|
|
62
|
+
async getActiveProviders(guestMode: boolean = false) {
|
|
63
|
+
const providers = this.activeProviders;
|
|
64
|
+
const dbModels = guestMode ? getGuestSafeProviders() : LANGUAGE_MODELS;
|
|
65
|
+
|
|
66
|
+
return providers.map((p) => ({
|
|
64
67
|
id: p.id,
|
|
65
68
|
name: p.name,
|
|
66
69
|
type: p.type,
|
|
67
|
-
chatModels: mergeChatModels(p),
|
|
68
|
-
}));
|
|
70
|
+
chatModels: guestMode ? this.getGuestChatModels(p, dbModels) : mergeChatModels(p),
|
|
71
|
+
})).filter((p) => p.chatModels.length > 0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get guest-safe chat models for a provider (only tested working models).
|
|
76
|
+
*/
|
|
77
|
+
private getGuestChatModels(provider: ConfigModelProvider, guestProviders: typeof LANGUAGE_MODELS): Model[] {
|
|
78
|
+
const dbName = PROVIDER_KEY_TO_DB_NAME[provider.type.toLowerCase()];
|
|
79
|
+
const dbEntry = guestProviders.find(
|
|
80
|
+
(p) => p.provider.toLowerCase() === (dbName?.toLowerCase() || provider.type.toLowerCase()),
|
|
81
|
+
);
|
|
82
|
+
if (!dbEntry?.models) return [];
|
|
83
|
+
return dbEntry.models.map((m: any) => ({ name: m.name, key: m.id }));
|
|
69
84
|
}
|
|
70
85
|
|
|
71
86
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { generateText } from "ai";
|
|
7
|
-
import { createLLMProvider } from "write-language
|
|
7
|
+
import { createLLMProvider } from "write-language";
|
|
8
8
|
|
|
9
9
|
export interface ModelTestResult {
|
|
10
10
|
modelId: string;
|
|
@@ -74,7 +74,7 @@ export async function testModel(
|
|
|
74
74
|
const testPromise = generateText({
|
|
75
75
|
model,
|
|
76
76
|
prompt: "Reply with just 'OK'",
|
|
77
|
-
|
|
77
|
+
maxOutputTokens: 10,
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
const result = await Promise.race([testPromise, timeoutPromise]) as any;
|
|
@@ -2,153 +2,129 @@
|
|
|
2
2
|
"connectors": [
|
|
3
3
|
{
|
|
4
4
|
"name": "Gmail",
|
|
5
|
-
"
|
|
5
|
+
"connector_id": "gmail",
|
|
6
6
|
"domain": "gmail.com",
|
|
7
7
|
"description": "Google's email service. Search inboxes, send/reply/draft messages, manage labels and threads."
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"name": "Google Calendar",
|
|
11
|
-
"
|
|
11
|
+
"connector_id": "googlecalendar",
|
|
12
12
|
"domain": "calendar.google.com",
|
|
13
13
|
"description": "Time management and scheduling. Create/update/list events, manage calendars and attendees."
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"name": "Outlook",
|
|
17
|
-
"
|
|
17
|
+
"connector_id": "outlook",
|
|
18
18
|
"domain": "outlook.com",
|
|
19
19
|
"description": "Microsoft's email and calendaring platform. Manage mail, contacts, calendars and rules."
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"name": "Notion",
|
|
23
|
-
"
|
|
23
|
+
"connector_id": "notion",
|
|
24
24
|
"domain": "notion.so",
|
|
25
25
|
"description": "Workspace for docs, wikis and databases. Search, read, create and update pages and database items."
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"name": "Linear",
|
|
29
|
-
"
|
|
29
|
+
"connector_id": "linear",
|
|
30
30
|
"domain": "linear.app",
|
|
31
31
|
"description": "Issue tracking and project management for software teams. Create, query and update issues, projects and cycles."
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "GitHub",
|
|
35
|
-
"
|
|
35
|
+
"connector_id": "github",
|
|
36
36
|
"domain": "github.com",
|
|
37
37
|
"description": "Code hosting and collaboration. Manage repos, issues, pull requests, branches and reviews."
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
"name": "Google Drive",
|
|
41
|
-
"
|
|
41
|
+
"connector_id": "googledrive",
|
|
42
42
|
"domain": "drive.google.com",
|
|
43
43
|
"description": "Cloud file storage. Search, upload, share and manage files, folders and permissions."
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"name": "SharePoint",
|
|
47
|
-
"
|
|
47
|
+
"connector_id": "share_point",
|
|
48
48
|
"domain": "sharepoint.com",
|
|
49
49
|
"description": "Microsoft document management and intranet platform. Search and manage sites, lists and files."
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"name": "OneDrive",
|
|
53
|
-
"
|
|
53
|
+
"connector_id": "one_drive",
|
|
54
54
|
"domain": "onedrive.live.com",
|
|
55
55
|
"description": "Microsoft cloud file storage. Upload, share and manage personal/business files and folders."
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "Slack",
|
|
59
|
-
"
|
|
59
|
+
"connector_id": "slack",
|
|
60
60
|
"domain": "slack.com",
|
|
61
61
|
"description": "Channel-based team messaging. Search history, post messages, manage channels and users."
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"name": "Box",
|
|
65
|
-
"
|
|
65
|
+
"connector_id": "box",
|
|
66
66
|
"domain": "box.com",
|
|
67
67
|
"description": "Enterprise cloud content management. Manage files, folders, sharing and collaboration."
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
"name": "Dropbox",
|
|
71
|
-
"
|
|
71
|
+
"connector_id": "dropbox",
|
|
72
72
|
"domain": "dropbox.com",
|
|
73
73
|
"description": "Cloud file syncing and sharing. Upload, list, move and share files across devices."
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"name": "HubSpot",
|
|
77
|
-
"
|
|
77
|
+
"connector_id": "hubspot",
|
|
78
78
|
"domain": "hubspot.com",
|
|
79
79
|
"description": "CRM and marketing platform. Manage contacts, companies, deals, tickets and engagements."
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
"name": "Jira",
|
|
83
|
-
"
|
|
83
|
+
"connector_id": "jira",
|
|
84
84
|
"domain": "atlassian.com",
|
|
85
85
|
"description": "Atlassian issue and project tracking. Create/search/update tickets, manage sprints and boards."
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"name": "Confluence",
|
|
89
|
-
"
|
|
89
|
+
"connector_id": "confluence",
|
|
90
90
|
"domain": "atlassian.com",
|
|
91
91
|
"description": "Atlassian knowledge base and team wiki. Search, create and edit pages and spaces."
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
"name": "Asana",
|
|
95
|
-
"
|
|
95
|
+
"connector_id": "asana",
|
|
96
96
|
"domain": "asana.com",
|
|
97
97
|
"description": "Task and project management. Create/update tasks, projects, sections and assignments."
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "Databricks",
|
|
101
|
-
"
|
|
101
|
+
"connector_id": "databricks",
|
|
102
102
|
"domain": "databricks.com",
|
|
103
103
|
"description": "Unified analytics and lakehouse platform. Run SQL/jobs, manage clusters, notebooks and Unity Catalog."
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
"name": "Snowflake",
|
|
107
|
-
"
|
|
107
|
+
"connector_id": "snowflake",
|
|
108
108
|
"domain": "snowflake.com",
|
|
109
109
|
"description": "Cloud data warehouse. Query structured data, manage warehouses, databases and roles."
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
"name": "Salesforce",
|
|
113
|
-
"
|
|
113
|
+
"connector_id": "salesforce",
|
|
114
114
|
"domain": "salesforce.com",
|
|
115
115
|
"description": "Enterprise CRM. Manage leads, accounts, opportunities, cases and custom objects."
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
"name": "ServiceNow",
|
|
119
|
-
"
|
|
119
|
+
"connector_id": "servicenow",
|
|
120
120
|
"domain": "servicenow.com",
|
|
121
121
|
"description": "IT service management platform. Manage incidents, change requests, knowledge base and CMDB."
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"name": "Microsoft Teams",
|
|
125
|
-
"
|
|
125
|
+
"connector_id": "microsoft_teams",
|
|
126
126
|
"domain": "teams.microsoft.com",
|
|
127
127
|
"description": "Microsoft collaboration platform. Send messages, manage channels, teams and meetings."
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "Zapier",
|
|
131
|
-
"composio_id": null,
|
|
132
|
-
"domain": null,
|
|
133
|
-
"description": "Not available as a Composio toolkit — Zapier is a direct competitor to Composio's integration platform."
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"name": "Make.com",
|
|
137
|
-
"composio_id": null,
|
|
138
|
-
"domain": null,
|
|
139
|
-
"description": "Not available as a Composio toolkit — Make (formerly Integromat) is a direct competitor."
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"name": "Google Workspace",
|
|
143
|
-
"composio_id": null,
|
|
144
|
-
"domain": null,
|
|
145
|
-
"description": "Not a single Composio toolkit. Use the individual Google toolkits instead: gmail, googledrive, googlecalendar, googledocs, googlesheets, etc."
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"name": "Custom Remote MCPs",
|
|
149
|
-
"composio_id": null,
|
|
150
|
-
"domain": null,
|
|
151
|
-
"description": "Not applicable — Composio is itself an MCP gateway. Custom MCPs are handled via Composio's auth-config/integration system or by registering a custom toolkit."
|
|
152
128
|
}
|
|
153
129
|
]
|
|
154
130
|
}
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
export * from "write-language";
|
|
17
17
|
export * from "./memory";
|
|
18
18
|
export * from "./tools";
|
|
19
|
+
// Both write-language and ./tools export AGENT_TOOLS; this package's own wins.
|
|
20
|
+
export { AGENT_TOOLS } from "./tools";
|
|
21
|
+
export * from "./utils";
|
|
19
22
|
export { configManager, ModelRegistry, getEnv, getModelProvidersUIConfigSection } from "./config";
|
|
20
23
|
export type { Config, ConfigModelProvider, MCPServerConfig, UIConfigSections, Model, ModelWithProvider } from "./config";
|
|
21
24
|
export { cropProvider, cropProviderAsBlob, cropProviderAsDataURL, getProviderImage, getProviderNames } from "./utils/provider-image-cropper";
|
|
@@ -91,7 +91,7 @@ The memory system has been refactored from a single monolithic file into a modul
|
|
|
91
91
|
### 4. **simple-memory.ts**
|
|
92
92
|
- **Purpose**: Core memory management logic
|
|
93
93
|
- **Exports**: `SimpleMemory` class
|
|
94
|
-
- **Dependencies**: `storage-interface.ts`, `types.ts`, `
|
|
94
|
+
- **Dependencies**: `storage-interface.ts`, `types.ts`, `writeLanguageResponse`
|
|
95
95
|
- **Features**:
|
|
96
96
|
- Message deduplication
|
|
97
97
|
- Auto-summarization
|
package/src/memory/example.ts
CHANGED
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
// Example 1: Basic Memory Usage with Drizzle
|
|
18
18
|
// ============================================================================
|
|
19
19
|
|
|
20
|
-
async function example1_basicMemory(db: any) {
|
|
20
|
+
async function example1_basicMemory(db: any, userMemoriesTable: any) {
|
|
21
21
|
console.log("Example 1: Basic Memory Usage");
|
|
22
22
|
|
|
23
23
|
// Create storage adapter
|
|
24
|
-
const storage = new DrizzleMemoryStorage(db);
|
|
24
|
+
const storage = new DrizzleMemoryStorage(db, userMemoriesTable);
|
|
25
25
|
|
|
26
26
|
// Create memory instance
|
|
27
27
|
const memory = new SimpleMemory("user-123", storage, {
|
|
@@ -56,10 +56,10 @@ async function example1_basicMemory(db: any) {
|
|
|
56
56
|
// Example 2: Using Memory Agent with LLM
|
|
57
57
|
// ============================================================================
|
|
58
58
|
|
|
59
|
-
async function example2_memoryAgent(db: any) {
|
|
59
|
+
async function example2_memoryAgent(db: any, userMemoriesTable: any) {
|
|
60
60
|
console.log("Example 2: Memory Agent with LLM");
|
|
61
61
|
|
|
62
|
-
const storage = new DrizzleMemoryStorage(db);
|
|
62
|
+
const storage = new DrizzleMemoryStorage(db, userMemoriesTable);
|
|
63
63
|
|
|
64
64
|
const agent = new MemoryAgent("user-123", storage, {
|
|
65
65
|
defaultProvider: "groq",
|
|
@@ -306,10 +306,10 @@ async function example4_testing() {
|
|
|
306
306
|
// Example 5: Advanced Usage - Batch Operations
|
|
307
307
|
// ============================================================================
|
|
308
308
|
|
|
309
|
-
async function example5_batchOperations(db: any) {
|
|
309
|
+
async function example5_batchOperations(db: any, userMemoriesTable: any) {
|
|
310
310
|
console.log("Example 5: Batch Operations");
|
|
311
311
|
|
|
312
|
-
const storage = new DrizzleMemoryStorage(db);
|
|
312
|
+
const storage = new DrizzleMemoryStorage(db, userMemoriesTable);
|
|
313
313
|
const memory = new SimpleMemory("user-123", storage, {
|
|
314
314
|
batchSize: 5, // Process 5 facts at a time
|
|
315
315
|
});
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Mastra } from '@mastra/core';
|
|
18
|
-
import
|
|
18
|
+
import { Agent } from '@mastra/core/agent';
|
|
19
19
|
import type { D1Database, KVNamespace } from '@cloudflare/workers-types';
|
|
20
20
|
import type { IMemoryStorage } from './storage/storage-interface';
|
|
21
21
|
import type { MemoryRecord, MemoryType, MemorySearchOptions, MemoryUpdate } from './types';
|
|
@@ -387,8 +387,8 @@ export class MastraKVMemoryStorage implements IMemoryStorage {
|
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
if (updates.access_count !== undefined) {
|
|
390
|
-
if (typeof updates.access_count === 'object'
|
|
391
|
-
memory.access_count += updates.access_count.increment;
|
|
390
|
+
if (typeof updates.access_count === 'object') {
|
|
391
|
+
memory.access_count += updates.access_count.increment ?? 0;
|
|
392
392
|
} else {
|
|
393
393
|
memory.access_count = updates.access_count;
|
|
394
394
|
}
|
|
@@ -462,14 +462,9 @@ export class MastraMemoryManager {
|
|
|
462
462
|
async initialize(): Promise<Mastra> {
|
|
463
463
|
if (this.mastra) return this.mastra;
|
|
464
464
|
|
|
465
|
-
this
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
config: {
|
|
469
|
-
// We'll use our custom storage adapter
|
|
470
|
-
},
|
|
471
|
-
},
|
|
472
|
-
});
|
|
465
|
+
// Memory persistence is handled by this manager's own D1/KV storage
|
|
466
|
+
// adapters rather than a Mastra memory backend.
|
|
467
|
+
this.mastra = new Mastra({});
|
|
473
468
|
|
|
474
469
|
// Initialize D1 schema if needed
|
|
475
470
|
if (this.config.storage === 'd1' && this.storage instanceof MastraD1MemoryStorage) {
|