dsh-mnemon-provider-openviking 0.5.11 → 0.5.12
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/lib/descriptor.d.ts
CHANGED
package/lib/descriptor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as descriptor } from "./descriptor-
|
|
1
|
+
import { t as descriptor } from "./descriptor-6sO1rrEx.js";
|
|
2
2
|
export { descriptor };
|
package/lib/index.d.ts
CHANGED
|
@@ -19,20 +19,8 @@ declare class OpenVikingProvider implements MemoryProviderAdapter {
|
|
|
19
19
|
search(body: MemoryBody, request: SearchRequest, signal?: AbortSignal): Promise<ProviderSearchResult>;
|
|
20
20
|
graph(body: MemoryBody, signal?: AbortSignal): Promise<MemoryGraphSnapshot>;
|
|
21
21
|
list(body: MemoryBody, request: MemoryListRequest, signal?: AbortSignal): Promise<Insight[]>;
|
|
22
|
-
/**
|
|
23
|
-
* Each listed memory with its full content, leaving out one the server cannot read: its index
|
|
24
|
-
* can still list a file it no longer holds. When none can be read, the first failure is the
|
|
25
|
-
* answer, so a server that cannot be reached is never shown as an empty space, and a cancelled
|
|
26
|
-
* turn stops at once.
|
|
27
|
-
*/
|
|
28
22
|
private readAll;
|
|
29
23
|
remember(body: MemoryBody, request: RememberRequest, signal?: AbortSignal): Promise<JsonValue>;
|
|
30
|
-
/**
|
|
31
|
-
* Label a verified memory. Tags only describe it - its category is in the URI too - so a server
|
|
32
|
-
* without the endpoint, one that refuses or does not confirm the call, or one that is slow to
|
|
33
|
-
* answer leaves an exact memory that is just untagged. The wait is short, as for `/health`:
|
|
34
|
-
* the receipt is already true.
|
|
35
|
-
*/
|
|
36
24
|
private tag;
|
|
37
25
|
forget(body: MemoryBody, id: string, signal?: AbortSignal): Promise<JsonValue>;
|
|
38
26
|
private connection;
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as descriptor } from "./descriptor-
|
|
1
|
+
import { t as descriptor } from "./descriptor-6sO1rrEx.js";
|
|
2
2
|
import * as providerSdk from "dsh-mnemon-source-memory-spaces/provider-sdk";
|
|
3
3
|
import { CATEGORIES, MEMORY_SPACE_PROVIDER_API_VERSION, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, jsonNumber, jsonObject, jsonString } from "dsh-mnemon-source-memory-spaces/provider-sdk";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -9,7 +9,6 @@ function normalizeBearerHeader(apiKey) {
|
|
|
9
9
|
const stripped = apiKey.trim().replace(/^Bearer(?:\s+|$)/iu, "").trim();
|
|
10
10
|
return stripped === "" ? void 0 : `Bearer ${stripped}`;
|
|
11
11
|
}
|
|
12
|
-
/** The categories Mnemon writes; anything else is stored, and read back, as general. */
|
|
13
12
|
const CATEGORY_NAMES = new Set(CATEGORIES);
|
|
14
13
|
function categoryOf(value) {
|
|
15
14
|
const category = jsonString(value)?.trim().toLowerCase();
|
|
@@ -23,10 +22,6 @@ const MEMORY_FOLDERS = {
|
|
|
23
22
|
fact: "entities",
|
|
24
23
|
general: "entities"
|
|
25
24
|
};
|
|
26
|
-
/**
|
|
27
|
-
* The slug's share of a file name, which Linux caps at 255 bytes: the stamp, the longest
|
|
28
|
-
* category, the UUID and the separators take 66, so 48 characters of four bytes would not fit.
|
|
29
|
-
*/
|
|
30
25
|
const SLUG_BYTES = 180;
|
|
31
26
|
function memoryUri(root, category, content) {
|
|
32
27
|
const folder = Object.hasOwn(MEMORY_FOLDERS, category) ? MEMORY_FOLDERS[category] : "entities";
|
|
@@ -56,14 +51,12 @@ function queueFailed(value) {
|
|
|
56
51
|
return (jsonNumber(queue?.error_count) ?? 0) > 0 || Array.isArray(queue?.errors) && queue.errors.length > 0;
|
|
57
52
|
});
|
|
58
53
|
}
|
|
59
|
-
/** What a folder holds, for files written before the category was in the name or by OpenViking itself. */
|
|
60
54
|
const FOLDER_CATEGORIES = {
|
|
61
55
|
preferences: "preference",
|
|
62
56
|
experiences: "insight",
|
|
63
57
|
events: "context",
|
|
64
58
|
entities: "fact"
|
|
65
59
|
};
|
|
66
|
-
/** The category in the file name Mnemon wrote, else one the server reports, else the folder's. */
|
|
67
60
|
function categoryFromUri(uri, reported) {
|
|
68
61
|
const named = /_([a-z]+)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.md$/u.exec(uri)?.[1];
|
|
69
62
|
if (named !== void 0 && CATEGORY_NAMES.has(named)) return named;
|
|
@@ -73,7 +66,6 @@ function categoryFromUri(uri, reported) {
|
|
|
73
66
|
const folder = (uri.includes(marker) ? uri.slice(uri.indexOf(marker) + 10) : "").split("/")[0] ?? "";
|
|
74
67
|
return Object.hasOwn(FOLDER_CATEGORIES, folder) ? FOLDER_CATEGORIES[folder] : "general";
|
|
75
68
|
}
|
|
76
|
-
/** Whether the server turned the request down as sent, so it wrote nothing: not a timeout or a server fault. */
|
|
77
69
|
function refused(error) {
|
|
78
70
|
const status = error?.status;
|
|
79
71
|
return typeof status === "number" && status >= 400 && status < 500 && status !== 408 && status !== 409;
|
|
@@ -246,12 +238,6 @@ var OpenVikingProvider = class {
|
|
|
246
238
|
};
|
|
247
239
|
});
|
|
248
240
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Each listed memory with its full content, leaving out one the server cannot read: its index
|
|
251
|
-
* can still list a file it no longer holds. When none can be read, the first failure is the
|
|
252
|
-
* answer, so a server that cannot be reached is never shown as an empty space, and a cancelled
|
|
253
|
-
* turn stops at once.
|
|
254
|
-
*/
|
|
255
241
|
async readAll(body, items, signal) {
|
|
256
242
|
const settled = await Promise.allSettled(items.map(async (item) => ({
|
|
257
243
|
...item,
|
|
@@ -308,12 +294,6 @@ var OpenVikingProvider = class {
|
|
|
308
294
|
tagsApplied: await this.tag(body, uri, tags, signal)
|
|
309
295
|
};
|
|
310
296
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Label a verified memory. Tags only describe it - its category is in the URI too - so a server
|
|
313
|
-
* without the endpoint, one that refuses or does not confirm the call, or one that is slow to
|
|
314
|
-
* answer leaves an exact memory that is just untagged. The wait is short, as for `/health`:
|
|
315
|
-
* the receipt is already true.
|
|
316
|
-
*/
|
|
317
297
|
async tag(body, uri, tags, signal) {
|
|
318
298
|
try {
|
|
319
299
|
return jsonObject(await this.request(body, "/api/v1/content/set_tags", {
|
|
@@ -442,7 +422,7 @@ const definition = defineMemorySpaceProviderDefinition({
|
|
|
442
422
|
kind: "provider",
|
|
443
423
|
typeId: descriptor.id,
|
|
444
424
|
packageName: "dsh-mnemon-provider-openviking",
|
|
445
|
-
version: "0.5.
|
|
425
|
+
version: "0.5.12",
|
|
446
426
|
label: descriptor.label,
|
|
447
427
|
icon: descriptor.icon,
|
|
448
428
|
summary: descriptor.summary,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon-provider-openviking",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"description": "OpenViking Provider child for the Memory Spaces Source.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^22.0.0",
|
|
37
|
-
"dsh-mnemon-source-memory-spaces": "^0.5.
|
|
37
|
+
"dsh-mnemon-source-memory-spaces": "^0.5.33",
|
|
38
38
|
"tsdown": "^0.22.0",
|
|
39
39
|
"typescript": "^5.9.0",
|
|
40
40
|
"vitest": "^3.2.0"
|