dsh-mnemon-provider-supermemory 0.5.0-rc.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-external contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # dsh-mnemon-provider-supermemory
2
+
3
+ Semantic memory, persistent profiles, conversation ingest, and multi-container recall.
4
+
5
+ This is a Memory Spaces **child module**, not a top-level Mnemon contribution. Its manifest, descriptor, driver, build and tests live here. It uses only the public dsh-mnemon-source-memory-spaces/provider-sdk entry.
6
+
7
+ Install alongside the Memory Spaces Source, then list { use: 'dsh-mnemon-provider-supermemory', instanceId: 'supermemory' } in that Source's providers. Multiple Source instances own independent children. Connection settings remain Source-owned; secret fields are never projected to the LLM.
8
+
9
+ Run pnpm install && pnpm verify from this directory. No root test config or private controller is required.
@@ -0,0 +1,86 @@
1
+ //#endregion
2
+ //#region src/descriptor.ts
3
+ /** Browser-safe metadata owned by this Provider. */
4
+ const descriptor = {
5
+ "id": "supermemory",
6
+ "label": "Supermemory",
7
+ "icon": {
8
+ "kind": "data-url",
9
+ "value": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMCAyNCIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0iTTI5LjMzODggOS40Njc2N0gxOC40NDhWMC4wMDE0NjQ4NEgxNC45MjkzVjEwLjI3MjVDMTQuOTI5MyAxMS4zNjM0IDE1LjM2IDEyLjQxMSAxNi4xMjU0IDEzLjE4M0wyNS4wMTggMjIuMTUxTDI3LjUwNiAxOS42NDE5TDIwLjkzOCAxMy4wMTgzSDI5LjM0MDhWOS40Njk3NUwyOS4zMzg4IDkuNDY3NjdaIiBmaWxsPSIjMEIxMDE1Ii8+CiAgPHBhdGggZD0iTTEuODI4MzkgNC4zNjA1Nkw4LjM5NjMzIDEwLjk4NDJILTAuMDA2NDY5NzNWMTQuNTMyOEgxMC44ODQzVjIzLjk5OUgxNC40MDNWMTMuNzI4QzE0LjQwMyAxMi42MzcgMTMuOTcyMyAxMS41ODk0IDEzLjIwNjkgMTAuODE3NUw0LjMxNjM1IDEuODUxNDdMMS44MjgzOSA0LjM2MDU2WiIgZmlsbD0iIzBCMTAxNSIvPgo8L3N2Zz4K"
10
+ },
11
+ "kind": "remote",
12
+ "workspaceBinding": "provider-global",
13
+ "summary": "Semantic memory, persistent profiles, conversation ingest, and multi-container recall.",
14
+ "summaryI18nKey": "overview.providerSummary.supermemory",
15
+ "origin": "third-party",
16
+ "capabilities": {
17
+ "search": true,
18
+ "browse": true,
19
+ "graph": false,
20
+ "entities": false,
21
+ "related": false,
22
+ "remember": true,
23
+ "link": false,
24
+ "forget": true,
25
+ "writeMode": "async-extracting",
26
+ "deletionMode": "soft"
27
+ },
28
+ "fields": [
29
+ {
30
+ "key": "endpoint",
31
+ "label": "Endpoint",
32
+ "scope": "service",
33
+ "input": "url",
34
+ "required": true,
35
+ "defaultValue": "https://api.supermemory.ai",
36
+ "i18nKey": "overview.providerEndpoint"
37
+ },
38
+ {
39
+ "key": "apiKey",
40
+ "label": "API key",
41
+ "scope": "service",
42
+ "input": "secret",
43
+ "required": true,
44
+ "i18nKey": "overview.providerApiKey"
45
+ },
46
+ {
47
+ "key": "containerTag",
48
+ "label": "Container tag",
49
+ "scope": "memory",
50
+ "input": "text",
51
+ "required": true,
52
+ "defaultValue": "dsh",
53
+ "maxLength": 100,
54
+ "pattern": "^[a-zA-Z0-9_:-]+$",
55
+ "i18nKey": "overview.providerField.containerTag"
56
+ },
57
+ {
58
+ "key": "searchMode",
59
+ "label": "Search mode",
60
+ "scope": "memory",
61
+ "input": "select",
62
+ "required": true,
63
+ "defaultValue": "hybrid",
64
+ "options": [
65
+ {
66
+ "value": "hybrid",
67
+ "label": "Hybrid",
68
+ "i18nKey": "overview.providerOption.hybrid"
69
+ },
70
+ {
71
+ "value": "memories",
72
+ "label": "Memories",
73
+ "i18nKey": "overview.providerOption.memories"
74
+ },
75
+ {
76
+ "value": "documents",
77
+ "label": "Documents",
78
+ "i18nKey": "overview.providerOption.documents"
79
+ }
80
+ ],
81
+ "i18nKey": "overview.providerField.searchMode"
82
+ }
83
+ ]
84
+ };
85
+ //#endregion
86
+ export { descriptor as t };
@@ -0,0 +1,6 @@
1
+ import { MemoryProviderDescriptor } from "dsh-mnemon-source-memory-spaces/provider-sdk";
2
+ //#region src/descriptor.d.ts
3
+ /** Browser-safe metadata owned by this Provider. */
4
+ declare const descriptor: MemoryProviderDescriptor;
5
+ //#endregion
6
+ export { descriptor };
@@ -0,0 +1,2 @@
1
+ import { t as descriptor } from "./descriptor-C8c57i4i.js";
2
+ export { descriptor };
package/lib/index.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { descriptor } from "./descriptor.js";
2
+ import { HttpMemoryProvider, HttpProviderOptions, Insight, JsonValue, MemoryBody, MemoryListRequest, MemoryProviderAdapter, MemorySpaceAuthority, ProviderBodyStatus, ProviderMemorySpace, ProviderSearchResult, RememberRequest, SearchRequest } from "dsh-mnemon-source-memory-spaces/provider-sdk";
3
+ //#region src/driver.d.ts
4
+ declare class SupermemoryProvider extends HttpMemoryProvider implements MemoryProviderAdapter {
5
+ readonly id: "supermemory";
6
+ readonly scoreSemantics: import("dsh-mnemon-source-memory-spaces/provider-sdk").ProviderScoreSemantics;
7
+ constructor(memoryBodies: MemorySpaceAuthority, options?: HttpProviderOptions);
8
+ discover(connection: Record<string, string | number | boolean>, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
9
+ status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
10
+ search(body: MemoryBody, request: SearchRequest, signal?: AbortSignal): Promise<ProviderSearchResult>;
11
+ list(body: MemoryBody, request: MemoryListRequest, signal?: AbortSignal): Promise<Insight[]>;
12
+ remember(body: MemoryBody, request: RememberRequest, signal?: AbortSignal): Promise<JsonValue>;
13
+ forget(body: MemoryBody, id: string, signal?: AbortSignal): Promise<JsonValue>;
14
+ private headers;
15
+ }
16
+ //#endregion
17
+ //#region src/index.d.ts
18
+ declare const definition: import("dsh-mnemon-source-memory-spaces/provider-sdk").MemorySpaceProviderDefinition;
19
+ declare const _default: import("dsh-mnemon-source-memory-spaces/provider-sdk").MemorySpaceProviderModule<undefined>;
20
+ //#endregion
21
+ export { SupermemoryProvider, _default as default, definition, descriptor };
package/lib/index.js ADDED
@@ -0,0 +1,200 @@
1
+ import { t as descriptor } from "./descriptor-C8c57i4i.js";
2
+ import { HttpMemoryProvider, MEMORY_SPACE_PROVIDER_API_VERSION, NORMALIZED_RELEVANCE_SCORE, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, firstArray, jsonNumber, jsonObject, jsonString } from "dsh-mnemon-source-memory-spaces/provider-sdk";
3
+ //#region src/driver.ts
4
+ function insight(value) {
5
+ const item = jsonObject(value);
6
+ const id = jsonString(item?.id);
7
+ const content = jsonString(item?.memory) ?? jsonString(item?.chunk) ?? jsonString(item?.content);
8
+ if (id === void 0 || content === void 0) return void 0;
9
+ const metadata = jsonObject(item?.metadata);
10
+ const score = jsonNumber(item?.similarity) ?? jsonNumber(item?.score);
11
+ const createdAt = jsonString(item?.updatedAt) ?? jsonString(item?.createdAt);
12
+ return {
13
+ id,
14
+ content,
15
+ category: jsonString(metadata?.category) ?? "general",
16
+ source: "external",
17
+ ...score === void 0 ? {} : { score },
18
+ ...createdAt === void 0 ? {} : { createdAt }
19
+ };
20
+ }
21
+ var SupermemoryProvider = class extends HttpMemoryProvider {
22
+ id = "supermemory";
23
+ scoreSemantics = NORMALIZED_RELEVANCE_SCORE;
24
+ constructor(memoryBodies, options = {}) {
25
+ super(memoryBodies, {
26
+ label: descriptor.label,
27
+ ...options
28
+ });
29
+ }
30
+ async discover(connection, signal) {
31
+ const payload = await this.requestConnection(connection, "/v3/container-tags/list", {
32
+ headers: this.headers(connection),
33
+ signal
34
+ });
35
+ return firstArray(payload, "containerTags", "items").flatMap((value) => {
36
+ const item = jsonObject(value);
37
+ const tag = jsonString(item?.containerTag) ?? jsonString(item?.container_tag);
38
+ if (tag === void 0) return [];
39
+ return [{
40
+ externalId: jsonString(item?.id) ?? tag,
41
+ name: jsonString(item?.name) ?? tag,
42
+ description: jsonString(item?.description) ?? `Supermemory space ${tag}`,
43
+ connection: {
44
+ containerTag: tag,
45
+ searchMode: "hybrid"
46
+ }
47
+ }];
48
+ });
49
+ }
50
+ async status(body, signal) {
51
+ try {
52
+ await this.list(body, { limit: 1 }, signal);
53
+ return { healthy: true };
54
+ } catch (error) {
55
+ return {
56
+ healthy: false,
57
+ error: error instanceof Error ? error.message : String(error)
58
+ };
59
+ }
60
+ }
61
+ async search(body, request, signal) {
62
+ const connection = this.connection(body);
63
+ const payload = await this.request(body, "/v4/search", {
64
+ headers: this.headers(connection),
65
+ json: {
66
+ q: request.query,
67
+ containerTag: String(connection.containerTag),
68
+ searchMode: String(connection.searchMode ?? "hybrid"),
69
+ limit: request.limit ?? 10
70
+ },
71
+ signal
72
+ });
73
+ return { results: firstArray(payload, "results").map(insight).filter((item) => item !== void 0) };
74
+ }
75
+ async list(body, request, signal) {
76
+ const connection = this.connection(body);
77
+ const limit = Math.min(Math.max(request.limit ?? 200, 1), 200);
78
+ const payload = await this.request(body, "/v4/memories/list", {
79
+ headers: this.headers(connection),
80
+ json: {
81
+ containerTags: [String(connection.containerTag)],
82
+ limit,
83
+ page: 1,
84
+ sort: "createdAt",
85
+ order: "desc"
86
+ },
87
+ signal
88
+ });
89
+ const memories = firstArray(payload, "memoryEntries", "results").map(insight).filter((item) => item !== void 0);
90
+ const documents = await this.request(body, "/v3/documents/documents", {
91
+ headers: this.headers(connection),
92
+ json: {
93
+ containerTags: [String(connection.containerTag)],
94
+ limit,
95
+ page: 1,
96
+ sort: "createdAt",
97
+ order: "desc"
98
+ },
99
+ signal
100
+ });
101
+ const projectedDocuments = firstArray(documents, "documents", "memories", "results").map(insight).filter((item) => item !== void 0);
102
+ return [...new Map([...memories, ...projectedDocuments].map((item) => [item.id, item])).values()].filter((item) => request.category === void 0 || item.category === request.category).slice(0, limit);
103
+ }
104
+ async remember(body, request, signal) {
105
+ const connection = this.connection(body);
106
+ const payload = await this.request(body, "/v3/documents", {
107
+ headers: this.headers(connection),
108
+ json: {
109
+ content: request.content,
110
+ containerTag: String(connection.containerTag),
111
+ taskType: "memory",
112
+ metadata: {
113
+ sm_source: "dsh-mnemon",
114
+ ...request.category === void 0 ? {} : { category: request.category },
115
+ ...request.importance === void 0 ? {} : { importance: request.importance }
116
+ }
117
+ },
118
+ signal
119
+ });
120
+ const result = jsonObject(payload) ?? {};
121
+ return {
122
+ action: "queued",
123
+ provider: this.id,
124
+ summary: "Supermemory accepted the memory document for extraction.",
125
+ ...jsonString(result.id) === void 0 ? {} : { id: jsonString(result.id) },
126
+ ...jsonString(result.status) === void 0 ? {} : { status: jsonString(result.status) }
127
+ };
128
+ }
129
+ async forget(body, id, signal) {
130
+ const connection = this.connection(body);
131
+ try {
132
+ const payload = await this.request(body, "/v4/memories", {
133
+ method: "DELETE",
134
+ headers: this.headers(connection),
135
+ json: {
136
+ id,
137
+ containerTag: String(connection.containerTag),
138
+ reason: "Deleted from dsh-mnemon"
139
+ },
140
+ signal
141
+ });
142
+ return {
143
+ action: "deleted",
144
+ provider: this.id,
145
+ id,
146
+ ...jsonObject(payload)?.forgotten === void 0 ? {} : { forgotten: jsonObject(payload).forgotten }
147
+ };
148
+ } catch (error) {
149
+ if (!(error instanceof Error) || !/HTTP 404\b/u.test(error.message)) throw error;
150
+ await this.request(body, `/v3/documents/${encodeURIComponent(id)}`, {
151
+ method: "DELETE",
152
+ headers: this.headers(connection),
153
+ signal
154
+ });
155
+ return {
156
+ action: "deleted",
157
+ provider: this.id,
158
+ id,
159
+ document: true
160
+ };
161
+ }
162
+ }
163
+ headers(connection) {
164
+ return {
165
+ Authorization: `Bearer ${String(connection.apiKey ?? "").replace(/^Bearer\s+/iu, "")}`,
166
+ "x-sm-source": "dsh-mnemon"
167
+ };
168
+ }
169
+ };
170
+ //#endregion
171
+ //#region src/index.ts
172
+ const definition = defineMemorySpaceProviderDefinition({
173
+ manifest: {
174
+ apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION,
175
+ kind: "provider",
176
+ typeId: descriptor.id,
177
+ packageName: "dsh-mnemon-provider-supermemory",
178
+ version: "0.5.0-rc.1",
179
+ label: descriptor.label,
180
+ icon: descriptor.icon,
181
+ summary: descriptor.summary,
182
+ ...descriptor.summaryI18nKey === void 0 ? {} : { summaryI18nKey: descriptor.summaryI18nKey },
183
+ origin: descriptor.origin,
184
+ locality: descriptor.kind,
185
+ workspaceBinding: descriptor.workspaceBinding,
186
+ capabilities: descriptor.capabilities,
187
+ fields: descriptor.fields,
188
+ secrets: descriptor.fields.filter((field) => field.input === "secret").map((field) => field.key),
189
+ scoreSemantics: "normalized-relevance"
190
+ },
191
+ create: (context) => new SupermemoryProvider(context.memoryBodies, { requestTimeoutMs: context.config.timeoutMs })
192
+ });
193
+ var src_default = defineMemorySpaceProvider({
194
+ id: descriptor.id,
195
+ apply(ctx, host) {
196
+ host.install(ctx, definition);
197
+ }
198
+ });
199
+ //#endregion
200
+ export { SupermemoryProvider, src_default as default, definition, descriptor };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "dsh-mnemon-provider-supermemory",
3
+ "version": "0.5.0-rc.1",
4
+ "description": "Supermemory Provider child for the Memory Spaces Source.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=20"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./lib/index.d.ts",
13
+ "default": "./lib/index.js"
14
+ },
15
+ "./descriptor": {
16
+ "types": "./lib/descriptor.d.ts",
17
+ "default": "./lib/descriptor.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "lib",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "typecheck": "tsc --noEmit",
27
+ "build": "tsdown",
28
+ "test": "vitest run",
29
+ "verify": "pnpm typecheck && pnpm test && pnpm build"
30
+ },
31
+ "peerDependencies": {
32
+ "@deepseek-ai/cordis": "^4.0.1",
33
+ "dsh-mnemon-source-memory-spaces": "0.5.0-rc.1"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^22.0.0",
37
+ "dsh-mnemon-source-memory-spaces": "0.5.0-rc.1",
38
+ "tsdown": "^0.22.0",
39
+ "typescript": "^5.9.0",
40
+ "vitest": "^3.2.0"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "tag": "rc"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/omdsh-dev/dsh-mnemon.git",
49
+ "directory": "plugins/dsh-mnemon-provider-supermemory"
50
+ },
51
+ "homepage": "https://github.com/omdsh-dev/dsh-mnemon/tree/main/plugins/dsh-mnemon-provider-supermemory#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/omdsh-dev/dsh-mnemon/issues"
54
+ }
55
+ }