@agentmemory/agentmemory 0.9.7 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -19
- package/dist/cli.mjs +4 -4
- package/dist/image-refs-DiN3VEf3.mjs +3 -0
- package/dist/{image-store-Bx3J2RQ8.mjs → image-store-DGMiEUaI.mjs} +1 -1
- package/dist/index.mjs +32 -6
- package/dist/index.mjs.map +1 -1
- package/dist/{src-DbgW4F8O.mjs → src-Br3vaM5Z.mjs} +40 -14
- package/dist/src-Br3vaM5Z.mjs.map +1 -0
- package/dist/{standalone-CFJp7B7c.mjs → standalone-CcVof5XG.mjs} +27 -26
- package/dist/standalone-CcVof5XG.mjs.map +1 -0
- package/dist/standalone.d.mts +4 -1
- package/dist/standalone.d.mts.map +1 -1
- package/dist/standalone.mjs +27 -40
- package/dist/standalone.mjs.map +1 -1
- package/dist/{tools-registry-UpRrZBDD.mjs → tools-registry-l6I20_xa.mjs} +2 -2
- package/dist/{tools-registry-UpRrZBDD.mjs.map → tools-registry-l6I20_xa.mjs.map} +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/image-refs-B2vyIEyZ.mjs +0 -3
- package/dist/src-DbgW4F8O.mjs.map +0 -1
- package/dist/standalone-CFJp7B7c.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as jaccardSimilarity, i as generateId, n as STREAM, r as fingerprintId, t as KV } from "./cli.mjs";
|
|
2
|
-
import { _ as loadSnapshotConfig, a as detectLlmProviderKind, d as isContextInjectionEnabled, f as isGraphExtractionEnabled, g as loadFallbackConfig, h as loadEmbeddingConfig, i as detectEmbeddingProvider, l as isAutoCompressEnabled, m as loadConfig, n as getVisibleTools, o as getConsolidationDecayDays, p as loadClaudeBridgeConfig, r as VERSION, s as getEnvVar, t as getAllTools, u as isConsolidationEnabled, v as loadTeamConfig } from "./tools-registry-
|
|
2
|
+
import { _ as loadSnapshotConfig, a as detectLlmProviderKind, d as isContextInjectionEnabled, f as isGraphExtractionEnabled, g as loadFallbackConfig, h as loadEmbeddingConfig, i as detectEmbeddingProvider, l as isAutoCompressEnabled, m as loadConfig, n as getVisibleTools, o as getConsolidationDecayDays, p as loadClaudeBridgeConfig, r as VERSION, s as getEnvVar, t as getAllTools, u as isConsolidationEnabled, v as loadTeamConfig } from "./tools-registry-l6I20_xa.mjs";
|
|
3
3
|
import { execFile } from "node:child_process";
|
|
4
4
|
import { constants, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { basename, dirname, extname, join, resolve, sep } from "node:path";
|
|
@@ -217,13 +217,13 @@ var AnthropicProvider = class {
|
|
|
217
217
|
* The Anthropic SDK automatically injects `x-stainless-*` headers that MiniMax
|
|
218
218
|
* rejects with 403. This provider bypasses the SDK and calls the API directly.
|
|
219
219
|
*
|
|
220
|
-
* Required env vars:
|
|
220
|
+
* Required env vars (loaded from ~/.agentmemory/.env or process.env):
|
|
221
221
|
* MINIMAX_API_KEY — your MiniMax API key
|
|
222
222
|
* MINIMAX_MODEL — model name (default: MiniMax-M2.7)
|
|
223
223
|
* MAX_TOKENS — max output tokens (default: 800; MiniMax-M2.7 needs ≤800)
|
|
224
224
|
*
|
|
225
225
|
* Optional:
|
|
226
|
-
* MINIMAX_BASE_URL — base URL without path (default: https://api.
|
|
226
|
+
* MINIMAX_BASE_URL — base URL without path (default: https://api.minimax.io/anthropic)
|
|
227
227
|
*/
|
|
228
228
|
var MinimaxProvider = class {
|
|
229
229
|
name = "minimax";
|
|
@@ -235,7 +235,7 @@ var MinimaxProvider = class {
|
|
|
235
235
|
this.apiKey = apiKey;
|
|
236
236
|
this.model = model;
|
|
237
237
|
this.maxTokens = maxTokens;
|
|
238
|
-
this.baseUrl =
|
|
238
|
+
this.baseUrl = getEnvVar("MINIMAX_BASE_URL") || "https://api.minimax.io/anthropic";
|
|
239
239
|
}
|
|
240
240
|
async compress(systemPrompt, userPrompt) {
|
|
241
241
|
return this.call(systemPrompt, userPrompt);
|
|
@@ -2600,10 +2600,10 @@ function registerObserveFunction(sdk, kv, dedupMap, maxObservationsPerSession) {
|
|
|
2600
2600
|
};
|
|
2601
2601
|
}
|
|
2602
2602
|
if (pendingImageData && (pendingImageData.startsWith("data:image/") || pendingImageData.startsWith("iVBORw0KGgo") || pendingImageData.startsWith("/9j/"))) {
|
|
2603
|
-
const { saveImageToDisk } = await import("./image-store-
|
|
2603
|
+
const { saveImageToDisk } = await import("./image-store-DGMiEUaI.mjs");
|
|
2604
2604
|
const { filePath, bytesWritten } = await saveImageToDisk(pendingImageData);
|
|
2605
2605
|
raw.imageData = filePath;
|
|
2606
|
-
const { incrementImageRef } = await import("./image-refs-
|
|
2606
|
+
const { incrementImageRef } = await import("./image-refs-DiN3VEf3.mjs");
|
|
2607
2607
|
await incrementImageRef(kv, filePath);
|
|
2608
2608
|
sdk.triggerVoid("mem::disk-size-delta", { deltaBytes: bytesWritten });
|
|
2609
2609
|
if (process.env["AGENTMEMORY_IMAGE_EMBEDDINGS"] === "true") sdk.triggerVoid("mem::vision-embed", {
|
|
@@ -2616,7 +2616,7 @@ function registerObserveFunction(sdk, kv, dedupMap, maxObservationsPerSession) {
|
|
|
2616
2616
|
await kv.set(KV.observations(payload.sessionId), obsId, raw);
|
|
2617
2617
|
} catch (error) {
|
|
2618
2618
|
if (raw.imageData) {
|
|
2619
|
-
const { deleteImage } = await import("./image-store-
|
|
2619
|
+
const { deleteImage } = await import("./image-store-DGMiEUaI.mjs");
|
|
2620
2620
|
const { deletedBytes } = await deleteImage(raw.imageData);
|
|
2621
2621
|
if (deletedBytes > 0) sdk.triggerVoid("mem::disk-size-delta", { deltaBytes: -deletedBytes });
|
|
2622
2622
|
}
|
|
@@ -3112,6 +3112,23 @@ async function seedDefaults(kv) {
|
|
|
3112
3112
|
await kv.set(target, tmpl.label, slot);
|
|
3113
3113
|
}
|
|
3114
3114
|
}
|
|
3115
|
+
async function listPinnedSlots(kv) {
|
|
3116
|
+
const [project, global] = await Promise.all([kv.list(KV.slots), kv.list(KV.globalSlots)]);
|
|
3117
|
+
const merged = /* @__PURE__ */ new Map();
|
|
3118
|
+
for (const s of global) merged.set(s.label, s);
|
|
3119
|
+
for (const s of project) merged.set(s.label, s);
|
|
3120
|
+
return Array.from(merged.values()).filter((s) => s.pinned && s.content.trim().length > 0).sort((a, b) => a.label.localeCompare(b.label));
|
|
3121
|
+
}
|
|
3122
|
+
function renderPinnedContext(slots) {
|
|
3123
|
+
if (slots.length === 0) return "";
|
|
3124
|
+
const lines = ["# agentmemory pinned slots", ""];
|
|
3125
|
+
for (const slot of slots) {
|
|
3126
|
+
lines.push(`## ${slot.label}`);
|
|
3127
|
+
lines.push(slot.content.trim());
|
|
3128
|
+
lines.push("");
|
|
3129
|
+
}
|
|
3130
|
+
return lines.join("\n");
|
|
3131
|
+
}
|
|
3115
3132
|
function registerSlotsFunctions(sdk, kv) {
|
|
3116
3133
|
seedDefaults(kv).catch((err) => {
|
|
3117
3134
|
logger.warn("slot defaults seed failed", { error: err instanceof Error ? err.message : String(err) });
|
|
@@ -3878,7 +3895,14 @@ function registerContextFunction(sdk, kv, tokenBudget) {
|
|
|
3878
3895
|
sdk.registerFunction("mem::context", async (data) => {
|
|
3879
3896
|
const budget = data.budget || tokenBudget;
|
|
3880
3897
|
const blocks = [];
|
|
3881
|
-
const profile = await kv.get(KV.profiles, data.project).catch(() => null);
|
|
3898
|
+
const [pinnedSlots, profile] = await Promise.all([isSlotsEnabled() ? listPinnedSlots(kv).catch(() => []) : Promise.resolve([]), kv.get(KV.profiles, data.project).catch(() => null)]);
|
|
3899
|
+
const slotContent = renderPinnedContext(pinnedSlots);
|
|
3900
|
+
if (slotContent) blocks.push({
|
|
3901
|
+
type: "memory",
|
|
3902
|
+
content: slotContent,
|
|
3903
|
+
tokens: estimateTokens$1(slotContent),
|
|
3904
|
+
recency: Date.now()
|
|
3905
|
+
});
|
|
3882
3906
|
if (profile) {
|
|
3883
3907
|
const profileParts = [];
|
|
3884
3908
|
if (profile.topConcepts.length > 0) profileParts.push(`Concepts: ${profile.topConcepts.slice(0, 8).map((c) => c.concept).join(", ")}`);
|
|
@@ -4657,7 +4681,7 @@ function registerRememberFunction(sdk, kv) {
|
|
|
4657
4681
|
const deletedMemoryIds = [];
|
|
4658
4682
|
const deletedObservationIds = [];
|
|
4659
4683
|
let deletedSession = false;
|
|
4660
|
-
const { decrementImageRef } = await import("./image-refs-
|
|
4684
|
+
const { decrementImageRef } = await import("./image-refs-DiN3VEf3.mjs");
|
|
4661
4685
|
if (data.memoryId) {
|
|
4662
4686
|
const mem = await kv.get(KV.memories, data.memoryId);
|
|
4663
4687
|
await kv.delete(KV.memories, data.memoryId);
|
|
@@ -4716,7 +4740,7 @@ const DEFAULTS$1 = {
|
|
|
4716
4740
|
function registerEvictFunction(sdk, kv) {
|
|
4717
4741
|
sdk.registerFunction("mem::evict", async (data) => {
|
|
4718
4742
|
const dryRun = data?.dryRun ?? false;
|
|
4719
|
-
const { decrementImageRef } = await import("./image-refs-
|
|
4743
|
+
const { decrementImageRef } = await import("./image-refs-DiN3VEf3.mjs");
|
|
4720
4744
|
const configOverride = await kv.get(KV.config, "eviction").catch(() => null);
|
|
4721
4745
|
const cfg = {
|
|
4722
4746
|
...DEFAULTS$1,
|
|
@@ -5319,7 +5343,7 @@ function registerAutoForgetFunction(sdk, kv) {
|
|
|
5319
5343
|
sdk.registerFunction("mem::auto-forget", async (data) => {
|
|
5320
5344
|
const dryRun = data?.dryRun ?? false;
|
|
5321
5345
|
const now = Date.now();
|
|
5322
|
-
const { decrementImageRef } = await import("./image-refs-
|
|
5346
|
+
const { decrementImageRef } = await import("./image-refs-DiN3VEf3.mjs");
|
|
5323
5347
|
const result = {
|
|
5324
5348
|
ttlExpired: [],
|
|
5325
5349
|
contradictions: [],
|
|
@@ -5555,7 +5579,9 @@ function registerExportImportFunction(sdk, kv) {
|
|
|
5555
5579
|
"0.9.4",
|
|
5556
5580
|
"0.9.5",
|
|
5557
5581
|
"0.9.6",
|
|
5558
|
-
"0.9.7"
|
|
5582
|
+
"0.9.7",
|
|
5583
|
+
"0.9.8",
|
|
5584
|
+
"0.9.9"
|
|
5559
5585
|
]).has(importData.version)) return {
|
|
5560
5586
|
success: false,
|
|
5561
5587
|
error: `Unsupported export version: ${importData.version}`
|
|
@@ -11912,7 +11938,7 @@ function registerRetentionFunctions(sdk, kv) {
|
|
|
11912
11938
|
const threshold = typeof data?.threshold === "number" && Number.isFinite(data.threshold) ? data.threshold : DEFAULT_DECAY.tierThresholds.cold;
|
|
11913
11939
|
const maxEvictRaw = typeof data?.maxEvict === "number" && Number.isInteger(data.maxEvict) ? data.maxEvict : 50;
|
|
11914
11940
|
const maxEvict = Math.min(1e3, Math.max(0, maxEvictRaw));
|
|
11915
|
-
const { decrementImageRef } = await import("./image-refs-
|
|
11941
|
+
const { decrementImageRef } = await import("./image-refs-DiN3VEf3.mjs");
|
|
11916
11942
|
const candidates = (await kv.list(KV.retentionScores)).filter((s) => s.score < threshold).sort((a, b) => a.score - b.score).slice(0, maxEvict);
|
|
11917
11943
|
if (data?.dryRun) return {
|
|
11918
11944
|
success: true,
|
|
@@ -18266,4 +18292,4 @@ main().catch((err) => {
|
|
|
18266
18292
|
|
|
18267
18293
|
//#endregion
|
|
18268
18294
|
export { deleteImage as a, saveImageToDisk as c, IMAGES_DIR as i, touchImage as l, getImageRefCount as n, getMaxBytes as o, incrementImageRef as r, isManagedImagePath as s, decrementImageRef as t };
|
|
18269
|
-
//# sourceMappingURL=src-
|
|
18295
|
+
//# sourceMappingURL=src-Br3vaM5Z.mjs.map
|