dsh-mnemon-provider-openviking 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-openviking
2
+
3
+ Filesystem-shaped shared memory with tiered reads and automatic semantic extraction.
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-openviking', instanceId: 'openviking' } 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,88 @@
1
+ //#endregion
2
+ //#region src/descriptor.ts
3
+ /** Browser-safe metadata owned by this Provider. */
4
+ const descriptor = {
5
+ "id": "openviking",
6
+ "label": "OpenViking",
7
+ "icon": {
8
+ "kind": "data-url",
9
+ "value": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAASKADAAQAAAABAAAASAAAAACQMUbvAAAVNUlEQVR4Ae2bCZRUxbmA/7pLb7d7erpnumdlmAWQYUAMsiggkBhjjCImUZK8qE89CDEeTWKi5GXxzXkxmrgmGlBUIiQRI8YsgLhBQEVwYRWGgRlmX3q6p3t6X+5a76/ByRtx2GSgOS8Up0/drrm3btXHX3/9SzXAuXKOwDkC5wj8GxJYuHC7+G847ROf8tptkVt/+Xz0xhN/Ijt3ctl5LQBHoHVEkXXlzQ/1LZ27cLstW+M4a997/o9el/a0yPXPbab0nt+nX1vweKj0rB1stgb2br3ycChF6VNvUFr7vLxv0eP+idkay9Hem7UlxgaEErQWK336WEq9eaYaj9PxylWLm88qSFkFtK8lvaM7ZLRUFhFSWWBQr8daAkT/be0zjaXLlp0du1xWAS293ZvoS2hbNRSjz1US8DgM6pQsl+xuydxw8RXjfrX6rZ4JTNKyWbIKiE08kjT+GUsB5OUQqB5BoLgoh2vvVmb3RuiGiaNd/1i/JXDFvzWg3ri2IxIzZFkFMroYoLrMRHNzrJfeeG+dry9GfzNhnOtv698NXJstSFmXoM7WYKeigc8gAAJPYEaNCC5XrjCq1HLLxWMtjzd2GZsnT3Cv+tsW3/xsQMo6oNqby6NpWe8CBKTqQMsLeaguNwMYcNUND/VIr26N3L6/A6LTJ3ie+8eWnqvPNKSsAwIgFIuPTVwzAHiOks9fYKVmq1SeCodnPrSooGlvc+LnHX28bfK4vJVr3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MG+Ifu81zrOQLnCJwj8P+LwP8CaTGCYxH2NZgAAAAASUVORK5CYII="
10
+ },
11
+ "kind": "remote",
12
+ "workspaceBinding": "provider-global",
13
+ "summary": "Filesystem-shaped shared memory with tiered reads and automatic semantic extraction.",
14
+ "summaryI18nKey": "overview.providerSummary.openviking",
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": "hard"
27
+ },
28
+ "fields": [
29
+ {
30
+ "key": "endpoint",
31
+ "label": "Endpoint",
32
+ "scope": "service",
33
+ "input": "url",
34
+ "required": true,
35
+ "defaultValue": "http://127.0.0.1:1933",
36
+ "placeholder": "http://127.0.0.1:1933",
37
+ "i18nKey": "overview.providerEndpoint"
38
+ },
39
+ {
40
+ "key": "targetUri",
41
+ "label": "Memory URI",
42
+ "scope": "memory",
43
+ "input": "text",
44
+ "required": true,
45
+ "defaultValue": "viking://user/memories",
46
+ "placeholder": "viking://user/memories",
47
+ "pattern": "^viking://user(?:/[^/]+)?/memories$",
48
+ "normalize": "trim-trailing-slash",
49
+ "validationMessage": "OpenViking memory URI must be a viking://user/.../memories root",
50
+ "i18nKey": "overview.providerTargetUri"
51
+ },
52
+ {
53
+ "key": "apiKey",
54
+ "label": "API key",
55
+ "scope": "service",
56
+ "input": "secret",
57
+ "required": false,
58
+ "i18nKey": "overview.providerApiKey"
59
+ },
60
+ {
61
+ "key": "account",
62
+ "label": "Account",
63
+ "scope": "service",
64
+ "input": "text",
65
+ "required": false,
66
+ "i18nKey": "overview.providerAccount"
67
+ },
68
+ {
69
+ "key": "user",
70
+ "label": "User",
71
+ "scope": "memory",
72
+ "input": "text",
73
+ "required": false,
74
+ "i18nKey": "overview.providerUser"
75
+ },
76
+ {
77
+ "key": "actorPeerId",
78
+ "label": "Agent peer",
79
+ "scope": "memory",
80
+ "input": "text",
81
+ "required": false,
82
+ "defaultValue": "dsh",
83
+ "i18nKey": "overview.providerActorPeer"
84
+ }
85
+ ]
86
+ };
87
+ //#endregion
88
+ 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-OAMVgT8m.js";
2
+ export { descriptor };
package/lib/index.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { descriptor } from "./descriptor.js";
2
+ import { Insight, JsonValue, MemoryBody, MemoryGraphSnapshot, MemoryListRequest, MemoryProviderAdapter, MemoryProviderConnection, MemorySpaceAuthority, ProviderBodyStatus, ProviderMemorySpace, ProviderSearchResult, RememberRequest, SearchRequest } from "dsh-mnemon-source-memory-spaces/provider-sdk";
3
+ //#region src/driver.d.ts
4
+ interface OpenVikingProviderOptions {
5
+ fetch?: typeof fetch;
6
+ requestTimeoutMs?: number;
7
+ settlementTimeoutMs?: number;
8
+ pollIntervalMs?: number;
9
+ }
10
+ declare class OpenVikingProvider implements MemoryProviderAdapter {
11
+ private readonly memoryBodies;
12
+ readonly id: "openviking";
13
+ readonly scoreSemantics: import("dsh-mnemon-source-memory-spaces/provider-sdk").ProviderScoreSemantics;
14
+ private readonly requestFetch;
15
+ private readonly requestTimeoutMs;
16
+ private readonly settlementTimeoutMs;
17
+ private readonly pollIntervalMs;
18
+ constructor(memoryBodies: MemorySpaceAuthority, options?: OpenVikingProviderOptions);
19
+ discover(connection: MemoryProviderConnection, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
20
+ status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
21
+ search(body: MemoryBody, request: SearchRequest, signal?: AbortSignal): Promise<ProviderSearchResult>;
22
+ graph(body: MemoryBody, signal?: AbortSignal): Promise<MemoryGraphSnapshot>;
23
+ list(body: MemoryBody, request: MemoryListRequest, signal?: AbortSignal): Promise<Insight[]>;
24
+ remember(body: MemoryBody, request: RememberRequest, signal?: AbortSignal): Promise<JsonValue>;
25
+ forget(body: MemoryBody, id: string, signal?: AbortSignal): Promise<JsonValue>;
26
+ private connection;
27
+ private settleTask;
28
+ private request;
29
+ private requestConnection;
30
+ }
31
+ //#endregion
32
+ //#region src/index.d.ts
33
+ declare const definition: import("dsh-mnemon-source-memory-spaces/provider-sdk").MemorySpaceProviderDefinition;
34
+ declare const _default: import("dsh-mnemon-source-memory-spaces/provider-sdk").MemorySpaceProviderModule<undefined>;
35
+ //#endregion
36
+ export { OpenVikingProvider, _default as default, definition, descriptor };
package/lib/index.js ADDED
@@ -0,0 +1,330 @@
1
+ import { t as descriptor } from "./descriptor-OAMVgT8m.js";
2
+ import { MEMORY_SPACE_PROVIDER_API_VERSION, NORMALIZED_RELEVANCE_SCORE, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition } from "dsh-mnemon-source-memory-spaces/provider-sdk";
3
+ import { randomUUID } from "node:crypto";
4
+ //#region src/driver.ts
5
+ function object(value) {
6
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
7
+ }
8
+ function string(value) {
9
+ return typeof value === "string" ? value : void 0;
10
+ }
11
+ function number(value) {
12
+ return typeof value === "number" && Number.isFinite(value) ? value : void 0;
13
+ }
14
+ function delay(ms, signal) {
15
+ if (signal?.aborted === true) return Promise.reject(signal.reason ?? /* @__PURE__ */ new Error("OpenViking request aborted"));
16
+ return new Promise((resolve, reject) => {
17
+ const aborted = () => {
18
+ clearTimeout(timer);
19
+ reject(signal?.reason ?? /* @__PURE__ */ new Error("OpenViking request aborted"));
20
+ };
21
+ const timer = setTimeout(() => {
22
+ signal?.removeEventListener("abort", aborted);
23
+ resolve();
24
+ }, ms);
25
+ signal?.addEventListener("abort", aborted, { once: true });
26
+ });
27
+ }
28
+ function categoryFromUri(uri) {
29
+ const marker = "/memories/";
30
+ return (uri.includes(marker) ? uri.slice(uri.indexOf(marker) + 10) : "").split("/")[0]?.replace(/\.md$/u, "") || "general";
31
+ }
32
+ var OpenVikingProvider = class {
33
+ memoryBodies;
34
+ id = "openviking";
35
+ scoreSemantics = NORMALIZED_RELEVANCE_SCORE;
36
+ requestFetch;
37
+ requestTimeoutMs;
38
+ settlementTimeoutMs;
39
+ pollIntervalMs;
40
+ constructor(memoryBodies, options = {}) {
41
+ this.memoryBodies = memoryBodies;
42
+ this.requestFetch = options.fetch ?? globalThis.fetch;
43
+ this.requestTimeoutMs = options.requestTimeoutMs ?? 15e3;
44
+ this.settlementTimeoutMs = options.settlementTimeoutMs ?? 12e4;
45
+ this.pollIntervalMs = options.pollIntervalMs ?? 750;
46
+ }
47
+ async discover(connection, signal) {
48
+ let account = String(connection.account ?? "").trim();
49
+ if (account === "") {
50
+ const accounts = await this.requestConnection(connection, "/api/v1/admin/accounts", {}, { signal });
51
+ const ids = (Array.isArray(accounts) ? accounts : []).flatMap((value) => {
52
+ const id = string(object(value)?.account_id) ?? string(object(value)?.id);
53
+ return id === void 0 ? [] : [id];
54
+ });
55
+ if (ids.length > 1) throw new Error("OpenViking exposes multiple accounts; configure the account to select one discovery scope");
56
+ account = ids[0] ?? "default";
57
+ }
58
+ const users = await this.requestConnection({
59
+ ...connection,
60
+ account
61
+ }, `/api/v1/admin/accounts/${encodeURIComponent(account)}/users?limit=100`, {}, { signal });
62
+ return (Array.isArray(users) ? users : []).flatMap((value) => {
63
+ const item = object(value);
64
+ const user = string(item?.user_id) ?? string(item?.id) ?? string(item?.name);
65
+ if (user === void 0) return [];
66
+ return [{
67
+ externalId: `${account}:${user}`,
68
+ name: string(item?.display_name) ?? string(item?.name) ?? user,
69
+ description: string(item?.description) ?? string(item?.role) ?? `OpenViking memory namespace for ${user}`,
70
+ connection: {
71
+ targetUri: "viking://user/memories",
72
+ user,
73
+ actorPeerId: "dsh"
74
+ }
75
+ }];
76
+ });
77
+ }
78
+ async status(body, signal) {
79
+ try {
80
+ await this.request(body, "/health", {}, {
81
+ signal,
82
+ timeoutMs: 5e3
83
+ });
84
+ return { healthy: true };
85
+ } catch (error) {
86
+ return {
87
+ healthy: false,
88
+ error: error instanceof Error ? error.message : String(error)
89
+ };
90
+ }
91
+ }
92
+ async search(body, request, signal) {
93
+ const connection = this.connection(body);
94
+ const root = object(await this.request(body, "/api/v1/search/find", {
95
+ method: "POST",
96
+ body: JSON.stringify({
97
+ query: request.query,
98
+ target_uri: connection.targetUri,
99
+ context_type: ["memory"],
100
+ limit: request.limit
101
+ })
102
+ }, { signal }));
103
+ return { results: (Array.isArray(root?.memories) ? root.memories : []).flatMap((value) => {
104
+ const item = object(value);
105
+ const uri = string(item?.uri);
106
+ if (uri === void 0) return [];
107
+ const score = number(item?.score);
108
+ return [{
109
+ id: uri,
110
+ externalUri: uri,
111
+ content: string(item?.overview) ?? string(item?.abstract) ?? uri,
112
+ category: string(item?.category) ?? categoryFromUri(uri),
113
+ source: "external",
114
+ ...score === void 0 ? {} : { score }
115
+ }];
116
+ }) };
117
+ }
118
+ async graph(body, signal) {
119
+ return {
120
+ nodes: (await this.list(body, { limit: 200 }, signal)).map((item) => ({
121
+ ...item,
122
+ color: "#5568d9"
123
+ })),
124
+ edges: [],
125
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString()
126
+ };
127
+ }
128
+ async list(body, request, signal) {
129
+ const connection = this.connection(body);
130
+ const query = new URLSearchParams({
131
+ uri: connection.targetUri,
132
+ recursive: "true",
133
+ output: "original"
134
+ });
135
+ const result = await this.request(body, `/api/v1/fs/ls?${query}`, {}, { signal });
136
+ const entries = Array.isArray(result) ? result : [];
137
+ const limit = Math.min(Math.max(request.limit ?? 200, 1), 1e3);
138
+ const files = entries.flatMap((value) => {
139
+ const item = object(value);
140
+ const uri = string(item?.uri);
141
+ const filename = uri?.slice(uri.lastIndexOf("/") + 1);
142
+ return item === void 0 || uri === void 0 || item.isDir === true || filename?.startsWith(".") === true || !uri.endsWith(".md") ? [] : [{
143
+ item,
144
+ uri
145
+ }];
146
+ }).slice(0, limit);
147
+ return Promise.all(files.map(async ({ item, uri }) => {
148
+ let content = string(item.abstract) ?? string(item.overview) ?? "";
149
+ if (content === "") try {
150
+ const read = await this.request(body, `/api/v1/content/abstract?uri=${encodeURIComponent(uri)}`, {}, { signal });
151
+ content = string(read) ?? string(object(read)?.content) ?? string(object(read)?.abstract) ?? uri;
152
+ } catch {
153
+ content = uri;
154
+ }
155
+ const createdAt = string(item.modTime);
156
+ return {
157
+ id: uri,
158
+ externalUri: uri,
159
+ content,
160
+ category: categoryFromUri(uri),
161
+ source: "external",
162
+ ...createdAt === void 0 ? {} : { createdAt }
163
+ };
164
+ }));
165
+ }
166
+ async remember(body, request, signal) {
167
+ const sessionId = `dsh-mnemon-${Date.now()}-${randomUUID()}`;
168
+ await this.request(body, "/api/v1/sessions", {
169
+ method: "POST",
170
+ body: JSON.stringify({ session_id: sessionId })
171
+ }, { signal });
172
+ await this.request(body, `/api/v1/sessions/${encodeURIComponent(sessionId)}/messages`, {
173
+ method: "POST",
174
+ body: JSON.stringify({
175
+ role: "user",
176
+ content: request.content
177
+ })
178
+ }, { signal });
179
+ const committed = object(await this.request(body, `/api/v1/sessions/${encodeURIComponent(sessionId)}/commit`, {
180
+ method: "POST",
181
+ body: JSON.stringify({ keep_recent_count: 0 })
182
+ }, {
183
+ signal,
184
+ timeoutMs: 3e4
185
+ }));
186
+ const taskId = string(committed?.task_id);
187
+ const archiveUri = string(committed?.archive_uri);
188
+ if (taskId === void 0) return {
189
+ action: "skipped",
190
+ provider: "openviking",
191
+ summary: string(committed?.reason) ?? "OpenViking did not archive a memory candidate.",
192
+ sessionId
193
+ };
194
+ const task = await this.settleTask(body, taskId, signal);
195
+ if (task === void 0) return {
196
+ action: "queued",
197
+ provider: "openviking",
198
+ summary: "OpenViking accepted the session and is extracting durable memories asynchronously.",
199
+ status: "pending",
200
+ taskId,
201
+ sessionId,
202
+ ...archiveUri === void 0 ? {} : { archiveUri }
203
+ };
204
+ const extracted = object(object(task.result)?.memories_extracted) ?? {};
205
+ const total = Object.values(extracted).reduce((sum, value) => sum + (number(value) ?? 0), 0);
206
+ return {
207
+ action: total > 0 ? "stored" : "skipped",
208
+ provider: "openviking",
209
+ summary: total > 0 ? `OpenViking extracted ${total} durable ${total === 1 ? "memory" : "memories"}.` : "OpenViking completed extraction without a durable memory change.",
210
+ taskId,
211
+ sessionId,
212
+ ...archiveUri === void 0 ? {} : { archiveUri },
213
+ extracted
214
+ };
215
+ }
216
+ async forget(body, id, signal) {
217
+ const connection = this.connection(body);
218
+ const uri = id.trim();
219
+ const root = connection.targetUri.replace(/\/+$/u, "");
220
+ const filename = uri.slice(uri.lastIndexOf("/") + 1);
221
+ if (!uri.startsWith(`${root}/`) || !uri.endsWith(".md") || filename.startsWith(".")) throw new Error("OpenViking forget requires an exact non-generated .md memory URI inside this Memory Space");
222
+ const query = new URLSearchParams({
223
+ uri,
224
+ recursive: "false"
225
+ });
226
+ const result = object(await this.request(body, `/api/v1/fs?${query}`, { method: "DELETE" }, { signal })) ?? {};
227
+ return {
228
+ action: "deleted",
229
+ provider: this.id,
230
+ uri: string(result.uri) ?? uri,
231
+ ...number(result.estimated_deleted_count) === void 0 ? {} : { estimatedDeletedCount: number(result.estimated_deleted_count) }
232
+ };
233
+ }
234
+ connection(body) {
235
+ if ((body.provider.typeId ?? body.provider.id) !== this.id) throw new Error(`OpenViking cannot serve provider ${body.provider.id}`);
236
+ const connection = this.memoryBodies.providerConnection(body.id, body.provider.id);
237
+ return {
238
+ endpoint: String(connection.endpoint ?? ""),
239
+ targetUri: String(connection.targetUri ?? ""),
240
+ apiKey: String(connection.apiKey ?? ""),
241
+ account: String(connection.account ?? ""),
242
+ user: String(connection.user ?? ""),
243
+ actorPeerId: String(connection.actorPeerId ?? "")
244
+ };
245
+ }
246
+ async settleTask(body, taskId, signal) {
247
+ const deadline = Date.now() + this.settlementTimeoutMs;
248
+ while (Date.now() < deadline) {
249
+ const task = object(await this.request(body, `/api/v1/tasks/${encodeURIComponent(taskId)}`, {}, {
250
+ signal,
251
+ timeoutMs: 1e4
252
+ })) ?? {};
253
+ const status = string(task.status);
254
+ if (status === "completed") return task;
255
+ if (status === "failed" || status === "cancelled") throw new Error(`OpenViking memory extraction ${status}: ${string(task.error) ?? taskId}`);
256
+ await delay(this.pollIntervalMs, signal);
257
+ }
258
+ }
259
+ async request(body, path, init = {}, options = {}) {
260
+ const connection = this.connection(body);
261
+ return this.requestConnection(connection, path, init, options);
262
+ }
263
+ async requestConnection(connection, path, init = {}, options = {}) {
264
+ options.signal?.throwIfAborted();
265
+ const controller = new AbortController();
266
+ const relay = () => controller.abort(options.signal?.reason);
267
+ options.signal?.addEventListener("abort", relay, { once: true });
268
+ const timer = setTimeout(() => controller.abort(/* @__PURE__ */ new Error("OpenViking request timed out")), options.timeoutMs ?? this.requestTimeoutMs);
269
+ try {
270
+ const response = await this.requestFetch(`${connection.endpoint}${path}`, {
271
+ ...init,
272
+ headers: {
273
+ "Content-Type": "application/json",
274
+ ...connection.apiKey === void 0 || connection.apiKey === "" ? {} : { Authorization: `Bearer ${connection.apiKey}` },
275
+ ...connection.account === void 0 || connection.account === "" ? {} : { "X-OpenViking-Account": String(connection.account) },
276
+ ...connection.user === void 0 || connection.user === "" ? {} : { "X-OpenViking-User": String(connection.user) },
277
+ ...connection.actorPeerId === void 0 || connection.actorPeerId === "" ? {} : { "X-OpenViking-Actor-Peer": String(connection.actorPeerId) },
278
+ ...init.headers
279
+ },
280
+ signal: controller.signal
281
+ });
282
+ const envelope = await response.json().catch(() => ({}));
283
+ if (!response.ok || envelope.status === "error") {
284
+ const trace = envelope.error?.trace_id ?? envelope.trace_id;
285
+ throw new Error(`${envelope.error?.message ?? `OpenViking HTTP ${response.status}`}${trace === void 0 ? "" : ` (trace ${trace})`}`);
286
+ }
287
+ return envelope.result ?? envelope;
288
+ } catch (error) {
289
+ if (controller.signal.aborted && options.signal?.aborted !== true) throw new Error(`OpenViking request timed out after ${options.timeoutMs ?? this.requestTimeoutMs}ms`);
290
+ throw error;
291
+ } finally {
292
+ clearTimeout(timer);
293
+ options.signal?.removeEventListener("abort", relay);
294
+ }
295
+ }
296
+ };
297
+ //#endregion
298
+ //#region src/index.ts
299
+ const definition = defineMemorySpaceProviderDefinition({
300
+ manifest: {
301
+ apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION,
302
+ kind: "provider",
303
+ typeId: descriptor.id,
304
+ packageName: "dsh-mnemon-provider-openviking",
305
+ version: "0.5.0-rc.1",
306
+ label: descriptor.label,
307
+ icon: descriptor.icon,
308
+ summary: descriptor.summary,
309
+ ...descriptor.summaryI18nKey === void 0 ? {} : { summaryI18nKey: descriptor.summaryI18nKey },
310
+ origin: descriptor.origin,
311
+ locality: descriptor.kind,
312
+ workspaceBinding: descriptor.workspaceBinding,
313
+ capabilities: descriptor.capabilities,
314
+ fields: descriptor.fields,
315
+ secrets: descriptor.fields.filter((field) => field.input === "secret").map((field) => field.key),
316
+ scoreSemantics: "normalized-relevance"
317
+ },
318
+ create: (context) => new OpenVikingProvider(context.memoryBodies, {
319
+ requestTimeoutMs: context.config.timeoutMs,
320
+ settlementTimeoutMs: context.config.timeoutMs
321
+ })
322
+ });
323
+ var src_default = defineMemorySpaceProvider({
324
+ id: descriptor.id,
325
+ apply(ctx, host) {
326
+ host.install(ctx, definition);
327
+ }
328
+ });
329
+ //#endregion
330
+ export { OpenVikingProvider, src_default as default, definition, descriptor };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "dsh-mnemon-provider-openviking",
3
+ "version": "0.5.0-rc.1",
4
+ "description": "OpenViking 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-openviking"
50
+ },
51
+ "homepage": "https://github.com/omdsh-dev/dsh-mnemon/tree/main/plugins/dsh-mnemon-provider-openviking#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/omdsh-dev/dsh-mnemon/issues"
54
+ }
55
+ }