om-memory-system 6.1.0-next.237 → 6.2.0-next.243
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/dist/config-template.d.ts +1 -1
- package/dist/config-template.js +3 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +1 -0
- package/dist/core/memorisation-operations.d.ts +5 -4
- package/dist/core/memorisation-operations.js +20 -12
- package/dist/core/memorisation-settings.d.ts +2 -2
- package/dist/core/memorisation-settings.js +11 -2
- package/dist/core/memorisation.d.ts +6 -0
- package/dist/core/memorisation.js +10 -0
- package/dist/core/memory-operations.js +1 -1
- package/dist/services/client.js +7 -5
- package/dist/services/global-config-writer.js +3 -0
- package/dist/services/linked-search.d.ts +2 -0
- package/dist/services/memorisation-routes.d.ts +7 -6
- package/dist/services/memorisation-routes.js +18 -27
- package/dist/services/memorisation-store.d.ts +9 -7
- package/dist/services/memorisation-store.js +11 -7
- package/dist/services/reranker.d.ts +6 -0
- package/dist/services/reranker.js +12 -0
- package/dist/services/settings-snapshot.js +2 -0
- package/dist/services/web-route-modules.js +1 -1
- package/dist/web/assets/{index-DBSeQOs6.js → index-jbZuE9HV.js} +32 -32
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -32,14 +32,17 @@ async function findActiveRow(id) {
|
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Looks a memorisation up by exact ID in the active space, then in the linked spaces.
|
|
36
|
-
*
|
|
35
|
+
* Looks a memorisation up by exact ID in the active space, then in the linked spaces. A
|
|
36
|
+
* project tag narrows the lookup to that project; `null` matches any project, the rule
|
|
37
|
+
* recall and bulk delete use.
|
|
37
38
|
* The caller snapshots `linked` from CONFIG, so this module never imports it.
|
|
38
39
|
*/
|
|
39
40
|
export async function getMemorisationById(id, containerTag, linked) {
|
|
40
41
|
const row = await findActiveRow(id);
|
|
41
|
-
if (row?.
|
|
42
|
+
if (row?.type === "memorisation" &&
|
|
43
|
+
(containerTag === null || row.container_tag === containerTag)) {
|
|
42
44
|
return toStored(row);
|
|
45
|
+
}
|
|
43
46
|
const found = await readLinkedMemory(id, activeOwner(), linked, containerTag);
|
|
44
47
|
return found?.row.type === "memorisation" ? toStored(found.row, found.name) : null;
|
|
45
48
|
}
|
|
@@ -94,9 +97,10 @@ export async function listMemorisationsByTags(containerTag, tags, scope, limit)
|
|
|
94
97
|
return { success: true, memories };
|
|
95
98
|
}
|
|
96
99
|
/**
|
|
97
|
-
* Deletes one memorisation
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
+
* Deletes one memorisation from the active space. A project tag narrows the delete to that
|
|
101
|
+
* project; `null` matches any project, the rule bulk delete uses. No row is "not-found".
|
|
102
|
+
* A row of another type is kept ("not-memorisation"). A row that lives only in a linked,
|
|
103
|
+
* read-only space is "linked" and is never touched.
|
|
100
104
|
*/
|
|
101
105
|
export async function deleteMemorisation(id, containerTag, linked) {
|
|
102
106
|
await memoryClient.ensureStorageReady();
|
|
@@ -107,7 +111,7 @@ export async function deleteMemorisation(id, containerTag, linked) {
|
|
|
107
111
|
for (const shard of shards) {
|
|
108
112
|
const db = await tursoConnectionManager.getConnection(shard.dbPath);
|
|
109
113
|
const row = await tursoVectorSearch.getMemoryById(db, id);
|
|
110
|
-
if (!row || row.container_tag !== containerTag)
|
|
114
|
+
if (!row || (containerTag !== null && row.container_tag !== containerTag))
|
|
111
115
|
continue;
|
|
112
116
|
if (row.type !== "memorisation")
|
|
113
117
|
return "not-memorisation";
|
|
@@ -32,6 +32,12 @@ export declare class RerankError extends Error {
|
|
|
32
32
|
* and the caller falls back.
|
|
33
33
|
*/
|
|
34
34
|
export declare function rerankSettingsFrom(config: RerankerConfigSlice): RerankerSettings | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Reranker settings for one read. An override decides for that read alone:
|
|
37
|
+
* `false` never reranks; `true` reranks whenever the server URL and model are
|
|
38
|
+
* set, even with the general switch off. No override keeps the general rule.
|
|
39
|
+
*/
|
|
40
|
+
export declare function rerankSettingsFor(config: RerankerConfigSlice, override?: boolean): RerankerSettings | undefined;
|
|
35
41
|
/**
|
|
36
42
|
* Ask the reranker to order the documents. Throws RerankError on any
|
|
37
43
|
* failure; the caller falls back to the threshold result. A reply is valid
|
|
@@ -59,6 +59,18 @@ export function rerankSettingsFrom(config) {
|
|
|
59
59
|
timeoutMs: config.rerankerTimeoutMs ?? RERANKER_TIMEOUT_DEFAULT_MS,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Reranker settings for one read. An override decides for that read alone:
|
|
64
|
+
* `false` never reranks; `true` reranks whenever the server URL and model are
|
|
65
|
+
* set, even with the general switch off. No override keeps the general rule.
|
|
66
|
+
*/
|
|
67
|
+
export function rerankSettingsFor(config, override) {
|
|
68
|
+
if (override === false)
|
|
69
|
+
return undefined;
|
|
70
|
+
if (override === true)
|
|
71
|
+
return rerankSettingsFrom({ ...config, rerankerEnabled: true });
|
|
72
|
+
return rerankSettingsFrom(config);
|
|
73
|
+
}
|
|
62
74
|
/**
|
|
63
75
|
* Ask the reranker to order the documents. Throws RerankError on any
|
|
64
76
|
* failure; the caller falls back to the threshold result. A reply is valid
|
|
@@ -45,6 +45,7 @@ const editable = [
|
|
|
45
45
|
"memorisationRepeat",
|
|
46
46
|
"memorisationMaxSize",
|
|
47
47
|
"memorisationSizeUnit",
|
|
48
|
+
"memorisationRerank",
|
|
48
49
|
...MEMORY_LIMIT_SETTINGS,
|
|
49
50
|
];
|
|
50
51
|
/**
|
|
@@ -79,6 +80,7 @@ const globalOnly = [
|
|
|
79
80
|
"memorisationRepeat",
|
|
80
81
|
"memorisationMaxSize",
|
|
81
82
|
"memorisationSizeUnit",
|
|
83
|
+
"memorisationRerank",
|
|
82
84
|
];
|
|
83
85
|
function readSettingsFile(path) {
|
|
84
86
|
if (!path)
|
|
@@ -33,7 +33,7 @@ export async function routeModules(path, method, url, req, ctx) {
|
|
|
33
33
|
});
|
|
34
34
|
if (spaces !== undefined)
|
|
35
35
|
return spaces;
|
|
36
|
-
const memorisations = await routeMemorisations(path, method, url,
|
|
36
|
+
const memorisations = await routeMemorisations(path, method, url, { linked: linkedSettingsFrom(config), rerank: config.memorisationRerank === true }, readBody);
|
|
37
37
|
if (memorisations !== undefined)
|
|
38
38
|
return memorisations;
|
|
39
39
|
return routeChat(path, method, readBody, config);
|