@ainetwork/adk-provider-memory-mongodb 0.3.7 → 0.4.0
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/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/implements/agent.memory.ts +22 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -125,6 +125,24 @@ var MongoDBAgent = class {
|
|
|
125
125
|
return metadata?.prompt || "";
|
|
126
126
|
}, "getToolSelectPrompt()");
|
|
127
127
|
}
|
|
128
|
+
async getPIIDetectPrompt() {
|
|
129
|
+
return this.executeWithRetry(async () => {
|
|
130
|
+
const timeout = this.getOperationTimeout();
|
|
131
|
+
const metadata = await AgentModel.findOne({
|
|
132
|
+
id: "pii_detect_prompt"
|
|
133
|
+
}).maxTimeMS(timeout).lean();
|
|
134
|
+
return metadata?.prompt || "";
|
|
135
|
+
}, "getPIIDetectPrompt()");
|
|
136
|
+
}
|
|
137
|
+
async getPIIFilterPrompt() {
|
|
138
|
+
return this.executeWithRetry(async () => {
|
|
139
|
+
const timeout = this.getOperationTimeout();
|
|
140
|
+
const metadata = await AgentModel.findOne({
|
|
141
|
+
id: "pii_filter_prompt"
|
|
142
|
+
}).maxTimeMS(timeout).lean();
|
|
143
|
+
return metadata?.prompt || "";
|
|
144
|
+
}, "getPIIFilterPrompt()");
|
|
145
|
+
}
|
|
128
146
|
};
|
|
129
147
|
|
|
130
148
|
// models/intent.model.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts","../implements/base.memory.ts","../models/agent.model.ts","../implements/agent.memory.ts","../models/intent.model.ts","../implements/intent.memory.ts","../models/threads.model.ts","../models/messages.model.ts","../implements/thread.memory.ts","../models/workflow.model.ts","../implements/workflow.memory.ts"],"sourcesContent":["export { MongoDBMemory } from \"./implements/base.memory\";\nexport type { MongoDBMemoryConfig } from \"./implements/base.memory\";","import { IAgentMemory, IIntentMemory, IMemory, IThreadMemory, IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport mongoose from \"mongoose\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\nimport { MongoDBAgent } from \"./agent.memory\";\nimport { MongoDBIntent } from \"./intent.memory\";\nimport { MongoDBThread } from \"./thread.memory\";\nimport { MongoDBWorkflow } from \"./workflow.memory\";\n\nexport interface MongoDBMemoryConfig {\n uri: string;\n maxReconnectAttempts?: number;\n reconnectInterval?: number;\n maxPoolSize?: number;\n serverSelectionTimeoutMS?: number;\n socketTimeoutMS?: number;\n connectTimeoutMS?: number;\n operationTimeoutMS?: number; // Timeout for database operations\n}\n\nexport class MongoDBMemory implements IMemory {\n private static instance: MongoDBMemory;\n private uri: string;\n private connected: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number;\n private reconnectInterval: number;\n private reconnecting: boolean = false;\n private connectionConfig: mongoose.ConnectOptions;\n private eventListenersSetup: boolean = false;\n private operationTimeoutMS: number;\n\n private agentMemory: MongoDBAgent;\n private intentMemory: MongoDBIntent;\n private threadMemory: MongoDBThread;\n private workflowMemory: MongoDBWorkflow;\n\n constructor(config: string | MongoDBMemoryConfig) {\n const cfg = typeof config === 'string' ? { uri: config } : config;\n\n this.uri = cfg.uri;\n this.maxReconnectAttempts = cfg.maxReconnectAttempts ?? 5;\n this.reconnectInterval = cfg.reconnectInterval ?? 5000;\n this.operationTimeoutMS = cfg.operationTimeoutMS ?? 10000; // Default 10 seconds\n this.connectionConfig = {\n maxPoolSize: cfg.maxPoolSize ?? 1,\n serverSelectionTimeoutMS: cfg.serverSelectionTimeoutMS ?? 30000,\n socketTimeoutMS: cfg.socketTimeoutMS ?? 45000,\n connectTimeoutMS: cfg.connectTimeoutMS ?? 30000,\n bufferCommands: false,\n };\n\n if (!MongoDBMemory.instance) {\n MongoDBMemory.instance = this;\n this.setupMongooseEventListeners();\n } else {\n // Use existing instance's connection state\n this.connected = MongoDBMemory.instance.connected;\n this.operationTimeoutMS = MongoDBMemory.instance.operationTimeoutMS;\n }\n\n\t\tthis.agentMemory = new MongoDBAgent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.threadMemory = new MongoDBThread(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.intentMemory = new MongoDBIntent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.workflowMemory = new MongoDBWorkflow(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n }\n\n public getAgentMemory(): IAgentMemory {\n return this.agentMemory;\n }\n\n public getThreadMemory(): IThreadMemory {\n return this.threadMemory;\n }\n\n public getIntentMemory(): IIntentMemory {\n return this.intentMemory;\n }\n\n public getWorkflowMemory(): IWorkflowMemory {\n return this.workflowMemory;\n }\n\n private setupMongooseEventListeners(): void {\n if (this.eventListenersSetup) return;\n\n this.eventListenersSetup = true;\n\n mongoose.connection.on(\"connected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB connected successfully\");\n });\n\n mongoose.connection.on(\"disconnected\", () => {\n this.connected = false;\n loggers.agent.warn(\"MongoDB disconnected\");\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"error\", (error) => {\n this.connected = false;\n loggers.agent.error(\"MongoDB connection error:\", error);\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"reconnected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnected successfully\");\n });\n }\n\n private async handleDisconnection(): Promise<void> {\n if (this.reconnecting) {\n return;\n }\n\n this.reconnecting = true;\n\n while (this.reconnectAttempts < this.maxReconnectAttempts && !this.isConnected) {\n this.reconnectAttempts++;\n loggers.agent.info(\n `Attempting to reconnect to MongoDB (${this.reconnectAttempts}/${this.maxReconnectAttempts})...`\n );\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnection successful\");\n return;\n } catch (error) {\n loggers.agent.error(\n `Reconnection attempt ${this.reconnectAttempts} failed:`,\n error\n );\n\n if (this.reconnectAttempts < this.maxReconnectAttempts) {\n await new Promise((resolve) =>\n setTimeout(resolve, this.reconnectInterval)\n );\n }\n }\n }\n\n this.reconnecting = false;\n\n if (!this.isConnected) {\n loggers.agent.error(\n `Failed to reconnect to MongoDB after ${this.maxReconnectAttempts} attempts`\n );\n }\n }\n\n public async connect(): Promise<void> {\n if (this.connected) {\n return;\n }\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n } catch (error) {\n loggers.agent.error(\"Failed to connect to MongoDB:\", error);\n throw error;\n }\n }\n\n public async disconnect(): Promise<void> {\n if (!this.isConnected) {\n return;\n }\n\n try {\n await mongoose.disconnect();\n this.connected = false;\n } catch (error) {\n loggers.agent.error(\"Failed to disconnect from MongoDB:\", error);\n throw error;\n }\n }\n\n public isConnected(): boolean {\n return this.connected;\n }\n\n private async ensureConnection(): Promise<void> {\n if (!this.isConnected && !this.reconnecting) {\n await this.connect();\n }\n\n // Wait for reconnection if in progress\n const maxWaitTime = 30000; // 30 seconds\n const startTime = Date.now();\n while (this.reconnecting && Date.now() - startTime < maxWaitTime) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n if (!this.isConnected) {\n throw new Error(\"MongoDB is not connected and reconnection failed\");\n }\n }\n\n /**\n * Get the operation timeout in milliseconds\n */\n protected getOperationTimeout(): number {\n return this.operationTimeoutMS;\n }\n\n /**\n * Execute a database operation with automatic retry on connection errors\n * Note: Use mongoose's maxTimeMS option in queries for timeout control\n */\n protected async executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string = \"Database operation\"\n ): Promise<T> {\n await this.ensureConnection();\n\n try {\n return await operation();\n } catch (error: any) {\n // Check if it's a timeout error from MongoDB\n if (error.code === 50 || error.message?.includes(\"operation exceeded time limit\")) {\n loggers.agent.error(`${operationName} exceeded time limit`);\n throw error;\n }\n\n // Check if it's a connection-related error\n if (\n error.name === \"MongoNetworkError\" ||\n error.name === \"MongoServerError\" ||\n error.message?.includes(\"connection\") ||\n error.message?.includes(\"disconnect\")\n ) {\n loggers.agent.warn(\n `${operationName} failed due to connection issue, attempting reconnection...`\n );\n\n await this.ensureConnection();\n\n // Retry the operation once after reconnection\n try {\n return await operation();\n } catch (retryError: any) {\n loggers.agent.error(`${operationName} failed after retry:`, retryError);\n throw retryError;\n }\n }\n\n // If it's not a connection error, just throw it\n throw error;\n }\n }\n}\n","import { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const AgentObjectSchema = new Schema(\n\t{\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tunique: true,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: String,\n\t\t},\n\t},\n);\n\nexport interface AgentDocument extends Document {\n\tid: string;\n\tprompt: string;\n}\n\nexport const AgentModel = mongoose.model<AgentDocument>(\"Agent\", AgentObjectSchema);\n","import { IAgentMemory } from \"@ainetwork/adk/modules\";\nimport { AgentModel } from \"../models/agent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\ntype PromptDocument = {\n id: string;\n prompt: string;\n}\n\nexport class MongoDBAgent implements IAgentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getAgentPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"agent_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAgentPrompt()\");\n };\n \n public async updateAgentPrompt(prompt: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await AgentModel.updateOne({\n id: \"agent_prompt\",\n }, { \"prompt\": prompt }, { upsert: true }).maxTimeMS(timeout);\n }, \"updateAgentPrompt()\");\n };\n\n public async getAggregatePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"aggregate_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAggregatePrompt()\");\n };\n\n public async getGenerateTitlePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"generate_title_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getGenerateTitlePrompt()\");\n };\n\n public async getSingleTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"single_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getSingleTriggerPrompt()\");\n };\n\n public async getMultiTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"multi_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getMultiTriggerPrompt()\");\n };\n\n public async getToolSelectPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"tool_select_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getToolSelectPrompt()\");\n };\n}\n","import { Intent } from \"@ainetwork/adk/types/memory\";\nimport mongoose, { type Document, Schema } from \"mongoose\";\n\nconst IntentObjectSchema = new Schema(\n\t{\n\t\tid: { \n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t\tunique: true,\n\t\t},\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t},\n\t\tstatus: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ttriggeringSentences: {\n\t\t\ttype: [String],\n\t\t\trequired: false,\n\t\t},\n\t\ttags: {\n\t\t\ttype: [String],\n\t\t\trequired: false,\n\t\t},\n\t},\n);\n\nexport interface IntentDocument extends Omit<Document, 'id'>, Omit<Intent, 'id'> {\n\tid: string;\n}\n\nexport const IntentModel = mongoose.model<IntentDocument>(\"Intent\", IntentObjectSchema);","import type { Intent } from \"@ainetwork/adk/types/memory\";\nimport { IIntentMemory } from \"@ainetwork/adk/modules\";\nimport { IntentModel } from \"../models/intent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBIntent implements IIntentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getIntent(intentId: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ id: intentId })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntent(${intentId})`);\n };\n\n public async getIntentByName(intentName: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ name: intentName })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntentByName(${intentName})`);\n }\n\n public async saveIntent(intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n await IntentModel.create(intent);\n }, `saveIntent(${intent.id})`);\n };\n\n public async updateIntent(intentId: string, intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.updateOne({\n id: intentId,\n }, intent).maxTimeMS(timeout);\n }, `updateIntent(${intentId})`);\n };\n\n public async deleteIntent(intentId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.deleteOne({ id: intentId }).maxTimeMS(timeout);\n }, `deleteIntent(${intentId})`);\n };\n\n public async listIntents(): Promise<Intent[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intents = await IntentModel.find()\n .maxTimeMS(timeout)\n .lean<Intent[]>();\n return intents;\n }, `listIntents()`);\n };\n}\n","import { ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const ThreadObjectSchema = new Schema(\n\t{\n\t\ttype: {\n\t\t\ttype: String,\n\t\t\tenum: Object.values(ThreadType),\n\t\t\trequired: true,\n\t\t},\n\t\tthreadId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t},\n\t\tcreated_at: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t},\n\t\tupdated_at: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t}\n\t},\n);\n\nexport interface ThreadDocument extends Document {\n\ttype: ThreadType;\n\tthreadId: string;\n\tuserId: string;\n\ttitle: string;\n\tcreated_at: number;\n\tupdated_at: number;\n}\n\nexport const ThreadModel = mongoose.model<ThreadDocument>(\"Thread\", ThreadObjectSchema);\n","import { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\n// MessageContentObject schema\nexport const MessageContentObjectSchema = new Schema(\n\t{\n\t\ttype: { type: String, required: true },\n\t\tparts: { type: [Schema.Types.Mixed], required: true },\n\t},\n\t{ _id: false },\n);\n\n// MessageObject schema - 개별 문서로 저장\nexport const MessageObjectSchema = new Schema(\n\t{\n\t\tmessageId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tthreadId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\trole: {\n\t\t\ttype: String,\n\t\t\tenum: Object.values(MessageRole),\n\t\t\trequired: true,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: MessageContentObjectSchema,\n\t\t\trequired: true,\n\t\t},\n\t\ttimestamp: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t},\n\t\tmetadata: {\n\t\t\ttype: Schema.Types.Mixed,\n\t\t\tdefault: {},\n\t\t},\n\t},\n);\n\n// Message Document interface\nexport interface MessageDocument extends Document {\n\tmessageId: string;\n\tthreadId: string;\n\tuserId: string;\n\trole: MessageRole;\n\tcontent: {\n\t\ttype: string;\n\t\tparts: any[];\n\t};\n\ttimestamp: number;\n\tmetadata?: { [key: string]: unknown };\n}\n\nexport const MessageModel = mongoose.model<MessageDocument>(\"Message\", MessageObjectSchema);","import type { MessageObject, ThreadMetadata, ThreadObject, ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { IThreadMemory } from \"@ainetwork/adk/modules\";\nimport { ThreadDocument, ThreadModel } from \"../models/threads.model\";\nimport { MessageDocument, MessageModel } from \"../models/messages.model\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBThread implements IThreadMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getThread(\n userId: string,\n threadId: string\n ): Promise<ThreadObject | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const thread = await ThreadModel.findOne({ threadId, userId }).maxTimeMS(timeout);\n const messages = await MessageModel.find({ threadId, userId })\n .sort({ timestamp: 1 })\n .maxTimeMS(timeout);\n\n if (!thread) return undefined;\n\n loggers.agent.debug(`Found ${messages.length} messages for thread ${threadId}`);\n\n const threadObject: ThreadObject = {\n threadId: thread.threadId,\n userId: thread.userId,\n type: thread.type as ThreadType,\n title: thread.title || \"New thread\",\n messages: []\n };\n messages.forEach((message: MessageDocument) => {\n threadObject.messages.push({\n messageId: message.messageId,\n role: message.role as MessageRole,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n });\n\n return threadObject;\n }, `getThread(${userId}, ${threadId})`);\n };\n\n public async createThread(\n type: ThreadType,\n userId: string,\n threadId: string,\n title: string,\n ): Promise<ThreadObject> {\n return this.executeWithRetry(async () => {\n const now = Date.now();\n await ThreadModel.create({\n type,\n userId,\n threadId,\n title,\n updated_at: now,\n created_at: now,\n });\n\n return { type, userId, threadId, title, messages: []};\n }, `createThread(${userId}, ${threadId})`);\n };\n\n public async addMessagesToThread(\n userId: string,\n threadId: string,\n messages: MessageObject[]\n ): Promise<void> {\n return this.executeWithRetry(async () => {\n await ThreadModel.updateOne({ threadId, userId }, {\n updated_at: Date.now(),\n });\n for (const message of messages) {\n await MessageModel.create({\n threadId,\n messageId: message.messageId,\n userId,\n role: message.role,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n }\n }, `addMessagesToThread(${userId}, ${threadId})`);\n };\n\n public async deleteThread(userId: string, threadId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n\n // Delete all messages for this thread\n await MessageModel.deleteMany({ userId, threadId }).maxTimeMS(timeout);\n\n // Delete the thread itself\n await ThreadModel.deleteOne({ userId, threadId }).maxTimeMS(timeout);\n }, `deleteThread(${userId}, ${threadId})`);\n };\n\n public async listThreads(userId: string): Promise<ThreadMetadata[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const threads = await ThreadModel.find({ userId })\n .sort({ updated_at: -1 })\n .maxTimeMS(timeout);\n const data: ThreadMetadata[] = threads.map((thread: ThreadDocument) => {\n return {\n type: thread.type,\n userId,\n threadId: thread.threadId,\n title: thread.title,\n updatedAt: thread.updated_at\n } as ThreadMetadata;\n })\n return data;\n }, `listThreads(${userId})`);\n };\n}\n","import { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const WorkflowObjectSchema = new Schema(\n\t{\n\t\tworkflowId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tunique: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tactive: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true,\n\t\t\tdefault: false,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\t{\n\t\ttimestamps: true,\n\t}\n);\n\nexport interface WorkflowDocument extends Document {\n\tworkflowId: string;\n\tuserId?: string;\n\ttitle: string;\n\tdescription: string;\n\tactive: boolean;\n\tcontent: string;\n}\n\nexport const WorkflowModel = mongoose.model<WorkflowDocument>(\"Workflow\", WorkflowObjectSchema);\n","import type { IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport type { Workflow } from \"@ainetwork/adk/types/memory\";\nimport { WorkflowModel } from \"../models/workflow.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBWorkflow implements IWorkflowMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async createWorkflow(workflow: Workflow): Promise<Workflow> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const created = await WorkflowModel.create(workflow);\n return created.toObject() as Workflow;\n }, \"createWorkflow()\");\n }\n\n public async getWorkflow(workflowId: string): Promise<Workflow | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const workflow = await WorkflowModel.findOne({\n workflowId\n }).maxTimeMS(timeout).lean<Workflow>();\n return workflow || undefined;\n }, \"getWorkflow()\");\n }\n\n public async updateWorkflow(workflowId: string, updates: Partial<Workflow>): Promise<void> {\n if (!updates.userId) {\n throw new Error(\"userId is required for updateWorkflow\");\n }\n\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId를 조건에 포함하여 소유자만 수정 가능하도록 함\n await WorkflowModel.updateOne(\n { workflowId, userId: updates.userId },\n { $set: updates }\n ).maxTimeMS(timeout);\n }, \"updateWorkflow()\");\n }\n\n public async deleteWorkflow(workflowId: string, userId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await WorkflowModel.deleteOne({ workflowId, userId }).maxTimeMS(timeout);\n }, \"deleteWorkflow()\");\n }\n\n public async listWorkflows(userId?: string): Promise<Workflow[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId가 있으면: 해당 유저 소유 + 템플릿(userId 없음)\n // userId가 없으면: 템플릿만 반환\n const query = userId\n ? { $or: [{ userId }, { userId: { $exists: false } }, { userId: null }] }\n : { $or: [{ userId: { $exists: false } }, { userId: null }] };\n const workflows = await WorkflowModel.find(query)\n .maxTimeMS(timeout)\n .lean<Workflow[]>();\n return workflows;\n }, \"listWorkflows()\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,oBAAqB;AACrB,IAAAC,iBAAwB;;;ACFxB,sBAAsC;AACtC,IAAAC,mBAAqB;AAEd,IAAM,oBAAoB,IAAI;AAAA,EACpC;AAAA,IACC,IAAI;AAAA,MACH,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAOO,IAAM,aAAa,iBAAAC,QAAS,MAAqB,SAAS,iBAAiB;;;ACN3E,IAAM,eAAN,MAA2C;AAAA,EACxC;AAAA,EACA;AAAA,EAER,YACE,kBACA,qBACA;AACA,SAAK,mBAAmB;AACxB,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,MAAa,iBAAkC;AAC7C,WAAO,KAAK,iBAAiB,YAAY;AACvC,YAAM,UAAU,KAAK,oBAAoB;AACzC,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import_logger","import_mongoose","mongoose","import_mongoose","mongoose","import_mongoose","mongoose","import_memory","import_mongoose","mongoose","import_mongoose","mongoose","mongoose"]}
|
|
1
|
+
{"version":3,"sources":["../index.ts","../implements/base.memory.ts","../models/agent.model.ts","../implements/agent.memory.ts","../models/intent.model.ts","../implements/intent.memory.ts","../models/threads.model.ts","../models/messages.model.ts","../implements/thread.memory.ts","../models/workflow.model.ts","../implements/workflow.memory.ts"],"sourcesContent":["export { MongoDBMemory } from \"./implements/base.memory\";\nexport type { MongoDBMemoryConfig } from \"./implements/base.memory\";","import { IAgentMemory, IIntentMemory, IMemory, IThreadMemory, IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport mongoose from \"mongoose\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\nimport { MongoDBAgent } from \"./agent.memory\";\nimport { MongoDBIntent } from \"./intent.memory\";\nimport { MongoDBThread } from \"./thread.memory\";\nimport { MongoDBWorkflow } from \"./workflow.memory\";\n\nexport interface MongoDBMemoryConfig {\n uri: string;\n maxReconnectAttempts?: number;\n reconnectInterval?: number;\n maxPoolSize?: number;\n serverSelectionTimeoutMS?: number;\n socketTimeoutMS?: number;\n connectTimeoutMS?: number;\n operationTimeoutMS?: number; // Timeout for database operations\n}\n\nexport class MongoDBMemory implements IMemory {\n private static instance: MongoDBMemory;\n private uri: string;\n private connected: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number;\n private reconnectInterval: number;\n private reconnecting: boolean = false;\n private connectionConfig: mongoose.ConnectOptions;\n private eventListenersSetup: boolean = false;\n private operationTimeoutMS: number;\n\n private agentMemory: MongoDBAgent;\n private intentMemory: MongoDBIntent;\n private threadMemory: MongoDBThread;\n private workflowMemory: MongoDBWorkflow;\n\n constructor(config: string | MongoDBMemoryConfig) {\n const cfg = typeof config === 'string' ? { uri: config } : config;\n\n this.uri = cfg.uri;\n this.maxReconnectAttempts = cfg.maxReconnectAttempts ?? 5;\n this.reconnectInterval = cfg.reconnectInterval ?? 5000;\n this.operationTimeoutMS = cfg.operationTimeoutMS ?? 10000; // Default 10 seconds\n this.connectionConfig = {\n maxPoolSize: cfg.maxPoolSize ?? 1,\n serverSelectionTimeoutMS: cfg.serverSelectionTimeoutMS ?? 30000,\n socketTimeoutMS: cfg.socketTimeoutMS ?? 45000,\n connectTimeoutMS: cfg.connectTimeoutMS ?? 30000,\n bufferCommands: false,\n };\n\n if (!MongoDBMemory.instance) {\n MongoDBMemory.instance = this;\n this.setupMongooseEventListeners();\n } else {\n // Use existing instance's connection state\n this.connected = MongoDBMemory.instance.connected;\n this.operationTimeoutMS = MongoDBMemory.instance.operationTimeoutMS;\n }\n\n\t\tthis.agentMemory = new MongoDBAgent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.threadMemory = new MongoDBThread(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.intentMemory = new MongoDBIntent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.workflowMemory = new MongoDBWorkflow(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n }\n\n public getAgentMemory(): IAgentMemory {\n return this.agentMemory;\n }\n\n public getThreadMemory(): IThreadMemory {\n return this.threadMemory;\n }\n\n public getIntentMemory(): IIntentMemory {\n return this.intentMemory;\n }\n\n public getWorkflowMemory(): IWorkflowMemory {\n return this.workflowMemory;\n }\n\n private setupMongooseEventListeners(): void {\n if (this.eventListenersSetup) return;\n\n this.eventListenersSetup = true;\n\n mongoose.connection.on(\"connected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB connected successfully\");\n });\n\n mongoose.connection.on(\"disconnected\", () => {\n this.connected = false;\n loggers.agent.warn(\"MongoDB disconnected\");\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"error\", (error) => {\n this.connected = false;\n loggers.agent.error(\"MongoDB connection error:\", error);\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"reconnected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnected successfully\");\n });\n }\n\n private async handleDisconnection(): Promise<void> {\n if (this.reconnecting) {\n return;\n }\n\n this.reconnecting = true;\n\n while (this.reconnectAttempts < this.maxReconnectAttempts && !this.isConnected) {\n this.reconnectAttempts++;\n loggers.agent.info(\n `Attempting to reconnect to MongoDB (${this.reconnectAttempts}/${this.maxReconnectAttempts})...`\n );\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnection successful\");\n return;\n } catch (error) {\n loggers.agent.error(\n `Reconnection attempt ${this.reconnectAttempts} failed:`,\n error\n );\n\n if (this.reconnectAttempts < this.maxReconnectAttempts) {\n await new Promise((resolve) =>\n setTimeout(resolve, this.reconnectInterval)\n );\n }\n }\n }\n\n this.reconnecting = false;\n\n if (!this.isConnected) {\n loggers.agent.error(\n `Failed to reconnect to MongoDB after ${this.maxReconnectAttempts} attempts`\n );\n }\n }\n\n public async connect(): Promise<void> {\n if (this.connected) {\n return;\n }\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n } catch (error) {\n loggers.agent.error(\"Failed to connect to MongoDB:\", error);\n throw error;\n }\n }\n\n public async disconnect(): Promise<void> {\n if (!this.isConnected) {\n return;\n }\n\n try {\n await mongoose.disconnect();\n this.connected = false;\n } catch (error) {\n loggers.agent.error(\"Failed to disconnect from MongoDB:\", error);\n throw error;\n }\n }\n\n public isConnected(): boolean {\n return this.connected;\n }\n\n private async ensureConnection(): Promise<void> {\n if (!this.isConnected && !this.reconnecting) {\n await this.connect();\n }\n\n // Wait for reconnection if in progress\n const maxWaitTime = 30000; // 30 seconds\n const startTime = Date.now();\n while (this.reconnecting && Date.now() - startTime < maxWaitTime) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n if (!this.isConnected) {\n throw new Error(\"MongoDB is not connected and reconnection failed\");\n }\n }\n\n /**\n * Get the operation timeout in milliseconds\n */\n protected getOperationTimeout(): number {\n return this.operationTimeoutMS;\n }\n\n /**\n * Execute a database operation with automatic retry on connection errors\n * Note: Use mongoose's maxTimeMS option in queries for timeout control\n */\n protected async executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string = \"Database operation\"\n ): Promise<T> {\n await this.ensureConnection();\n\n try {\n return await operation();\n } catch (error: any) {\n // Check if it's a timeout error from MongoDB\n if (error.code === 50 || error.message?.includes(\"operation exceeded time limit\")) {\n loggers.agent.error(`${operationName} exceeded time limit`);\n throw error;\n }\n\n // Check if it's a connection-related error\n if (\n error.name === \"MongoNetworkError\" ||\n error.name === \"MongoServerError\" ||\n error.message?.includes(\"connection\") ||\n error.message?.includes(\"disconnect\")\n ) {\n loggers.agent.warn(\n `${operationName} failed due to connection issue, attempting reconnection...`\n );\n\n await this.ensureConnection();\n\n // Retry the operation once after reconnection\n try {\n return await operation();\n } catch (retryError: any) {\n loggers.agent.error(`${operationName} failed after retry:`, retryError);\n throw retryError;\n }\n }\n\n // If it's not a connection error, just throw it\n throw error;\n }\n }\n}\n","import { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const AgentObjectSchema = new Schema(\n\t{\n\t\tid: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tunique: true,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: String,\n\t\t},\n\t},\n);\n\nexport interface AgentDocument extends Document {\n\tid: string;\n\tprompt: string;\n}\n\nexport const AgentModel = mongoose.model<AgentDocument>(\"Agent\", AgentObjectSchema);\n","import { IAgentMemory } from \"@ainetwork/adk/modules\";\nimport { AgentModel } from \"../models/agent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\ntype PromptDocument = {\n id: string;\n prompt: string;\n}\n\nexport class MongoDBAgent implements IAgentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getAgentPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"agent_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAgentPrompt()\");\n };\n \n public async updateAgentPrompt(prompt: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await AgentModel.updateOne({\n id: \"agent_prompt\",\n }, { \"prompt\": prompt }, { upsert: true }).maxTimeMS(timeout);\n }, \"updateAgentPrompt()\");\n };\n\n public async getAggregatePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"aggregate_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAggregatePrompt()\");\n };\n\n public async getGenerateTitlePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"generate_title_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getGenerateTitlePrompt()\");\n };\n\n public async getSingleTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"single_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getSingleTriggerPrompt()\");\n };\n\n public async getMultiTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"multi_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getMultiTriggerPrompt()\");\n };\n\n public async getToolSelectPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"tool_select_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getToolSelectPrompt()\");\n };\n\n public async getPIIDetectPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"pii_detect_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getPIIDetectPrompt()\");\n };\n\n public async getPIIFilterPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"pii_filter_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getPIIFilterPrompt()\");\n };\n}\n","import { Intent } from \"@ainetwork/adk/types/memory\";\nimport mongoose, { type Document, Schema } from \"mongoose\";\n\nconst IntentObjectSchema = new Schema(\n\t{\n\t\tid: { \n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t\tunique: true,\n\t\t},\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tprompt: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t},\n\t\tstatus: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\ttriggeringSentences: {\n\t\t\ttype: [String],\n\t\t\trequired: false,\n\t\t},\n\t\ttags: {\n\t\t\ttype: [String],\n\t\t\trequired: false,\n\t\t},\n\t},\n);\n\nexport interface IntentDocument extends Omit<Document, 'id'>, Omit<Intent, 'id'> {\n\tid: string;\n}\n\nexport const IntentModel = mongoose.model<IntentDocument>(\"Intent\", IntentObjectSchema);","import type { Intent } from \"@ainetwork/adk/types/memory\";\nimport { IIntentMemory } from \"@ainetwork/adk/modules\";\nimport { IntentModel } from \"../models/intent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBIntent implements IIntentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getIntent(intentId: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ id: intentId })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntent(${intentId})`);\n };\n\n public async getIntentByName(intentName: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ name: intentName })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntentByName(${intentName})`);\n }\n\n public async saveIntent(intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n await IntentModel.create(intent);\n }, `saveIntent(${intent.id})`);\n };\n\n public async updateIntent(intentId: string, intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.updateOne({\n id: intentId,\n }, intent).maxTimeMS(timeout);\n }, `updateIntent(${intentId})`);\n };\n\n public async deleteIntent(intentId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.deleteOne({ id: intentId }).maxTimeMS(timeout);\n }, `deleteIntent(${intentId})`);\n };\n\n public async listIntents(): Promise<Intent[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intents = await IntentModel.find()\n .maxTimeMS(timeout)\n .lean<Intent[]>();\n return intents;\n }, `listIntents()`);\n };\n}\n","import { ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const ThreadObjectSchema = new Schema(\n\t{\n\t\ttype: {\n\t\t\ttype: String,\n\t\t\tenum: Object.values(ThreadType),\n\t\t\trequired: true,\n\t\t},\n\t\tthreadId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t},\n\t\tcreated_at: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t},\n\t\tupdated_at: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t}\n\t},\n);\n\nexport interface ThreadDocument extends Document {\n\ttype: ThreadType;\n\tthreadId: string;\n\tuserId: string;\n\ttitle: string;\n\tcreated_at: number;\n\tupdated_at: number;\n}\n\nexport const ThreadModel = mongoose.model<ThreadDocument>(\"Thread\", ThreadObjectSchema);\n","import { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\n// MessageContentObject schema\nexport const MessageContentObjectSchema = new Schema(\n\t{\n\t\ttype: { type: String, required: true },\n\t\tparts: { type: [Schema.Types.Mixed], required: true },\n\t},\n\t{ _id: false },\n);\n\n// MessageObject schema - 개별 문서로 저장\nexport const MessageObjectSchema = new Schema(\n\t{\n\t\tmessageId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tthreadId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\trole: {\n\t\t\ttype: String,\n\t\t\tenum: Object.values(MessageRole),\n\t\t\trequired: true,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: MessageContentObjectSchema,\n\t\t\trequired: true,\n\t\t},\n\t\ttimestamp: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t},\n\t\tmetadata: {\n\t\t\ttype: Schema.Types.Mixed,\n\t\t\tdefault: {},\n\t\t},\n\t},\n);\n\n// Message Document interface\nexport interface MessageDocument extends Document {\n\tmessageId: string;\n\tthreadId: string;\n\tuserId: string;\n\trole: MessageRole;\n\tcontent: {\n\t\ttype: string;\n\t\tparts: any[];\n\t};\n\ttimestamp: number;\n\tmetadata?: { [key: string]: unknown };\n}\n\nexport const MessageModel = mongoose.model<MessageDocument>(\"Message\", MessageObjectSchema);","import type { MessageObject, ThreadMetadata, ThreadObject, ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { IThreadMemory } from \"@ainetwork/adk/modules\";\nimport { ThreadDocument, ThreadModel } from \"../models/threads.model\";\nimport { MessageDocument, MessageModel } from \"../models/messages.model\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBThread implements IThreadMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getThread(\n userId: string,\n threadId: string\n ): Promise<ThreadObject | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const thread = await ThreadModel.findOne({ threadId, userId }).maxTimeMS(timeout);\n const messages = await MessageModel.find({ threadId, userId })\n .sort({ timestamp: 1 })\n .maxTimeMS(timeout);\n\n if (!thread) return undefined;\n\n loggers.agent.debug(`Found ${messages.length} messages for thread ${threadId}`);\n\n const threadObject: ThreadObject = {\n threadId: thread.threadId,\n userId: thread.userId,\n type: thread.type as ThreadType,\n title: thread.title || \"New thread\",\n messages: []\n };\n messages.forEach((message: MessageDocument) => {\n threadObject.messages.push({\n messageId: message.messageId,\n role: message.role as MessageRole,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n });\n\n return threadObject;\n }, `getThread(${userId}, ${threadId})`);\n };\n\n public async createThread(\n type: ThreadType,\n userId: string,\n threadId: string,\n title: string,\n ): Promise<ThreadObject> {\n return this.executeWithRetry(async () => {\n const now = Date.now();\n await ThreadModel.create({\n type,\n userId,\n threadId,\n title,\n updated_at: now,\n created_at: now,\n });\n\n return { type, userId, threadId, title, messages: []};\n }, `createThread(${userId}, ${threadId})`);\n };\n\n public async addMessagesToThread(\n userId: string,\n threadId: string,\n messages: MessageObject[]\n ): Promise<void> {\n return this.executeWithRetry(async () => {\n await ThreadModel.updateOne({ threadId, userId }, {\n updated_at: Date.now(),\n });\n for (const message of messages) {\n await MessageModel.create({\n threadId,\n messageId: message.messageId,\n userId,\n role: message.role,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n }\n }, `addMessagesToThread(${userId}, ${threadId})`);\n };\n\n public async deleteThread(userId: string, threadId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n\n // Delete all messages for this thread\n await MessageModel.deleteMany({ userId, threadId }).maxTimeMS(timeout);\n\n // Delete the thread itself\n await ThreadModel.deleteOne({ userId, threadId }).maxTimeMS(timeout);\n }, `deleteThread(${userId}, ${threadId})`);\n };\n\n public async listThreads(userId: string): Promise<ThreadMetadata[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const threads = await ThreadModel.find({ userId })\n .sort({ updated_at: -1 })\n .maxTimeMS(timeout);\n const data: ThreadMetadata[] = threads.map((thread: ThreadDocument) => {\n return {\n type: thread.type,\n userId,\n threadId: thread.threadId,\n title: thread.title,\n updatedAt: thread.updated_at\n } as ThreadMetadata;\n })\n return data;\n }, `listThreads(${userId})`);\n };\n}\n","import { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const WorkflowObjectSchema = new Schema(\n\t{\n\t\tworkflowId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tunique: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tactive: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true,\n\t\t\tdefault: false,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\t{\n\t\ttimestamps: true,\n\t}\n);\n\nexport interface WorkflowDocument extends Document {\n\tworkflowId: string;\n\tuserId?: string;\n\ttitle: string;\n\tdescription: string;\n\tactive: boolean;\n\tcontent: string;\n}\n\nexport const WorkflowModel = mongoose.model<WorkflowDocument>(\"Workflow\", WorkflowObjectSchema);\n","import type { IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport type { Workflow } from \"@ainetwork/adk/types/memory\";\nimport { WorkflowModel } from \"../models/workflow.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBWorkflow implements IWorkflowMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async createWorkflow(workflow: Workflow): Promise<Workflow> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const created = await WorkflowModel.create(workflow);\n return created.toObject() as Workflow;\n }, \"createWorkflow()\");\n }\n\n public async getWorkflow(workflowId: string): Promise<Workflow | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const workflow = await WorkflowModel.findOne({\n workflowId\n }).maxTimeMS(timeout).lean<Workflow>();\n return workflow || undefined;\n }, \"getWorkflow()\");\n }\n\n public async updateWorkflow(workflowId: string, updates: Partial<Workflow>): Promise<void> {\n if (!updates.userId) {\n throw new Error(\"userId is required for updateWorkflow\");\n }\n\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId를 조건에 포함하여 소유자만 수정 가능하도록 함\n await WorkflowModel.updateOne(\n { workflowId, userId: updates.userId },\n { $set: updates }\n ).maxTimeMS(timeout);\n }, \"updateWorkflow()\");\n }\n\n public async deleteWorkflow(workflowId: string, userId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await WorkflowModel.deleteOne({ workflowId, userId }).maxTimeMS(timeout);\n }, \"deleteWorkflow()\");\n }\n\n public async listWorkflows(userId?: string): Promise<Workflow[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId가 있으면: 해당 유저 소유 + 템플릿(userId 없음)\n // userId가 없으면: 템플릿만 반환\n const query = userId\n ? { $or: [{ userId }, { userId: { $exists: false } }, { userId: null }] }\n : { $or: [{ userId: { $exists: false } }, { userId: null }] };\n const workflows = await WorkflowModel.find(query)\n .maxTimeMS(timeout)\n .lean<Workflow[]>();\n return workflows;\n }, \"listWorkflows()\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,IAAAA,oBAAqB;AACrB,IAAAC,iBAAwB;;;ACFxB,sBAAsC;AACtC,IAAAC,mBAAqB;AAEd,IAAM,oBAAoB,IAAI;AAAA,EACpC;AAAA,IACC,IAAI;AAAA,MACH,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAOO,IAAM,aAAa,iBAAAC,QAAS,MAAqB,SAAS,iBAAiB;;;ACN3E,IAAM,eAAN,MAA2C;AAAA,EACxC;AAAA,EACA;AAAA,EAER,YACE,kBACA,qBACA;AACA,SAAK,mBAAmB;AACxB,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,MAAa,iBAAkC;AAC7C,WAAO,KAAK,iBAAiB,YAAY;AACvC,YAAM,UAAU,KAAK,oBAAoB;AACzC,YAAM,WAAW,MAAM,WAAW,QAAQ;AAAA,QACxC,IAAI;AAAA,MACN,CAAC,EAAE,UAAU,OAAO,EACjB,KAAqB;AACxB,aAAO,UAAU,UAAU;AAAA,IAC7B,GAAG,kBAAkB;AAAA,EACvB;AAAA,EAEA,MAAa,kBAAkB,QAA+B;AAC5D,WAAO,KAAK,iBAAiB,YAAY;AACvC,YAAM,UAAU,KAAK,oBAAoB;AACzC,YAAM,WAAW,UAAU;AAAA,QACzB,IAAI;AAAA,MACN,GAAG,EAAE,UAAU,OAAO,GAAG,EAAE,QAAQ,KAAK,CAAC,EAAE,UAAU,OAAO;AAAA,IAC9D,GAAG,qBAAqB;AAAA,EAC1B;AAAA,EAEA,MAAa,qBAAsC;AACjD,WAAO,KAAK,iBAAiB,YAAY;AACvC,YAAM,UAAU,KAAK,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import_mongoose","import_logger","import_mongoose","mongoose","import_mongoose","mongoose","import_mongoose","mongoose","import_memory","import_mongoose","mongoose","import_mongoose","mongoose","mongoose"]}
|
package/dist/index.js
CHANGED
|
@@ -88,6 +88,24 @@ var MongoDBAgent = class {
|
|
|
88
88
|
return metadata?.prompt || "";
|
|
89
89
|
}, "getToolSelectPrompt()");
|
|
90
90
|
}
|
|
91
|
+
async getPIIDetectPrompt() {
|
|
92
|
+
return this.executeWithRetry(async () => {
|
|
93
|
+
const timeout = this.getOperationTimeout();
|
|
94
|
+
const metadata = await AgentModel.findOne({
|
|
95
|
+
id: "pii_detect_prompt"
|
|
96
|
+
}).maxTimeMS(timeout).lean();
|
|
97
|
+
return metadata?.prompt || "";
|
|
98
|
+
}, "getPIIDetectPrompt()");
|
|
99
|
+
}
|
|
100
|
+
async getPIIFilterPrompt() {
|
|
101
|
+
return this.executeWithRetry(async () => {
|
|
102
|
+
const timeout = this.getOperationTimeout();
|
|
103
|
+
const metadata = await AgentModel.findOne({
|
|
104
|
+
id: "pii_filter_prompt"
|
|
105
|
+
}).maxTimeMS(timeout).lean();
|
|
106
|
+
return metadata?.prompt || "";
|
|
107
|
+
}, "getPIIFilterPrompt()");
|
|
108
|
+
}
|
|
91
109
|
};
|
|
92
110
|
|
|
93
111
|
// implements/intent.memory.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../implements/base.memory.ts","../implements/agent.memory.ts","../implements/intent.memory.ts","../implements/thread.memory.ts","../implements/workflow.memory.ts"],"sourcesContent":["import { IAgentMemory, IIntentMemory, IMemory, IThreadMemory, IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport mongoose from \"mongoose\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\nimport { MongoDBAgent } from \"./agent.memory\";\nimport { MongoDBIntent } from \"./intent.memory\";\nimport { MongoDBThread } from \"./thread.memory\";\nimport { MongoDBWorkflow } from \"./workflow.memory\";\n\nexport interface MongoDBMemoryConfig {\n uri: string;\n maxReconnectAttempts?: number;\n reconnectInterval?: number;\n maxPoolSize?: number;\n serverSelectionTimeoutMS?: number;\n socketTimeoutMS?: number;\n connectTimeoutMS?: number;\n operationTimeoutMS?: number; // Timeout for database operations\n}\n\nexport class MongoDBMemory implements IMemory {\n private static instance: MongoDBMemory;\n private uri: string;\n private connected: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number;\n private reconnectInterval: number;\n private reconnecting: boolean = false;\n private connectionConfig: mongoose.ConnectOptions;\n private eventListenersSetup: boolean = false;\n private operationTimeoutMS: number;\n\n private agentMemory: MongoDBAgent;\n private intentMemory: MongoDBIntent;\n private threadMemory: MongoDBThread;\n private workflowMemory: MongoDBWorkflow;\n\n constructor(config: string | MongoDBMemoryConfig) {\n const cfg = typeof config === 'string' ? { uri: config } : config;\n\n this.uri = cfg.uri;\n this.maxReconnectAttempts = cfg.maxReconnectAttempts ?? 5;\n this.reconnectInterval = cfg.reconnectInterval ?? 5000;\n this.operationTimeoutMS = cfg.operationTimeoutMS ?? 10000; // Default 10 seconds\n this.connectionConfig = {\n maxPoolSize: cfg.maxPoolSize ?? 1,\n serverSelectionTimeoutMS: cfg.serverSelectionTimeoutMS ?? 30000,\n socketTimeoutMS: cfg.socketTimeoutMS ?? 45000,\n connectTimeoutMS: cfg.connectTimeoutMS ?? 30000,\n bufferCommands: false,\n };\n\n if (!MongoDBMemory.instance) {\n MongoDBMemory.instance = this;\n this.setupMongooseEventListeners();\n } else {\n // Use existing instance's connection state\n this.connected = MongoDBMemory.instance.connected;\n this.operationTimeoutMS = MongoDBMemory.instance.operationTimeoutMS;\n }\n\n\t\tthis.agentMemory = new MongoDBAgent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.threadMemory = new MongoDBThread(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.intentMemory = new MongoDBIntent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.workflowMemory = new MongoDBWorkflow(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n }\n\n public getAgentMemory(): IAgentMemory {\n return this.agentMemory;\n }\n\n public getThreadMemory(): IThreadMemory {\n return this.threadMemory;\n }\n\n public getIntentMemory(): IIntentMemory {\n return this.intentMemory;\n }\n\n public getWorkflowMemory(): IWorkflowMemory {\n return this.workflowMemory;\n }\n\n private setupMongooseEventListeners(): void {\n if (this.eventListenersSetup) return;\n\n this.eventListenersSetup = true;\n\n mongoose.connection.on(\"connected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB connected successfully\");\n });\n\n mongoose.connection.on(\"disconnected\", () => {\n this.connected = false;\n loggers.agent.warn(\"MongoDB disconnected\");\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"error\", (error) => {\n this.connected = false;\n loggers.agent.error(\"MongoDB connection error:\", error);\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"reconnected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnected successfully\");\n });\n }\n\n private async handleDisconnection(): Promise<void> {\n if (this.reconnecting) {\n return;\n }\n\n this.reconnecting = true;\n\n while (this.reconnectAttempts < this.maxReconnectAttempts && !this.isConnected) {\n this.reconnectAttempts++;\n loggers.agent.info(\n `Attempting to reconnect to MongoDB (${this.reconnectAttempts}/${this.maxReconnectAttempts})...`\n );\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnection successful\");\n return;\n } catch (error) {\n loggers.agent.error(\n `Reconnection attempt ${this.reconnectAttempts} failed:`,\n error\n );\n\n if (this.reconnectAttempts < this.maxReconnectAttempts) {\n await new Promise((resolve) =>\n setTimeout(resolve, this.reconnectInterval)\n );\n }\n }\n }\n\n this.reconnecting = false;\n\n if (!this.isConnected) {\n loggers.agent.error(\n `Failed to reconnect to MongoDB after ${this.maxReconnectAttempts} attempts`\n );\n }\n }\n\n public async connect(): Promise<void> {\n if (this.connected) {\n return;\n }\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n } catch (error) {\n loggers.agent.error(\"Failed to connect to MongoDB:\", error);\n throw error;\n }\n }\n\n public async disconnect(): Promise<void> {\n if (!this.isConnected) {\n return;\n }\n\n try {\n await mongoose.disconnect();\n this.connected = false;\n } catch (error) {\n loggers.agent.error(\"Failed to disconnect from MongoDB:\", error);\n throw error;\n }\n }\n\n public isConnected(): boolean {\n return this.connected;\n }\n\n private async ensureConnection(): Promise<void> {\n if (!this.isConnected && !this.reconnecting) {\n await this.connect();\n }\n\n // Wait for reconnection if in progress\n const maxWaitTime = 30000; // 30 seconds\n const startTime = Date.now();\n while (this.reconnecting && Date.now() - startTime < maxWaitTime) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n if (!this.isConnected) {\n throw new Error(\"MongoDB is not connected and reconnection failed\");\n }\n }\n\n /**\n * Get the operation timeout in milliseconds\n */\n protected getOperationTimeout(): number {\n return this.operationTimeoutMS;\n }\n\n /**\n * Execute a database operation with automatic retry on connection errors\n * Note: Use mongoose's maxTimeMS option in queries for timeout control\n */\n protected async executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string = \"Database operation\"\n ): Promise<T> {\n await this.ensureConnection();\n\n try {\n return await operation();\n } catch (error: any) {\n // Check if it's a timeout error from MongoDB\n if (error.code === 50 || error.message?.includes(\"operation exceeded time limit\")) {\n loggers.agent.error(`${operationName} exceeded time limit`);\n throw error;\n }\n\n // Check if it's a connection-related error\n if (\n error.name === \"MongoNetworkError\" ||\n error.name === \"MongoServerError\" ||\n error.message?.includes(\"connection\") ||\n error.message?.includes(\"disconnect\")\n ) {\n loggers.agent.warn(\n `${operationName} failed due to connection issue, attempting reconnection...`\n );\n\n await this.ensureConnection();\n\n // Retry the operation once after reconnection\n try {\n return await operation();\n } catch (retryError: any) {\n loggers.agent.error(`${operationName} failed after retry:`, retryError);\n throw retryError;\n }\n }\n\n // If it's not a connection error, just throw it\n throw error;\n }\n }\n}\n","import { IAgentMemory } from \"@ainetwork/adk/modules\";\nimport { AgentModel } from \"../models/agent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\ntype PromptDocument = {\n id: string;\n prompt: string;\n}\n\nexport class MongoDBAgent implements IAgentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getAgentPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"agent_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAgentPrompt()\");\n };\n \n public async updateAgentPrompt(prompt: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await AgentModel.updateOne({\n id: \"agent_prompt\",\n }, { \"prompt\": prompt }, { upsert: true }).maxTimeMS(timeout);\n }, \"updateAgentPrompt()\");\n };\n\n public async getAggregatePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"aggregate_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAggregatePrompt()\");\n };\n\n public async getGenerateTitlePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"generate_title_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getGenerateTitlePrompt()\");\n };\n\n public async getSingleTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"single_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getSingleTriggerPrompt()\");\n };\n\n public async getMultiTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"multi_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getMultiTriggerPrompt()\");\n };\n\n public async getToolSelectPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"tool_select_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getToolSelectPrompt()\");\n };\n}\n","import type { Intent } from \"@ainetwork/adk/types/memory\";\nimport { IIntentMemory } from \"@ainetwork/adk/modules\";\nimport { IntentModel } from \"../models/intent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBIntent implements IIntentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getIntent(intentId: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ id: intentId })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntent(${intentId})`);\n };\n\n public async getIntentByName(intentName: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ name: intentName })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntentByName(${intentName})`);\n }\n\n public async saveIntent(intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n await IntentModel.create(intent);\n }, `saveIntent(${intent.id})`);\n };\n\n public async updateIntent(intentId: string, intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.updateOne({\n id: intentId,\n }, intent).maxTimeMS(timeout);\n }, `updateIntent(${intentId})`);\n };\n\n public async deleteIntent(intentId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.deleteOne({ id: intentId }).maxTimeMS(timeout);\n }, `deleteIntent(${intentId})`);\n };\n\n public async listIntents(): Promise<Intent[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intents = await IntentModel.find()\n .maxTimeMS(timeout)\n .lean<Intent[]>();\n return intents;\n }, `listIntents()`);\n };\n}\n","import type { MessageObject, ThreadMetadata, ThreadObject, ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { IThreadMemory } from \"@ainetwork/adk/modules\";\nimport { ThreadDocument, ThreadModel } from \"../models/threads.model\";\nimport { MessageDocument, MessageModel } from \"../models/messages.model\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBThread implements IThreadMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getThread(\n userId: string,\n threadId: string\n ): Promise<ThreadObject | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const thread = await ThreadModel.findOne({ threadId, userId }).maxTimeMS(timeout);\n const messages = await MessageModel.find({ threadId, userId })\n .sort({ timestamp: 1 })\n .maxTimeMS(timeout);\n\n if (!thread) return undefined;\n\n loggers.agent.debug(`Found ${messages.length} messages for thread ${threadId}`);\n\n const threadObject: ThreadObject = {\n threadId: thread.threadId,\n userId: thread.userId,\n type: thread.type as ThreadType,\n title: thread.title || \"New thread\",\n messages: []\n };\n messages.forEach((message: MessageDocument) => {\n threadObject.messages.push({\n messageId: message.messageId,\n role: message.role as MessageRole,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n });\n\n return threadObject;\n }, `getThread(${userId}, ${threadId})`);\n };\n\n public async createThread(\n type: ThreadType,\n userId: string,\n threadId: string,\n title: string,\n ): Promise<ThreadObject> {\n return this.executeWithRetry(async () => {\n const now = Date.now();\n await ThreadModel.create({\n type,\n userId,\n threadId,\n title,\n updated_at: now,\n created_at: now,\n });\n\n return { type, userId, threadId, title, messages: []};\n }, `createThread(${userId}, ${threadId})`);\n };\n\n public async addMessagesToThread(\n userId: string,\n threadId: string,\n messages: MessageObject[]\n ): Promise<void> {\n return this.executeWithRetry(async () => {\n await ThreadModel.updateOne({ threadId, userId }, {\n updated_at: Date.now(),\n });\n for (const message of messages) {\n await MessageModel.create({\n threadId,\n messageId: message.messageId,\n userId,\n role: message.role,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n }\n }, `addMessagesToThread(${userId}, ${threadId})`);\n };\n\n public async deleteThread(userId: string, threadId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n\n // Delete all messages for this thread\n await MessageModel.deleteMany({ userId, threadId }).maxTimeMS(timeout);\n\n // Delete the thread itself\n await ThreadModel.deleteOne({ userId, threadId }).maxTimeMS(timeout);\n }, `deleteThread(${userId}, ${threadId})`);\n };\n\n public async listThreads(userId: string): Promise<ThreadMetadata[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const threads = await ThreadModel.find({ userId })\n .sort({ updated_at: -1 })\n .maxTimeMS(timeout);\n const data: ThreadMetadata[] = threads.map((thread: ThreadDocument) => {\n return {\n type: thread.type,\n userId,\n threadId: thread.threadId,\n title: thread.title,\n updatedAt: thread.updated_at\n } as ThreadMetadata;\n })\n return data;\n }, `listThreads(${userId})`);\n };\n}\n","import type { IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport type { Workflow } from \"@ainetwork/adk/types/memory\";\nimport { WorkflowModel } from \"../models/workflow.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBWorkflow implements IWorkflowMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async createWorkflow(workflow: Workflow): Promise<Workflow> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const created = await WorkflowModel.create(workflow);\n return created.toObject() as Workflow;\n }, \"createWorkflow()\");\n }\n\n public async getWorkflow(workflowId: string): Promise<Workflow | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const workflow = await WorkflowModel.findOne({\n workflowId\n }).maxTimeMS(timeout).lean<Workflow>();\n return workflow || undefined;\n }, \"getWorkflow()\");\n }\n\n public async updateWorkflow(workflowId: string, updates: Partial<Workflow>): Promise<void> {\n if (!updates.userId) {\n throw new Error(\"userId is required for updateWorkflow\");\n }\n\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId를 조건에 포함하여 소유자만 수정 가능하도록 함\n await WorkflowModel.updateOne(\n { workflowId, userId: updates.userId },\n { $set: updates }\n ).maxTimeMS(timeout);\n }, \"updateWorkflow()\");\n }\n\n public async deleteWorkflow(workflowId: string, userId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await WorkflowModel.deleteOne({ workflowId, userId }).maxTimeMS(timeout);\n }, \"deleteWorkflow()\");\n }\n\n public async listWorkflows(userId?: string): Promise<Workflow[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId가 있으면: 해당 유저 소유 + 템플릿(userId 없음)\n // userId가 없으면: 템플릿만 반환\n const query = userId\n ? { $or: [{ userId }, { userId: { $exists: false } }, { userId: null }] }\n : { $or: [{ userId: { $exists: false } }, { userId: null }] };\n const workflows = await WorkflowModel.find(query)\n .maxTimeMS(timeout)\n .lean<Workflow[]>();\n return workflows;\n }, \"listWorkflows()\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAO,cAAc;AACrB,SAAS,WAAAA,gBAAe;;;ACajB,IAAM,eAAN,MAA2C;AAAA,EACxC;AAAA,EACA;AAAA,EAER,YACE,kBACA,qBACA;AACA,SAAK,mBAAmB;AACxB,SAAK,sBAAsB;AAAA,EAC7B;AAAA,EAEA,MAAa,iBAAkC;AAC7C,WAAO,KAAK,iBAAiB,YAAY;AACvC,YAAM,UAAU,KAAK,oBAAoB;AACzC,YAAM,WAAW,MAAM,WAAW,QAAQ;AAAA,QACxC,IAAI;AAAA,MACN,CAAC,EAAE,UAAU,OAAO,EACjB,KAAqB;AACxB,aAAO,UAAU,UAAU;AAAA,IAC7B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AAI,MAAM,kDAAkD;AAAA,IACpE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKU,sBAA8B;AACtC,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAgB,iBACd,WACA,gBAAwB,sBACZ;AACZ,UAAM,KAAK,iBAAiB;AAE5B,QAAI;AACF,aAAO,MAAM,UAAU;AAAA,IACzB,SAAS,OAAY;AAEnB,UAAI,MAAM,SAAS,MAAM,MAAM,SAAS,SAAS,+BAA+B,GAAG;AACjF,QAAAA,SAAQ,MAAM,MAAM,GAAG,aAAa,sBAAsB;AAC1D,cAAM;AAAA,MACR;AAGA,UACE,MAAM,SAAS,uBACf,MAAM,SAAS,sBACf,MAAM,SAAS,SAAS,YAAY,KACpC,MAAM,SAAS,SAAS,YAAY,GACpC;AACA,QAAAA,SAAQ,MAAM;AAAA,UACZ,GAAG,aAAa;AAAA,QAClB;AAEA,cAAM,KAAK,iBAAiB;AAG5B,YAAI;AACF,iBAAO,MAAM,UAAU;AAAA,QACzB,SAAS,YAAiB;AACxB,UAAAA,SAAQ,MAAM,MAAM,GAAG,aAAa,wBAAwB,UAAU;AACtE,gBAAM;AAAA,QACR;AAAA,MACF;AAGA,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":["loggers","loggers"]}
|
|
1
|
+
{"version":3,"sources":["../implements/base.memory.ts","../implements/agent.memory.ts","../implements/intent.memory.ts","../implements/thread.memory.ts","../implements/workflow.memory.ts"],"sourcesContent":["import { IAgentMemory, IIntentMemory, IMemory, IThreadMemory, IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport mongoose from \"mongoose\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\nimport { MongoDBAgent } from \"./agent.memory\";\nimport { MongoDBIntent } from \"./intent.memory\";\nimport { MongoDBThread } from \"./thread.memory\";\nimport { MongoDBWorkflow } from \"./workflow.memory\";\n\nexport interface MongoDBMemoryConfig {\n uri: string;\n maxReconnectAttempts?: number;\n reconnectInterval?: number;\n maxPoolSize?: number;\n serverSelectionTimeoutMS?: number;\n socketTimeoutMS?: number;\n connectTimeoutMS?: number;\n operationTimeoutMS?: number; // Timeout for database operations\n}\n\nexport class MongoDBMemory implements IMemory {\n private static instance: MongoDBMemory;\n private uri: string;\n private connected: boolean = false;\n private reconnectAttempts: number = 0;\n private maxReconnectAttempts: number;\n private reconnectInterval: number;\n private reconnecting: boolean = false;\n private connectionConfig: mongoose.ConnectOptions;\n private eventListenersSetup: boolean = false;\n private operationTimeoutMS: number;\n\n private agentMemory: MongoDBAgent;\n private intentMemory: MongoDBIntent;\n private threadMemory: MongoDBThread;\n private workflowMemory: MongoDBWorkflow;\n\n constructor(config: string | MongoDBMemoryConfig) {\n const cfg = typeof config === 'string' ? { uri: config } : config;\n\n this.uri = cfg.uri;\n this.maxReconnectAttempts = cfg.maxReconnectAttempts ?? 5;\n this.reconnectInterval = cfg.reconnectInterval ?? 5000;\n this.operationTimeoutMS = cfg.operationTimeoutMS ?? 10000; // Default 10 seconds\n this.connectionConfig = {\n maxPoolSize: cfg.maxPoolSize ?? 1,\n serverSelectionTimeoutMS: cfg.serverSelectionTimeoutMS ?? 30000,\n socketTimeoutMS: cfg.socketTimeoutMS ?? 45000,\n connectTimeoutMS: cfg.connectTimeoutMS ?? 30000,\n bufferCommands: false,\n };\n\n if (!MongoDBMemory.instance) {\n MongoDBMemory.instance = this;\n this.setupMongooseEventListeners();\n } else {\n // Use existing instance's connection state\n this.connected = MongoDBMemory.instance.connected;\n this.operationTimeoutMS = MongoDBMemory.instance.operationTimeoutMS;\n }\n\n\t\tthis.agentMemory = new MongoDBAgent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.threadMemory = new MongoDBThread(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.intentMemory = new MongoDBIntent(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n\n\t\tthis.workflowMemory = new MongoDBWorkflow(\n\t\t\tthis.executeWithRetry.bind(this),\n\t\t\tthis.getOperationTimeout.bind(this)\n\t\t);\n }\n\n public getAgentMemory(): IAgentMemory {\n return this.agentMemory;\n }\n\n public getThreadMemory(): IThreadMemory {\n return this.threadMemory;\n }\n\n public getIntentMemory(): IIntentMemory {\n return this.intentMemory;\n }\n\n public getWorkflowMemory(): IWorkflowMemory {\n return this.workflowMemory;\n }\n\n private setupMongooseEventListeners(): void {\n if (this.eventListenersSetup) return;\n\n this.eventListenersSetup = true;\n\n mongoose.connection.on(\"connected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB connected successfully\");\n });\n\n mongoose.connection.on(\"disconnected\", () => {\n this.connected = false;\n loggers.agent.warn(\"MongoDB disconnected\");\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"error\", (error) => {\n this.connected = false;\n loggers.agent.error(\"MongoDB connection error:\", error);\n this.handleDisconnection();\n });\n\n mongoose.connection.on(\"reconnected\", () => {\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnected successfully\");\n });\n }\n\n private async handleDisconnection(): Promise<void> {\n if (this.reconnecting) {\n return;\n }\n\n this.reconnecting = true;\n\n while (this.reconnectAttempts < this.maxReconnectAttempts && !this.isConnected) {\n this.reconnectAttempts++;\n loggers.agent.info(\n `Attempting to reconnect to MongoDB (${this.reconnectAttempts}/${this.maxReconnectAttempts})...`\n );\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n this.reconnecting = false;\n loggers.agent.info(\"MongoDB reconnection successful\");\n return;\n } catch (error) {\n loggers.agent.error(\n `Reconnection attempt ${this.reconnectAttempts} failed:`,\n error\n );\n\n if (this.reconnectAttempts < this.maxReconnectAttempts) {\n await new Promise((resolve) =>\n setTimeout(resolve, this.reconnectInterval)\n );\n }\n }\n }\n\n this.reconnecting = false;\n\n if (!this.isConnected) {\n loggers.agent.error(\n `Failed to reconnect to MongoDB after ${this.maxReconnectAttempts} attempts`\n );\n }\n }\n\n public async connect(): Promise<void> {\n if (this.connected) {\n return;\n }\n\n try {\n await mongoose.connect(this.uri, this.connectionConfig);\n this.connected = true;\n this.reconnectAttempts = 0;\n } catch (error) {\n loggers.agent.error(\"Failed to connect to MongoDB:\", error);\n throw error;\n }\n }\n\n public async disconnect(): Promise<void> {\n if (!this.isConnected) {\n return;\n }\n\n try {\n await mongoose.disconnect();\n this.connected = false;\n } catch (error) {\n loggers.agent.error(\"Failed to disconnect from MongoDB:\", error);\n throw error;\n }\n }\n\n public isConnected(): boolean {\n return this.connected;\n }\n\n private async ensureConnection(): Promise<void> {\n if (!this.isConnected && !this.reconnecting) {\n await this.connect();\n }\n\n // Wait for reconnection if in progress\n const maxWaitTime = 30000; // 30 seconds\n const startTime = Date.now();\n while (this.reconnecting && Date.now() - startTime < maxWaitTime) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n if (!this.isConnected) {\n throw new Error(\"MongoDB is not connected and reconnection failed\");\n }\n }\n\n /**\n * Get the operation timeout in milliseconds\n */\n protected getOperationTimeout(): number {\n return this.operationTimeoutMS;\n }\n\n /**\n * Execute a database operation with automatic retry on connection errors\n * Note: Use mongoose's maxTimeMS option in queries for timeout control\n */\n protected async executeWithRetry<T>(\n operation: () => Promise<T>,\n operationName: string = \"Database operation\"\n ): Promise<T> {\n await this.ensureConnection();\n\n try {\n return await operation();\n } catch (error: any) {\n // Check if it's a timeout error from MongoDB\n if (error.code === 50 || error.message?.includes(\"operation exceeded time limit\")) {\n loggers.agent.error(`${operationName} exceeded time limit`);\n throw error;\n }\n\n // Check if it's a connection-related error\n if (\n error.name === \"MongoNetworkError\" ||\n error.name === \"MongoServerError\" ||\n error.message?.includes(\"connection\") ||\n error.message?.includes(\"disconnect\")\n ) {\n loggers.agent.warn(\n `${operationName} failed due to connection issue, attempting reconnection...`\n );\n\n await this.ensureConnection();\n\n // Retry the operation once after reconnection\n try {\n return await operation();\n } catch (retryError: any) {\n loggers.agent.error(`${operationName} failed after retry:`, retryError);\n throw retryError;\n }\n }\n\n // If it's not a connection error, just throw it\n throw error;\n }\n }\n}\n","import { IAgentMemory } from \"@ainetwork/adk/modules\";\nimport { AgentModel } from \"../models/agent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\ntype PromptDocument = {\n id: string;\n prompt: string;\n}\n\nexport class MongoDBAgent implements IAgentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getAgentPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"agent_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAgentPrompt()\");\n };\n \n public async updateAgentPrompt(prompt: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await AgentModel.updateOne({\n id: \"agent_prompt\",\n }, { \"prompt\": prompt }, { upsert: true }).maxTimeMS(timeout);\n }, \"updateAgentPrompt()\");\n };\n\n public async getAggregatePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"aggregate_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getAggregatePrompt()\");\n };\n\n public async getGenerateTitlePrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"generate_title_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getGenerateTitlePrompt()\");\n };\n\n public async getSingleTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"single_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getSingleTriggerPrompt()\");\n };\n\n public async getMultiTriggerPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"multi_trigger_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getMultiTriggerPrompt()\");\n };\n\n public async getToolSelectPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"tool_select_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getToolSelectPrompt()\");\n };\n\n public async getPIIDetectPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"pii_detect_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getPIIDetectPrompt()\");\n };\n\n public async getPIIFilterPrompt(): Promise<string> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const metadata = await AgentModel.findOne({\n id: \"pii_filter_prompt\"\n }).maxTimeMS(timeout)\n .lean<PromptDocument>();\n return metadata?.prompt || \"\";\n }, \"getPIIFilterPrompt()\");\n };\n}\n","import type { Intent } from \"@ainetwork/adk/types/memory\";\nimport { IIntentMemory } from \"@ainetwork/adk/modules\";\nimport { IntentModel } from \"../models/intent.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBIntent implements IIntentMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getIntent(intentId: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ id: intentId })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntent(${intentId})`);\n };\n\n public async getIntentByName(intentName: string): Promise<Intent | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intent = await IntentModel.findOne({ name: intentName })\n .maxTimeMS(timeout)\n .lean<Intent>();\n return intent || undefined;\n }, `getIntentByName(${intentName})`);\n }\n\n public async saveIntent(intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n await IntentModel.create(intent);\n }, `saveIntent(${intent.id})`);\n };\n\n public async updateIntent(intentId: string, intent: Intent): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.updateOne({\n id: intentId,\n }, intent).maxTimeMS(timeout);\n }, `updateIntent(${intentId})`);\n };\n\n public async deleteIntent(intentId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await IntentModel.deleteOne({ id: intentId }).maxTimeMS(timeout);\n }, `deleteIntent(${intentId})`);\n };\n\n public async listIntents(): Promise<Intent[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const intents = await IntentModel.find()\n .maxTimeMS(timeout)\n .lean<Intent[]>();\n return intents;\n }, `listIntents()`);\n };\n}\n","import type { MessageObject, ThreadMetadata, ThreadObject, ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { IThreadMemory } from \"@ainetwork/adk/modules\";\nimport { ThreadDocument, ThreadModel } from \"../models/threads.model\";\nimport { MessageDocument, MessageModel } from \"../models/messages.model\";\nimport { loggers } from \"@ainetwork/adk/utils/logger\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBThread implements IThreadMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async getThread(\n userId: string,\n threadId: string\n ): Promise<ThreadObject | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const thread = await ThreadModel.findOne({ threadId, userId }).maxTimeMS(timeout);\n const messages = await MessageModel.find({ threadId, userId })\n .sort({ timestamp: 1 })\n .maxTimeMS(timeout);\n\n if (!thread) return undefined;\n\n loggers.agent.debug(`Found ${messages.length} messages for thread ${threadId}`);\n\n const threadObject: ThreadObject = {\n threadId: thread.threadId,\n userId: thread.userId,\n type: thread.type as ThreadType,\n title: thread.title || \"New thread\",\n messages: []\n };\n messages.forEach((message: MessageDocument) => {\n threadObject.messages.push({\n messageId: message.messageId,\n role: message.role as MessageRole,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n });\n\n return threadObject;\n }, `getThread(${userId}, ${threadId})`);\n };\n\n public async createThread(\n type: ThreadType,\n userId: string,\n threadId: string,\n title: string,\n ): Promise<ThreadObject> {\n return this.executeWithRetry(async () => {\n const now = Date.now();\n await ThreadModel.create({\n type,\n userId,\n threadId,\n title,\n updated_at: now,\n created_at: now,\n });\n\n return { type, userId, threadId, title, messages: []};\n }, `createThread(${userId}, ${threadId})`);\n };\n\n public async addMessagesToThread(\n userId: string,\n threadId: string,\n messages: MessageObject[]\n ): Promise<void> {\n return this.executeWithRetry(async () => {\n await ThreadModel.updateOne({ threadId, userId }, {\n updated_at: Date.now(),\n });\n for (const message of messages) {\n await MessageModel.create({\n threadId,\n messageId: message.messageId,\n userId,\n role: message.role,\n content: message.content,\n timestamp: message.timestamp,\n metadata: message.metadata,\n });\n }\n }, `addMessagesToThread(${userId}, ${threadId})`);\n };\n\n public async deleteThread(userId: string, threadId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n\n // Delete all messages for this thread\n await MessageModel.deleteMany({ userId, threadId }).maxTimeMS(timeout);\n\n // Delete the thread itself\n await ThreadModel.deleteOne({ userId, threadId }).maxTimeMS(timeout);\n }, `deleteThread(${userId}, ${threadId})`);\n };\n\n public async listThreads(userId: string): Promise<ThreadMetadata[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const threads = await ThreadModel.find({ userId })\n .sort({ updated_at: -1 })\n .maxTimeMS(timeout);\n const data: ThreadMetadata[] = threads.map((thread: ThreadDocument) => {\n return {\n type: thread.type,\n userId,\n threadId: thread.threadId,\n title: thread.title,\n updatedAt: thread.updated_at\n } as ThreadMetadata;\n })\n return data;\n }, `listThreads(${userId})`);\n };\n}\n","import type { IWorkflowMemory } from \"@ainetwork/adk/modules\";\nimport type { Workflow } from \"@ainetwork/adk/types/memory\";\nimport { WorkflowModel } from \"../models/workflow.model\";\n\nexport type ExecuteWithRetryFn = <T>(\n operation: () => Promise<T>,\n operationName?: string\n) => Promise<T>;\n\nexport type GetOperationTimeoutFn = () => number;\n\nexport class MongoDBWorkflow implements IWorkflowMemory {\n private executeWithRetry: ExecuteWithRetryFn;\n private getOperationTimeout: GetOperationTimeoutFn;\n\n constructor(\n executeWithRetry: ExecuteWithRetryFn,\n getOperationTimeout: GetOperationTimeoutFn\n ) {\n this.executeWithRetry = executeWithRetry;\n this.getOperationTimeout = getOperationTimeout;\n }\n\n public async createWorkflow(workflow: Workflow): Promise<Workflow> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const created = await WorkflowModel.create(workflow);\n return created.toObject() as Workflow;\n }, \"createWorkflow()\");\n }\n\n public async getWorkflow(workflowId: string): Promise<Workflow | undefined> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n const workflow = await WorkflowModel.findOne({\n workflowId\n }).maxTimeMS(timeout).lean<Workflow>();\n return workflow || undefined;\n }, \"getWorkflow()\");\n }\n\n public async updateWorkflow(workflowId: string, updates: Partial<Workflow>): Promise<void> {\n if (!updates.userId) {\n throw new Error(\"userId is required for updateWorkflow\");\n }\n\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId를 조건에 포함하여 소유자만 수정 가능하도록 함\n await WorkflowModel.updateOne(\n { workflowId, userId: updates.userId },\n { $set: updates }\n ).maxTimeMS(timeout);\n }, \"updateWorkflow()\");\n }\n\n public async deleteWorkflow(workflowId: string, userId: string): Promise<void> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n await WorkflowModel.deleteOne({ workflowId, userId }).maxTimeMS(timeout);\n }, \"deleteWorkflow()\");\n }\n\n public async listWorkflows(userId?: string): Promise<Workflow[]> {\n return this.executeWithRetry(async () => {\n const timeout = this.getOperationTimeout();\n // userId가 있으면: 해당 유저 소유 + 템플릿(userId 없음)\n // userId가 없으면: 템플릿만 반환\n const query = userId\n ? { $or: [{ userId }, { userId: { $exists: false } }, { userId: null }] }\n : { $or: [{ userId: { $exists: false } }, { userId: null }] };\n const workflows = await WorkflowModel.find(query)\n .maxTimeMS(timeout)\n .lean<Workflow[]>();\n return workflows;\n }, \"listWorkflows()\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,OAAO,cAAc;AACrB,SAAS,WAAAA,gBAAe;;;ACajB,IA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,GAAG,aAAa,sBAAsB;AAC1D,cAAM;AAAA,MACR;AAGA,UACE,MAAM,SAAS,uBACf,MAAM,SAAS,sBACf,MAAM,SAAS,SAAS,YAAY,KACpC,MAAM,SAAS,SAAS,YAAY,GACpC;AACA,QAAAA,SAAQ,MAAM;AAAA,UACZ,GAAG,aAAa;AAAA,QAClB;AAEA,cAAM,KAAK,iBAAiB;AAG5B,YAAI;AACF,iBAAO,MAAM,UAAU;AAAA,QACzB,SAAS,YAAiB;AACxB,UAAAA,SAAQ,MAAM,MAAM,GAAG,aAAa,wBAAwB,UAAU;AACtE,gBAAM;AAAA,QACR;AAAA,MACF;AAGA,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":["loggers","loggers"]}
|
|
@@ -99,4 +99,26 @@ export class MongoDBAgent implements IAgentMemory {
|
|
|
99
99
|
return metadata?.prompt || "";
|
|
100
100
|
}, "getToolSelectPrompt()");
|
|
101
101
|
};
|
|
102
|
+
|
|
103
|
+
public async getPIIDetectPrompt(): Promise<string> {
|
|
104
|
+
return this.executeWithRetry(async () => {
|
|
105
|
+
const timeout = this.getOperationTimeout();
|
|
106
|
+
const metadata = await AgentModel.findOne({
|
|
107
|
+
id: "pii_detect_prompt"
|
|
108
|
+
}).maxTimeMS(timeout)
|
|
109
|
+
.lean<PromptDocument>();
|
|
110
|
+
return metadata?.prompt || "";
|
|
111
|
+
}, "getPIIDetectPrompt()");
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
public async getPIIFilterPrompt(): Promise<string> {
|
|
115
|
+
return this.executeWithRetry(async () => {
|
|
116
|
+
const timeout = this.getOperationTimeout();
|
|
117
|
+
const metadata = await AgentModel.findOne({
|
|
118
|
+
id: "pii_filter_prompt"
|
|
119
|
+
}).maxTimeMS(timeout)
|
|
120
|
+
.lean<PromptDocument>();
|
|
121
|
+
return metadata?.prompt || "";
|
|
122
|
+
}, "getPIIFilterPrompt()");
|
|
123
|
+
};
|
|
102
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainetwork/adk-provider-memory-mongodb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"author": "AI Network (https://ainetwork.ai)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean": "rm -rf dist"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ainetwork/adk": "^0.
|
|
31
|
+
"@ainetwork/adk": "^0.4.0",
|
|
32
32
|
"mongoose": "^8.16.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "36d311adf911c3539166e08bc2e6b7e240e8615c"
|
|
42
42
|
}
|