@pennyclaw/auto-compact 0.1.1 → 0.1.3
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 +13 -0
- package/dist/index.js +3 -3
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Idle + threshold based transcript compaction with optional aggressive tool pruning.
|
|
4
4
|
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
openclaw plugins install @pennyclaw/auto-compact
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Update
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
openclaw plugins update auto-compact
|
|
15
|
+
```
|
|
16
|
+
|
|
5
17
|
## Requires
|
|
6
18
|
- `gateway.http.endpoints.chatCompletions.enabled = true`
|
|
7
19
|
|
|
@@ -32,3 +44,4 @@ plugins: {
|
|
|
32
44
|
- Chunking + fallback to avoid overflow.
|
|
33
45
|
- When `aggressive=true`, prunes all tool_result content before summary.
|
|
34
46
|
- Credentials are **never included**; only `/secrets` file paths are referenced.
|
|
47
|
+
- Native compaction compat (no custom prefix, tree safe, rolling disabled)
|
package/dist/index.js
CHANGED
|
@@ -361,7 +361,7 @@ function register(api) {
|
|
|
361
361
|
if (cutoff < 1e12) cutoff *= 1e3;
|
|
362
362
|
const lastTs = await getLastMessageTimestampBefore(sessionFile, cutoff);
|
|
363
363
|
const idleOk = idleMinutes > 0 && typeof lastTs === "number" && now - lastTs >= idleMinutes * 60 * 1e3;
|
|
364
|
-
const contextTokens =
|
|
364
|
+
const contextTokens = Number(entry.totalTokens ?? entry.contextTokens ?? 0);
|
|
365
365
|
const thresholdOk = contextTokensThreshold > 0 && contextTokens >= contextTokensThreshold;
|
|
366
366
|
let shouldRun = false;
|
|
367
367
|
if (idleMinutes > 0 && contextTokensThreshold > 0) {
|
|
@@ -412,11 +412,11 @@ function register(api) {
|
|
|
412
412
|
content: e.message.content,
|
|
413
413
|
timestamp: e.message.timestamp ?? e.timestamp ?? Date.now()
|
|
414
414
|
}));
|
|
415
|
-
const { previousSummary, filtered } = findPreviousSummary(summaryMessages);
|
|
416
415
|
const secretsList = extractSecretsList();
|
|
416
|
+
const { previousSummary, filtered } = findPreviousSummary(summaryMessages);
|
|
417
417
|
let summaryText;
|
|
418
418
|
try {
|
|
419
|
-
summaryText = await summarizeWithFallback({
|
|
419
|
+
api.logger.info(`DEBUG filtered.length=${filtered ? filtered.length : "undefined"} previousSummary=${!!previousSummary}`); summaryText = await summarizeWithFallback({
|
|
420
420
|
messages: filtered,
|
|
421
421
|
baseUrl,
|
|
422
422
|
token,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pennyclaw/auto-compact",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Idle + threshold based transcript compaction with optional aggressive tool pruning.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"openclaw.plugin.json",
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
|
+
"openclaw": {
|
|
13
|
+
"extensions": [
|
|
14
|
+
"./dist/index.js"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
12
17
|
"keywords": [
|
|
13
18
|
"openclaw",
|
|
14
19
|
"plugin",
|