@augmem/cortext-openclaw-plugin 0.1.0 → 0.1.2
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/cortext.js +5 -3
- package/dist/engine.js +32 -6
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/cortext.js
CHANGED
|
@@ -18,9 +18,11 @@ export class CortextEngine {
|
|
|
18
18
|
if (!trimmed)
|
|
19
19
|
return null;
|
|
20
20
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Durable processText commits on its own: the write is immediately
|
|
22
|
+
// visible to recall, even from a fresh handle on the same DB (verified
|
|
23
|
+
// empirically against @augmem/cortext 1.2.0). No per-message flush;
|
|
24
|
+
// flush() remains only at deliberate checkpoints (compact/evict/dispose).
|
|
25
|
+
return this.engine.processText(trimmed, sourceId, { retention: "durable" });
|
|
24
26
|
}
|
|
25
27
|
catch {
|
|
26
28
|
return null;
|
package/dist/engine.js
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { formatMemories, memoryBlock, safe } from "./cortext.js";
|
|
2
|
+
// Bound serialized tool-call arguments so a huge payload (a file write, a long
|
|
3
|
+
// patch) doesn't dominate the store; the result text is ingested separately.
|
|
4
|
+
const TOOL_ARGS_MAX_CHARS = 2000;
|
|
5
|
+
/** Render a transcript content part as text. Tool calls (OpenClaw stores them
|
|
6
|
+
* as `{type:"toolCall", name, arguments}` content parts with no `text` field)
|
|
7
|
+
* are rendered as "[tool call] name {args}" so the durable record keeps WHAT
|
|
8
|
+
* the agent did, not just what came back. Parts with no textual form (images,
|
|
9
|
+
* binary payloads) yield "". */
|
|
10
|
+
function partText(part) {
|
|
11
|
+
if (typeof part === "string")
|
|
12
|
+
return part;
|
|
13
|
+
if (!part || typeof part !== "object")
|
|
14
|
+
return "";
|
|
15
|
+
const p = part;
|
|
16
|
+
if (typeof p.text === "string")
|
|
17
|
+
return p.text;
|
|
18
|
+
if (p.type === "toolCall" && typeof p.name === "string") {
|
|
19
|
+
let args = "";
|
|
20
|
+
try {
|
|
21
|
+
args = p.arguments === undefined ? "" : JSON.stringify(p.arguments);
|
|
22
|
+
}
|
|
23
|
+
catch { /* unserializable */ }
|
|
24
|
+
if (args.length > TOOL_ARGS_MAX_CHARS)
|
|
25
|
+
args = args.slice(0, TOOL_ARGS_MAX_CHARS) + "…";
|
|
26
|
+
return `[tool call] ${p.name}${args ? " " + args : ""}`;
|
|
27
|
+
}
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
2
30
|
function messageText(content) {
|
|
3
31
|
if (typeof content === "string")
|
|
4
32
|
return content;
|
|
5
33
|
if (Array.isArray(content)) {
|
|
6
34
|
const parts = [];
|
|
7
35
|
for (const part of content) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
parts.push(part.text);
|
|
12
|
-
}
|
|
36
|
+
const text = partText(part);
|
|
37
|
+
if (text)
|
|
38
|
+
parts.push(text);
|
|
13
39
|
}
|
|
14
40
|
return parts.join(" ");
|
|
15
41
|
}
|
|
@@ -45,7 +71,7 @@ export class CortextContextEngine {
|
|
|
45
71
|
info = {
|
|
46
72
|
id: "cortext",
|
|
47
73
|
name: "Cortext Memory",
|
|
48
|
-
version: "0.1.
|
|
74
|
+
version: "0.1.2",
|
|
49
75
|
ownsCompaction: false,
|
|
50
76
|
};
|
|
51
77
|
constructor(store, bus, logger, autoConsolidate, recallLimit) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "cortext",
|
|
3
3
|
"name": "Cortext Memory",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Durable local memory for OpenClaw. Per-conversation-isolated context engine with an interrupt gate over streaming reasoning.",
|
|
6
6
|
"kind": "context-engine",
|
|
7
7
|
"configSchema": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augmem/cortext-openclaw-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Cortext memory for OpenClaw: a per-conversation-isolated context engine plus an interrupt gate over streaming reasoning.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|