@xdarkicex/openclaw-memory-libravdb 1.3.13 → 1.3.17
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 +245 -44
- package/docs/README.md +1 -0
- package/docs/ast-v2.md +47 -5
- package/docs/continuity.md +220 -0
- package/docs/contributing.md +1 -0
- package/docs/elevated-guidance.md +258 -0
- package/docs/implementation.md +60 -2
- package/docs/install.md +7 -5
- package/docs/installation.md +13 -16
- package/docs/mathematics-v2.md +161 -1
- package/docs/uninstall.md +2 -2
- package/openclaw.plugin.json +5 -0
- package/package.json +5 -1
- package/packaging/README.md +36 -0
- package/packaging/homebrew/libravdbd.rb.tmpl +176 -2
- package/packaging/launchd/com.xdarkicex.libravdbd.plist +6 -0
- package/src/cli.ts +47 -0
- package/src/context-engine.ts +596 -157
- package/src/index.ts +6 -1
- package/src/lifecycle-hooks.ts +96 -0
- package/src/memory-provider.ts +80 -17
- package/src/memory-runtime.ts +150 -0
- package/src/openclaw-plugin-sdk.d.ts +1 -0
- package/src/plugin-runtime.ts +53 -4
- package/src/recall-utils.ts +20 -3
- package/src/scoring.ts +130 -0
- package/src/sidecar.ts +45 -1
- package/src/types.ts +28 -0
package/src/sidecar.ts
CHANGED
|
@@ -263,6 +263,10 @@ export function resolveConfiguredEndpoint(cfg: PluginConfig): string {
|
|
|
263
263
|
return value;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
export function daemonProvisioningHint(): string {
|
|
267
|
+
return "If you installed the npm package, install and start libravdbd separately; the package does not provision the daemon binary, ONNX Runtime, or model assets.";
|
|
268
|
+
}
|
|
269
|
+
|
|
266
270
|
export function defaultEndpoint(platform = process.platform, homeDir = os.homedir()): string {
|
|
267
271
|
if (platform === "win32") {
|
|
268
272
|
return "tcp:127.0.0.1:37421";
|
|
@@ -357,6 +361,9 @@ export function buildSidecarEnv(cfg: PluginConfig): Record<string, string> {
|
|
|
357
361
|
if (typeof cfg.gatingCentroidK === "number" && cfg.gatingCentroidK > 0) {
|
|
358
362
|
env.LIBRAVDB_GATING_CENTROID_K = String(cfg.gatingCentroidK);
|
|
359
363
|
}
|
|
364
|
+
if (typeof cfg.lifecycleJournalMaxEntries === "number" && cfg.lifecycleJournalMaxEntries > 0) {
|
|
365
|
+
env.LIBRAVDB_LIFECYCLE_JOURNAL_MAX_ENTRIES = String(cfg.lifecycleJournalMaxEntries);
|
|
366
|
+
}
|
|
360
367
|
|
|
361
368
|
return env;
|
|
362
369
|
}
|
|
@@ -392,7 +399,7 @@ function formatConnectionError(endpoint: string, error: Error): Error {
|
|
|
392
399
|
: "";
|
|
393
400
|
if (code === "ENOENT" || code === "ECONNREFUSED") {
|
|
394
401
|
return new Error(
|
|
395
|
-
`LibraVDB daemon unavailable at ${describeEndpoint(endpoint)}.
|
|
402
|
+
`LibraVDB daemon unavailable at ${describeEndpoint(endpoint)}. ${daemonProvisioningHint()} Or set sidecarPath to a running daemon endpoint.`,
|
|
396
403
|
);
|
|
397
404
|
}
|
|
398
405
|
return error;
|
|
@@ -410,3 +417,40 @@ function isConfiguredEndpoint(value?: string): boolean {
|
|
|
410
417
|
}
|
|
411
418
|
|
|
412
419
|
export { PlaceholderSocket };
|
|
420
|
+
|
|
421
|
+
export async function probeSidecarEndpoint(cfg: PluginConfig): Promise<string | null> {
|
|
422
|
+
const endpoint = resolveConfiguredEndpoint(cfg);
|
|
423
|
+
try {
|
|
424
|
+
await new Promise<void>((resolve, reject) => {
|
|
425
|
+
if (isTcpEndpoint(endpoint)) {
|
|
426
|
+
const address = endpoint.slice("tcp:".length);
|
|
427
|
+
const separator = address.lastIndexOf(":");
|
|
428
|
+
if (separator <= 0) {
|
|
429
|
+
reject(new Error("invalid tcp endpoint"));
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
const host = address.slice(0, separator);
|
|
433
|
+
const port = Number(address.slice(separator + 1));
|
|
434
|
+
const socket = net.connect({ host, port }, () => {
|
|
435
|
+
socket.destroy();
|
|
436
|
+
resolve();
|
|
437
|
+
});
|
|
438
|
+
socket.setTimeout(500);
|
|
439
|
+
socket.on("error", reject);
|
|
440
|
+
socket.on("timeout", reject);
|
|
441
|
+
} else {
|
|
442
|
+
const socketPath = endpoint.replace(/^unix:/, "");
|
|
443
|
+
const socket = net.connect(socketPath, () => {
|
|
444
|
+
socket.destroy();
|
|
445
|
+
resolve();
|
|
446
|
+
});
|
|
447
|
+
socket.setTimeout(500);
|
|
448
|
+
socket.on("error", reject);
|
|
449
|
+
socket.on("timeout", reject);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
return endpoint;
|
|
453
|
+
} catch {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export interface PluginConfig {
|
|
2
2
|
dbPath?: string;
|
|
3
3
|
sidecarPath?: string;
|
|
4
|
+
useSessionRecallProjection?: boolean;
|
|
5
|
+
useSessionSummarySearchExperiment?: boolean;
|
|
4
6
|
embeddingRuntimePath?: string;
|
|
5
7
|
embeddingBackend?: "bundled" | "onnx-local" | "custom-local";
|
|
6
8
|
embeddingProfile?: string;
|
|
@@ -32,6 +34,7 @@ export interface PluginConfig {
|
|
|
32
34
|
};
|
|
33
35
|
gatingTechNorm?: number;
|
|
34
36
|
gatingCentroidK?: number;
|
|
37
|
+
lifecycleJournalMaxEntries?: number;
|
|
35
38
|
compactionQualityWeight?: number;
|
|
36
39
|
recencyLambdaSession?: number;
|
|
37
40
|
recencyLambdaUser?: number;
|
|
@@ -39,6 +42,7 @@ export interface PluginConfig {
|
|
|
39
42
|
tokenBudgetFraction?: number;
|
|
40
43
|
authoredHardBudgetFraction?: number;
|
|
41
44
|
authoredSoftBudgetFraction?: number;
|
|
45
|
+
elevatedGuidanceBudgetFraction?: number;
|
|
42
46
|
section7StartupTokenBudgetTokens?: number;
|
|
43
47
|
continuityMinTurns?: number;
|
|
44
48
|
continuityTailBudgetTokens?: number;
|
|
@@ -54,6 +58,13 @@ export interface PluginConfig {
|
|
|
54
58
|
section7AuthorityRecencyWeight?: number;
|
|
55
59
|
section7AuthorityFrequencyWeight?: number;
|
|
56
60
|
section7AuthorityAuthoredWeight?: number;
|
|
61
|
+
summaryExpansionConfidenceThreshold?: number;
|
|
62
|
+
summaryExpansionDepth?: number;
|
|
63
|
+
summaryExpansionTokenBudget?: number;
|
|
64
|
+
summaryExpansionPenaltyFactor?: number;
|
|
65
|
+
recoveryFloorScore?: number;
|
|
66
|
+
recoveryMinTopK?: number;
|
|
67
|
+
recoveryMinConfidenceMean?: number;
|
|
57
68
|
ollamaUrl?: string;
|
|
58
69
|
compactModel?: string;
|
|
59
70
|
rpcTimeoutMs?: number;
|
|
@@ -94,6 +105,7 @@ export interface SearchResult {
|
|
|
94
105
|
source_doc?: string;
|
|
95
106
|
node_kind?: string;
|
|
96
107
|
ordinal?: number;
|
|
108
|
+
position?: number;
|
|
97
109
|
tier?: number;
|
|
98
110
|
authored?: boolean;
|
|
99
111
|
authority?: number;
|
|
@@ -104,6 +116,15 @@ export interface SearchResult {
|
|
|
104
116
|
continuity_tail?: boolean;
|
|
105
117
|
continuity_base?: boolean;
|
|
106
118
|
continuity_bundle_id?: string;
|
|
119
|
+
elevated_guidance?: boolean;
|
|
120
|
+
source_turn_id?: string;
|
|
121
|
+
source_turn_ts?: number;
|
|
122
|
+
provenance_class?: string;
|
|
123
|
+
stability_weight?: number;
|
|
124
|
+
expanded_from_summary?: boolean;
|
|
125
|
+
parent_summary_id?: string;
|
|
126
|
+
expansion_depth?: number;
|
|
127
|
+
cascade_tier?: number;
|
|
107
128
|
[key: string]: unknown;
|
|
108
129
|
};
|
|
109
130
|
finalScore?: number;
|
|
@@ -170,6 +191,13 @@ export interface ContextAssembleArgs {
|
|
|
170
191
|
tokenBudget: number;
|
|
171
192
|
}
|
|
172
193
|
|
|
194
|
+
export interface ContextAssembleResult {
|
|
195
|
+
messages: MemoryMessage[];
|
|
196
|
+
estimatedTokens: number;
|
|
197
|
+
systemPromptAddition: string;
|
|
198
|
+
_profile?: string[];
|
|
199
|
+
}
|
|
200
|
+
|
|
173
201
|
export interface ContextCompactArgs {
|
|
174
202
|
sessionId: string;
|
|
175
203
|
force?: boolean;
|