@mono-agent/memory-supermemory 0.4.1
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 +74 -0
- package/dist/client.d.ts +76 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +160 -0
- package/dist/client.js.map +1 -0
- package/dist/format.d.ts +10 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +33 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/store.d.ts +54 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +101 -0
- package/dist/store.js.map +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @mono-agent/memory-supermemory
|
|
2
|
+
|
|
3
|
+
## Category
|
|
4
|
+
|
|
5
|
+
Category: `context`
|
|
6
|
+
|
|
7
|
+
## Responsibility
|
|
8
|
+
|
|
9
|
+
Provides a `MemoryStore` (from `@mono-agent/agent-contracts`) backed by an external
|
|
10
|
+
[Supermemory](https://supermemory.ai) instance — a local OSS binary
|
|
11
|
+
(`supermemory-server`, MIT) or the hosted cloud — reached over its REST API. Selected via
|
|
12
|
+
`config.memory.backend: "supermemory"`; the built-in BuJo engine remains the default.
|
|
13
|
+
Supermemory extracts and consolidates memories **server-side**, so this backend needs no
|
|
14
|
+
embeddings model and no memory chat LLM — the adapter just posts turns and searches.
|
|
15
|
+
|
|
16
|
+
## Install / Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm --filter @mono-agent/memory-supermemory run build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { createSupermemoryStore } from "@mono-agent/memory-supermemory";
|
|
24
|
+
|
|
25
|
+
const store = createSupermemoryStore({
|
|
26
|
+
baseUrl: "http://127.0.0.1:6767", // local binary; or https://api.supermemory.ai for cloud
|
|
27
|
+
apiKey: process.env.SUPERMEMORY_API_KEY, // optional; omit for a keyless local instance
|
|
28
|
+
container: "my-agent", // namespace tag scoping every add + search
|
|
29
|
+
maxBytes: 64_000,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
await store.appendHostSummary("conv-1", "User prefers dark mode.");
|
|
33
|
+
const block = await store.load("conv-1", "preferences");
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `load(query)` → `POST /v4/search` (cached `/v3` fallback), formats ranked hits into a
|
|
37
|
+
markdown block capped at `maxBytes`. Degrades to `undefined` on any error.
|
|
38
|
+
- `appendHostSummary` / `scheduleCapture` → `POST /v3/documents` (one-liner / full turn,
|
|
39
|
+
async server-side extraction). Writes never throw.
|
|
40
|
+
- `recall(query)` → hits shaped for the in-app `memory_recall` MCP tool.
|
|
41
|
+
|
|
42
|
+
## Public API
|
|
43
|
+
|
|
44
|
+
- `createSupermemoryStore`, `SupermemoryMemoryStore`
|
|
45
|
+
- `createSupermemoryHttpClient`
|
|
46
|
+
- `formatHitsAsBlock`, `SUPERMEMORY_SOURCE`
|
|
47
|
+
- `CreateSupermemoryStoreConfig`, `SupermemoryStoreOptions`, `SupermemoryRecallHit`
|
|
48
|
+
- `SupermemoryClient`, `SupermemoryHttpClientConfig`, `SupermemoryAddParams`,
|
|
49
|
+
`SupermemorySearchParams`, `SupermemoryHit`, `SupermemoryMetadataValue`,
|
|
50
|
+
`SupermemorySearchMode`, `SupermemoryFetch`, `SupermemoryFetchResponse`
|
|
51
|
+
|
|
52
|
+
## Dependency Boundary
|
|
53
|
+
|
|
54
|
+
Depends only on `@mono-agent/agent-contracts` (for the `MemoryStore` contract types) and the
|
|
55
|
+
Fetch API. No native build, no SDK dependency — the REST client uses raw `fetch` behind an
|
|
56
|
+
injectable seam (`SupermemoryFetch`) so the store is fully unit-testable without a network.
|
|
57
|
+
|
|
58
|
+
## What This Package Does Not Own
|
|
59
|
+
|
|
60
|
+
It does not own backend selection (that is `config.memory.backend`) or the
|
|
61
|
+
`memory_recall` tool wiring; both are resolved in `@mono-agent/agent-app`. It also does not own
|
|
62
|
+
the Supermemory service itself (extraction, consolidation, and storage all happen
|
|
63
|
+
server-side). It does not run BuJo scheduled consolidation and ignores `mode`/`embeddings`/`llm`.
|
|
64
|
+
|
|
65
|
+
## Verification
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm --filter @mono-agent/memory-supermemory run build
|
|
69
|
+
pnpm --filter @mono-agent/memory-supermemory run typecheck
|
|
70
|
+
pnpm --filter @mono-agent/memory-supermemory run test
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A gated real-instance round-trip runs when `MONO_AGENT_TEST_SUPERMEMORY_BASE_URL` points
|
|
74
|
+
at a running Supermemory instance (skipped otherwise).
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin REST client for Supermemory's Memory API. Two operations back the MemoryStore adapter:
|
|
3
|
+
* - ADD `POST {base}/v3/documents` (ingestion is async; the server returns `{ id, status }`)
|
|
4
|
+
* - SEARCH `POST {base}/v4/search` (preferred; falls back to legacy `/v3/search`)
|
|
5
|
+
*
|
|
6
|
+
* Wire shapes are taken from the verified Supermemory API surface (sdk-ts api.md + docs). We use raw
|
|
7
|
+
* `fetch` behind a tiny injectable seam ({@link SupermemoryFetch}) rather than the `supermemory` SDK:
|
|
8
|
+
* the adapter only needs two endpoints, the wire format is fixed, and a raw client keeps the package
|
|
9
|
+
* dependency-free and fully unit-testable without a network or the SDK.
|
|
10
|
+
*
|
|
11
|
+
* Self-host caveat: the self-hosted binary's quickstart documents only the v3 routes, so search tries
|
|
12
|
+
* `/v4/search` first and transparently falls back to the legacy `/v3/search` (plural `containerTags`,
|
|
13
|
+
* `score` instead of `similarity`, text under `content`/`chunks[].content`) on a 404. Both response
|
|
14
|
+
* shapes are normalized into {@link SupermemoryHit}.
|
|
15
|
+
*/
|
|
16
|
+
export type SupermemorySearchMode = "memories" | "hybrid" | "documents";
|
|
17
|
+
/** A normalized, ranked memory hit (uniform across the v4 and legacy v3 response shapes). */
|
|
18
|
+
export interface SupermemoryHit {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
/** Relevance score in [0, 1]. */
|
|
22
|
+
readonly score: number;
|
|
23
|
+
}
|
|
24
|
+
/** Flat metadata values only — Supermemory rejects nested objects. */
|
|
25
|
+
export type SupermemoryMetadataValue = string | number | boolean | readonly string[];
|
|
26
|
+
export interface SupermemoryAddParams {
|
|
27
|
+
readonly content: string;
|
|
28
|
+
/** Stable id enabling idempotent upsert/de-dup of re-emitted content. */
|
|
29
|
+
readonly customId?: string;
|
|
30
|
+
readonly metadata?: Readonly<Record<string, SupermemoryMetadataValue>>;
|
|
31
|
+
}
|
|
32
|
+
export interface SupermemorySearchParams {
|
|
33
|
+
readonly query: string;
|
|
34
|
+
/** Max hits (defaults to the client's configured `searchLimit`). */
|
|
35
|
+
readonly limit?: number;
|
|
36
|
+
}
|
|
37
|
+
/** The capability the store depends on. Fakes implement this directly in unit tests. */
|
|
38
|
+
export interface SupermemoryClient {
|
|
39
|
+
/** Add a document to the agent's container. Rejects on non-2xx so callers can degrade. */
|
|
40
|
+
add(params: SupermemoryAddParams): Promise<void>;
|
|
41
|
+
/** Search the agent's container. Rejects on transport failure so `load` can degrade to undefined. */
|
|
42
|
+
search(params: SupermemorySearchParams): Promise<SupermemoryHit[]>;
|
|
43
|
+
}
|
|
44
|
+
/** Minimal response surface we use — keeps the injectable `fetch` seam trivial to stub in tests. */
|
|
45
|
+
export interface SupermemoryFetchResponse {
|
|
46
|
+
readonly status: number;
|
|
47
|
+
json(): Promise<unknown>;
|
|
48
|
+
}
|
|
49
|
+
export type SupermemoryFetch = (url: string, init: {
|
|
50
|
+
readonly method: string;
|
|
51
|
+
readonly headers: Record<string, string>;
|
|
52
|
+
readonly body: string;
|
|
53
|
+
readonly signal: AbortSignal;
|
|
54
|
+
}) => Promise<SupermemoryFetchResponse>;
|
|
55
|
+
export interface SupermemoryHttpClientConfig {
|
|
56
|
+
/** REST base URL — local OSS binary (e.g. http://127.0.0.1:6767) or hosted cloud. */
|
|
57
|
+
readonly baseUrl: string;
|
|
58
|
+
/** Bearer token. Omitted → no Authorization header (keyless local instances). */
|
|
59
|
+
readonly apiKey?: string;
|
|
60
|
+
/** Namespace tag scoping every add + search. */
|
|
61
|
+
readonly containerTag: string;
|
|
62
|
+
readonly timeoutMs?: number;
|
|
63
|
+
readonly searchLimit?: number;
|
|
64
|
+
readonly searchMode?: SupermemorySearchMode;
|
|
65
|
+
/**
|
|
66
|
+
* Minimum-similarity cutoff (0..1) applied SERVER-SIDE on v4 search. Unset (default) → no floor,
|
|
67
|
+
* so recall returns the top ranked hits like the bujo backend. Set it only to deliberately drop
|
|
68
|
+
* weak matches; a non-trivial floor on hybrid search can silently discard relevant memories.
|
|
69
|
+
*/
|
|
70
|
+
readonly threshold?: number;
|
|
71
|
+
readonly rerank?: boolean;
|
|
72
|
+
/** Injectable transport (defaults to global fetch). */
|
|
73
|
+
readonly fetch?: SupermemoryFetch;
|
|
74
|
+
}
|
|
75
|
+
export declare function createSupermemoryHttpClient(config: SupermemoryHttpClientConfig): SupermemoryClient;
|
|
76
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExE,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,sEAAsE;AACtE,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E,MAAM,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAOD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,GAAG,iBAAiB,CA0ElG"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin REST client for Supermemory's Memory API. Two operations back the MemoryStore adapter:
|
|
3
|
+
* - ADD `POST {base}/v3/documents` (ingestion is async; the server returns `{ id, status }`)
|
|
4
|
+
* - SEARCH `POST {base}/v4/search` (preferred; falls back to legacy `/v3/search`)
|
|
5
|
+
*
|
|
6
|
+
* Wire shapes are taken from the verified Supermemory API surface (sdk-ts api.md + docs). We use raw
|
|
7
|
+
* `fetch` behind a tiny injectable seam ({@link SupermemoryFetch}) rather than the `supermemory` SDK:
|
|
8
|
+
* the adapter only needs two endpoints, the wire format is fixed, and a raw client keeps the package
|
|
9
|
+
* dependency-free and fully unit-testable without a network or the SDK.
|
|
10
|
+
*
|
|
11
|
+
* Self-host caveat: the self-hosted binary's quickstart documents only the v3 routes, so search tries
|
|
12
|
+
* `/v4/search` first and transparently falls back to the legacy `/v3/search` (plural `containerTags`,
|
|
13
|
+
* `score` instead of `similarity`, text under `content`/`chunks[].content`) on a 404. Both response
|
|
14
|
+
* shapes are normalized into {@link SupermemoryHit}.
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
17
|
+
const DEFAULT_SEARCH_LIMIT = 10;
|
|
18
|
+
const DEFAULT_SEARCH_MODE = "hybrid";
|
|
19
|
+
const defaultFetch = async (url, init) => {
|
|
20
|
+
const res = await fetch(url, init);
|
|
21
|
+
return { status: res.status, json: () => res.json() };
|
|
22
|
+
};
|
|
23
|
+
export function createSupermemoryHttpClient(config) {
|
|
24
|
+
const base = config.baseUrl.replace(/\/+$/u, "");
|
|
25
|
+
const containerTag = config.containerTag;
|
|
26
|
+
const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
27
|
+
const searchLimit = config.searchLimit ?? DEFAULT_SEARCH_LIMIT;
|
|
28
|
+
const searchMode = config.searchMode ?? DEFAULT_SEARCH_MODE;
|
|
29
|
+
const threshold = config.threshold;
|
|
30
|
+
const rerank = config.rerank ?? false;
|
|
31
|
+
const doFetch = config.fetch ?? defaultFetch;
|
|
32
|
+
// Remember when an instance doesn't serve /v4 so we route straight to /v3 thereafter instead of
|
|
33
|
+
// re-probing v4 (and paying its latency) on every subsequent search.
|
|
34
|
+
let v4Available = true;
|
|
35
|
+
async function request(path, body) {
|
|
36
|
+
const controller = new AbortController();
|
|
37
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
38
|
+
try {
|
|
39
|
+
const res = await doFetch(`${base}${path}`, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"content-type": "application/json",
|
|
43
|
+
...(config.apiKey === undefined ? {} : { authorization: `Bearer ${config.apiKey}` }),
|
|
44
|
+
},
|
|
45
|
+
body: JSON.stringify(body),
|
|
46
|
+
signal: controller.signal,
|
|
47
|
+
});
|
|
48
|
+
const json = await res.json().catch(() => undefined);
|
|
49
|
+
return { status: res.status, json };
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
async add(params) {
|
|
57
|
+
const { status } = await request("/v3/documents", {
|
|
58
|
+
content: params.content,
|
|
59
|
+
containerTag,
|
|
60
|
+
...(params.customId === undefined ? {} : { customId: params.customId }),
|
|
61
|
+
...(params.metadata === undefined ? {} : { metadata: params.metadata }),
|
|
62
|
+
});
|
|
63
|
+
if (!ok(status)) {
|
|
64
|
+
throw new Error(`supermemory add failed: HTTP ${status}`);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
async search(params) {
|
|
68
|
+
const limit = params.limit ?? searchLimit;
|
|
69
|
+
if (v4Available) {
|
|
70
|
+
const v4 = await request("/v4/search", {
|
|
71
|
+
q: params.query,
|
|
72
|
+
containerTag,
|
|
73
|
+
searchMode,
|
|
74
|
+
limit,
|
|
75
|
+
// Omit the floor unless explicitly configured — match bujo's "top-N, no minimum" recall.
|
|
76
|
+
...(threshold === undefined ? {} : { threshold }),
|
|
77
|
+
rerank,
|
|
78
|
+
});
|
|
79
|
+
if (v4.status !== 404) {
|
|
80
|
+
if (!ok(v4.status)) {
|
|
81
|
+
throw new Error(`supermemory search failed: HTTP ${v4.status}`);
|
|
82
|
+
}
|
|
83
|
+
return normalizeHits(v4.json, "v4");
|
|
84
|
+
}
|
|
85
|
+
// This instance doesn't serve /v4 (self-hosted binary may only expose v3) — remember it.
|
|
86
|
+
v4Available = false;
|
|
87
|
+
}
|
|
88
|
+
const v3 = await request("/v3/search", { q: params.query, containerTags: [containerTag], limit });
|
|
89
|
+
if (!ok(v3.status)) {
|
|
90
|
+
throw new Error(`supermemory v3 search failed: HTTP ${v3.status}`);
|
|
91
|
+
}
|
|
92
|
+
return normalizeHits(v3.json, "v3");
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function ok(status) {
|
|
97
|
+
return status >= 200 && status < 300;
|
|
98
|
+
}
|
|
99
|
+
function isRecord(value) {
|
|
100
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
101
|
+
}
|
|
102
|
+
/** Pull the result array from either a `results` or `documents` envelope. */
|
|
103
|
+
function resultsOf(json) {
|
|
104
|
+
if (!isRecord(json)) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
if (Array.isArray(json.results)) {
|
|
108
|
+
return json.results;
|
|
109
|
+
}
|
|
110
|
+
if (Array.isArray(json.documents)) {
|
|
111
|
+
return json.documents;
|
|
112
|
+
}
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Normalize a search response into ranked hits. v4 carries text under `memory`/`chunk` and the score
|
|
117
|
+
* under `similarity`; legacy v3 carries text under `content`/`chunks[].content` and the score under
|
|
118
|
+
* `score`. Malformed/empty rows are dropped rather than throwing.
|
|
119
|
+
*/
|
|
120
|
+
function normalizeHits(json, shape) {
|
|
121
|
+
const hits = [];
|
|
122
|
+
for (const row of resultsOf(json)) {
|
|
123
|
+
if (!isRecord(row)) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// v4 identifies hits as `id`; the legacy v3 route uses `documentId` (fall back to `id`).
|
|
127
|
+
const idField = shape === "v4" ? row.id : row.documentId ?? row.id;
|
|
128
|
+
const id = typeof idField === "string" ? idField : "";
|
|
129
|
+
const text = shape === "v4" ? textV4(row) : textV3(row);
|
|
130
|
+
if (text.trim().length === 0) {
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const rawScore = shape === "v4" ? row.similarity : row.score;
|
|
134
|
+
const score = typeof rawScore === "number" && Number.isFinite(rawScore) ? rawScore : 0;
|
|
135
|
+
hits.push({ id, text, score });
|
|
136
|
+
}
|
|
137
|
+
return hits;
|
|
138
|
+
}
|
|
139
|
+
function textV4(row) {
|
|
140
|
+
if (typeof row.memory === "string") {
|
|
141
|
+
return row.memory;
|
|
142
|
+
}
|
|
143
|
+
if (typeof row.chunk === "string") {
|
|
144
|
+
return row.chunk;
|
|
145
|
+
}
|
|
146
|
+
return "";
|
|
147
|
+
}
|
|
148
|
+
function textV3(row) {
|
|
149
|
+
if (typeof row.content === "string") {
|
|
150
|
+
return row.content;
|
|
151
|
+
}
|
|
152
|
+
if (Array.isArray(row.chunks)) {
|
|
153
|
+
const first = row.chunks.find((c) => isRecord(c) && typeof c.content === "string");
|
|
154
|
+
if (isRecord(first) && typeof first.content === "string") {
|
|
155
|
+
return first.content;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return "";
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,mBAAmB,GAA0B,QAAQ,CAAC;AAyE5D,MAAM,YAAY,GAAqB,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IACzD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAsB,EAAE,CAAC;AAC5E,CAAC,CAAC;AAEF,MAAM,UAAU,2BAA2B,CAAC,MAAmC;IAC7E,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;IACzC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,kBAAkB,CAAC;IACzD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,oBAAoB,CAAC;IAC/D,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,mBAAmB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AO,GAAG,CAAC,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,MAAM,CAAC,GAA4B;IAC1C,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC;QACnF,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/format.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MemoryBlock } from "@mono-agent/agent-contracts";
|
|
2
|
+
import type { SupermemoryHit } from "./client.js";
|
|
3
|
+
export declare const SUPERMEMORY_SOURCE = "supermemory";
|
|
4
|
+
/**
|
|
5
|
+
* Render ranked Supermemory hits into a markdown {@link MemoryBlock}, capped at `maxBytes`. Each hit
|
|
6
|
+
* is one bullet `- (score) text` with whitespace collapsed. The block is truncated on a byte boundary
|
|
7
|
+
* (with `truncated: true`) so it never blows the per-turn recall budget.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatHitsAsBlock(hits: readonly SupermemoryHit[], maxBytes: number): MemoryBlock;
|
|
10
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAkBhD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAWhG"}
|
package/dist/format.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const SUPERMEMORY_SOURCE = "supermemory";
|
|
2
|
+
function byteLength(text) {
|
|
3
|
+
return Buffer.byteLength(text, "utf8");
|
|
4
|
+
}
|
|
5
|
+
/** Truncate to at most `maxBytes` UTF-8 bytes on a character boundary. */
|
|
6
|
+
function truncateToBytes(text, maxBytes) {
|
|
7
|
+
if (byteLength(text) <= maxBytes) {
|
|
8
|
+
return text;
|
|
9
|
+
}
|
|
10
|
+
let end = Math.min(text.length, maxBytes);
|
|
11
|
+
while (end > 0 && byteLength(text.slice(0, end)) > maxBytes) {
|
|
12
|
+
end -= 1;
|
|
13
|
+
}
|
|
14
|
+
return text.slice(0, end);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Render ranked Supermemory hits into a markdown {@link MemoryBlock}, capped at `maxBytes`. Each hit
|
|
18
|
+
* is one bullet `- (score) text` with whitespace collapsed. The block is truncated on a byte boundary
|
|
19
|
+
* (with `truncated: true`) so it never blows the per-turn recall budget.
|
|
20
|
+
*/
|
|
21
|
+
export function formatHitsAsBlock(hits, maxBytes) {
|
|
22
|
+
const full = hits
|
|
23
|
+
.map((hit) => `- (${hit.score.toFixed(3)}) ${hit.text.replace(/\s+/gu, " ").trim()}`)
|
|
24
|
+
.join("\n");
|
|
25
|
+
const truncated = byteLength(full) > maxBytes;
|
|
26
|
+
return {
|
|
27
|
+
kind: "markdown",
|
|
28
|
+
content: truncated ? truncateToBytes(full, maxBytes) : full,
|
|
29
|
+
source: SUP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,CAAC;IAC9C,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3D,MAAM,EAAE,kBAAkB;QAC1B,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SupermemorySearchMode } from "./client.js";
|
|
2
|
+
import { SupermemoryMemoryStore } from "./store.js";
|
|
3
|
+
export { createSupermemoryHttpClient } from "./client.js";
|
|
4
|
+
export type { SupermemoryAddParams, SupermemoryClient, SupermemoryFetch, SupermemoryFetchResponse, SupermemoryHit, SupermemoryHttpClientConfig, SupermemoryMetadataValue, SupermemorySearchMode, SupermemorySearchParams, } from "./client.js";
|
|
5
|
+
export { formatHitsAsBlock, SUPERMEMORY_SOURCE } from "./format.js";
|
|
6
|
+
export { SupermemoryMemoryStore } from "./store.js";
|
|
7
|
+
export type { SupermemoryRecallHit, SupermemoryStoreOptions } from "./store.js";
|
|
8
|
+
/** Config for the convenience factory that wires an HTTP client + store in one call. */
|
|
9
|
+
export interface CreateSupermemoryStoreConfig {
|
|
10
|
+
readonly baseUrl: string;
|
|
11
|
+
readonly apiKey?: string;
|
|
12
|
+
/** Namespace tag scoping this agent's memories. */
|
|
13
|
+
readonly container: string;
|
|
14
|
+
readonly timeoutMs?: number;
|
|
15
|
+
readonly maxBytes?: number;
|
|
16
|
+
readonly searchLimit?: number;
|
|
17
|
+
readonly searchMode?: SupermemorySearchMode;
|
|
18
|
+
readonly threshold?: number;
|
|
19
|
+
readonly rerank?: boolean;
|
|
20
|
+
readonly logger?: {
|
|
21
|
+
warn(message: string): void;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Build a {@link SupermemoryMemoryStore} over the REST client. The single entry point hosts use. */
|
|
25
|
+
export declare function createSupermemoryStore(config: CreateSupermemoryStoreConfig): S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AAI,CAAA;KAAE,CAAC;CACnD;AAED,qGAAqG;AACrG,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,sBAAsB,CAgBnG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSupermemoryHttpClient } from "./client.js";
|
|
2
|
+
import { SupermemoryMemoryStore } from "./store.js";
|
|
3
|
+
export { createSupermemoryHttpClient } from "./client.js";
|
|
4
|
+
export { formatHitsAsBlock, SUPERMEMORY_SOURCE } from "./format.js";
|
|
5
|
+
export { SupermemoryMemoryStore } from "./store.js";
|
|
6
|
+
/** Build a {@link SupermemoryMemoryStore} over the REST client. The single entry point hosts use. */
|
|
7
|
+
export function createSupermemoryStore(config) {
|
|
8
|
+
const client = createSupermemoryHttpClient({
|
|
9
|
+
baseUrl: config.baseUrl,
|
|
10
|
+
containerTag: config.container,
|
|
11
|
+
...(config.apiKey === undefined ? {} : { apiKey: config.apiKey }),
|
|
12
|
+
...(config.timeoutMs === undefined ? {} : { timeoutMs: config.timeoutMs }),
|
|
13
|
+
...(config.searchLimit === undefined ? {} : { searchLimit: config.searchLimit }),
|
|
14
|
+
...(config.searchMode === undefined ? {} : { searchMode: config.searchMode }),
|
|
15
|
+
...(config.threshold === undefined ? {} : { threshold: config.threshold }),
|
|
16
|
+
...(config.rerank === undefined ? {} : { rerank: config.rerank }),
|
|
17
|
+
});
|
|
18
|
+
return new SupermemoryMemoryStore(client, {
|
|
19
|
+
...(config.maxBytes === undefined ? {} : { maxBytes: config.maxBytes }),
|
|
20
|
+
...(config.searchLimit === undefined ? {} : { recallLimit: config.searchLimit }),
|
|
21
|
+
...(config.logger === undefined ? {} : { logger: config.logger }),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AAC,MAAM,EAAE,CAAC;KAClE,CAAC,CAAC;IACH,OAAO,IAAI,sBAAsB,CAAC,MAAM,EAAE;QACxC,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QACvE,GAAG,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;QAChF,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;KAClE,CAAC,CAAC;AACL,CAAC"}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { MemoryBlock, MemoryStore, MemoryWriteResult } from "@mono-agent/agent-contracts";
|
|
2
|
+
import type { SupermemoryClient } from "./client.js";
|
|
3
|
+
export interface SupermemoryStoreOptions {
|
|
4
|
+
/** Hard cap on the bytes a single `load` may return. */
|
|
5
|
+
readonly maxBytes?: number;
|
|
6
|
+
/** Max hits to request per recall (passed through to the client). */
|
|
7
|
+
readonly recallLimit?: number;
|
|
8
|
+
readonly logger?: {
|
|
9
|
+
warn(message: string): void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** A recall hit shaped like the bujo store's, so the recall MCP server can format it uniformly. */
|
|
13
|
+
export interface SupermemoryRecallHit {
|
|
14
|
+
readonly score: number;
|
|
15
|
+
readonly record: {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly text: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* MemoryStore backed by an external Supermemory instance (local OSS binary or hosted cloud).
|
|
22
|
+
*
|
|
23
|
+
* Writes are best-effort and NEVER throw — a memory failure must not break a reply. `appendHostSummary`
|
|
24
|
+
* is a bounded await that returns `bytesWritten: 0` on failure; `scheduleCapture` is fire-and-forget,
|
|
25
|
+
* serialized through a single chain (like the bujo store) so captures can't overlap or reject the
|
|
26
|
+
* chain. Supermemory does extraction/consolidation server-side, so capture just posts the raw turn —
|
|
27
|
+
* note that ingestion is async, so a just-captured turn is not immediately searchable.
|
|
28
|
+
*
|
|
29
|
+
* `load` degrades to `undefined` on any client error (mirroring how the harness treats empty recall),
|
|
30
|
+
* so a slow/down backend yields no context rather than a failed turn.
|
|
31
|
+
*/
|
|
32
|
+
export declare class SupermemoryMemoryStore implements MemoryStore {
|
|
33
|
+
private readonly client;
|
|
34
|
+
private captureChain;
|
|
35
|
+
private readonly maxBytes;
|
|
36
|
+
private readonly recallLimit;
|
|
37
|
+
private readonly logger;
|
|
38
|
+
constructor(client: SupermemoryClient, options?: SupermemoryStoreOptions);
|
|
39
|
+
load(conversationId: string, query?: string): Promise<MemoryBlock | undefined>;
|
|
40
|
+
appendHostSummary(conversationId: string, summary: string): Promise<MemoryWriteResult>;
|
|
41
|
+
scheduleCapture(conversationId: string, text: string): void;
|
|
42
|
+
flush(): Promise<void>;
|
|
43
|
+
/** Drain queued captures (HTTP client owns no handle to close). */
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Recall hits shaped for the in-app `memory_recall` MCP tool (Stage 3 reuses the bujo formatter).
|
|
47
|
+
* Unlike `load`, this propagates client errors so the recall tool can report a search failure.
|
|
48
|
+
*/
|
|
49
|
+
recall(query: string, options?: {
|
|
50
|
+
readonly topK?: number;
|
|
51
|
+
}): Promise<SupermemoryRecallHit[]>;
|
|
52
|
+
private search;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,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AC,IAAI,CAAC;IAI5B,mEAAmE;IAC7D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;YAKpF,MAAM;CAIrB"}
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { formatHitsAsBlock, SUPERMEMORY_SOURCE } from "./format.js";
|
|
3
|
+
/** Default per-turn recall budget (bytes) — mirrors the host's DEFAULT_MEMORY_MAX_BYTES. */
|
|
4
|
+
const DEFAULT_MAX_BYTES = 64_000;
|
|
5
|
+
const NOOP_LOGGER = { warn: (_message) => { } };
|
|
6
|
+
/**
|
|
7
|
+
* MemoryStore backed by an external Supermemory instance (local OSS binary or hosted cloud).
|
|
8
|
+
*
|
|
9
|
+
* Writes are best-effort and NEVER throw — a memory failure must not break a reply. `appendHostSummary`
|
|
10
|
+
* is a bounded await that returns `bytesWritten: 0` on failure; `scheduleCapture` is fire-and-forget,
|
|
11
|
+
* serialized through a single chain (like the bujo store) so captures can't overlap or reject the
|
|
12
|
+
* chain. Supermemory does extraction/consolidation server-side, so capture just posts the raw turn —
|
|
13
|
+
* note that ingestion is async, so a just-captured turn is not immediately searchable.
|
|
14
|
+
*
|
|
15
|
+
* `load` degrades to `undefined` on any client error (mirroring how the harness treats empty recall),
|
|
16
|
+
* so a slow/down backend yields no context rather than a failed turn.
|
|
17
|
+
*/
|
|
18
|
+
export class SupermemoryMemoryStore {
|
|
19
|
+
client;
|
|
20
|
+
captureChain = Promise.resolve();
|
|
21
|
+
maxBytes;
|
|
22
|
+
recallLimit;
|
|
23
|
+
logger;
|
|
24
|
+
constructor(client, options = {}) {
|
|
25
|
+
this.client = client;
|
|
26
|
+
this.maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
27
|
+
this.recallLimit = options.recallLimit;
|
|
28
|
+
this.logger = options.logger ?? NOOP_LOGGER;
|
|
29
|
+
}
|
|
30
|
+
async load(conversationId, query) {
|
|
31
|
+
const q = (query ?? "").trim().length > 0 ? query : conversationId;
|
|
32
|
+
try {
|
|
33
|
+
const hits = await this.search(q);
|
|
34
|
+
if (hits.length === 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return formatHitsAsBlock(hits, this.maxBytes);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
this.logger.warn(`supermemory recall failed: ${message(error)}`);
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async appendHostSummary(conversationId, summary) {
|
|
45
|
+
const bytes = Buffer.byteLength(summary, "utf8");
|
|
46
|
+
try {
|
|
47
|
+
await this.client.add({
|
|
48
|
+
content: summary,
|
|
49
|
+
// Idempotent: re-emitting the same one-liner upserts instead of duplicating. Supermemory
|
|
50
|
+
// customIds allow only [A-Za-z0-9._-], so use a hyphen separator (NOT a colon — that is
|
|
51
|
+
// rejected, which would silently drop the write).
|
|
52
|
+
customId: `host-summary-${stableId(`${conversationId}\n${summary}`)}`,
|
|
53
|
+
metadata: { kind: "host-summary", conversationId },
|
|
54
|
+
});
|
|
55
|
+
return { conversationId, source: SUPERMEMORY_SOURCE, bytesWritten: bytes };
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
this.logger.warn(`supermemory appendHostSummary failed: ${message(error)}`);
|
|
59
|
+
return { conversationId, source: SUPERMEMORY_SOURCE, bytesWritten: 0 };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
scheduleCapture(conversationId, text) {
|
|
63
|
+
this.captureChain = this.captureChain
|
|
64
|
+
.then(async () => {
|
|
65
|
+
try {
|
|
66
|
+
await this.client.add({ content: text, metadata: { kind: "turn-capture", conversationId } });
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
this.logger.warn(`supermemory capture failed: ${message(error)}`);
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
// Terminal guard: the chain must never settle rejected, or every future capture would be skipped.
|
|
73
|
+
.catch(() => undefined);
|
|
74
|
+
}
|
|
75
|
+
async flush() {
|
|
76
|
+
await this.captureChain;
|
|
77
|
+
}
|
|
78
|
+
/** Drain queued captures (HTTP client owns no handle to close). */
|
|
79
|
+
async close() {
|
|
80
|
+
await this.flush();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Recall hits shaped for the in-app `memory_recall` MCP tool (Stage 3 reuses the bujo formatter).
|
|
84
|
+
* Unlike `load`, this propagates client errors so the recall tool can report a search failure.
|
|
85
|
+
*/
|
|
86
|
+
async recall(query, options) {
|
|
87
|
+
const hits = await this.search(query, options?.topK);
|
|
88
|
+
return hits.map((hit) => ({ score: hit.score, record: { id: hit.id, text: hit.text } }));
|
|
89
|
+
}
|
|
90
|
+
async search(query, topK) {
|
|
91
|
+
const limit = topK ?? this.recallLimit;
|
|
92
|
+
return this.client.search({ query, ...(limit === undefined ? {} : { limit }) });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function stableId(input) {
|
|
96
|
+
return createHash("sha1").update(input).digest("hex").slice(0, 24);
|
|
97
|
+
}
|
|
98
|
+
function message(error) {
|
|
99
|
+
return error instanceof Error ? error.message : String(error);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEpE,4FAA4F;AAC5F,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAgBjC,MAAM,WAAW,GAAG,EAA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|
+
{
|
|
2
|
+
"name": "@mono-agent/memory-supermemory",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Supermemory external memory backend: a MemoryStore over Supermemory's REST API (local OSS binary or hosted cloud).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"private": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@mono-agent/agent-contracts": "0.4.1"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
29
|
+
"test": "vitest run --passWithNoTests"
|
|
30
|
+
}
|
|
31
|
+
}
|