@agenticmail/enterprise 0.5.95 → 0.5.97
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/chunk-CDBIJ42S.js +898 -0
- package/dist/chunk-CWAFR2JH.js +2191 -0
- package/dist/chunk-F7HD443H.js +898 -0
- package/dist/chunk-FJPRGEUN.js +16106 -0
- package/dist/chunk-NWL4TLF4.js +2194 -0
- package/dist/chunk-QC2XKXAY.js +2391 -0
- package/dist/cli.js +1 -1
- package/dist/db-adapter-65QMSGCB.js +7 -0
- package/dist/index.js +4 -4
- package/dist/runtime-IEUW4STA.js +49 -0
- package/dist/server-4DJAKGYA.js +12 -0
- package/dist/server-UHM4CFFF.js +12 -0
- package/dist/setup-CRY7S2BG.js +20 -0
- package/dist/setup-QLGEBVYU.js +20 -0
- package/package.json +1 -1
- package/src/agent-tools/index.ts +20 -2
- package/src/agent-tools/tools/memory.ts +377 -91
- package/src/engine/db-adapter.ts +1 -1
- package/src/runtime/index.ts +31 -5
- package/src/runtime/types.ts +2 -0
- package/src/server.ts +4 -1
package/src/runtime/index.ts
CHANGED
|
@@ -137,6 +137,8 @@ export class AgentRuntime {
|
|
|
137
137
|
agentId,
|
|
138
138
|
workspaceDir: process.cwd(),
|
|
139
139
|
agenticmailManager: this.config.agenticmailManager,
|
|
140
|
+
agentMemoryManager: this.config.agentMemoryManager,
|
|
141
|
+
orgId: 'default', // TODO: resolve from agent's org
|
|
140
142
|
};
|
|
141
143
|
if (this.config.getEmailConfig) {
|
|
142
144
|
const ec = this.config.getEmailConfig(agentId);
|
|
@@ -258,7 +260,12 @@ export class AgentRuntime {
|
|
|
258
260
|
// Build agent config
|
|
259
261
|
var tools = opts.tools || await createAllTools(this.buildToolOptions(agentId));
|
|
260
262
|
|
|
261
|
-
|
|
263
|
+
// Inject persistent memory context into system prompt
|
|
264
|
+
var memoryContext = '';
|
|
265
|
+
if (this.config.agentMemoryManager) {
|
|
266
|
+
try { memoryContext = await this.config.agentMemoryManager.generateMemoryContext(agentId); } catch {}
|
|
267
|
+
}
|
|
268
|
+
var systemPrompt = opts.systemPrompt || buildDefaultSystemPrompt(agentId, memoryContext);
|
|
262
269
|
|
|
263
270
|
var agentConfig: AgentConfig = {
|
|
264
271
|
agentId,
|
|
@@ -300,11 +307,16 @@ export class AgentRuntime {
|
|
|
300
307
|
|
|
301
308
|
var tools = await createAllTools(this.buildToolOptions(session.agentId));
|
|
302
309
|
|
|
310
|
+
var memoryContext = '';
|
|
311
|
+
if (this.config.agentMemoryManager) {
|
|
312
|
+
try { memoryContext = await this.config.agentMemoryManager.generateMemoryContext(session.agentId); } catch {}
|
|
313
|
+
}
|
|
314
|
+
|
|
303
315
|
var agentConfig: AgentConfig = {
|
|
304
316
|
agentId: session.agentId,
|
|
305
317
|
orgId: session.orgId,
|
|
306
318
|
model,
|
|
307
|
-
systemPrompt: buildDefaultSystemPrompt(session.agentId),
|
|
319
|
+
systemPrompt: buildDefaultSystemPrompt(session.agentId, memoryContext),
|
|
308
320
|
tools,
|
|
309
321
|
};
|
|
310
322
|
|
|
@@ -591,11 +603,16 @@ export class AgentRuntime {
|
|
|
591
603
|
|
|
592
604
|
var tools = await createAllTools(this.buildToolOptions(session.agentId));
|
|
593
605
|
|
|
606
|
+
var mc = '';
|
|
607
|
+
if (this.config.agentMemoryManager) {
|
|
608
|
+
try { mc = await this.config.agentMemoryManager.generateMemoryContext(session.agentId); } catch {}
|
|
609
|
+
}
|
|
610
|
+
|
|
594
611
|
var agentConfig: AgentConfig = {
|
|
595
612
|
agentId: session.agentId,
|
|
596
613
|
orgId: session.orgId,
|
|
597
614
|
model,
|
|
598
|
-
systemPrompt: buildDefaultSystemPrompt(session.agentId),
|
|
615
|
+
systemPrompt: buildDefaultSystemPrompt(session.agentId, mc),
|
|
599
616
|
tools,
|
|
600
617
|
};
|
|
601
618
|
|
|
@@ -678,8 +695,8 @@ export function createAgentRuntime(config: RuntimeConfig): AgentRuntime {
|
|
|
678
695
|
|
|
679
696
|
// ─── Default System Prompt ───────────────────────────────
|
|
680
697
|
|
|
681
|
-
function buildDefaultSystemPrompt(agentId: string): string {
|
|
682
|
-
|
|
698
|
+
function buildDefaultSystemPrompt(agentId: string, memoryContext?: string): string {
|
|
699
|
+
var base = `You are an AI agent managed by AgenticMail Enterprise (agent: ${agentId}).
|
|
683
700
|
|
|
684
701
|
You have access to a comprehensive set of tools for completing tasks. Use them effectively.
|
|
685
702
|
|
|
@@ -691,6 +708,15 @@ Guidelines:
|
|
|
691
708
|
- Respect organization policies and permissions
|
|
692
709
|
- Keep responses concise unless detail is requested
|
|
693
710
|
- For long tasks, work systematically and report progress
|
|
711
|
+
- ACTIVELY USE YOUR MEMORY: After corrections, lessons, or insights, call memory_reflect to record them
|
|
712
|
+
- Before complex tasks, call memory_context to recall relevant knowledge
|
|
713
|
+
- Your memory persists across conversations — it's how you grow as an expert
|
|
694
714
|
|
|
695
715
|
Current time: ${new Date().toISOString()}`;
|
|
716
|
+
|
|
717
|
+
if (memoryContext) {
|
|
718
|
+
base += '\n\n' + memoryContext;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
return base;
|
|
696
722
|
}
|
package/src/runtime/types.ts
CHANGED
|
@@ -118,6 +118,8 @@ export interface RuntimeConfig {
|
|
|
118
118
|
gatewayEnabled?: boolean;
|
|
119
119
|
/** AgenticMail manager for org email access (optional — enables agenticmail_* tools) */
|
|
120
120
|
agenticmailManager?: import('../agent-tools/tools/agenticmail.js').AgenticMailManagerRef;
|
|
121
|
+
/** Agent memory manager for persistent DB-backed memory (optional — enables enhanced memory tools) */
|
|
122
|
+
agentMemoryManager?: import('../engine/agent-memory.js').AgentMemoryManager;
|
|
121
123
|
/** Get OAuth email config for an agent (enables Google/Microsoft Workspace tools) */
|
|
122
124
|
getEmailConfig?: (agentId: string) => any;
|
|
123
125
|
/** Callback to persist refreshed OAuth tokens */
|
package/src/server.ts
CHANGED
|
@@ -268,8 +268,10 @@ export function createServer(config: ServerConfig): ServerInstance {
|
|
|
268
268
|
// Import lifecycle for email config access
|
|
269
269
|
let getEmailConfig: ((agentId: string) => any) | undefined;
|
|
270
270
|
let onTokenRefresh: ((agentId: string, tokens: any) => void) | undefined;
|
|
271
|
+
let agentMemoryMgr: any;
|
|
271
272
|
try {
|
|
272
|
-
const { lifecycle: lc } = await import('./engine/routes.js');
|
|
273
|
+
const { lifecycle: lc, memoryManager: mm } = await import('./engine/routes.js');
|
|
274
|
+
agentMemoryMgr = mm;
|
|
273
275
|
if (lc) {
|
|
274
276
|
getEmailConfig = (agentId: string) => {
|
|
275
277
|
const managed = lc.getAgent(agentId);
|
|
@@ -294,6 +296,7 @@ export function createServer(config: ServerConfig): ServerInstance {
|
|
|
294
296
|
gatewayEnabled: true,
|
|
295
297
|
getEmailConfig,
|
|
296
298
|
onTokenRefresh,
|
|
299
|
+
agentMemoryManager: agentMemoryMgr,
|
|
297
300
|
});
|
|
298
301
|
await runtime.start();
|
|
299
302
|
const runtimeApp = runtime.getApp();
|