@openviking/dsh-memory-plugin 0.5.26 → 0.5.28
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/config.mjs +2 -2
- package/package.json +1 -1
- package/shared/pending-queue.mjs +5 -1
- package/shared/recall-core.mjs +11 -6
package/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildPluginConfig } from "./shared/plugin-config.mjs";
|
|
2
|
-
import { loadCredentialFiles } from "./shared/credentials.mjs";
|
|
2
|
+
import { loadCredentialFiles, readManifestVersion } from "./shared/credentials.mjs";
|
|
3
3
|
|
|
4
|
-
export const PLUGIN_VERSION = "
|
|
4
|
+
export const PLUGIN_VERSION = readManifestVersion(new URL("./package.json", import.meta.url));
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Namespace for the bridged OpenViking MCP tools. DSH publishes every MCP tool
|
package/package.json
CHANGED
package/shared/pending-queue.mjs
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* (default: 50)
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod } from "node:fs/promises";
|
|
24
|
+
import { mkdir, readdir, readFile, rename, writeFile, unlink, stat, chmod, utimes } from "node:fs/promises";
|
|
25
25
|
import { createHash } from "node:crypto";
|
|
26
26
|
import { join } from "node:path";
|
|
27
27
|
import { homedir } from "node:os";
|
|
@@ -268,6 +268,10 @@ export async function claimForReplay(filename) {
|
|
|
268
268
|
const dir = getPendingDir();
|
|
269
269
|
const claimed = processingFilename(filename);
|
|
270
270
|
try {
|
|
271
|
+
// Recovery measures claim age, not how long the item waited offline.
|
|
272
|
+
// Refresh before publishing .processing so recovery cannot see an old mtime.
|
|
273
|
+
const now = new Date();
|
|
274
|
+
await utimes(join(dir, filename), now, now);
|
|
271
275
|
await rename(join(dir, filename), join(dir, claimed));
|
|
272
276
|
return claimed;
|
|
273
277
|
} catch {
|
package/shared/recall-core.mjs
CHANGED
|
@@ -473,17 +473,22 @@ function looksLikeUnknownField(res) {
|
|
|
473
473
|
return text.includes("extra") || text.includes("mode") || text.includes("unexpected");
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
+
// Recalled text is the user's own history. Without a provenance boundary a model
|
|
477
|
+
// may cite an internal decision as external evidence or industry practice.
|
|
478
|
+
export const RECALL_CONTEXT_TEMPLATE = [
|
|
479
|
+
"<openviking-context>",
|
|
480
|
+
"Relevant memory from OpenViking. It is this user's own saved history (past conversations, meetings, notes) as recorded then: internal context, not an external source or established fact. Use the search/read MCP tools to expand URIs.",
|
|
481
|
+
"{context}",
|
|
482
|
+
"</openviking-context>",
|
|
483
|
+
].join("\n");
|
|
484
|
+
|
|
476
485
|
function wrapContext(body) {
|
|
477
486
|
// Retrieved text cannot introduce a second capture delimiter inside ours.
|
|
478
487
|
const text = String(body)
|
|
479
488
|
.replace(/<\/?relevant-memor(?:y|ies)\b[^>]*>/gi, "legacy memory wrapper")
|
|
480
489
|
.replace(/<\/?openviking-context\b[^>]*>/gi, "openviking context marker");
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
"Relevant memory from OpenViking. Use the search/read MCP tools to expand URIs.",
|
|
484
|
-
text,
|
|
485
|
-
"</openviking-context>",
|
|
486
|
-
].join("\n");
|
|
490
|
+
// Use a replacer so recalled dollar sequences stay literal.
|
|
491
|
+
return RECALL_CONTEXT_TEMPLATE.replace("{context}", () => text);
|
|
487
492
|
}
|
|
488
493
|
|
|
489
494
|
/**
|