@psiclawops/hypermem 0.8.5 → 0.9.0
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 +26 -0
- package/INSTALL.md +132 -9
- package/README.md +119 -272
- package/bench/README.md +42 -0
- package/bench/data-access-bench.mjs +380 -0
- package/bin/hypermem-bench.mjs +2 -0
- package/bin/hypermem-doctor.mjs +412 -0
- package/bin/hypermem-model-audit.mjs +339 -0
- package/bin/hypermem-status.mjs +491 -70
- package/dist/adaptive-lifecycle.d.ts +81 -0
- package/dist/adaptive-lifecycle.d.ts.map +1 -0
- package/dist/adaptive-lifecycle.js +190 -0
- package/dist/budget-policy.d.ts +1 -1
- package/dist/budget-policy.d.ts.map +1 -1
- package/dist/budget-policy.js +10 -5
- package/dist/cache.d.ts +1 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +2 -0
- package/dist/composition-snapshot-integrity.d.ts +36 -0
- package/dist/composition-snapshot-integrity.d.ts.map +1 -0
- package/dist/composition-snapshot-integrity.js +131 -0
- package/dist/composition-snapshot-runtime.d.ts +59 -0
- package/dist/composition-snapshot-runtime.d.ts.map +1 -0
- package/dist/composition-snapshot-runtime.js +250 -0
- package/dist/composition-snapshot-store.d.ts +44 -0
- package/dist/composition-snapshot-store.d.ts.map +1 -0
- package/dist/composition-snapshot-store.js +117 -0
- package/dist/compositor.d.ts +125 -1
- package/dist/compositor.d.ts.map +1 -1
- package/dist/compositor.js +692 -44
- package/dist/doc-chunk-store.d.ts +19 -0
- package/dist/doc-chunk-store.d.ts.map +1 -1
- package/dist/doc-chunk-store.js +56 -6
- package/dist/hybrid-retrieval.d.ts +38 -0
- package/dist/hybrid-retrieval.d.ts.map +1 -1
- package/dist/hybrid-retrieval.js +86 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -2
- package/dist/knowledge-store.d.ts +4 -1
- package/dist/knowledge-store.d.ts.map +1 -1
- package/dist/knowledge-store.js +27 -4
- package/dist/library-schema.d.ts +12 -8
- package/dist/library-schema.d.ts.map +1 -1
- package/dist/library-schema.js +22 -8
- package/dist/message-store.d.ts.map +1 -1
- package/dist/message-store.js +7 -3
- package/dist/metrics-dashboard.d.ts +18 -1
- package/dist/metrics-dashboard.d.ts.map +1 -1
- package/dist/metrics-dashboard.js +52 -14
- package/dist/reranker.d.ts +1 -1
- package/dist/reranker.js +2 -2
- package/dist/schema.d.ts +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +28 -1
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -0
- package/dist/topic-synthesizer.d.ts +20 -0
- package/dist/topic-synthesizer.d.ts.map +1 -1
- package/dist/topic-synthesizer.js +113 -3
- package/dist/trigger-registry.d.ts.map +1 -1
- package/dist/trigger-registry.js +10 -2
- package/dist/types.d.ts +271 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +7 -7
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +17 -7
- package/docs/DIAGNOSTICS.md +205 -0
- package/docs/INTEGRATION_VALIDATION.md +186 -0
- package/docs/MIGRATION.md +9 -6
- package/docs/MIGRATION_GUIDE.md +125 -101
- package/docs/ROADMAP.md +238 -20
- package/docs/TUNING.md +19 -5
- package/install.sh +152 -401
- package/memory-plugin/LICENSE +190 -0
- package/memory-plugin/README.md +20 -0
- package/memory-plugin/dist/index.js +50 -0
- package/memory-plugin/package.json +2 -2
- package/package.json +18 -4
- package/plugin/LICENSE +190 -0
- package/plugin/README.md +20 -0
- package/plugin/dist/index.d.ts +29 -0
- package/plugin/dist/index.d.ts.map +1 -1
- package/plugin/dist/index.js +288 -23
- package/plugin/dist/index.js.map +1 -1
- package/plugin/package.json +2 -2
- package/scripts/install-runtime.mjs +12 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { isInlineSnapshotSlotPayload, } from './composition-snapshot-integrity.js';
|
|
2
|
+
export const WARM_RESTORE_MEASUREMENT_GATES = Object.freeze({
|
|
3
|
+
tokenParityDriftP95Max: 0.03,
|
|
4
|
+
tokenParityDriftP99Max: 0.05,
|
|
5
|
+
requiredSlotDropRateMax: 0,
|
|
6
|
+
stablePrefixBoundaryViolationsMax: 0,
|
|
7
|
+
toolPairParityViolationsMax: 0,
|
|
8
|
+
crossProviderAssistantTurnsMax: 0,
|
|
9
|
+
continuityCriticalBoundaryTransformRateMax: 0.005,
|
|
10
|
+
});
|
|
11
|
+
export function evaluateWarmRestoreRolloutGate(diagnostics) {
|
|
12
|
+
const violations = [];
|
|
13
|
+
const check = (gate, actual) => {
|
|
14
|
+
const max = WARM_RESTORE_MEASUREMENT_GATES[gate];
|
|
15
|
+
if (actual > max)
|
|
16
|
+
violations.push({ gate, actual, max });
|
|
17
|
+
};
|
|
18
|
+
check('tokenParityDriftP95Max', diagnostics.tokenParityDriftP95);
|
|
19
|
+
check('tokenParityDriftP99Max', diagnostics.tokenParityDriftP99);
|
|
20
|
+
check('requiredSlotDropRateMax', diagnostics.requiredSlotDropRate);
|
|
21
|
+
check('stablePrefixBoundaryViolationsMax', diagnostics.stablePrefixBoundaryViolations);
|
|
22
|
+
check('toolPairParityViolationsMax', diagnostics.toolPairParityViolations);
|
|
23
|
+
check('crossProviderAssistantTurnsMax', diagnostics.crossProviderAssistantTurns);
|
|
24
|
+
check('continuityCriticalBoundaryTransformRateMax', diagnostics.continuityCriticalBoundaryTransformRate);
|
|
25
|
+
return { passed: violations.length === 0, violations };
|
|
26
|
+
}
|
|
27
|
+
function toSnapshotInlineContent(content) {
|
|
28
|
+
return { kind: 'inline', content };
|
|
29
|
+
}
|
|
30
|
+
function normalizeSnapshotMessage(message) {
|
|
31
|
+
const base = {
|
|
32
|
+
role: message.role,
|
|
33
|
+
textContent: message.textContent,
|
|
34
|
+
toolCalls: message.toolCalls,
|
|
35
|
+
toolResults: message.toolResults,
|
|
36
|
+
};
|
|
37
|
+
const stored = message;
|
|
38
|
+
if (typeof stored.id === 'number')
|
|
39
|
+
base.id = stored.id;
|
|
40
|
+
if (typeof stored.conversationId === 'number')
|
|
41
|
+
base.conversationId = stored.conversationId;
|
|
42
|
+
if (typeof stored.agentId === 'string')
|
|
43
|
+
base.agentId = stored.agentId;
|
|
44
|
+
if (typeof stored.messageIndex === 'number')
|
|
45
|
+
base.messageIndex = stored.messageIndex;
|
|
46
|
+
if (typeof stored.tokenCount === 'number' || stored.tokenCount === null)
|
|
47
|
+
base.tokenCount = stored.tokenCount ?? null;
|
|
48
|
+
if (typeof stored.isHeartbeat === 'boolean')
|
|
49
|
+
base.isHeartbeat = stored.isHeartbeat;
|
|
50
|
+
if (typeof stored.createdAt === 'string')
|
|
51
|
+
base.createdAt = stored.createdAt;
|
|
52
|
+
if (message.metadata && typeof message.metadata === 'object')
|
|
53
|
+
base.metadata = message.metadata;
|
|
54
|
+
return base;
|
|
55
|
+
}
|
|
56
|
+
export function buildCompositionSnapshotSlots(input) {
|
|
57
|
+
const stablePrefix = input.messages
|
|
58
|
+
.filter(message => message.role === 'system')
|
|
59
|
+
.map(message => normalizeSnapshotMessage(message));
|
|
60
|
+
const history = input.messages
|
|
61
|
+
.filter(message => message.role !== 'system')
|
|
62
|
+
.map(message => normalizeSnapshotMessage(message));
|
|
63
|
+
const slots = {
|
|
64
|
+
system: toSnapshotInlineContent(input.system ?? ''),
|
|
65
|
+
identity: toSnapshotInlineContent(input.identity ?? ''),
|
|
66
|
+
stable_prefix: toSnapshotInlineContent(stablePrefix),
|
|
67
|
+
history: toSnapshotInlineContent(history),
|
|
68
|
+
};
|
|
69
|
+
if (input.repairNotice) {
|
|
70
|
+
slots.repair_notice = toSnapshotInlineContent(input.repairNotice);
|
|
71
|
+
}
|
|
72
|
+
if (input.contextBlock) {
|
|
73
|
+
slots.context_block = toSnapshotInlineContent(input.contextBlock);
|
|
74
|
+
}
|
|
75
|
+
return slots;
|
|
76
|
+
}
|
|
77
|
+
function extractInlineContent(slotValue) {
|
|
78
|
+
if (!slotValue || !isInlineSnapshotSlotPayload(slotValue))
|
|
79
|
+
return undefined;
|
|
80
|
+
return slotValue.content;
|
|
81
|
+
}
|
|
82
|
+
function isMessageRole(value) {
|
|
83
|
+
return value === 'user' || value === 'assistant' || value === 'system';
|
|
84
|
+
}
|
|
85
|
+
function restoreStoredMessages(value) {
|
|
86
|
+
if (!Array.isArray(value))
|
|
87
|
+
return null;
|
|
88
|
+
const restored = [];
|
|
89
|
+
for (const entry of value) {
|
|
90
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
91
|
+
return null;
|
|
92
|
+
const row = entry;
|
|
93
|
+
if (!isMessageRole(row.role) || row.role === 'system')
|
|
94
|
+
return null;
|
|
95
|
+
if (row.textContent !== null && typeof row.textContent !== 'string')
|
|
96
|
+
return null;
|
|
97
|
+
restored.push({
|
|
98
|
+
id: typeof row.id === 'number' ? row.id : 0,
|
|
99
|
+
conversationId: typeof row.conversationId === 'number' ? row.conversationId : 0,
|
|
100
|
+
agentId: typeof row.agentId === 'string' ? row.agentId : '',
|
|
101
|
+
role: row.role,
|
|
102
|
+
textContent: row.textContent ?? null,
|
|
103
|
+
toolCalls: Array.isArray(row.toolCalls) ? row.toolCalls : null,
|
|
104
|
+
toolResults: Array.isArray(row.toolResults) ? row.toolResults : null,
|
|
105
|
+
metadata: typeof row.metadata === 'object' && row.metadata !== null && !Array.isArray(row.metadata)
|
|
106
|
+
? row.metadata
|
|
107
|
+
: undefined,
|
|
108
|
+
messageIndex: typeof row.messageIndex === 'number' ? row.messageIndex : 0,
|
|
109
|
+
tokenCount: typeof row.tokenCount === 'number' ? row.tokenCount : null,
|
|
110
|
+
isHeartbeat: typeof row.isHeartbeat === 'boolean' ? row.isHeartbeat : false,
|
|
111
|
+
createdAt: typeof row.createdAt === 'string' ? row.createdAt : new Date(0).toISOString(),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return restored;
|
|
115
|
+
}
|
|
116
|
+
function estimateTextTokens(text) {
|
|
117
|
+
if (!text)
|
|
118
|
+
return 0;
|
|
119
|
+
return Math.ceil(text.length / 4);
|
|
120
|
+
}
|
|
121
|
+
function estimateToolTokens(value) {
|
|
122
|
+
if (!value)
|
|
123
|
+
return 0;
|
|
124
|
+
return Math.ceil(JSON.stringify(value).length / 2);
|
|
125
|
+
}
|
|
126
|
+
function estimateStoredMessageTokens(message) {
|
|
127
|
+
return estimateTextTokens(message.textContent)
|
|
128
|
+
+ estimateToolTokens(message.toolCalls)
|
|
129
|
+
+ estimateToolTokens(message.toolResults)
|
|
130
|
+
+ 4;
|
|
131
|
+
}
|
|
132
|
+
function computeRelativeTokenDrift(baselineTokens, restoredTokens) {
|
|
133
|
+
if (baselineTokens <= 0)
|
|
134
|
+
return restoredTokens > 0 ? 1 : 0;
|
|
135
|
+
return Math.abs(restoredTokens - baselineTokens) / baselineTokens;
|
|
136
|
+
}
|
|
137
|
+
function computePercentile(values, percentile) {
|
|
138
|
+
if (values.length === 0)
|
|
139
|
+
return 0;
|
|
140
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
141
|
+
const rank = Math.min(sorted.length - 1, Math.max(0, Math.ceil(sorted.length * percentile) - 1));
|
|
142
|
+
return sorted[rank] ?? 0;
|
|
143
|
+
}
|
|
144
|
+
function quoteForeignProviderAssistantTurns(history, sourceProvider, targetProvider) {
|
|
145
|
+
if (!sourceProvider || !targetProvider || sourceProvider === targetProvider) {
|
|
146
|
+
return { history, quotedAssistantTurns: 0, toolPairParityViolations: 0 };
|
|
147
|
+
}
|
|
148
|
+
let quotedAssistantTurns = 0;
|
|
149
|
+
let toolPairParityViolations = 0;
|
|
150
|
+
const quotedHistory = history.map(message => {
|
|
151
|
+
if (message.role !== 'assistant')
|
|
152
|
+
return message;
|
|
153
|
+
quotedAssistantTurns++;
|
|
154
|
+
const hadToolPayload = Boolean((message.toolCalls && message.toolCalls.length > 0)
|
|
155
|
+
|| (message.toolResults && message.toolResults.length > 0));
|
|
156
|
+
if (hadToolPayload)
|
|
157
|
+
toolPairParityViolations++;
|
|
158
|
+
const quotedText = (message.textContent && message.textContent.trim().length > 0)
|
|
159
|
+
? `"""${message.textContent.trim()}"""`
|
|
160
|
+
: '[no text content retained]';
|
|
161
|
+
const prefix = `Historical assistant turn from ${sourceProvider} provider, quoted for ${targetProvider} replay.`;
|
|
162
|
+
const toolGap = hadToolPayload
|
|
163
|
+
? '[tool call/result payload omitted at cross-provider boundary]'
|
|
164
|
+
: null;
|
|
165
|
+
return {
|
|
166
|
+
...message,
|
|
167
|
+
role: 'user',
|
|
168
|
+
textContent: [prefix, quotedText, toolGap].filter(Boolean).join('\n'),
|
|
169
|
+
toolCalls: null,
|
|
170
|
+
toolResults: null,
|
|
171
|
+
metadata: {
|
|
172
|
+
...(message.metadata || {}),
|
|
173
|
+
_historicalQuote: true,
|
|
174
|
+
_quotedFromRole: 'assistant',
|
|
175
|
+
_quotedSourceProvider: sourceProvider,
|
|
176
|
+
_quotedTargetProvider: targetProvider,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
return { history: quotedHistory, quotedAssistantTurns, toolPairParityViolations };
|
|
181
|
+
}
|
|
182
|
+
export function restoreWarmSnapshotState(slots, options) {
|
|
183
|
+
const requiredSlotDrops = [];
|
|
184
|
+
if (extractInlineContent(slots.system) === undefined)
|
|
185
|
+
requiredSlotDrops.push('system');
|
|
186
|
+
if (extractInlineContent(slots.identity) === undefined)
|
|
187
|
+
requiredSlotDrops.push('identity');
|
|
188
|
+
if (extractInlineContent(slots.history) === undefined)
|
|
189
|
+
requiredSlotDrops.push('history');
|
|
190
|
+
const stablePrefixBoundaryViolations = Array.isArray(extractInlineContent(slots.stable_prefix)) ? 0 : 1;
|
|
191
|
+
const history = restoreStoredMessages(extractInlineContent(slots.history));
|
|
192
|
+
if (!history || history.length === 0)
|
|
193
|
+
return null;
|
|
194
|
+
const sourceProvider = options?.sourceProvider ?? null;
|
|
195
|
+
const targetProvider = options?.targetProvider ?? null;
|
|
196
|
+
const quoted = quoteForeignProviderAssistantTurns(history, sourceProvider, targetProvider);
|
|
197
|
+
const continuityCriticalBoundaryTransformCount = quoted.quotedAssistantTurns;
|
|
198
|
+
const continuityCriticalBoundaryTransformRate = quoted.history.length > 0
|
|
199
|
+
? continuityCriticalBoundaryTransformCount / quoted.history.length
|
|
200
|
+
: 0;
|
|
201
|
+
const restoreStringSlot = (key) => {
|
|
202
|
+
const value = extractInlineContent(slots[key]);
|
|
203
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
204
|
+
};
|
|
205
|
+
const restoredSystem = restoreStringSlot('system');
|
|
206
|
+
const restoredIdentity = restoreStringSlot('identity');
|
|
207
|
+
const tokenParityDriftSamples = [];
|
|
208
|
+
const originalSystem = extractInlineContent(slots.system);
|
|
209
|
+
if (typeof originalSystem === 'string' && restoredSystem !== undefined) {
|
|
210
|
+
tokenParityDriftSamples.push(computeRelativeTokenDrift(estimateTextTokens(originalSystem), estimateTextTokens(restoredSystem)));
|
|
211
|
+
}
|
|
212
|
+
const originalIdentity = extractInlineContent(slots.identity);
|
|
213
|
+
if (typeof originalIdentity === 'string' && restoredIdentity !== undefined) {
|
|
214
|
+
tokenParityDriftSamples.push(computeRelativeTokenDrift(estimateTextTokens(originalIdentity), estimateTextTokens(restoredIdentity)));
|
|
215
|
+
}
|
|
216
|
+
for (let i = 0; i < history.length && i < quoted.history.length; i++) {
|
|
217
|
+
tokenParityDriftSamples.push(computeRelativeTokenDrift(estimateStoredMessageTokens(history[i]), estimateStoredMessageTokens(quoted.history[i])));
|
|
218
|
+
}
|
|
219
|
+
const baseDiagnostics = {
|
|
220
|
+
sourceProvider,
|
|
221
|
+
targetProvider,
|
|
222
|
+
crossProviderBoundary: Boolean(sourceProvider && targetProvider && sourceProvider !== targetProvider),
|
|
223
|
+
requiredSlotDrops,
|
|
224
|
+
requiredSlotDropRate: requiredSlotDrops.length / 3,
|
|
225
|
+
stablePrefixBoundaryViolations,
|
|
226
|
+
toolPairParityViolations: quoted.toolPairParityViolations,
|
|
227
|
+
crossProviderAssistantTurns: quoted.quotedAssistantTurns,
|
|
228
|
+
quotedAssistantTurns: quoted.quotedAssistantTurns,
|
|
229
|
+
continuityCriticalBoundaryTransformCount,
|
|
230
|
+
continuityCriticalBoundaryTransformRate,
|
|
231
|
+
tokenParityDriftSampleCount: tokenParityDriftSamples.length,
|
|
232
|
+
tokenParityDriftP95: computePercentile(tokenParityDriftSamples, 0.95),
|
|
233
|
+
tokenParityDriftP99: computePercentile(tokenParityDriftSamples, 0.99),
|
|
234
|
+
};
|
|
235
|
+
const rolloutGate = evaluateWarmRestoreRolloutGate(baseDiagnostics);
|
|
236
|
+
return {
|
|
237
|
+
system: restoredSystem,
|
|
238
|
+
identity: restoredIdentity,
|
|
239
|
+
history: quoted.history.map(message => ({
|
|
240
|
+
...message,
|
|
241
|
+
metadata: { ...(message.metadata || {}), _warmed: true },
|
|
242
|
+
})),
|
|
243
|
+
diagnostics: {
|
|
244
|
+
...baseDiagnostics,
|
|
245
|
+
rolloutGatePassed: rolloutGate.passed,
|
|
246
|
+
rolloutGateViolations: rolloutGate.violations,
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=composition-snapshot-runtime.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import { type SnapshotIntegrityVerification, type SnapshotSlotsRecord } from './composition-snapshot-integrity.js';
|
|
3
|
+
export interface CompositionSnapshotRecord {
|
|
4
|
+
id: number;
|
|
5
|
+
contextId: number;
|
|
6
|
+
headMessageId: number | null;
|
|
7
|
+
schemaVersion: number;
|
|
8
|
+
capturedAt: string;
|
|
9
|
+
model: string;
|
|
10
|
+
contextWindow: number;
|
|
11
|
+
totalTokens: number;
|
|
12
|
+
fillPct: number;
|
|
13
|
+
snapshotKind: string;
|
|
14
|
+
repairDepth: number;
|
|
15
|
+
slotsJson: string;
|
|
16
|
+
slotsIntegrityHash: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
}
|
|
19
|
+
export interface InsertCompositionSnapshotInput {
|
|
20
|
+
contextId: number;
|
|
21
|
+
headMessageId?: number | null;
|
|
22
|
+
schemaVersion?: number;
|
|
23
|
+
capturedAt?: string;
|
|
24
|
+
model: string;
|
|
25
|
+
contextWindow: number;
|
|
26
|
+
totalTokens: number;
|
|
27
|
+
fillPct: number;
|
|
28
|
+
snapshotKind?: string;
|
|
29
|
+
repairDepth?: number;
|
|
30
|
+
slots: SnapshotSlotsRecord | string;
|
|
31
|
+
createdAt?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface LatestValidCompositionSnapshot {
|
|
34
|
+
snapshot: CompositionSnapshotRecord;
|
|
35
|
+
verification: SnapshotIntegrityVerification;
|
|
36
|
+
fallbackUsed: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const MAX_WARM_RESTORE_REPAIR_DEPTH = 1;
|
|
39
|
+
export declare function insertCompositionSnapshot(db: DatabaseSync, input: InsertCompositionSnapshotInput): CompositionSnapshotRecord;
|
|
40
|
+
export declare function listCompositionSnapshots(db: DatabaseSync, contextId: number, limit?: number): CompositionSnapshotRecord[];
|
|
41
|
+
export declare function getCompositionSnapshot(db: DatabaseSync, snapshotId: number): CompositionSnapshotRecord | null;
|
|
42
|
+
export declare function verifyCompositionSnapshot(snapshot: CompositionSnapshotRecord): SnapshotIntegrityVerification;
|
|
43
|
+
export declare function getLatestValidCompositionSnapshot(db: DatabaseSync, contextId: number): LatestValidCompositionSnapshot | null;
|
|
44
|
+
//# sourceMappingURL=composition-snapshot-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-snapshot-store.d.ts","sourceRoot":"","sources":["../src/composition-snapshot-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAOL,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACzB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B,CACtC,EAAE,EAAE,YAAY,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,SAAI,GACR,yBAAyB,EAAE,CAU7B;AAED,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,YAAY,EAChB,UAAU,EAAE,MAAM,GACjB,yBAAyB,GAAG,IAAI,CAIlC;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,yBAAyB,GAClC,6BAA6B,CAE/B;AAED,wBAAgB,iCAAiC,CAC/C,EAAE,EAAE,YAAY,EAChB,SAAS,EAAE,MAAM,GAChB,8BAA8B,GAAG,IAAI,CAevC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { attachInlineIntegrityHash, canonicalizeSnapshotJson, computeSlotsIntegrityHash, isInlineSnapshotSlotPayload, parseSnapshotSlotsJson, verifySnapshotSlotsIntegrity, } from './composition-snapshot-integrity.js';
|
|
2
|
+
export const MAX_WARM_RESTORE_REPAIR_DEPTH = 1;
|
|
3
|
+
function nowIso() {
|
|
4
|
+
return new Date().toISOString();
|
|
5
|
+
}
|
|
6
|
+
function parseSnapshotRow(row) {
|
|
7
|
+
return {
|
|
8
|
+
id: row.id,
|
|
9
|
+
contextId: row.context_id,
|
|
10
|
+
headMessageId: row.head_message_id ?? null,
|
|
11
|
+
schemaVersion: row.schema_version,
|
|
12
|
+
capturedAt: row.captured_at,
|
|
13
|
+
model: row.model,
|
|
14
|
+
contextWindow: row.context_window,
|
|
15
|
+
totalTokens: row.total_tokens,
|
|
16
|
+
fillPct: row.fill_pct,
|
|
17
|
+
snapshotKind: row.snapshot_kind,
|
|
18
|
+
repairDepth: row.repair_depth,
|
|
19
|
+
slotsJson: row.slots_json,
|
|
20
|
+
slotsIntegrityHash: row.slots_integrity_hash,
|
|
21
|
+
createdAt: row.created_at,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function normalizeSlots(slots) {
|
|
25
|
+
const parsed = typeof slots === 'string' ? parseSnapshotSlotsJson(slots) : parseSnapshotSlotsJson(canonicalizeSnapshotJson(slots));
|
|
26
|
+
const normalized = {};
|
|
27
|
+
for (const [slotKey, slotValue] of Object.entries(parsed)) {
|
|
28
|
+
normalized[slotKey] = isInlineSnapshotSlotPayload(slotValue)
|
|
29
|
+
? attachInlineIntegrityHash(slotValue)
|
|
30
|
+
: slotValue;
|
|
31
|
+
}
|
|
32
|
+
return normalized;
|
|
33
|
+
}
|
|
34
|
+
function normalizeRepairDepth(repairDepth) {
|
|
35
|
+
const normalized = repairDepth ?? 0;
|
|
36
|
+
if (!Number.isInteger(normalized) || normalized < 0 || normalized > MAX_WARM_RESTORE_REPAIR_DEPTH) {
|
|
37
|
+
throw new Error(`composition snapshot repair_depth must be an integer between 0 and ${MAX_WARM_RESTORE_REPAIR_DEPTH}`);
|
|
38
|
+
}
|
|
39
|
+
return normalized;
|
|
40
|
+
}
|
|
41
|
+
export function insertCompositionSnapshot(db, input) {
|
|
42
|
+
const capturedAt = input.capturedAt ?? nowIso();
|
|
43
|
+
const createdAt = input.createdAt ?? capturedAt;
|
|
44
|
+
const repairDepth = normalizeRepairDepth(input.repairDepth);
|
|
45
|
+
const normalizedSlots = normalizeSlots(input.slots);
|
|
46
|
+
const slotsJson = canonicalizeSnapshotJson(normalizedSlots);
|
|
47
|
+
const slotsIntegrityHash = computeSlotsIntegrityHash(normalizedSlots);
|
|
48
|
+
const result = db.prepare(`
|
|
49
|
+
INSERT INTO composition_snapshots (
|
|
50
|
+
context_id,
|
|
51
|
+
head_message_id,
|
|
52
|
+
schema_version,
|
|
53
|
+
captured_at,
|
|
54
|
+
model,
|
|
55
|
+
context_window,
|
|
56
|
+
total_tokens,
|
|
57
|
+
fill_pct,
|
|
58
|
+
snapshot_kind,
|
|
59
|
+
repair_depth,
|
|
60
|
+
slots_json,
|
|
61
|
+
slots_integrity_hash,
|
|
62
|
+
created_at
|
|
63
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
64
|
+
`).run(input.contextId, input.headMessageId ?? null, input.schemaVersion ?? 1, capturedAt, input.model, input.contextWindow, input.totalTokens, input.fillPct, input.snapshotKind ?? 'full', repairDepth, slotsJson, slotsIntegrityHash, createdAt);
|
|
65
|
+
db.prepare(`
|
|
66
|
+
DELETE FROM composition_snapshots
|
|
67
|
+
WHERE context_id = ?
|
|
68
|
+
AND id NOT IN (
|
|
69
|
+
SELECT id
|
|
70
|
+
FROM composition_snapshots
|
|
71
|
+
WHERE context_id = ?
|
|
72
|
+
ORDER BY captured_at DESC, id DESC
|
|
73
|
+
LIMIT 2
|
|
74
|
+
)
|
|
75
|
+
`).run(input.contextId, input.contextId);
|
|
76
|
+
const row = db.prepare('SELECT * FROM composition_snapshots WHERE id = ?')
|
|
77
|
+
.get(Number(result.lastInsertRowid));
|
|
78
|
+
if (!row) {
|
|
79
|
+
throw new Error('Failed to read back inserted composition snapshot');
|
|
80
|
+
}
|
|
81
|
+
return parseSnapshotRow(row);
|
|
82
|
+
}
|
|
83
|
+
export function listCompositionSnapshots(db, contextId, limit = 2) {
|
|
84
|
+
const rows = db.prepare(`
|
|
85
|
+
SELECT *
|
|
86
|
+
FROM composition_snapshots
|
|
87
|
+
WHERE context_id = ?
|
|
88
|
+
ORDER BY captured_at DESC, id DESC
|
|
89
|
+
LIMIT ?
|
|
90
|
+
`).all(contextId, limit);
|
|
91
|
+
return rows.map(parseSnapshotRow);
|
|
92
|
+
}
|
|
93
|
+
export function getCompositionSnapshot(db, snapshotId) {
|
|
94
|
+
const row = db.prepare('SELECT * FROM composition_snapshots WHERE id = ?')
|
|
95
|
+
.get(snapshotId);
|
|
96
|
+
return row ? parseSnapshotRow(row) : null;
|
|
97
|
+
}
|
|
98
|
+
export function verifyCompositionSnapshot(snapshot) {
|
|
99
|
+
return verifySnapshotSlotsIntegrity(snapshot.slotsJson, snapshot.slotsIntegrityHash);
|
|
100
|
+
}
|
|
101
|
+
export function getLatestValidCompositionSnapshot(db, contextId) {
|
|
102
|
+
const candidates = listCompositionSnapshots(db, contextId, 2)
|
|
103
|
+
.filter(snapshot => snapshot.repairDepth < MAX_WARM_RESTORE_REPAIR_DEPTH);
|
|
104
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
105
|
+
const snapshot = candidates[i];
|
|
106
|
+
const verification = verifyCompositionSnapshot(snapshot);
|
|
107
|
+
if (verification.ok) {
|
|
108
|
+
return {
|
|
109
|
+
snapshot,
|
|
110
|
+
verification,
|
|
111
|
+
fallbackUsed: i > 0,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=composition-snapshot-store.js.map
|
package/dist/compositor.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { CacheLayer } from './cache.js';
|
|
|
17
17
|
type AnyCache = CacheLayer;
|
|
18
18
|
import { VectorStore } from './vector-store.js';
|
|
19
19
|
import { type OrgRegistry } from './cross-agent.js';
|
|
20
|
+
import { type AdaptiveLifecyclePolicy } from './adaptive-lifecycle.js';
|
|
20
21
|
import { type DegradationReason } from './degradation.js';
|
|
21
22
|
/**
|
|
22
23
|
* Files that OpenClaw's contextInjection injects into the system prompt.
|
|
@@ -91,8 +92,111 @@ export declare function estimateObservedMsgDensity(messages: NeutralMessage[]):
|
|
|
91
92
|
* - shared max: config.maxHistoryMessages (never exceed the DB fetch ceiling)
|
|
92
93
|
*/
|
|
93
94
|
export declare function computeAdaptiveHistoryDepth(sessionType: SessionType, observedDensity: number, historyBudgetTokens: number, maxHistoryMessages: number): number;
|
|
95
|
+
/**
|
|
96
|
+
* Canonical pressure labels shared across compose and compaction paths.
|
|
97
|
+
* Use these constants when setting the `pressureSource` field so all consumers
|
|
98
|
+
* can filter logs with a stable string without guessing spellings.
|
|
99
|
+
*/
|
|
100
|
+
export declare const PRESSURE_SOURCE: {
|
|
101
|
+
/** Compose path: pressure derived from (budget - remaining) after full slot assembly. */
|
|
102
|
+
readonly COMPOSE_POST_ASSEMBLY: "compose:post-assembly";
|
|
103
|
+
/** Compose path: pressure measured immediately before semantic recall runs. */
|
|
104
|
+
readonly COMPOSE_PRE_RECALL: "compose:pre-recall";
|
|
105
|
+
/** Compaction path: pressure from Redis token estimate / effectiveBudget. */
|
|
106
|
+
readonly COMPACT_REDIS_ESTIMATE: "compact:redis-estimate";
|
|
107
|
+
/** Compaction path: pressure from runtime-reported currentTokenCount / effectiveBudget. */
|
|
108
|
+
readonly COMPACT_RUNTIME_TOTAL: "compact:runtime-total";
|
|
109
|
+
/** Tool-loop assemble path: pressure from in-memory working message array / effectiveBudget. */
|
|
110
|
+
readonly TOOLLOOP_RUNTIME_ARRAY: "toolloop:runtime-array";
|
|
111
|
+
};
|
|
112
|
+
export type PressureSourceLabel = typeof PRESSURE_SOURCE[keyof typeof PRESSURE_SOURCE];
|
|
113
|
+
/**
|
|
114
|
+
* Compute a unified pressure fraction so compose and compaction paths report
|
|
115
|
+
* the same numeric concept without drift.
|
|
116
|
+
*
|
|
117
|
+
* Always clamps to [0, Infinity) — callers get the raw fraction so they can
|
|
118
|
+
* decide their own thresholds without us hardcoding them here.
|
|
119
|
+
*
|
|
120
|
+
* @param usedTokens Tokens consumed (numerator).
|
|
121
|
+
* @param budgetTokens Effective budget (denominator). Must be > 0.
|
|
122
|
+
* @param source Label from PRESSURE_SOURCE for telemetry (metadata only).
|
|
123
|
+
* @returns { fraction, pct, source } where fraction = usedTokens / budgetTokens,
|
|
124
|
+
* pct = Math.round(fraction * 100), source = canonical label.
|
|
125
|
+
*/
|
|
126
|
+
export declare function computeUnifiedPressure(usedTokens: number, budgetTokens: number, source: string): {
|
|
127
|
+
fraction: number;
|
|
128
|
+
pct: number;
|
|
129
|
+
source: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* 0.9.0: adaptive lifecycle scales semantic-recall breadth in compose.
|
|
133
|
+
*
|
|
134
|
+
* Base fractions match the historical compositor constants so that a steady
|
|
135
|
+
* (multiplier=1.0) call reproduces prior behavior exactly. Candidate limit is
|
|
136
|
+
* clamped so even a critical-pressure pass keeps a usable retrieval window
|
|
137
|
+
* and a /new surge does not blow up hybrid search cost.
|
|
138
|
+
*/
|
|
139
|
+
export declare const RECALL_BREADTH_BASE: Readonly<{
|
|
140
|
+
mainBudgetFraction: 0.12;
|
|
141
|
+
fallbackBudgetFraction: 0.1;
|
|
142
|
+
candidateLimit: 10;
|
|
143
|
+
candidateLimitMin: 6;
|
|
144
|
+
candidateLimitMax: 16;
|
|
145
|
+
}>;
|
|
146
|
+
export interface ScaledRecallBreadth {
|
|
147
|
+
mainBudgetTokens: number;
|
|
148
|
+
fallbackBudgetTokens: number;
|
|
149
|
+
candidateLimit: number;
|
|
150
|
+
multiplier: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Apply the adaptive lifecycle smartRecallMultiplier to recall breadth.
|
|
154
|
+
* Pure helper — does not read state or mutate anything. Steady multiplier=1
|
|
155
|
+
* preserves the historical (0.12, 0.10, limit=10) recall envelope.
|
|
156
|
+
*/
|
|
157
|
+
export declare function scaleRecallBreadth(remainingTokens: number, multiplier: number): ScaledRecallBreadth;
|
|
94
158
|
export { CollectionTrigger, DEFAULT_TRIGGERS, matchTriggers } from './trigger-registry.js';
|
|
95
159
|
export { getTurnAge, applyToolGradient, appendToolSummary, truncateWithHeadTail, applyTierPayloadCap, evictLargeToolResults };
|
|
160
|
+
interface NeutralMessageCluster<T extends NeutralMessage> {
|
|
161
|
+
messages: T[];
|
|
162
|
+
tokenCost: number;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Adaptive eviction ordering for the compose-window cluster-drop pass.
|
|
166
|
+
*
|
|
167
|
+
* Pure helper: derives drop priority from `policy.evictionPlan` (which is
|
|
168
|
+
* itself derived from `policy.band`) and an optional `activeTopicId`. Does
|
|
169
|
+
* not read state, mutate clusters, or introduce a parallel pressure brain.
|
|
170
|
+
*
|
|
171
|
+
* Returns:
|
|
172
|
+
* - `protectedIndices`: clusters never selected for topic-aware drop
|
|
173
|
+
* (system prefix, dynamicBoundary, the latest user-role cluster). The
|
|
174
|
+
* existing oldest-first sweep can still drop them as a last resort,
|
|
175
|
+
* same as before this helper.
|
|
176
|
+
* - `topicAwareDropOrder`: cluster indices (oldest→newest) to drop
|
|
177
|
+
* before the oldest-first sweep when the band promotes topic-aware
|
|
178
|
+
* drop. Tool-call/result clusters are excluded so they remain atomic
|
|
179
|
+
* and ballast reduction (applyToolGradient/evictLargeToolResults/
|
|
180
|
+
* resolveOversizedArtifacts) handles them upstream.
|
|
181
|
+
* - `preferTopicAwareDrop`: mirrors `policy.evictionPlan.preferTopicAwareDrop`.
|
|
182
|
+
*/
|
|
183
|
+
export type AdaptiveEvictionBypassReason = 'no-active-topic' | 'no-stamped-clusters' | 'band-not-topic-aware' | 'within-budget' | 'no-eligible-inactive-topic-clusters';
|
|
184
|
+
export interface AdaptiveEvictionTelemetry {
|
|
185
|
+
topicAwareEligibleClusters: number;
|
|
186
|
+
topicAwareDroppedClusters: number;
|
|
187
|
+
protectedClusters: number;
|
|
188
|
+
topicIdCoveragePct: number;
|
|
189
|
+
bypassReason?: AdaptiveEvictionBypassReason;
|
|
190
|
+
}
|
|
191
|
+
export interface AdaptiveEvictionOrdering {
|
|
192
|
+
preferTopicAwareDrop: boolean;
|
|
193
|
+
topicAwareDropOrder: number[];
|
|
194
|
+
protectedIndices: ReadonlySet<number>;
|
|
195
|
+
telemetry: AdaptiveEvictionTelemetry;
|
|
196
|
+
}
|
|
197
|
+
export declare function orderClustersForAdaptiveEviction<T extends NeutralMessage>(clusters: NeutralMessageCluster<T>[], policy: AdaptiveLifecyclePolicy, opts?: {
|
|
198
|
+
activeTopicId?: string;
|
|
199
|
+
}): AdaptiveEvictionOrdering;
|
|
96
200
|
/**
|
|
97
201
|
* Public reshape helper: apply tool gradient then trim to fit within a token budget.
|
|
98
202
|
*
|
|
@@ -210,6 +314,17 @@ export interface CompositorDeps {
|
|
|
210
314
|
libraryDb?: DatabaseSync | null;
|
|
211
315
|
/** Custom trigger registry; defaults to DEFAULT_TRIGGERS if not provided */
|
|
212
316
|
triggerRegistry?: CollectionTrigger[];
|
|
317
|
+
/**
|
|
318
|
+
* Optional reranker applied to fused hybridSearch results. Null disables
|
|
319
|
+
* reranking; hybridSearch still runs and returns the RRF-ordered list.
|
|
320
|
+
*/
|
|
321
|
+
reranker?: import('./reranker.js').RerankerProvider | null;
|
|
322
|
+
/** Min fused-candidate count before the reranker is invoked. Default: 2. */
|
|
323
|
+
rerankerMinCandidates?: number;
|
|
324
|
+
/** Max docs sent to reranker (bounds provider cost). Default: all fused. */
|
|
325
|
+
rerankerMaxDocuments?: number;
|
|
326
|
+
/** Top-K passed to reranker. Default: slice length. */
|
|
327
|
+
rerankerTopK?: number;
|
|
213
328
|
}
|
|
214
329
|
export declare class Compositor {
|
|
215
330
|
private readonly config;
|
|
@@ -217,6 +332,10 @@ export declare class Compositor {
|
|
|
217
332
|
private vectorStore;
|
|
218
333
|
private readonly libraryDb;
|
|
219
334
|
private readonly triggerRegistry;
|
|
335
|
+
private reranker;
|
|
336
|
+
private readonly rerankerMinCandidates;
|
|
337
|
+
private readonly rerankerMaxDocuments;
|
|
338
|
+
private readonly rerankerTopK;
|
|
220
339
|
/** Cached org registry loaded from fleet_agents at construction time. */
|
|
221
340
|
private _orgRegistry;
|
|
222
341
|
constructor(deps: CompositorDeps, config?: Partial<CompositorConfig>);
|
|
@@ -225,6 +344,11 @@ export declare class Compositor {
|
|
|
225
344
|
* Called by hypermem.create() once sqlite-vec is confirmed available.
|
|
226
345
|
*/
|
|
227
346
|
setVectorStore(vs: VectorStore): void;
|
|
347
|
+
/**
|
|
348
|
+
* Set or replace the reranker after construction.
|
|
349
|
+
* Called by hypermem.create() once the reranker config has been resolved.
|
|
350
|
+
*/
|
|
351
|
+
setReranker(rr: import('./reranker.js').RerankerProvider | null): void;
|
|
228
352
|
/**
|
|
229
353
|
* Hot-reload the org registry from the fleet_agents table.
|
|
230
354
|
* Call after fleet membership changes (new agent, org restructure)
|
|
@@ -283,7 +407,7 @@ export declare class Compositor {
|
|
|
283
407
|
/** Model string for budget resolution. If omitted, falls back to defaultTokenBudget. */
|
|
284
408
|
model?: string;
|
|
285
409
|
}): Promise<void>;
|
|
286
|
-
refreshRedisGradient(agentId: string, sessionKey: string, db: DatabaseSync, tokenBudget?: number, historyDepth?: number): Promise<void>;
|
|
410
|
+
refreshRedisGradient(agentId: string, sessionKey: string, db: DatabaseSync, tokenBudget?: number, historyDepth?: number, trimSoftTarget?: number): Promise<void>;
|
|
287
411
|
/**
|
|
288
412
|
* Get slot content: try Redis first, fall back to SQLite.
|
|
289
413
|
*/
|
package/dist/compositor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compositor.d.ts","sourceRoot":"","sources":["../src/compositor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,
|
|
1
|
+
{"version":3,"file":"compositor.d.ts","sourceRoot":"","sources":["../src/compositor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAKb,cAAc,EAGd,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iBAAiB,EAMlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,KAAK,QAAQ,GAAG,UAAU,CAAC;AAI3B,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAMzE,OAAO,EAA8C,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAMhG,OAAO,EAAkC,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAA+F,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