@psiclawops/hypermem 0.9.6 → 0.9.9
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/CHANGELOG.md +23 -0
- package/INSTALL.md +29 -9
- package/README.md +5 -1
- package/assets/default-config.json +20 -5
- package/assets/runtime-validation-fixture.json +123 -0
- package/bin/hypermem-cleanup.mjs +334 -0
- package/bin/hypermem-doctor.mjs +71 -0
- package/bin/hypermem-validate-runtime.mjs +282 -0
- package/dist/compositor.d.ts +43 -5
- package/dist/compositor.d.ts.map +1 -1
- package/dist/compositor.js +802 -30
- package/dist/entity-bridge-backfill.d.ts +66 -0
- package/dist/entity-bridge-backfill.d.ts.map +1 -0
- package/dist/entity-bridge-backfill.js +145 -0
- package/dist/entity-bridge-store.d.ts +164 -0
- package/dist/entity-bridge-store.d.ts.map +1 -0
- package/dist/entity-bridge-store.js +488 -0
- package/dist/entity-extractor.d.ts +124 -0
- package/dist/entity-extractor.d.ts.map +1 -0
- package/dist/entity-extractor.js +382 -0
- package/dist/entity-ppr.d.ts +55 -0
- package/dist/entity-ppr.d.ts.map +1 -0
- package/dist/entity-ppr.js +180 -0
- package/dist/hybrid-retrieval.d.ts +27 -0
- package/dist/hybrid-retrieval.d.ts.map +1 -1
- package/dist/hybrid-retrieval.js +26 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -13
- package/dist/message-store.d.ts +36 -0
- package/dist/message-store.d.ts.map +1 -1
- package/dist/message-store.js +155 -1
- package/dist/open-domain.d.ts +13 -4
- package/dist/open-domain.d.ts.map +1 -1
- package/dist/open-domain.js +222 -20
- package/dist/profiles.js +13 -13
- package/dist/question-shape.d.ts +73 -0
- package/dist/question-shape.d.ts.map +1 -0
- package/dist/question-shape.js +230 -0
- package/dist/schema.d.ts +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +92 -1
- package/dist/topic-detector.d.ts.map +1 -1
- package/dist/topic-detector.js +22 -9
- package/dist/types.d.ts +176 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vector-store.d.ts +6 -0
- package/dist/vector-store.d.ts.map +1 -1
- package/dist/vector-store.js +3 -0
- package/docs/DIAGNOSTICS.md +47 -0
- package/docs/INTEGRATION_VALIDATION.md +24 -4
- package/docs/TUNING.md +21 -21
- package/memory-plugin/dist/index.d.ts +3 -3
- package/memory-plugin/dist/index.js +4 -2
- package/memory-plugin/openclaw.plugin.json +5 -0
- package/memory-plugin/package.json +10 -6
- package/package.json +22 -5
- package/plugin/dist/index.d.ts +3 -3
- package/plugin/dist/index.d.ts.map +1 -1
- package/plugin/dist/index.js +115 -13
- package/plugin/dist/index.js.map +1 -1
- package/plugin/package.json +10 -6
- package/scripts/install-runtime.mjs +4 -1
|
@@ -11,6 +11,7 @@ This page is the operator validation contract for HyperMem releases. It describe
|
|
|
11
11
|
| Memory plugin | `~/.openclaw/plugins/hypermem/memory-plugin` | OpenClaw memory slot integration for `memory_search` and retrieval surfaces | `openclaw plugins list` shows `hypermem` loaded |
|
|
12
12
|
| Runtime staging tool | `hypermem-install` | Copies package runtime into `~/.openclaw/plugins/hypermem` | staged directory contains `dist`, `plugin`, `memory-plugin`, `bin` |
|
|
13
13
|
| Status CLI | `hypermem-status` | Health, database, vector, and runtime summary | `hypermem-status --health` exits cleanly or reports only healthy-empty state |
|
|
14
|
+
| Runtime validator | `hypermem-validate-runtime` | Seeds a deterministic fixture and validates write, FTS, facts, vector index/search, warm, and compose | exits 0 with `consistencyScore: 1` |
|
|
14
15
|
| Model audit CLI | `hypermem-model-audit` | Checks model context-window detection and overrides | `hypermem-model-audit --strict` reports no risky unknown models, or known required overrides |
|
|
15
16
|
|
|
16
17
|
## Install state machine
|
|
@@ -24,8 +25,9 @@ Do not treat installation as complete until all 5 states pass.
|
|
|
24
25
|
| 3. OpenClaw wired | OpenClaw config points at staged plugins | `plugins.load.paths` includes both staged plugin dirs, slots are set |
|
|
25
26
|
| 4. Runtime loaded | Gateway has loaded both plugins | `openclaw plugins list` shows `hypercompositor` and `hypermem` loaded |
|
|
26
27
|
| 5. Runtime active | HyperMem is composing live turns | logs show `[hypermem] hypermem initialized` and `[hypermem:compose]` |
|
|
28
|
+
| 6. Runtime validated | HyperMem components round-trip deterministic data | `hypermem-validate-runtime` exits 0 |
|
|
27
29
|
|
|
28
|
-
A successful `hypermem-install` proves only state 2. It does not modify OpenClaw config and does not restart the gateway.
|
|
30
|
+
A successful `hypermem-install` proves only state 2. It does not modify OpenClaw config and does not restart the gateway. A live install is not complete until runtime validation passes or a skipped semantic path is explicitly accepted for lightweight FTS-only mode.
|
|
29
31
|
|
|
30
32
|
## Fresh install validation
|
|
31
33
|
|
|
@@ -47,13 +49,13 @@ cat > ~/.openclaw/hypermem/config.json <<'JSON'
|
|
|
47
49
|
{
|
|
48
50
|
"embedding": { "provider": "none" },
|
|
49
51
|
"compositor": {
|
|
50
|
-
"budgetFraction": 0.
|
|
52
|
+
"budgetFraction": 0.60,
|
|
51
53
|
"contextWindowReserve": 0.25,
|
|
52
54
|
"targetBudgetFraction": 0.50,
|
|
53
55
|
"warmHistoryBudgetFraction": 0.27,
|
|
54
56
|
"maxFacts": 25,
|
|
55
|
-
"maxHistoryMessages":
|
|
56
|
-
"maxCrossSessionContext":
|
|
57
|
+
"maxHistoryMessages": 250,
|
|
58
|
+
"maxCrossSessionContext": 0,
|
|
57
59
|
"maxRecentToolPairs": 3,
|
|
58
60
|
"maxProseToolPairs": 10,
|
|
59
61
|
"keystoneHistoryFraction": 0.15,
|
|
@@ -88,6 +90,7 @@ Verify activation:
|
|
|
88
90
|
openclaw plugins list
|
|
89
91
|
openclaw logs --limit 100 | grep -E 'hypermem|context-engine'
|
|
90
92
|
hypermem-status --health
|
|
93
|
+
hypermem-validate-runtime --allow-no-embedding
|
|
91
94
|
hypermem-model-audit --strict
|
|
92
95
|
```
|
|
93
96
|
|
|
@@ -116,6 +119,7 @@ Validate after restart:
|
|
|
116
119
|
openclaw plugins list
|
|
117
120
|
openclaw logs --limit 100 | grep -E 'hypermem|context-engine|falling back'
|
|
118
121
|
hypermem-status --health
|
|
122
|
+
hypermem-validate-runtime --allow-no-embedding
|
|
119
123
|
hypermem-model-audit --strict
|
|
120
124
|
```
|
|
121
125
|
|
|
@@ -143,6 +147,9 @@ Before publishing a release, run:
|
|
|
143
147
|
|
|
144
148
|
```bash
|
|
145
149
|
npm run validate:version-parity
|
|
150
|
+
npm run validate:sdk-imports
|
|
151
|
+
npm run validate:sdk-latest-canary
|
|
152
|
+
npm run validate:plugin-checkers
|
|
146
153
|
npm run validate:docs
|
|
147
154
|
npm run validate:config
|
|
148
155
|
npm run validate:release-path
|
|
@@ -154,6 +161,10 @@ npm pack ./plugin --dry-run
|
|
|
154
161
|
npm pack ./memory-plugin --dry-run
|
|
155
162
|
```
|
|
156
163
|
|
|
164
|
+
The SDK gates are split deliberately: `validate:sdk-imports` enforces reproducible pinned OpenClaw Plugin SDK metadata, while `validate:sdk-latest-canary` rebuilds both plugin packages against the latest published OpenClaw SDK in a temp workspace so a stale pin cannot hide a future import break.
|
|
165
|
+
|
|
166
|
+
The plugin checker gate is deliberately composite: it runs Plugin Inspector static/runtime reports, isolated dependency-install cold import proof, production/dev dependency audit, Plugin Inspector issue-debt validation for the plugin packages. Raw Plugin Inspector P2 rows are not ignored: they must either disappear or have a proof artifact consumed by `validate:plugin-inspector:debt`.
|
|
167
|
+
|
|
157
168
|
Runtime validation must install the packed artifact, not the repo working tree. The production-shaped local install path is:
|
|
158
169
|
|
|
159
170
|
```bash
|
|
@@ -161,8 +172,17 @@ npm run install:runtime:packed
|
|
|
161
172
|
openclaw gateway restart
|
|
162
173
|
openclaw plugins list
|
|
163
174
|
node ~/.openclaw/plugins/hypermem/bin/hypermem-status.mjs --master
|
|
175
|
+
node ~/.openclaw/plugins/hypermem/bin/hypermem-validate-runtime.mjs --allow-no-embedding
|
|
164
176
|
```
|
|
165
177
|
|
|
178
|
+
The final OpenClaw host-runtime plugin checker is:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npm run validate:plugins:runtime
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
That gate packs and installs the release artifact into OpenClaw's managed plugin directory, refreshes the plugin registry, runs `openclaw plugins doctor`, and runs runtime inspection for `hypercompositor` and `hypermem`. Treat HyperMem-owned doctor diagnostics as release-blocking. Unrelated local plugin diagnostics are reported but ignored by the HyperMem gate.
|
|
185
|
+
|
|
166
186
|
For isolated validation, test the packed artifact from a temp directory:
|
|
167
187
|
|
|
168
188
|
```bash
|
package/docs/TUNING.md
CHANGED
|
@@ -72,7 +72,7 @@ Estimates on a 200k model (Claude Sonnet). Scale proportionally for smaller wind
|
|
|
72
72
|
| `standard` (default) | **35–50k** | 55–80k | All layers, default caps |
|
|
73
73
|
| `full` | **40–55k** | 60–85k | All layers, raised caps, cross-session on |
|
|
74
74
|
|
|
75
|
-
Standard turn 1 is
|
|
75
|
+
Standard turn 1 is intentionally conservative. Full keeps cross-session context opt-in and should be used only when operators accept the extra pressure.
|
|
76
76
|
|
|
77
77
|
**Turn 1 is where token-conscious users will react.** Light vs full on turn 1 is roughly 25–40k tokens — the number that shows up in provider dashboards. By turn 5 the gap is still real, but the value case is easier to make because the user has already experienced continuity.
|
|
78
78
|
|
|
@@ -145,12 +145,12 @@ The standard semantic configuration. All memory layers are active with 0.9.4 rec
|
|
|
145
145
|
"budgetFraction": 0.6,
|
|
146
146
|
"contextWindowReserve": 0.25,
|
|
147
147
|
"targetBudgetFraction": 0.5,
|
|
148
|
-
"warmHistoryBudgetFraction": 0.
|
|
149
|
-
"maxFacts":
|
|
148
|
+
"warmHistoryBudgetFraction": 0.27,
|
|
149
|
+
"maxFacts": 25,
|
|
150
150
|
"maxHistoryMessages": 250,
|
|
151
151
|
"maxCrossSessionContext": 0,
|
|
152
|
-
"keystoneHistoryFraction": 0.
|
|
153
|
-
"keystoneMaxMessages":
|
|
152
|
+
"keystoneHistoryFraction": 0.15,
|
|
153
|
+
"keystoneMaxMessages": 12,
|
|
154
154
|
"hyperformProfile": "standard"
|
|
155
155
|
},
|
|
156
156
|
"indexer": {
|
|
@@ -187,11 +187,11 @@ For long-running sessions, multi-agent fleets, or any deployment where the agent
|
|
|
187
187
|
"compositor": {
|
|
188
188
|
"budgetFraction": 0.70,
|
|
189
189
|
"contextWindowReserve": 0.22,
|
|
190
|
-
"maxFacts":
|
|
190
|
+
"maxFacts": 35,
|
|
191
191
|
"maxHistoryMessages": 500,
|
|
192
|
-
"maxCrossSessionContext":
|
|
193
|
-
"keystoneHistoryFraction": 0.
|
|
194
|
-
"keystoneMaxMessages":
|
|
192
|
+
"maxCrossSessionContext": 4000,
|
|
193
|
+
"keystoneHistoryFraction": 0.18,
|
|
194
|
+
"keystoneMaxMessages": 18,
|
|
195
195
|
"wikiTokenCap": 600,
|
|
196
196
|
"hyperformProfile": "full"
|
|
197
197
|
},
|
|
@@ -234,7 +234,7 @@ Three pre-built profiles ship with hypermem. Each configures every setting to a
|
|
|
234
234
|
| Profile | Context window | Budget | Hyperform | Best for |
|
|
235
235
|
|---|---|---|---|---|
|
|
236
236
|
| `light` | 64k | 40k effective | `light` (behavior only) | Single agent, small models, constrained resources |
|
|
237
|
-
| `standard` | 128k |
|
|
237
|
+
| `standard` | 128k | ~77k effective before reserve | `standard` (behavior + structure) | Normal deployments, safe starter posture |
|
|
238
238
|
| `full` | 200k+ | 160k effective | `full` (behavior + model adaptation) | Multi-agent fleets, large-context models |
|
|
239
239
|
|
|
240
240
|
```ts
|
|
@@ -432,10 +432,10 @@ effective budget × (1 - targetBudgetFraction) = history budget
|
|
|
432
432
|
**Worked example (standard profile, 128k model):**
|
|
433
433
|
|
|
434
434
|
```
|
|
435
|
-
128,000 × 0.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
435
|
+
128,000 × 0.60 = 76,800 (effective budget before reserve)
|
|
436
|
+
76,800 × (1 - 0.25) = 57,600 (effective budget after reserve)
|
|
437
|
+
57,600 × 0.50 = 28,800 (context assembly budget)
|
|
438
|
+
57,600 × 0.50 = 28,800 (history budget)
|
|
439
439
|
```
|
|
440
440
|
|
|
441
441
|
**Model swap resilience:** The budget is computed from the model's actual context window at compose time when OpenClaw passes `tokenBudget`. If runtime metadata is missing, HyperMem falls back to `contextWindowOverrides` and then `contextWindowSize`. Structured tool history is guarded from being overwritten during a budget downshift — the compositor computes the new allocation but doesn't persist a lower-context snapshot to disk, preserving the full history for when the larger model returns.
|
|
@@ -542,7 +542,7 @@ This gives only 45% to context assembly and 55% to history. Useful for coding ag
|
|
|
542
542
|
}
|
|
543
543
|
```
|
|
544
544
|
|
|
545
|
-
Raises the fact injection cap from the default
|
|
545
|
+
Raises the fact injection cap from the default 25 to 50, and reduces wiki page space from 600 to 400 tokens.
|
|
546
546
|
|
|
547
547
|
**More keystone history (recalled older messages):**
|
|
548
548
|
|
|
@@ -555,7 +555,7 @@ Raises the fact injection cap from the default 30 to 50, and reduces wiki page s
|
|
|
555
555
|
}
|
|
556
556
|
```
|
|
557
557
|
|
|
558
|
-
Reserves 30% of the history budget for keystones (up from default
|
|
558
|
+
Reserves 30% of the history budget for keystones (up from default 15%) and allows up to 25 keystone messages (up from 12). Keystones are high-significance older messages that survive pressure trimming ahead of ordinary history.
|
|
559
559
|
|
|
560
560
|
### Adjusting for model context size
|
|
561
561
|
|
|
@@ -880,7 +880,7 @@ Higher `contextWindowReserve` (0.30) gives more headroom for large tool results.
|
|
|
880
880
|
|
|
881
881
|
| Knob | Type | Default | What it controls |
|
|
882
882
|
|---|---|---|---|
|
|
883
|
-
| `maxFacts` | number |
|
|
883
|
+
| `maxFacts` | number | 25 | Maximum facts surfaced per compose pass. |
|
|
884
884
|
| `wikiTokenCap` | tokens | 600 | Hard ceiling on wiki/knowledge injection per pass. |
|
|
885
885
|
| `maxTotalTriggerTokens` | tokens | 4000 | Ceiling across all trigger-fired doc chunk collections. |
|
|
886
886
|
|
|
@@ -888,9 +888,9 @@ Higher `contextWindowReserve` (0.30) gives more headroom for large tool results.
|
|
|
888
888
|
|
|
889
889
|
| Knob | Type | Default | What it controls |
|
|
890
890
|
|---|---|---|---|
|
|
891
|
-
| `maxHistoryMessages` | number |
|
|
892
|
-
| `keystoneHistoryFraction` | 0.0
|
|
893
|
-
| `keystoneMaxMessages` | number |
|
|
891
|
+
| `maxHistoryMessages` | number | 250 | Maximum messages in the hot history window. |
|
|
892
|
+
| `keystoneHistoryFraction` | 0.0-0.5 | 0.15 | Fraction of history budget reserved for keystones. 0 disables. |
|
|
893
|
+
| `keystoneMaxMessages` | number | 12 | Max keystone messages injected per pass. |
|
|
894
894
|
| `keystoneMinSignificance` | 0.0–1.0 | 0.5 | Minimum episode significance for keystone qualification. |
|
|
895
895
|
|
|
896
896
|
### Tool history
|
|
@@ -899,7 +899,7 @@ Higher `contextWindowReserve` (0.30) gives more headroom for large tool results.
|
|
|
899
899
|
|---|---|---|---|
|
|
900
900
|
| `maxRecentToolPairs` | number | 3 | Tool call/result pairs kept verbatim. |
|
|
901
901
|
| `maxProseToolPairs` | number | 10 | Older pairs converted to prose stubs. Beyond this, payloads dropped. |
|
|
902
|
-
| `maxCrossSessionContext` | tokens |
|
|
902
|
+
| `maxCrossSessionContext` | tokens | 0 | Token ceiling for cross-session context. 0 disables and is the default. |
|
|
903
903
|
|
|
904
904
|
### Dynamic reserve
|
|
905
905
|
|
|
@@ -18,7 +18,7 @@ declare const _default: {
|
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
20
20
|
description: string;
|
|
21
|
-
configSchema: import("openclaw/plugin-sdk").OpenClawPluginConfigSchema;
|
|
22
|
-
register: NonNullable<import("openclaw/plugin-sdk/
|
|
23
|
-
} & Pick<import("openclaw/plugin-sdk/
|
|
21
|
+
configSchema: import("openclaw/plugin-sdk/core").OpenClawPluginConfigSchema;
|
|
22
|
+
register: NonNullable<import("openclaw/plugin-sdk/core").OpenClawPluginDefinition["register"]>;
|
|
23
|
+
} & Pick<import("openclaw/plugin-sdk/core").OpenClawPluginDefinition, "kind" | "reload" | "nodeHostCommands" | "securityAuditCollectors">;
|
|
24
24
|
export default _default;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Both plugins share the same HyperMem singleton (loaded from repo dist).
|
|
16
16
|
*/
|
|
17
|
-
import { definePluginEntry, emptyPluginConfigSchema } from 'openclaw/plugin-sdk/
|
|
17
|
+
import { definePluginEntry, emptyPluginConfigSchema } from 'openclaw/plugin-sdk/core';
|
|
18
18
|
import { matchTriggers, TRIGGER_REGISTRY } from '@psiclawops/hypermem';
|
|
19
19
|
import path from 'path';
|
|
20
20
|
import fs from 'fs/promises';
|
|
@@ -181,9 +181,11 @@ function createMemorySearchManager(hm, agentId, workspaceDir) {
|
|
|
181
181
|
try {
|
|
182
182
|
const vectorStore = hm.getVectorStore();
|
|
183
183
|
if (vectorStore) {
|
|
184
|
-
const
|
|
184
|
+
const semanticSearch = hm.semanticSearch;
|
|
185
|
+
const vectorResults = await semanticSearch(agentId, query, {
|
|
185
186
|
limit: maxResults,
|
|
186
187
|
maxDistance: 1.5,
|
|
188
|
+
allowInlineQueryEmbedding: false,
|
|
187
189
|
});
|
|
188
190
|
for (const vr of vectorResults) {
|
|
189
191
|
const score = 1.0 - (vr.distance / 2.0); // normalize distance to 0-1 score
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@psiclawops/hypermem-memory",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "HyperMem memory plugin for OpenClaw \u2014 bridges HyperMem retrieval into the memory slot",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"minGatewayVersion": "2026.4.12"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.
|
|
33
|
-
"pluginSdkVersion": "2026.
|
|
32
|
+
"openclawVersion": "2026.5.7",
|
|
33
|
+
"pluginSdkVersion": "2026.5.7"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@psiclawops/hypermem": "0.9.
|
|
43
|
+
"@psiclawops/hypermem": "0.9.9"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"openclaw": "
|
|
46
|
+
"openclaw": "2026.5.7",
|
|
47
47
|
"typescript": "^5.4.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -62,5 +62,9 @@
|
|
|
62
62
|
"openclaw.plugin.json",
|
|
63
63
|
"README.md",
|
|
64
64
|
"LICENSE"
|
|
65
|
-
]
|
|
65
|
+
],
|
|
66
|
+
"overrides": {
|
|
67
|
+
"uuid": "14.0.0",
|
|
68
|
+
"fast-xml-builder": "1.2.0"
|
|
69
|
+
}
|
|
66
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@psiclawops/hypermem",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Agent-centric memory and context composition engine for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"hypermem-install": "scripts/install-runtime.mjs",
|
|
11
11
|
"hypermem-model-audit": "bin/hypermem-model-audit.mjs",
|
|
12
12
|
"hypermem-bench": "bin/hypermem-bench.mjs",
|
|
13
|
-
"hypermem-doctor": "bin/hypermem-doctor.mjs"
|
|
13
|
+
"hypermem-doctor": "bin/hypermem-doctor.mjs",
|
|
14
|
+
"hypermem-cleanup": "bin/hypermem-cleanup.mjs",
|
|
15
|
+
"hypermem-validate-runtime": "bin/hypermem-validate-runtime.mjs"
|
|
14
16
|
},
|
|
15
17
|
"exports": {
|
|
16
18
|
".": {
|
|
@@ -31,13 +33,14 @@
|
|
|
31
33
|
"install:runtime": "node scripts/install-runtime.mjs",
|
|
32
34
|
"dev": "tsc --watch",
|
|
33
35
|
"typecheck": "tsc --noEmit",
|
|
34
|
-
"test": "npm run build && node test/smoke.mjs && node test/lightweight-mode.mjs && node test/cross-agent.mjs && node test/vector-search.mjs && node test/embed-existing-coverage.mjs && node test/library.mjs && node test/compositor.mjs && node test/fleet-cache.mjs && node test/fleet-startup-seeding.mjs && node test/rotation.mjs && node test/knowledge-graph.mjs && node test/rate-limiter.mjs && node test/doc-chunker.mjs && node test/compaction-fence-gate.mjs && node test/hybrid-retrieval.mjs && node test/reranker-hotfix.mjs && node test/live-org-registry.mjs && node test/multi-turn-session.mjs && node test/secret-scanner.mjs && node --test test/content-type-classifier.mjs && node --test test/composition-snapshot-integrity.test.mjs && node --test test/composition-snapshot-store.test.mjs && node test/keystone-history.mjs && node test/cross-topic-keystone.mjs && node test/proactive-pass.mjs && node test/topic-synthesis.mjs && node test/session-topic-map.mjs && node test/virtual-sessions.mjs && node test/budget-downshift.mjs && node --test test/image-eviction.mjs && node test/fos-mod.mjs && node test/history-depth-estimator.mjs && node test/unified-pressure-signal.mjs && node test/sprint4-prompt-placement.mjs && node test/model-aware-budgeting-b4.mjs && node test/adaptive-lifecycle.mjs && node test/repair-tool-pairs.mjs && node test/tool-result-guards.mjs && node test/phase-c-fixtures.mjs && node test/oversized-artifact-c2.mjs && node test/oversized-artifact-guards.mjs && node test/doc-chunk-artifact-retrieval.mjs && node test/dreaming-promoter-temporal.mjs",
|
|
36
|
+
"test": "npm run build && node test/smoke.mjs && node test/lightweight-mode.mjs && node test/cross-agent.mjs && node test/vector-search.mjs && node test/embed-existing-coverage.mjs && node test/library.mjs && node test/compositor.mjs && node test/fleet-cache.mjs && node test/fleet-startup-seeding.mjs && node test/rotation.mjs && node test/knowledge-graph.mjs && node test/rate-limiter.mjs && node test/doc-chunker.mjs && node test/compaction-fence-gate.mjs && node test/hybrid-retrieval.mjs && node --test test/entity-extractor.mjs test/question-shape.mjs test/entity-bridge.mjs && node test/reranker-hotfix.mjs && node test/live-org-registry.mjs && node test/multi-turn-session.mjs && node test/secret-scanner.mjs && node --test test/content-type-classifier.mjs && node --test test/composition-snapshot-integrity.test.mjs && node --test test/composition-snapshot-store.test.mjs && node test/keystone-history.mjs && node test/cross-topic-keystone.mjs && node test/proactive-pass.mjs && node test/topic-synthesis.mjs && node test/session-topic-map.mjs && node test/virtual-sessions.mjs && node test/budget-downshift.mjs && node --test test/image-eviction.mjs && node test/fos-mod.mjs && node test/history-depth-estimator.mjs && node test/unified-pressure-signal.mjs && node test/sprint4-prompt-placement.mjs && node test/model-aware-budgeting-b4.mjs && node test/adaptive-lifecycle.mjs && node test/repair-tool-pairs.mjs && node test/tool-result-guards.mjs && node test/phase-c-fixtures.mjs && node test/oversized-artifact-c2.mjs && node test/oversized-artifact-guards.mjs && node test/doc-chunk-artifact-retrieval.mjs && node test/dreaming-promoter-temporal.mjs",
|
|
35
37
|
"test:quick": "node test/smoke.mjs && node test/lightweight-mode.mjs && node test/library.mjs && node test/compositor.mjs",
|
|
36
38
|
"validate:plugin-pipeline": "npm --prefix plugin run build && node test/plugin-pipeline.mjs && node test/batch-trim-b3.mjs",
|
|
37
39
|
"validate:release-path": "npm run build && npm --prefix plugin run build && node test/release-gateway-path.mjs",
|
|
38
40
|
"test:multi-turn": "node test/multi-turn-session.mjs",
|
|
39
41
|
"test:ci": "npm test && npm --prefix plugin run typecheck",
|
|
40
42
|
"smoke": "node scripts/smoke-test.mjs",
|
|
43
|
+
"validate:runtime": "node bin/hypermem-validate-runtime.mjs --data-dir /tmp/hypermem-runtime-validation --allow-no-embedding",
|
|
41
44
|
"sync-public": "node scripts/sync-public.mjs",
|
|
42
45
|
"validate:docs": "node scripts/validate-docs.mjs",
|
|
43
46
|
"validate:config": "node scripts/validate-config-surface.mjs",
|
|
@@ -45,16 +48,27 @@
|
|
|
45
48
|
"validate:public-surface": "node scripts/validate-public-surface.mjs",
|
|
46
49
|
"bench:memory": "node bench/data-access-bench.mjs --iterations 1000 --warmup 50",
|
|
47
50
|
"validate:doctor": "node test/doctor-cli.mjs",
|
|
48
|
-
"build:all": "npm run build && npm --prefix plugin
|
|
51
|
+
"build:all": "npm run build && npm --prefix plugin run build && npm --prefix memory-plugin run build",
|
|
49
52
|
"validate:history-query": "npm run build && npm --prefix memory-plugin run build && node scripts/validate-history-query.mjs",
|
|
50
53
|
"install:runtime:packed": "node scripts/install-packed-runtime.mjs",
|
|
51
|
-
"release:install-smoke": "bash release-gate-internal/fresh-install-smoke.sh"
|
|
54
|
+
"release:install-smoke": "bash release-gate-internal/fresh-install-smoke.sh",
|
|
55
|
+
"validate:sdk-imports": "node scripts/validate-sdk-imports.mjs",
|
|
56
|
+
"validate:sdk-latest-canary": "node scripts/validate-sdk-latest-canary.mjs",
|
|
57
|
+
"validate:plugin-inspector": "node scripts/validate-plugin-inspector.mjs",
|
|
58
|
+
"validate:plugin-inspector:runtime": "npm run build:all && node scripts/validate-plugin-inspector.mjs --runtime",
|
|
59
|
+
"validate:plugins:runtime": "node scripts/validate-openclaw-plugin-runtime.mjs",
|
|
60
|
+
"validate:release-readiness": "npm run validate:version-parity && npm run validate:sdk-imports && npm run validate:sdk-latest-canary && npm run validate:plugin-checkers && npm run validate:docs && npm run validate:config && npm run validate:release-path && npm run validate:public-surface",
|
|
61
|
+
"validate:plugin-isolated-cold-import": "npm run build:all && node scripts/validate-plugin-isolated-cold-import.mjs",
|
|
62
|
+
"validate:plugin-inspector:debt": "node scripts/validate-plugin-inspector-issue-debt.mjs",
|
|
63
|
+
"validate:plugin-checkers": "npm run validate:plugin-inspector && npm run validate:plugin-isolated-cold-import && npm run validate:plugin-inspector:runtime && npm run validate:plugin-inspector:debt && npm run validate:plugin-dev-audit",
|
|
64
|
+
"validate:plugin-dev-audit": "npm audit && npm --prefix plugin audit && npm --prefix memory-plugin audit"
|
|
52
65
|
},
|
|
53
66
|
"dependencies": {
|
|
54
67
|
"sqlite-vec": "^0.1.9",
|
|
55
68
|
"zod": "^4.0.0"
|
|
56
69
|
},
|
|
57
70
|
"devDependencies": {
|
|
71
|
+
"@openclaw/plugin-inspector": "0.3.6",
|
|
58
72
|
"@types/node": "^22.0.0",
|
|
59
73
|
"typescript": "^5.7.0"
|
|
60
74
|
},
|
|
@@ -66,9 +80,12 @@
|
|
|
66
80
|
"dist/**/*.d.ts",
|
|
67
81
|
"dist/**/*.d.ts.map",
|
|
68
82
|
"assets/default-config.json",
|
|
83
|
+
"assets/runtime-validation-fixture.json",
|
|
69
84
|
"bin/hypermem-status.mjs",
|
|
70
85
|
"bin/hypermem-model-audit.mjs",
|
|
71
86
|
"bin/hypermem-doctor.mjs",
|
|
87
|
+
"bin/hypermem-cleanup.mjs",
|
|
88
|
+
"bin/hypermem-validate-runtime.mjs",
|
|
72
89
|
"bench/README.md",
|
|
73
90
|
"bench/data-access-bench.mjs",
|
|
74
91
|
"bin/hypermem-bench.mjs",
|
package/plugin/dist/index.d.ts
CHANGED
|
@@ -203,8 +203,8 @@ declare const _default: {
|
|
|
203
203
|
id: string;
|
|
204
204
|
name: string;
|
|
205
205
|
description: string;
|
|
206
|
-
configSchema: import("openclaw/plugin-sdk").OpenClawPluginConfigSchema;
|
|
207
|
-
register: NonNullable<import("openclaw/plugin-sdk/
|
|
208
|
-
} & Pick<import("openclaw/plugin-sdk/
|
|
206
|
+
configSchema: import("openclaw/plugin-sdk/core").OpenClawPluginConfigSchema;
|
|
207
|
+
register: NonNullable<import("openclaw/plugin-sdk/core").OpenClawPluginDefinition["register"]>;
|
|
208
|
+
} & Pick<import("openclaw/plugin-sdk/core").OpenClawPluginDefinition, "kind" | "reload" | "nodeHostCommands" | "securityAuditCollectors">;
|
|
209
209
|
export default _default;
|
|
210
210
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","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C;CACtB,GAAG,IAAI,GAAG,SAAS,EACpB,OAAO,EAAE;IACP,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA;IACD,gBAAgB,EAAE,aAAa,CAAC;IAChC,eAAe,EAAE,aAAa,CAAC;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;CACvB,CAyBA;AA62GD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAU1F;;;;;;;;AA2GD,wBAgGG"}
|
package/plugin/dist/index.js
CHANGED
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* Session key format expected: "agent:<agentId>:<channel>:<name>"
|
|
21
21
|
*/
|
|
22
|
-
import { definePluginEntry } from 'openclaw/plugin-sdk/
|
|
23
|
-
import { buildPluginConfigSchema } from 'openclaw/plugin-sdk/core';
|
|
22
|
+
import { buildPluginConfigSchema, definePluginEntry } from 'openclaw/plugin-sdk/core';
|
|
24
23
|
import { z } from 'zod';
|
|
25
24
|
import { detectTopicShift, stripMessageMetadata, SessionTopicMap, applyToolGradientToWindow, OPENCLAW_BOOTSTRAP_FILES, rotateSessionContext, TRIM_SOFT_TARGET, TRIM_GROWTH_THRESHOLD, TRIM_HEADROOM_FRACTION, resolveTrimBudgets, resolveAdaptiveLifecyclePolicy, formatToolChainStub, decideReplayRecovery, isReplayState, recordOutputMetrics,
|
|
26
25
|
// Sprint 3: unified pressure signal
|
|
@@ -813,6 +812,67 @@ function extractTextFromInboundContent(content) {
|
|
|
813
812
|
.map(part => part.text ?? '')
|
|
814
813
|
.join('\n');
|
|
815
814
|
}
|
|
815
|
+
function isToolResultRole(role) {
|
|
816
|
+
return role === 'tool' || role === 'tool_result' || role === 'toolResult';
|
|
817
|
+
}
|
|
818
|
+
function isPersistableInboundRole(role) {
|
|
819
|
+
return role === 'user' || role === 'assistant' || role === 'system' || isToolResultRole(role);
|
|
820
|
+
}
|
|
821
|
+
function isSenderMetadataText(text) {
|
|
822
|
+
const trimmed = text.trim();
|
|
823
|
+
if (!trimmed)
|
|
824
|
+
return false;
|
|
825
|
+
if (/^Sender \(untrusted metadata\):/i.test(trimmed))
|
|
826
|
+
return true;
|
|
827
|
+
return stripMessageMetadata(trimmed).trim().length === 0 && /Sender \(untrusted metadata\):/i.test(trimmed);
|
|
828
|
+
}
|
|
829
|
+
function shouldDropInboundMessage(msg) {
|
|
830
|
+
if (isPersistableInboundRole(msg.role))
|
|
831
|
+
return false;
|
|
832
|
+
const text = extractTextFromInboundContent(msg.content);
|
|
833
|
+
// OpenClaw/webchat may carry adjacent sender envelopes as role='custom'. They
|
|
834
|
+
// are transport metadata, not conversation turns. Persisting or replaying them
|
|
835
|
+
// lets the metadata row become the latest assistant-ish history item, which can
|
|
836
|
+
// mask the real user prompt under load.
|
|
837
|
+
if (msg.role === 'custom' && isSenderMetadataText(text))
|
|
838
|
+
return true;
|
|
839
|
+
// Unknown roles are not part of the provider transcript contract. Dropping is
|
|
840
|
+
// safer than casting them to assistant in toNeutralMessage().
|
|
841
|
+
return true;
|
|
842
|
+
}
|
|
843
|
+
function sanitizeInboundMessageForModel(msg) {
|
|
844
|
+
if (shouldDropInboundMessage(msg))
|
|
845
|
+
return null;
|
|
846
|
+
// OpenClaw prepends untrusted inbound metadata directly to user-role text for
|
|
847
|
+
// the current provider prompt. That context is useful for the live inbound
|
|
848
|
+
// turn, but if HyperMem replays it from the message window it becomes duplicate
|
|
849
|
+
// user content and can make the model repeat the previous message. Strip it at
|
|
850
|
+
// the context-engine boundary while preserving the actual user text.
|
|
851
|
+
if (msg.role !== 'user')
|
|
852
|
+
return msg;
|
|
853
|
+
if (typeof msg.content === 'string') {
|
|
854
|
+
const stripped = stripMessageMetadata(msg.content);
|
|
855
|
+
return stripped === msg.content ? msg : { ...msg, content: stripped };
|
|
856
|
+
}
|
|
857
|
+
if (Array.isArray(msg.content)) {
|
|
858
|
+
let changed = false;
|
|
859
|
+
const content = msg.content.map((part) => {
|
|
860
|
+
if (!part || part.type !== 'text' || typeof part.text !== 'string')
|
|
861
|
+
return part;
|
|
862
|
+
const stripped = stripMessageMetadata(part.text);
|
|
863
|
+
if (stripped !== part.text)
|
|
864
|
+
changed = true;
|
|
865
|
+
return stripped === part.text ? part : { ...part, text: stripped };
|
|
866
|
+
});
|
|
867
|
+
return changed ? { ...msg, content } : msg;
|
|
868
|
+
}
|
|
869
|
+
return msg;
|
|
870
|
+
}
|
|
871
|
+
function sanitizeInboundMessagesForModel(messages) {
|
|
872
|
+
return messages
|
|
873
|
+
.map((msg) => sanitizeInboundMessageForModel(msg))
|
|
874
|
+
.filter((msg) => Boolean(msg));
|
|
875
|
+
}
|
|
816
876
|
/**
|
|
817
877
|
* Determine whether a user turn is "topic-bearing" (substantive).
|
|
818
878
|
*
|
|
@@ -1046,7 +1106,7 @@ function toNeutralMessage(msg) {
|
|
|
1046
1106
|
toolCalls = contentBlockToolCalls;
|
|
1047
1107
|
}
|
|
1048
1108
|
// OpenClaw uses role 'toolResult' (camelCase). Support all three spellings.
|
|
1049
|
-
const isToolResultMsg = msg.role
|
|
1109
|
+
const isToolResultMsg = isToolResultRole(msg.role);
|
|
1050
1110
|
// Tool results must stay on the result side of the transcript. If we persist them as
|
|
1051
1111
|
// assistant rows with orphaned toolResults, later replay can retain a tool_result after
|
|
1052
1112
|
// trimming away the matching assistant tool_use, which Anthropic rejects with a 400.
|
|
@@ -1067,6 +1127,27 @@ function toNeutralMessage(msg) {
|
|
|
1067
1127
|
toolResults,
|
|
1068
1128
|
};
|
|
1069
1129
|
}
|
|
1130
|
+
function isPlainUserTurnMessage(msg) {
|
|
1131
|
+
if (msg.role !== 'user' || shouldDropInboundMessage(msg))
|
|
1132
|
+
return false;
|
|
1133
|
+
const neutral = toNeutralMessage(msg);
|
|
1134
|
+
return neutral.role === 'user'
|
|
1135
|
+
&& !neutral.toolResults?.length
|
|
1136
|
+
&& stripMessageMetadata(neutral.textContent ?? '').trim().length > 0;
|
|
1137
|
+
}
|
|
1138
|
+
function findBoundaryPlainUserMessage(messages, prePromptMessageCount) {
|
|
1139
|
+
const start = Math.min(prePromptMessageCount - 1, messages.length - 1);
|
|
1140
|
+
for (let i = start; i >= 0; i--) {
|
|
1141
|
+
const msg = messages[i];
|
|
1142
|
+
if (shouldDropInboundMessage(msg))
|
|
1143
|
+
continue;
|
|
1144
|
+
if (isPlainUserTurnMessage(msg))
|
|
1145
|
+
return msg;
|
|
1146
|
+
if (msg.role === 'assistant' || msg.role === 'system' || isToolResultRole(msg.role))
|
|
1147
|
+
return null;
|
|
1148
|
+
}
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1070
1151
|
// ─── Context Engine Implementation ─────────────────────────────
|
|
1071
1152
|
/**
|
|
1072
1153
|
* In-flight warm dedup map.
|
|
@@ -1640,7 +1721,7 @@ function createHyperMemEngine() {
|
|
|
1640
1721
|
}
|
|
1641
1722
|
// Skip system messages — they come from the runtime, not the conversation
|
|
1642
1723
|
const msg = message;
|
|
1643
|
-
if (msg.role === 'system') {
|
|
1724
|
+
if (msg.role === 'system' || shouldDropInboundMessage(msg)) {
|
|
1644
1725
|
return { ingested: false };
|
|
1645
1726
|
}
|
|
1646
1727
|
try {
|
|
@@ -1755,7 +1836,7 @@ function createHyperMemEngine() {
|
|
|
1755
1836
|
const agentId = extractAgentId(sk);
|
|
1756
1837
|
for (const message of messages) {
|
|
1757
1838
|
const msg = message;
|
|
1758
|
-
if (msg.role === 'system')
|
|
1839
|
+
if (msg.role === 'system' || shouldDropInboundMessage(msg))
|
|
1759
1840
|
continue;
|
|
1760
1841
|
const neutral = toNeutralMessage(msg);
|
|
1761
1842
|
if (neutral.role === 'user' && !neutral.toolResults?.length) {
|
|
@@ -1785,6 +1866,11 @@ function createHyperMemEngine() {
|
|
|
1785
1866
|
* systemPromptAddition — facts/recall/episodes injected before runtime system prompt
|
|
1786
1867
|
*/
|
|
1787
1868
|
async assemble({ sessionId, sessionKey, messages, tokenBudget, prompt, model }) {
|
|
1869
|
+
// Drop non-provider transcript metadata before any pass-through, token
|
|
1870
|
+
// estimate, or persistence-adjacent decision. The current user prompt is
|
|
1871
|
+
// carried separately as `prompt`; adjacent role='custom' sender envelopes
|
|
1872
|
+
// must never become the final model message.
|
|
1873
|
+
messages = sanitizeInboundMessagesForModel(messages);
|
|
1788
1874
|
// ── Tool-loop guard ──────────────────────────────────────────────────────
|
|
1789
1875
|
// When the last message is a toolResult, the runtime is mid tool-loop:
|
|
1790
1876
|
// the model already has full context from the initial turn assembly.
|
|
@@ -2795,7 +2881,10 @@ ${replayRecovery.emittedText}`
|
|
|
2795
2881
|
*
|
|
2796
2882
|
* IMPORTANT: When afterTurn is defined, the runtime calls ONLY afterTurn —
|
|
2797
2883
|
* it never calls ingest() or ingestBatch(). So we must ingest the new
|
|
2798
|
-
* messages here
|
|
2884
|
+
* messages here. Some OpenClaw runtimes include the current user + adjacent
|
|
2885
|
+
* transport metadata in prePromptMessageCount, leaving only assistant/tool
|
|
2886
|
+
* outputs in messages.slice(prePromptMessageCount). Reconcile the boundary
|
|
2887
|
+
* user turn explicitly so SQLite preserves the real user→assistant order.
|
|
2799
2888
|
*/
|
|
2800
2889
|
async afterTurn({ sessionId, sessionKey, messages, prePromptMessageCount, isHeartbeat, runtimeContext }) {
|
|
2801
2890
|
if (isHeartbeat)
|
|
@@ -2804,12 +2893,25 @@ ${replayRecovery.emittedText}`
|
|
|
2804
2893
|
const hm = await getHyperMem();
|
|
2805
2894
|
const sk = resolveSessionKey(sessionId, sessionKey);
|
|
2806
2895
|
const agentId = extractAgentId(sk);
|
|
2807
|
-
// Ingest only the new messages produced this turn
|
|
2896
|
+
// Ingest only the new messages produced this turn, plus the boundary
|
|
2897
|
+
// user turn when OpenClaw counted it as pre-prompt context. The write
|
|
2898
|
+
// path is idempotent, so if an ingress/runtime variant already persisted
|
|
2899
|
+
// this user message, recordUserMessage() suppresses the duplicate.
|
|
2808
2900
|
const newMessages = messages.slice(prePromptMessageCount);
|
|
2809
|
-
|
|
2901
|
+
const hasNewPlainUserMessage = newMessages
|
|
2902
|
+
.map(m => m)
|
|
2903
|
+
.some(m => isPlainUserTurnMessage(m));
|
|
2904
|
+
const boundaryUserMessage = hasNewPlainUserMessage
|
|
2905
|
+
? null
|
|
2906
|
+
: findBoundaryPlainUserMessage(messages, prePromptMessageCount);
|
|
2907
|
+
const currentTurnMessages = boundaryUserMessage
|
|
2908
|
+
? [boundaryUserMessage, ...newMessages]
|
|
2909
|
+
: newMessages;
|
|
2910
|
+
for (const msg of currentTurnMessages) {
|
|
2810
2911
|
const m = msg;
|
|
2811
|
-
// Skip system messages — they come from the
|
|
2812
|
-
|
|
2912
|
+
// Skip system and non-provider metadata messages — they come from the
|
|
2913
|
+
// runtime/transport, not the conversation.
|
|
2914
|
+
if (m.role === 'system' || shouldDropInboundMessage(m))
|
|
2813
2915
|
continue;
|
|
2814
2916
|
if (m.role === 'toolResult' && extractTextFromInboundContent(m.content).trim() === SYNTHETIC_MISSING_TOOL_RESULT_TEXT) {
|
|
2815
2917
|
const toolCallId = typeof m.toolCallId === 'string' ? m.toolCallId : 'unknown';
|
|
@@ -2845,7 +2947,7 @@ ${replayRecovery.emittedText}`
|
|
|
2845
2947
|
}
|
|
2846
2948
|
}
|
|
2847
2949
|
try {
|
|
2848
|
-
const lastAssistantMessage = [...
|
|
2950
|
+
const lastAssistantMessage = [...currentTurnMessages].reverse().find(m => m.role === 'assistant');
|
|
2849
2951
|
if (lastAssistantMessage) {
|
|
2850
2952
|
const modelState = await hm.cache.getModelState(agentId, sk).catch(() => null);
|
|
2851
2953
|
const promptCacheUsage = runtimeContext?.promptCache?.lastCallUsage;
|
|
@@ -2893,7 +2995,7 @@ ${replayRecovery.emittedText}`
|
|
|
2893
2995
|
// Non-fatal: topic detection never blocks afterTurn
|
|
2894
2996
|
let adaptiveTopicShiftConfidence;
|
|
2895
2997
|
try {
|
|
2896
|
-
const inboundUserMsg =
|
|
2998
|
+
const inboundUserMsg = currentTurnMessages
|
|
2897
2999
|
.map(m => m)
|
|
2898
3000
|
.find(m => m.role === 'user');
|
|
2899
3001
|
if (inboundUserMsg) {
|
|
@@ -2954,7 +3056,7 @@ ${replayRecovery.emittedText}`
|
|
|
2954
3056
|
const modelState = await hm.cache.getModelState(agentId, sk);
|
|
2955
3057
|
const gradientBudget = modelState?.tokenBudget;
|
|
2956
3058
|
const gradientDepth = modelState?.historyDepth;
|
|
2957
|
-
const inboundUserMsg =
|
|
3059
|
+
const inboundUserMsg = currentTurnMessages
|
|
2958
3060
|
.map(m => m)
|
|
2959
3061
|
.find(m => m.role === 'user');
|
|
2960
3062
|
const inboundUserText = inboundUserMsg
|