@martian-engineering/lossless-claw 0.1.0 → 0.1.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/README.md +23 -3
- package/docs/configuration.md +8 -2
- package/openclaw.plugin.json +62 -0
- package/package.json +2 -1
- package/src/engine.ts +0 -3
- package/src/summarize.ts +0 -2
package/README.md
CHANGED
|
@@ -26,12 +26,17 @@ Nothing is lost. Raw messages stay in the database. Summaries link back to their
|
|
|
26
26
|
|
|
27
27
|
### Install the plugin
|
|
28
28
|
|
|
29
|
+
**From npm** (recommended):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @martian-engineering/lossless-claw
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**From source** (for development):
|
|
36
|
+
|
|
29
37
|
```bash
|
|
30
|
-
# Clone the repo
|
|
31
38
|
git clone https://github.com/Martian-Engineering/lossless-claw.git
|
|
32
39
|
cd lossless-claw
|
|
33
|
-
|
|
34
|
-
# Install dependencies
|
|
35
40
|
npm install
|
|
36
41
|
```
|
|
37
42
|
|
|
@@ -39,6 +44,21 @@ npm install
|
|
|
39
44
|
|
|
40
45
|
Add the plugin to your OpenClaw config (`~/.openclaw/openclaw.json`):
|
|
41
46
|
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"plugins": {
|
|
50
|
+
"paths": [
|
|
51
|
+
"node_modules/@martian-engineering/lossless-claw"
|
|
52
|
+
],
|
|
53
|
+
"slots": {
|
|
54
|
+
"contextEngine": "lossless-claw"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If installed from source, use the absolute path to the cloned repo instead:
|
|
61
|
+
|
|
42
62
|
```json
|
|
43
63
|
{
|
|
44
64
|
"plugins": {
|
package/docs/configuration.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Quick start
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Install the plugin and add it to your OpenClaw config:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @martian-engineering/lossless-claw
|
|
9
|
+
```
|
|
6
10
|
|
|
7
11
|
```json
|
|
8
12
|
{
|
|
9
13
|
"plugins": {
|
|
10
|
-
"paths": ["/
|
|
14
|
+
"paths": ["node_modules/@martian-engineering/lossless-claw"],
|
|
11
15
|
"slots": {
|
|
12
16
|
"contextEngine": "lossless-claw"
|
|
13
17
|
}
|
|
@@ -15,6 +19,8 @@ Add LCM to your OpenClaw config:
|
|
|
15
19
|
}
|
|
16
20
|
```
|
|
17
21
|
|
|
22
|
+
If installed from source, use the absolute path to the repo instead of `node_modules/...`.
|
|
23
|
+
|
|
18
24
|
Set recommended environment variables:
|
|
19
25
|
|
|
20
26
|
```bash
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "lossless-claw",
|
|
3
|
+
"uiHints": {
|
|
4
|
+
"contextThreshold": {
|
|
5
|
+
"label": "Context Threshold",
|
|
6
|
+
"help": "Fraction of context window that triggers compaction (0.0–1.0)"
|
|
7
|
+
},
|
|
8
|
+
"incrementalMaxDepth": {
|
|
9
|
+
"label": "Incremental Max Depth",
|
|
10
|
+
"help": "How deep incremental compaction goes (0 = leaf only)"
|
|
11
|
+
},
|
|
12
|
+
"freshTailCount": {
|
|
13
|
+
"label": "Fresh Tail Count",
|
|
14
|
+
"help": "Number of recent messages protected from compaction"
|
|
15
|
+
},
|
|
16
|
+
"dbPath": {
|
|
17
|
+
"label": "Database Path",
|
|
18
|
+
"help": "Path to LCM SQLite database (default: ~/.openclaw/lcm.db)"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"configSchema": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"properties": {
|
|
25
|
+
"enabled": {
|
|
26
|
+
"type": "boolean"
|
|
27
|
+
},
|
|
28
|
+
"contextThreshold": {
|
|
29
|
+
"type": "number",
|
|
30
|
+
"minimum": 0,
|
|
31
|
+
"maximum": 1
|
|
32
|
+
},
|
|
33
|
+
"incrementalMaxDepth": {
|
|
34
|
+
"type": "integer",
|
|
35
|
+
"minimum": 0
|
|
36
|
+
},
|
|
37
|
+
"freshTailCount": {
|
|
38
|
+
"type": "integer",
|
|
39
|
+
"minimum": 1
|
|
40
|
+
},
|
|
41
|
+
"leafMinFanout": {
|
|
42
|
+
"type": "integer",
|
|
43
|
+
"minimum": 2
|
|
44
|
+
},
|
|
45
|
+
"condensedMinFanout": {
|
|
46
|
+
"type": "integer",
|
|
47
|
+
"minimum": 2
|
|
48
|
+
},
|
|
49
|
+
"condensedMinFanoutHard": {
|
|
50
|
+
"type": "integer",
|
|
51
|
+
"minimum": 2
|
|
52
|
+
},
|
|
53
|
+
"dbPath": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"largeFileThresholdTokens": {
|
|
57
|
+
"type": "integer",
|
|
58
|
+
"minimum": 1000
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@martian-engineering/lossless-claw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Lossless Context Management plugin for OpenClaw — DAG-based conversation summarization with incremental compaction",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"index.ts",
|
|
20
20
|
"src/**/*.ts",
|
|
21
|
+
"openclaw.plugin.json",
|
|
21
22
|
"docs/",
|
|
22
23
|
"README.md",
|
|
23
24
|
"LICENSE"
|
package/src/engine.ts
CHANGED
|
@@ -647,9 +647,7 @@ export class LcmContextEngine implements ContextEngine {
|
|
|
647
647
|
customInstructions?: string;
|
|
648
648
|
}): Promise<(text: string, aggressive?: boolean) => Promise<string>> {
|
|
649
649
|
const lp = params.legacyParams ?? {};
|
|
650
|
-
console.error(`[lcm] resolveSummarize called, legacyParams keys: ${Object.keys(lp).join(",")}, has summarize fn: ${typeof lp.summarize === "function"}`);
|
|
651
650
|
if (typeof lp.summarize === "function") {
|
|
652
|
-
console.error(`[lcm] resolveSummarize: using legacy summarize function`);
|
|
653
651
|
return lp.summarize as (text: string, aggressive?: boolean) => Promise<string>;
|
|
654
652
|
}
|
|
655
653
|
try {
|
|
@@ -659,7 +657,6 @@ export class LcmContextEngine implements ContextEngine {
|
|
|
659
657
|
customInstructions: params.customInstructions,
|
|
660
658
|
});
|
|
661
659
|
if (runtimeSummarizer) {
|
|
662
|
-
console.error(`[lcm] resolveSummarize: got runtime summarizer`);
|
|
663
660
|
return runtimeSummarizer;
|
|
664
661
|
}
|
|
665
662
|
console.error(`[lcm] resolveSummarize: createLcmSummarizeFromLegacyParams returned undefined`);
|
package/src/summarize.ts
CHANGED
|
@@ -338,12 +338,10 @@ export async function createLcmSummarizeFromLegacyParams(params: {
|
|
|
338
338
|
const modelHint =
|
|
339
339
|
typeof params.legacyParams.model === "string" ? params.legacyParams.model.trim() : "";
|
|
340
340
|
const modelRef = modelHint || undefined;
|
|
341
|
-
console.error(`[lcm] createLcmSummarize: providerHint="${providerHint}", modelHint="${modelHint}", modelRef="${modelRef}"`);
|
|
342
341
|
|
|
343
342
|
let resolved: { provider: string; model: string };
|
|
344
343
|
try {
|
|
345
344
|
resolved = params.deps.resolveModel(modelRef, providerHint || undefined);
|
|
346
|
-
console.error(`[lcm] createLcmSummarize: resolved model=${resolved.model}, provider=${resolved.provider}`);
|
|
347
345
|
} catch (err) {
|
|
348
346
|
console.error(`[lcm] createLcmSummarize: resolveModel FAILED:`, err instanceof Error ? err.message : err);
|
|
349
347
|
return undefined;
|