chat-agent-toolkit 1.2.33 → 1.2.35

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.
Files changed (42) hide show
  1. package/dist/research-agent.cjs.js.map +1 -1
  2. package/dist/research-agent.es.js.map +1 -1
  3. package/package.json +1 -1
  4. package/src/config/config-manager.ts +295 -295
  5. package/src/config/config-types.ts +65 -65
  6. package/src/config/environment-variables.ts +16 -16
  7. package/src/config/index.ts +26 -26
  8. package/src/config/language-models-database.ts +1434 -1434
  9. package/src/config/mcp-server-registry.ts +24 -24
  10. package/src/config/model-registry.ts +271 -271
  11. package/src/config/model-tester.ts +211 -211
  12. package/src/config/model-utils.ts +193 -193
  13. package/src/config/provider-ui-config.ts +196 -196
  14. package/src/connectors/open-connector.json +130 -130
  15. package/src/index.ts +26 -26
  16. package/src/memory/ARCHITECTURE.md +302 -302
  17. package/src/memory/README.md +224 -224
  18. package/src/memory/agent-memory-manager.ts +416 -416
  19. package/src/memory/example.ts +343 -343
  20. package/src/memory/index.ts +47 -47
  21. package/src/memory/mastra-integration.ts +604 -604
  22. package/src/memory/storage/drizzle-storage.ts +236 -236
  23. package/src/memory/storage/in-memory-storage.ts +551 -551
  24. package/src/memory/storage/storage-interface.ts +68 -68
  25. package/src/memory/types.ts +125 -125
  26. package/src/models/types.ts +4 -4
  27. package/src/tools/index.ts +13 -13
  28. package/src/tools/open-connector-mastra.ts +270 -270
  29. package/src/tools/open-connector-mcp.ts +170 -170
  30. package/src/tools/qwksearch-api-tools.ts +326 -326
  31. package/src/tools/search/doc-utils.ts +139 -139
  32. package/src/tools/search/document.ts +47 -47
  33. package/src/tools/search/index.ts +14 -14
  34. package/src/tools/search/link-summarizer.ts +112 -112
  35. package/src/tools/search/meta-search-types.ts +62 -62
  36. package/src/tools/search/metaSearchAgent.ts +465 -465
  37. package/src/tools/search/search-handlers.ts +97 -97
  38. package/src/tools/search/suggestionGeneratorAgent.ts +56 -56
  39. package/src/types.d.ts +137 -137
  40. package/src/utils/index.ts +2 -2
  41. package/src/utils/markdown-to-html.ts +53 -53
  42. package/src/utils/outputParser.ts +73 -73
@@ -1,68 +1,68 @@
1
- /**
2
- * Storage Interface
3
- *
4
- * Abstract interface for memory storage implementations.
5
- * This allows swapping database backends without changing memory logic.
6
- */
7
-
8
- import type {
9
- MemoryRecord,
10
- MemoryType,
11
- MemorySearchOptions,
12
- MemoryUpdate,
13
- } from "../types";
14
-
15
- /**
16
- * Storage interface that any database adapter must implement
17
- */
18
- export interface IMemoryStorage {
19
- /**
20
- * Insert a new memory record
21
- */
22
- insertMemory(
23
- userId: string,
24
- memoryType: MemoryType,
25
- content: string,
26
- importance: number,
27
- metadata?: Record<string, any>,
28
- ): Promise<string>;
29
-
30
- /**
31
- * Find memories by user ID and optional filters
32
- */
33
- findMemories(
34
- userId: string,
35
- query?: string,
36
- limit?: number,
37
- options?: MemorySearchOptions,
38
- ): Promise<MemoryRecord[]>;
39
-
40
- /**
41
- * Find similar memories based on content
42
- */
43
- findSimilarMemories(
44
- userId: string,
45
- content: string,
46
- limit?: number,
47
- ): Promise<MemoryRecord[]>;
48
-
49
- /**
50
- * Update a memory record
51
- */
52
- updateMemory(id: string, updates: MemoryUpdate): Promise<void>;
53
-
54
- /**
55
- * Delete a memory record
56
- */
57
- deleteMemory(id: string): Promise<void>;
58
-
59
- /**
60
- * Get memory by ID
61
- */
62
- getMemoryById(id: string): Promise<MemoryRecord | null>;
63
-
64
- /**
65
- * Batch update memories
66
- */
67
- batchUpdateMemories(updates: Array<{ id: string; updates: MemoryUpdate }>): Promise<void>;
68
- }
1
+ /**
2
+ * Storage Interface
3
+ *
4
+ * Abstract interface for memory storage implementations.
5
+ * This allows swapping database backends without changing memory logic.
6
+ */
7
+
8
+ import type {
9
+ MemoryRecord,
10
+ MemoryType,
11
+ MemorySearchOptions,
12
+ MemoryUpdate,
13
+ } from "../types";
14
+
15
+ /**
16
+ * Storage interface that any database adapter must implement
17
+ */
18
+ export interface IMemoryStorage {
19
+ /**
20
+ * Insert a new memory record
21
+ */
22
+ insertMemory(
23
+ userId: string,
24
+ memoryType: MemoryType,
25
+ content: string,
26
+ importance: number,
27
+ metadata?: Record<string, any>,
28
+ ): Promise<string>;
29
+
30
+ /**
31
+ * Find memories by user ID and optional filters
32
+ */
33
+ findMemories(
34
+ userId: string,
35
+ query?: string,
36
+ limit?: number,
37
+ options?: MemorySearchOptions,
38
+ ): Promise<MemoryRecord[]>;
39
+
40
+ /**
41
+ * Find similar memories based on content
42
+ */
43
+ findSimilarMemories(
44
+ userId: string,
45
+ content: string,
46
+ limit?: number,
47
+ ): Promise<MemoryRecord[]>;
48
+
49
+ /**
50
+ * Update a memory record
51
+ */
52
+ updateMemory(id: string, updates: MemoryUpdate): Promise<void>;
53
+
54
+ /**
55
+ * Delete a memory record
56
+ */
57
+ deleteMemory(id: string): Promise<void>;
58
+
59
+ /**
60
+ * Get memory by ID
61
+ */
62
+ getMemoryById(id: string): Promise<MemoryRecord | null>;
63
+
64
+ /**
65
+ * Batch update memories
66
+ */
67
+ batchUpdateMemories(updates: Array<{ id: string; updates: MemoryUpdate }>): Promise<void>;
68
+ }
@@ -1,125 +1,125 @@
1
- /**
2
- * Memory System Types and Constants
3
- *
4
- * Defines interfaces and configuration for the memory management system
5
- */
6
-
7
- /**
8
- * Memory types for categorization
9
- */
10
- export const MEMORY_TYPES = {
11
- FACT: "fact",
12
- CONVERSATION: "conversation",
13
- PREFERENCE: "preference",
14
- PERSONAL: "personal",
15
- WORK: "work",
16
- MANUAL: "manual",
17
- } as const;
18
-
19
- export type MemoryType = (typeof MEMORY_TYPES)[keyof typeof MEMORY_TYPES];
20
-
21
- /**
22
- * Configuration constants for memory management
23
- */
24
- export const MEMORY_CONFIG = {
25
- DEFAULT_MAX_MEMORIES: 100,
26
- DEFAULT_SUMMARY_THRESHOLD: 10,
27
- DEFAULT_CACHE_EXPIRY: 5 * 60 * 1000, // 5 minutes
28
- DEFAULT_BATCH_SIZE: 5,
29
- DEFAULT_RELEVANCE_THRESHOLD: 0.3,
30
- DEFAULT_IMPORTANCE_RANGE: { min: 0, max: 10 },
31
- DEFAULT_RATE_LIMIT: { requests: 10, windowMs: 60000 },
32
- DEFAULT_TIMEOUT: 30000, // 30 seconds
33
- VECTOR_SEARCH_ENABLED: true,
34
- AUTO_SUMMARIZATION_ENABLED: true,
35
- } as const;
36
-
37
- /**
38
- * Memory record structure
39
- */
40
- export interface MemoryRecord {
41
- id: string;
42
- user_id: string;
43
- memory_type: MemoryType;
44
- content: string;
45
- importance: number;
46
- access_count: number;
47
- metadata?: Record<string, any>;
48
- created_at: Date;
49
- updated_at: Date;
50
- relevance_score?: number;
51
- }
52
-
53
- /**
54
- * Message structure for conversation tracking
55
- */
56
- export interface Message {
57
- role: "user" | "assistant";
58
- content: string;
59
- timestamp: number;
60
- metadata?: Record<string, any>;
61
- }
62
-
63
- /**
64
- * Memory search options
65
- */
66
- export interface MemorySearchOptions {
67
- minImportance?: number;
68
- memoryType?: MemoryType;
69
- includeMetadata?: boolean;
70
- }
71
-
72
- /**
73
- * Memory update payload
74
- */
75
- export interface MemoryUpdate {
76
- importance?: number;
77
- access_count?: number | { increment: number };
78
- updated_at?: Date;
79
- metadata?: Record<string, any>;
80
- }
81
-
82
- /**
83
- * Memory context options
84
- */
85
- export interface MemoryContextOptions {
86
- maxMemories?: number;
87
- minImportance?: number;
88
- }
89
-
90
- /**
91
- * Performance metrics
92
- */
93
- export interface MemoryMetrics {
94
- cacheHits: number;
95
- cacheMisses: number;
96
- vectorSearches: number;
97
- summarizations: number;
98
- errors: number;
99
- cacheSize: number;
100
- recentMessagesCount: number;
101
- isProcessing: boolean;
102
- }
103
-
104
- /**
105
- * Memory initialization options
106
- */
107
- export interface MemoryOptions {
108
- maxMemories?: number;
109
- summaryThreshold?: number;
110
- cacheExpiry?: number;
111
- batchSize?: number;
112
- relevanceThreshold?: number;
113
- enableVectorSearch?: boolean;
114
- enableAutoSummarization?: boolean;
115
- }
116
-
117
- /**
118
- * Extracted fact structure
119
- */
120
- export interface ExtractedFact {
121
- content: string;
122
- importance?: number;
123
- category?: MemoryType;
124
- metadata?: Record<string, any>;
125
- }
1
+ /**
2
+ * Memory System Types and Constants
3
+ *
4
+ * Defines interfaces and configuration for the memory management system
5
+ */
6
+
7
+ /**
8
+ * Memory types for categorization
9
+ */
10
+ export const MEMORY_TYPES = {
11
+ FACT: "fact",
12
+ CONVERSATION: "conversation",
13
+ PREFERENCE: "preference",
14
+ PERSONAL: "personal",
15
+ WORK: "work",
16
+ MANUAL: "manual",
17
+ } as const;
18
+
19
+ export type MemoryType = (typeof MEMORY_TYPES)[keyof typeof MEMORY_TYPES];
20
+
21
+ /**
22
+ * Configuration constants for memory management
23
+ */
24
+ export const MEMORY_CONFIG = {
25
+ DEFAULT_MAX_MEMORIES: 100,
26
+ DEFAULT_SUMMARY_THRESHOLD: 10,
27
+ DEFAULT_CACHE_EXPIRY: 5 * 60 * 1000, // 5 minutes
28
+ DEFAULT_BATCH_SIZE: 5,
29
+ DEFAULT_RELEVANCE_THRESHOLD: 0.3,
30
+ DEFAULT_IMPORTANCE_RANGE: { min: 0, max: 10 },
31
+ DEFAULT_RATE_LIMIT: { requests: 10, windowMs: 60000 },
32
+ DEFAULT_TIMEOUT: 30000, // 30 seconds
33
+ VECTOR_SEARCH_ENABLED: true,
34
+ AUTO_SUMMARIZATION_ENABLED: true,
35
+ } as const;
36
+
37
+ /**
38
+ * Memory record structure
39
+ */
40
+ export interface MemoryRecord {
41
+ id: string;
42
+ user_id: string;
43
+ memory_type: MemoryType;
44
+ content: string;
45
+ importance: number;
46
+ access_count: number;
47
+ metadata?: Record<string, any>;
48
+ created_at: Date;
49
+ updated_at: Date;
50
+ relevance_score?: number;
51
+ }
52
+
53
+ /**
54
+ * Message structure for conversation tracking
55
+ */
56
+ export interface Message {
57
+ role: "user" | "assistant";
58
+ content: string;
59
+ timestamp: number;
60
+ metadata?: Record<string, any>;
61
+ }
62
+
63
+ /**
64
+ * Memory search options
65
+ */
66
+ export interface MemorySearchOptions {
67
+ minImportance?: number;
68
+ memoryType?: MemoryType;
69
+ includeMetadata?: boolean;
70
+ }
71
+
72
+ /**
73
+ * Memory update payload
74
+ */
75
+ export interface MemoryUpdate {
76
+ importance?: number;
77
+ access_count?: number | { increment: number };
78
+ updated_at?: Date;
79
+ metadata?: Record<string, any>;
80
+ }
81
+
82
+ /**
83
+ * Memory context options
84
+ */
85
+ export interface MemoryContextOptions {
86
+ maxMemories?: number;
87
+ minImportance?: number;
88
+ }
89
+
90
+ /**
91
+ * Performance metrics
92
+ */
93
+ export interface MemoryMetrics {
94
+ cacheHits: number;
95
+ cacheMisses: number;
96
+ vectorSearches: number;
97
+ summarizations: number;
98
+ errors: number;
99
+ cacheSize: number;
100
+ recentMessagesCount: number;
101
+ isProcessing: boolean;
102
+ }
103
+
104
+ /**
105
+ * Memory initialization options
106
+ */
107
+ export interface MemoryOptions {
108
+ maxMemories?: number;
109
+ summaryThreshold?: number;
110
+ cacheExpiry?: number;
111
+ batchSize?: number;
112
+ relevanceThreshold?: number;
113
+ enableVectorSearch?: boolean;
114
+ enableAutoSummarization?: boolean;
115
+ }
116
+
117
+ /**
118
+ * Extracted fact structure
119
+ */
120
+ export interface ExtractedFact {
121
+ content: string;
122
+ importance?: number;
123
+ category?: MemoryType;
124
+ metadata?: Record<string, any>;
125
+ }
@@ -1,4 +1,4 @@
1
- /**
2
- * @fileoverview Re-export model types from config directory
3
- */
4
- export type { Model, ConfigModelProvider, MinimalProvider } from "../config/config-types";
1
+ /**
2
+ * @fileoverview Re-export model types from config directory
3
+ */
4
+ export type { Model, ConfigModelProvider, MinimalProvider } from "../config/config-types";
@@ -1,13 +1,13 @@
1
- /**
2
- * @fileoverview Agent Tools Module
3
- *
4
- * Exports tool definitions for QwkSearch API integration including web search,
5
- * content extraction, and AI response generation. Tools are automatically
6
- * attached to agents when declared in prompt templates.
7
- *
8
- * @module tools
9
- * @author ai-research-agent contributors
10
- */
11
-
12
- export { AGENT_TOOLS } from "./qwksearch-api-tools";
13
- export * from "./search";
1
+ /**
2
+ * @fileoverview Agent Tools Module
3
+ *
4
+ * Exports tool definitions for QwkSearch API integration including web search,
5
+ * content extraction, and AI response generation. Tools are automatically
6
+ * attached to agents when declared in prompt templates.
7
+ *
8
+ * @module tools
9
+ * @author ai-research-agent contributors
10
+ */
11
+
12
+ export { AGENT_TOOLS } from "./qwksearch-api-tools";
13
+ export * from "./search";