@agentmemory/agentmemory 0.9.31 → 0.9.32
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/.env.example +18 -15
- package/AGENTS.md +4 -4
- package/README.md +92 -270
- package/dist/.env.example +18 -15
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +530 -75
- package/dist/cli.mjs.map +1 -1
- package/dist/{compression-recovery-CnhLQC6N.mjs → compression-recovery-CZh63Jmz.mjs} +174 -89
- package/dist/compression-recovery-CZh63Jmz.mjs.map +1 -0
- package/dist/{connect-BSLIAMpw.mjs → connect-BX3njQ3Y.mjs} +28 -14
- package/dist/connect-BX3njQ3Y.mjs.map +1 -0
- package/dist/hooks/_capture.d.mts +3 -2
- package/dist/hooks/_capture.d.mts.map +1 -1
- package/dist/hooks/_capture.mjs +87 -8
- package/dist/hooks/_capture.mjs.map +1 -1
- package/dist/hooks/post-commit.mjs +58 -5
- package/dist/hooks/post-commit.mjs.map +1 -1
- package/dist/hooks/post-tool-failure.mjs +7 -2
- package/dist/hooks/post-tool-failure.mjs.map +1 -1
- package/dist/hooks/post-tool-use.mjs +7 -2
- package/dist/hooks/post-tool-use.mjs.map +1 -1
- package/dist/hooks/pre-compact.mjs +67 -12
- package/dist/hooks/pre-compact.mjs.map +1 -1
- package/dist/hooks/pre-tool-use.mjs +58 -5
- package/dist/hooks/pre-tool-use.mjs.map +1 -1
- package/dist/hooks/session-end.mjs +14 -3
- package/dist/hooks/session-end.mjs.map +1 -1
- package/dist/hooks/session-start.mjs +58 -5
- package/dist/hooks/session-start.mjs.map +1 -1
- package/dist/hooks/stop.mjs +2 -1
- package/dist/hooks/stop.mjs.map +1 -1
- package/dist/hooks/subagent-stop.mjs +15 -5
- package/dist/hooks/subagent-stop.mjs.map +1 -1
- package/dist/hooks/task-completed.mjs +8 -1
- package/dist/hooks/task-completed.mjs.map +1 -1
- package/dist/index.mjs +724 -200
- package/dist/index.mjs.map +1 -1
- package/dist/integrations/dsh.mjs +31 -4
- package/dist/integrations/dsh.mjs.map +1 -1
- package/dist/{secret-store-D9GwO0xp.mjs → secret-store-iYXRcrO8.mjs} +197 -55
- package/dist/secret-store-iYXRcrO8.mjs.map +1 -0
- package/dist/{src-DaMtDzt_.mjs → src-C23nMpda.mjs} +359 -62
- package/dist/src-C23nMpda.mjs.map +1 -0
- package/dist/{standalone-BlqshyZ5.mjs → standalone-BYo5USDb.mjs} +169 -10
- package/dist/standalone-BYo5USDb.mjs.map +1 -0
- package/dist/standalone.d.mts.map +1 -1
- package/dist/standalone.mjs +240 -10
- package/dist/standalone.mjs.map +1 -1
- package/dist/viewer/index.html +49 -28
- package/integrations/hermes/README.md +11 -1
- package/integrations/hermes/__init__.py +1 -0
- package/integrations/hermes/plugin.yaml +1 -1
- package/integrations/omp/dist/index.mjs +31 -4
- package/integrations/omp/package.json +1 -1
- package/integrations/omp/skills/agentmemory-agents/REFERENCE.md +1 -1
- package/integrations/omp/skills/agentmemory-architecture/SKILL.md +5 -1
- package/integrations/omp/skills/agentmemory-config/REFERENCE.md +2 -1
- package/integrations/omp/skills/agentmemory-config/SKILL.md +29 -9
- package/integrations/omp/skills/agentmemory-hooks/SKILL.md +17 -6
- package/integrations/omp/skills/agentmemory-mcp-tools/REFERENCE.md +1 -1
- package/integrations/omp/skills/agentmemory-mcp-tools/SKILL.md +10 -0
- package/integrations/omp/skills/agentmemory-rest-api/REFERENCE.md +2 -1
- package/integrations/omp/skills/agentmemory-rest-api/SKILL.md +1 -1
- package/integrations/openclaw/README.md +10 -0
- package/integrations/openclaw/openclaw.plugin.json +1 -1
- package/integrations/openclaw/package.json +1 -1
- package/integrations/openclaw/plugin.yaml +1 -1
- package/integrations/openclaw/skills/agentmemory-agents/REFERENCE.md +1 -1
- package/integrations/openclaw/skills/agentmemory-architecture/SKILL.md +5 -1
- package/integrations/openclaw/skills/agentmemory-config/REFERENCE.md +2 -1
- package/integrations/openclaw/skills/agentmemory-config/SKILL.md +29 -9
- package/integrations/openclaw/skills/agentmemory-hooks/SKILL.md +17 -6
- package/integrations/openclaw/skills/agentmemory-mcp-tools/REFERENCE.md +1 -1
- package/integrations/openclaw/skills/agentmemory-mcp-tools/SKILL.md +10 -0
- package/integrations/openclaw/skills/agentmemory-rest-api/REFERENCE.md +2 -1
- package/integrations/openclaw/skills/agentmemory-rest-api/SKILL.md +1 -1
- package/integrations/pi/README.md +1 -0
- package/integrations/pi/dist/index.mjs +92 -11
- package/integrations/pi/index.ts +56 -6
- package/integrations/pi/package.json +1 -1
- package/integrations/pi/skills/agentmemory-agents/REFERENCE.md +1 -1
- package/integrations/pi/skills/agentmemory-architecture/SKILL.md +5 -1
- package/integrations/pi/skills/agentmemory-config/REFERENCE.md +2 -1
- package/integrations/pi/skills/agentmemory-config/SKILL.md +29 -9
- package/integrations/pi/skills/agentmemory-hooks/SKILL.md +17 -6
- package/integrations/pi/skills/agentmemory-mcp-tools/REFERENCE.md +1 -1
- package/integrations/pi/skills/agentmemory-mcp-tools/SKILL.md +10 -0
- package/integrations/pi/skills/agentmemory-rest-api/REFERENCE.md +2 -1
- package/integrations/pi/skills/agentmemory-rest-api/SKILL.md +1 -1
- package/package.json +4 -3
- package/plugin/.claude-plugin/plugin.json +16 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.devin-plugin/plugin.json +3 -4
- package/plugin/.mcp.json +5 -1
- package/plugin/README.md +71 -0
- package/plugin/hooks/hooks.json +24 -12
- package/plugin/opencode/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/plugin/scripts/_capture.d.mts +3 -2
- package/plugin/scripts/_capture.d.mts.map +1 -1
- package/plugin/scripts/_capture.mjs +87 -8
- package/plugin/scripts/_capture.mjs.map +1 -1
- package/plugin/scripts/plugin-bridge.mjs +25 -6
- package/plugin/scripts/post-tool-failure.mjs +7 -2
- package/plugin/scripts/post-tool-failure.mjs.map +1 -1
- package/plugin/scripts/post-tool-use.mjs +7 -2
- package/plugin/scripts/post-tool-use.mjs.map +1 -1
- package/plugin/scripts/pre-compact.mjs +67 -12
- package/plugin/scripts/pre-compact.mjs.map +1 -1
- package/plugin/scripts/pre-tool-use.mjs +58 -5
- package/plugin/scripts/pre-tool-use.mjs.map +1 -1
- package/plugin/scripts/session-end.mjs +14 -3
- package/plugin/scripts/session-end.mjs.map +1 -1
- package/plugin/scripts/session-start.mjs +58 -5
- package/plugin/scripts/session-start.mjs.map +1 -1
- package/plugin/scripts/stop.mjs +2 -1
- package/plugin/scripts/stop.mjs.map +1 -1
- package/plugin/scripts/subagent-stop.mjs +15 -5
- package/plugin/scripts/subagent-stop.mjs.map +1 -1
- package/plugin/scripts/task-completed.mjs +8 -1
- package/plugin/scripts/task-completed.mjs.map +1 -1
- package/plugin/skills/agentmemory-agents/REFERENCE.md +1 -1
- package/plugin/skills/agentmemory-architecture/SKILL.md +5 -1
- package/plugin/skills/agentmemory-config/REFERENCE.md +2 -1
- package/plugin/skills/agentmemory-config/SKILL.md +29 -9
- package/plugin/skills/agentmemory-hooks/SKILL.md +17 -6
- package/plugin/skills/agentmemory-mcp-tools/REFERENCE.md +1 -1
- package/plugin/skills/agentmemory-mcp-tools/SKILL.md +10 -0
- package/plugin/skills/agentmemory-rest-api/REFERENCE.md +2 -1
- package/plugin/skills/agentmemory-rest-api/SKILL.md +1 -1
- package/dist/compression-recovery-CnhLQC6N.mjs.map +0 -1
- package/dist/connect-BSLIAMpw.mjs.map +0 -1
- package/dist/secret-store-D9GwO0xp.mjs.map +0 -1
- package/dist/src-DaMtDzt_.mjs.map +0 -1
- package/dist/standalone-BlqshyZ5.mjs.map +0 -1
- package/plugin/scripts/post-commit.d.mts +0 -1
- package/plugin/scripts/post-commit.mjs +0 -204
- package/plugin/scripts/post-commit.mjs.map +0 -1
|
@@ -66,53 +66,120 @@ function warnIfPremiumModel(env, envName, model) {
|
|
|
66
66
|
warnPremiumModelShown = true;
|
|
67
67
|
process.stderr.write(`[agentmemory] ${envName}=${model} is in the premium tier. Background compression on this model can cost $5+/day under active use. Cheaper alternatives with comparable quality for memory compression: deepseek/deepseek-v4-flash-0731, deepseek/deepseek-v4-pro, qwen/qwen3-coder. See README "Cost-aware model selection" for the full table. Set AGENTMEMORY_SUPPRESS_COST_WARNING=1 to silence.\n`);
|
|
68
68
|
}
|
|
69
|
+
const LLM_PROVIDER_NAMES = [
|
|
70
|
+
"anthropic",
|
|
71
|
+
"openai",
|
|
72
|
+
"gemini",
|
|
73
|
+
"openrouter",
|
|
74
|
+
"minimax"
|
|
75
|
+
];
|
|
76
|
+
const LLM_PROVIDER_KEYS = {
|
|
77
|
+
anthropic: ["ANTHROPIC_API_KEY"],
|
|
78
|
+
openai: ["OPENAI_API_KEY"],
|
|
79
|
+
gemini: ["GEMINI_API_KEY", "GOOGLE_API_KEY"],
|
|
80
|
+
openrouter: ["OPENROUTER_API_KEY"],
|
|
81
|
+
minimax: ["MINIMAX_API_KEY"]
|
|
82
|
+
};
|
|
83
|
+
const REMOTE_EMBEDDING_PROVIDER_KEYS = {
|
|
84
|
+
gemini: ["GEMINI_API_KEY"],
|
|
85
|
+
openai: ["OPENAI_API_KEY", "OPENAI_EMBEDDING_API_KEY"],
|
|
86
|
+
voyage: ["VOYAGE_API_KEY"],
|
|
87
|
+
cohere: ["COHERE_API_KEY"],
|
|
88
|
+
openrouter: ["OPENROUTER_API_KEY"]
|
|
89
|
+
};
|
|
90
|
+
function isLlmProviderName(value) {
|
|
91
|
+
return LLM_PROVIDER_NAMES.includes(value);
|
|
92
|
+
}
|
|
93
|
+
function selectedLlmProviderValue(env) {
|
|
94
|
+
return (env["AGENTMEMORY_LLM_PROVIDER"] || "").trim().toLowerCase();
|
|
95
|
+
}
|
|
96
|
+
function llmProviderHasKey(env, name) {
|
|
97
|
+
return LLM_PROVIDER_KEYS[name].some((k) => hasRealValue(env[k]));
|
|
98
|
+
}
|
|
99
|
+
function envFileLabel(path = ENV_FILE) {
|
|
100
|
+
const home = homedir();
|
|
101
|
+
return path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
|
|
102
|
+
}
|
|
103
|
+
function llmOptInHint(env = getMergedEnv()) {
|
|
104
|
+
const selected = selectedLlmProviderValue(env);
|
|
105
|
+
if (selected) {
|
|
106
|
+
if (!isLlmProviderName(selected)) return `AGENTMEMORY_LLM_PROVIDER=${selected} is not a known provider. Use one of: ${LLM_PROVIDER_NAMES.join(", ")}.`;
|
|
107
|
+
if (!llmProviderHasKey(env, selected)) return `AGENTMEMORY_LLM_PROVIDER=${selected} is set, but ${LLM_PROVIDER_KEYS[selected].join(" or ")} is not. Add the key to ${envFileLabel()}.`;
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
if (env["AGENTMEMORY_ALLOW_AGENT_SDK"] === "true") return null;
|
|
111
|
+
const withKey = LLM_PROVIDER_NAMES.filter((name) => llmProviderHasKey(env, name));
|
|
112
|
+
if (withKey.length === 0) return null;
|
|
113
|
+
return `Found ${withKey.flatMap((name) => LLM_PROVIDER_KEYS[name].filter((k) => hasRealValue(env[k]))).join(", ")}, but agentmemory sends nothing to an LLM provider until you choose one for it. To turn on LLM summaries and compression, add AGENTMEMORY_LLM_PROVIDER=${withKey[0]} to ${envFileLabel()}.`;
|
|
114
|
+
}
|
|
115
|
+
function embeddingOptInHint(env = getMergedEnv()) {
|
|
116
|
+
const chosen = (env["EMBEDDING_PROVIDER"] || "").trim().toLowerCase();
|
|
117
|
+
if (chosen) {
|
|
118
|
+
const keys = REMOTE_EMBEDDING_PROVIDER_KEYS[chosen];
|
|
119
|
+
if (keys && !keys.some((k) => hasRealValue(env[k]))) return `EMBEDDING_PROVIDER=${chosen} is set, but ${keys.join(" or ")} is not. Add the key to ${envFileLabel()}, or set EMBEDDING_PROVIDER=local for on-device embeddings.`;
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const withKey = Object.keys(REMOTE_EMBEDDING_PROVIDER_KEYS).filter((name) => REMOTE_EMBEDDING_PROVIDER_KEYS[name].some((k) => hasRealValue(env[k])));
|
|
123
|
+
if (withKey.length === 0) return null;
|
|
124
|
+
return `A ${withKey.join("/")} key is present, but cloud embeddings stay off until you choose them. Add EMBEDDING_PROVIDER=${withKey[0]} to ${envFileLabel()}, or EMBEDDING_PROVIDER=local for on-device embeddings.`;
|
|
125
|
+
}
|
|
69
126
|
function detectProvider(env) {
|
|
70
127
|
const maxTokens = parseInt(env["MAX_TOKENS"] || "4096", 10);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
provider: "openai",
|
|
76
|
-
model,
|
|
77
|
-
maxTokens,
|
|
78
|
-
baseURL: env["OPENAI_BASE_URL"]
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
if (hasRealValue(env["MINIMAX_API_KEY"])) return {
|
|
82
|
-
provider: "minimax",
|
|
83
|
-
model: env["MINIMAX_MODEL"] || "MiniMax-M3",
|
|
128
|
+
const noop = {
|
|
129
|
+
provider: "noop",
|
|
130
|
+
model: "noop",
|
|
84
131
|
maxTokens
|
|
85
132
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
133
|
+
const selected = selectedLlmProviderValue(env);
|
|
134
|
+
if (selected) {
|
|
135
|
+
if (!isLlmProviderName(selected) || !llmProviderHasKey(env, selected)) {
|
|
136
|
+
writeProviderNoticeOnce(`[agentmemory] ${llmOptInHint(env)} Running zero-LLM.\n`);
|
|
137
|
+
return noop;
|
|
138
|
+
}
|
|
139
|
+
switch (selected) {
|
|
140
|
+
case "openai": {
|
|
141
|
+
const model = env["OPENAI_MODEL"] || "gpt-5.6-luna";
|
|
142
|
+
warnIfPremiumModel(env, "OPENAI_MODEL", model);
|
|
143
|
+
return {
|
|
144
|
+
provider: "openai",
|
|
145
|
+
model,
|
|
146
|
+
maxTokens,
|
|
147
|
+
baseURL: env["OPENAI_BASE_URL"]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
case "minimax": return {
|
|
151
|
+
provider: "minimax",
|
|
152
|
+
model: env["MINIMAX_MODEL"] || "MiniMax-M3",
|
|
153
|
+
maxTokens
|
|
154
|
+
};
|
|
155
|
+
case "anthropic": return {
|
|
156
|
+
provider: "anthropic",
|
|
157
|
+
model: env["ANTHROPIC_MODEL"] || "claude-sonnet-5",
|
|
158
|
+
maxTokens,
|
|
159
|
+
baseURL: env["ANTHROPIC_BASE_URL"]
|
|
160
|
+
};
|
|
161
|
+
case "gemini":
|
|
162
|
+
if (!hasRealValue(env["GEMINI_API_KEY"])) process.stderr.write("[agentmemory] GOOGLE_API_KEY detected — treating as GEMINI_API_KEY. Set GEMINI_API_KEY in ~/.agentmemory/.env to silence this warning.\n");
|
|
163
|
+
return {
|
|
164
|
+
provider: "gemini",
|
|
165
|
+
model: env["GEMINI_MODEL"] || "gemini-3.7-flash",
|
|
166
|
+
maxTokens
|
|
167
|
+
};
|
|
168
|
+
case "openrouter": {
|
|
169
|
+
const model = env["OPENROUTER_MODEL"] || "anthropic/claude-sonnet-5";
|
|
170
|
+
warnIfPremiumModel(env, "OPENROUTER_MODEL", model);
|
|
171
|
+
return {
|
|
172
|
+
provider: "openrouter",
|
|
173
|
+
model,
|
|
174
|
+
maxTokens
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
108
178
|
}
|
|
109
179
|
if (!(env["AGENTMEMORY_ALLOW_AGENT_SDK"] === "true")) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
model: "noop",
|
|
114
|
-
maxTokens
|
|
115
|
-
};
|
|
180
|
+
const hint = llmOptInHint(env);
|
|
181
|
+
writeProviderNoticeOnce(hint ? `[agentmemory] ${hint}\n` : pc.dim("[agentmemory] No LLM provider chosen, so agentmemory runs zero-LLM: no LLM compression or summaries, and no session content leaves this machine for an LLM. Search uses BM25 plus any embedding provider you set with EMBEDDING_PROVIDER (EMBEDDING_PROVIDER=local runs on-device). To turn on LLM summaries, set AGENTMEMORY_LLM_PROVIDER (anthropic, openai, gemini, openrouter or minimax) and that provider's key in ~/.agentmemory/.env.\n"));
|
|
182
|
+
return noop;
|
|
116
183
|
}
|
|
117
184
|
writeProviderNoticeOnce("[agentmemory] WARNING: agent-sdk fallback enabled via AGENTMEMORY_ALLOW_AGENT_SDK=true. This spawns @anthropic-ai/claude-agent-sdk child sessions that can trigger the Stop-hook recursion loop. A SDK-child env marker is set to block re-entry, but prefer setting a real API key in ~/.agentmemory/.env instead.\n");
|
|
118
185
|
return {
|
|
@@ -192,7 +259,9 @@ function getAuditMigrateMaxBytes() {
|
|
|
192
259
|
return safeParseInt(getMergedEnv()["AGENTMEMORY_AUDIT_MIGRATE_MAX_BYTES"], 32 * 1024 * 1024);
|
|
193
260
|
}
|
|
194
261
|
function detectLlmProviderKind(env = getMergedEnv()) {
|
|
195
|
-
|
|
262
|
+
const selected = selectedLlmProviderValue(env);
|
|
263
|
+
if (selected && isLlmProviderName(selected) && llmProviderHasKey(env, selected)) return "llm";
|
|
264
|
+
if (!selected && env["AGENTMEMORY_ALLOW_AGENT_SDK"] === "true") return "llm";
|
|
196
265
|
return "noop";
|
|
197
266
|
}
|
|
198
267
|
function describeLlmRoute(provider) {
|
|
@@ -218,15 +287,8 @@ function loadEmbeddingConfig() {
|
|
|
218
287
|
};
|
|
219
288
|
}
|
|
220
289
|
function detectEmbeddingProvider(env) {
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
if (forced) return forced;
|
|
224
|
-
if (source["GEMINI_API_KEY"]) return "gemini";
|
|
225
|
-
if (source["OPENAI_API_KEY"] || source["OPENAI_EMBEDDING_API_KEY"]) return "openai";
|
|
226
|
-
if (source["VOYAGE_API_KEY"]) return "voyage";
|
|
227
|
-
if (source["COHERE_API_KEY"]) return "cohere";
|
|
228
|
-
if (source["OPENROUTER_API_KEY"]) return "openrouter";
|
|
229
|
-
return null;
|
|
290
|
+
const forced = ((env ?? getMergedEnv())["EMBEDDING_PROVIDER"] || "").trim();
|
|
291
|
+
return forced ? forced : null;
|
|
230
292
|
}
|
|
231
293
|
function loadClaudeBridgeConfig() {
|
|
232
294
|
const env = getMergedEnv();
|
|
@@ -458,10 +520,63 @@ function bootWarn(msg) {
|
|
|
458
520
|
}
|
|
459
521
|
//#endregion
|
|
460
522
|
//#region src/version.ts
|
|
461
|
-
const VERSION = "0.9.
|
|
523
|
+
const VERSION = "0.9.32";
|
|
462
524
|
const III_PINNED_VERSION = "0.25.0";
|
|
463
525
|
//#endregion
|
|
464
526
|
//#region src/mcp/tools-registry.ts
|
|
527
|
+
const READ_ONLY_TOOLS = new Set([
|
|
528
|
+
"memory_recall",
|
|
529
|
+
"memory_file_history",
|
|
530
|
+
"memory_patterns",
|
|
531
|
+
"memory_sessions",
|
|
532
|
+
"memory_smart_search",
|
|
533
|
+
"memory_vision_search",
|
|
534
|
+
"memory_timeline",
|
|
535
|
+
"memory_export",
|
|
536
|
+
"memory_relations",
|
|
537
|
+
"memory_commit_lookup",
|
|
538
|
+
"memory_commits",
|
|
539
|
+
"memory_graph_query",
|
|
540
|
+
"memory_team_feed",
|
|
541
|
+
"memory_audit",
|
|
542
|
+
"memory_frontier",
|
|
543
|
+
"memory_next",
|
|
544
|
+
"memory_diagnose",
|
|
545
|
+
"memory_facet_query",
|
|
546
|
+
"memory_verify",
|
|
547
|
+
"memory_lesson_recall",
|
|
548
|
+
"memory_insight_list",
|
|
549
|
+
"memory_slot_list",
|
|
550
|
+
"memory_slot_get"
|
|
551
|
+
]);
|
|
552
|
+
const DESTRUCTIVE_TOOLS = new Set([
|
|
553
|
+
"memory_action_update",
|
|
554
|
+
"memory_compress_file",
|
|
555
|
+
"memory_claude_bridge_sync",
|
|
556
|
+
"memory_governance_delete",
|
|
557
|
+
"memory_heal",
|
|
558
|
+
"memory_lesson_delete",
|
|
559
|
+
"memory_obsidian_export",
|
|
560
|
+
"memory_slot_replace",
|
|
561
|
+
"memory_slot_delete"
|
|
562
|
+
]);
|
|
563
|
+
const IDEMPOTENT_WRITE_TOOLS = new Set([
|
|
564
|
+
"memory_governance_delete",
|
|
565
|
+
"memory_lesson_delete",
|
|
566
|
+
"memory_slot_replace",
|
|
567
|
+
"memory_slot_delete",
|
|
568
|
+
"memory_claude_bridge_sync"
|
|
569
|
+
]);
|
|
570
|
+
const OPEN_WORLD_TOOLS = new Set(["memory_mesh_sync"]);
|
|
571
|
+
function toolAnnotations(name) {
|
|
572
|
+
const readOnly = READ_ONLY_TOOLS.has(name);
|
|
573
|
+
return {
|
|
574
|
+
readOnlyHint: readOnly,
|
|
575
|
+
destructiveHint: !readOnly && DESTRUCTIVE_TOOLS.has(name),
|
|
576
|
+
idempotentHint: readOnly || IDEMPOTENT_WRITE_TOOLS.has(name),
|
|
577
|
+
openWorldHint: OPEN_WORLD_TOOLS.has(name)
|
|
578
|
+
};
|
|
579
|
+
}
|
|
465
580
|
const CORE_TOOLS = [
|
|
466
581
|
{
|
|
467
582
|
name: "memory_recall",
|
|
@@ -1442,6 +1557,11 @@ const V070_TOOLS = [
|
|
|
1442
1557
|
tags: {
|
|
1443
1558
|
type: "string",
|
|
1444
1559
|
description: "Comma-separated tags"
|
|
1560
|
+
},
|
|
1561
|
+
sourceIds: {
|
|
1562
|
+
type: "array",
|
|
1563
|
+
items: { type: "string" },
|
|
1564
|
+
description: "Ids of the session, memory, observation or crystal this lesson came from (max 50)"
|
|
1445
1565
|
}
|
|
1446
1566
|
},
|
|
1447
1567
|
required: ["content"]
|
|
@@ -1664,7 +1784,10 @@ function getAllTools() {
|
|
|
1664
1784
|
...V070_TOOLS,
|
|
1665
1785
|
...V073_TOOLS,
|
|
1666
1786
|
...V010_SLOTS_TOOLS
|
|
1667
|
-
]
|
|
1787
|
+
].map((tool) => ({
|
|
1788
|
+
...tool,
|
|
1789
|
+
annotations: toolAnnotations(tool.name)
|
|
1790
|
+
}));
|
|
1668
1791
|
}
|
|
1669
1792
|
function getVisibleTools() {
|
|
1670
1793
|
if ((process.env["AGENTMEMORY_TOOLS"] || "all") === "core") return getAllTools().filter((t) => ESSENTIAL_TOOLS.has(t.name));
|
|
@@ -2080,12 +2203,20 @@ function matchesSearchLayer(obsId, sessionId, targetLayer = "all", layer) {
|
|
|
2080
2203
|
}
|
|
2081
2204
|
//#endregion
|
|
2082
2205
|
//#region src/state/memory-utils.ts
|
|
2206
|
+
const MAX_DATE_MS = 864e13;
|
|
2207
|
+
function supersededAt(previous, now) {
|
|
2208
|
+
const prior = previous ? Date.parse(previous) : NaN;
|
|
2209
|
+
const current = Date.parse(now);
|
|
2210
|
+
if (Number.isNaN(prior) || current > prior) return now;
|
|
2211
|
+
return new Date(Math.min(prior + 1, MAX_DATE_MS)).toISOString();
|
|
2212
|
+
}
|
|
2083
2213
|
function memoryToObservation(memory) {
|
|
2084
2214
|
return {
|
|
2085
2215
|
id: memory.id,
|
|
2086
2216
|
sessionId: memory.sessionIds?.[0] ?? "memory",
|
|
2087
2217
|
timestamp: memory.createdAt,
|
|
2088
2218
|
type: "decision",
|
|
2219
|
+
memoryType: memory.type,
|
|
2089
2220
|
title: memory.title,
|
|
2090
2221
|
facts: [memory.content],
|
|
2091
2222
|
narrative: memory.content,
|
|
@@ -2109,6 +2240,13 @@ function lessonToObservation(l) {
|
|
|
2109
2240
|
importance: l.confidence
|
|
2110
2241
|
};
|
|
2111
2242
|
}
|
|
2243
|
+
function observationEmbedText(record) {
|
|
2244
|
+
return [
|
|
2245
|
+
record.title,
|
|
2246
|
+
...record.concepts || [],
|
|
2247
|
+
record.narrative || ""
|
|
2248
|
+
].filter((part) => part && part.trim()).join(" ").trim();
|
|
2249
|
+
}
|
|
2112
2250
|
//#endregion
|
|
2113
2251
|
//#region src/functions/recall-response.ts
|
|
2114
2252
|
function estimateTokens(value) {
|
|
@@ -2137,6 +2275,7 @@ function formatResult(result, format) {
|
|
|
2137
2275
|
sessionId: result.sessionId,
|
|
2138
2276
|
title: observation.title,
|
|
2139
2277
|
type: observation.type,
|
|
2278
|
+
...observation.memoryType !== void 0 && { memoryType: observation.memoryType },
|
|
2140
2279
|
score: result.score,
|
|
2141
2280
|
timestamp: observation.timestamp,
|
|
2142
2281
|
...result.layer !== void 0 && { layer: result.layer }
|
|
@@ -2157,6 +2296,7 @@ function clipResult(result, format, budget) {
|
|
|
2157
2296
|
sessionId: result.sessionId,
|
|
2158
2297
|
title: "",
|
|
2159
2298
|
type: observation.type,
|
|
2299
|
+
...observation.memoryType !== void 0 && { memoryType: observation.memoryType },
|
|
2160
2300
|
score: result.score,
|
|
2161
2301
|
timestamp: observation.timestamp,
|
|
2162
2302
|
...layer,
|
|
@@ -2178,6 +2318,7 @@ function clipResult(result, format, budget) {
|
|
|
2178
2318
|
sessionId: result.sessionId,
|
|
2179
2319
|
title,
|
|
2180
2320
|
narrative,
|
|
2321
|
+
...observation.memoryType !== void 0 && { memoryType: observation.memoryType },
|
|
2181
2322
|
score: result.score,
|
|
2182
2323
|
timestamp: observation.timestamp,
|
|
2183
2324
|
...layer,
|
|
@@ -2189,6 +2330,7 @@ function clipResult(result, format, budget) {
|
|
|
2189
2330
|
sessionId: observation.sessionId,
|
|
2190
2331
|
timestamp: observation.timestamp,
|
|
2191
2332
|
type: observation.type,
|
|
2333
|
+
...observation.memoryType !== void 0 && { memoryType: observation.memoryType },
|
|
2192
2334
|
title,
|
|
2193
2335
|
facts: [],
|
|
2194
2336
|
narrative,
|
|
@@ -2444,6 +2586,6 @@ function bearerHeaders(baseUrl, env = process.env) {
|
|
|
2444
2586
|
return secret ? { Authorization: `Bearer ${secret}` } : {};
|
|
2445
2587
|
}
|
|
2446
2588
|
//#endregion
|
|
2447
|
-
export {
|
|
2589
|
+
export { getStandalonePersistPath as $, setBootVerbose as A, detectLlmProviderKind as B, getAllTools as C, bootLog as D, VERSION as E, runtimeConfigPath as F, getConsolidationDecayDays as G, getAgentId as H, LLM_PROVIDER_KEYS as I, getFinalizeIdleMs as J, getConsolidationIntervalMs as K, MAX_IMPORT_OBS_PER_SESSION as L, engineFlushWaitMs as M, engineStateConfigPaths as N, bootWarn as O, redactCredentialUrls as P, getSessionSweepStaleHours as Q, describeLlmRoute as R, ESSENTIAL_TOOLS as S, III_PINNED_VERSION as T, getAuditRetentionMonths as U, embeddingOptInHint as V, getConsolidationCooldownMs as W, getIndexSaveIntervalMs as X, getFollowupWindowSeconds as Y, getRedisUrl as Z, recordAudit as _, loadEmbeddingConfig as _t, secretFilePath as a, isAgentScopeIsolated as at, setAuditRecordedListener as b, loadTeamConfig as bt, memoryToObservation as c, isContextInjectionEnabled as ct, getSearchResultLayer as d, isGraphExtractionEnabled as dt, getStateBackend as et, isSearchLayer as f, isSessionSweepEnabled as ft, queryAudit as g, loadConfig as gt, AUDIT_MIGRATION_STATE_KEY as h, loadClaudeBridgeConfig as ht, resolveClientSecret as i, hydrateProcessEnvFromFile as it, captureDurableAfterMs as j, logger as k, observationEmbedText as l, isDropStaleIndexEnabled as lt, matchesSearchLayer as m, llmOptInHint as mt, ensureServerSecret as n, getVectorBackfillMax as nt, buildRecallResponse as o, isAutoCompressEnabled as ot, isSearchResultLayer as p, isVectorBackfillAllEnabled as pt, getEnvVar as q, explicitSecret as r, getVectorBucketSize as rt, lessonToObservation as s, isConsolidationEnabled as st, bearerHeaders as t, getStateSaveIntervalMs as tt, supersededAt as u, isGraphCompactOnBootEnabled as ut, runAuditRetentionSweep as v, loadFallbackConfig as vt, getVisibleTools as w, startAuditMigration as x, parseEnvContent as xt, safeAudit as y, loadSnapshotConfig as yt, detectEmbeddingProvider as z };
|
|
2448
2590
|
|
|
2449
|
-
//# sourceMappingURL=secret-store-
|
|
2591
|
+
//# sourceMappingURL=secret-store-iYXRcrO8.mjs.map
|