@xdarkicex/openclaw-memory-libravdb 1.6.10 → 1.6.11
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.
|
@@ -42,4 +42,5 @@ export declare function promoteDreamDiaryFile(client: LibravDBClient, opts: {
|
|
|
42
42
|
sourceMtimeMs?: number;
|
|
43
43
|
}): Promise<DreamPromotionResult>;
|
|
44
44
|
export declare function parseDreamPromotionCandidates(text: string): DreamPromotionCandidate[];
|
|
45
|
+
export declare function normalizeDiaryPath(value?: string): string;
|
|
45
46
|
export {};
|
package/dist/dream-promotion.js
CHANGED
|
@@ -357,18 +357,23 @@ function parseInteger(value) {
|
|
|
357
357
|
function normalizeSectionName(value) {
|
|
358
358
|
return value.trim().toLowerCase().replace(/\s+/g, " ");
|
|
359
359
|
}
|
|
360
|
-
function normalizeDiaryPath(value) {
|
|
360
|
+
export function normalizeDiaryPath(value) {
|
|
361
361
|
const trimmed = value?.trim();
|
|
362
362
|
if (!trimmed) {
|
|
363
363
|
return "";
|
|
364
364
|
}
|
|
365
|
+
// Expand ~ to home directory before resolving. path.resolve does not
|
|
366
|
+
// expand tilde, so "~/dreams.md" would resolve to "<cwd>/~/dreams.md".
|
|
367
|
+
const expanded = trimmed.startsWith("~")
|
|
368
|
+
? path.join(os.homedir(), trimmed.slice(1))
|
|
369
|
+
: trimmed;
|
|
365
370
|
// Reject traversal components — even though path.resolve collapses them,
|
|
366
371
|
// their presence signals an attempt to escape intended boundaries.
|
|
367
|
-
const segments =
|
|
372
|
+
const segments = expanded.split(/[/\\]+/);
|
|
368
373
|
if (segments.some((s) => s === "..")) {
|
|
369
374
|
throw new Error(`dream diary path must not contain ".." traversal: ${trimmed}`);
|
|
370
375
|
}
|
|
371
|
-
const resolved = path.resolve(
|
|
376
|
+
const resolved = path.resolve(expanded);
|
|
372
377
|
// Restrict to known-safe locations to prevent arbitrary file reads.
|
|
373
378
|
// Allowed roots: home directory and the configured OpenClaw state dir.
|
|
374
379
|
const allowedRoots = [
|
package/dist/index.js
CHANGED
|
@@ -25684,13 +25684,14 @@ function normalizeDiaryPath(value) {
|
|
|
25684
25684
|
if (!trimmed) {
|
|
25685
25685
|
return "";
|
|
25686
25686
|
}
|
|
25687
|
-
const
|
|
25687
|
+
const expanded = trimmed.startsWith("~") ? path.join(os.homedir(), trimmed.slice(1)) : trimmed;
|
|
25688
|
+
const segments = expanded.split(/[/\\]+/);
|
|
25688
25689
|
if (segments.some((s) => s === "..")) {
|
|
25689
25690
|
throw new Error(
|
|
25690
25691
|
`dream diary path must not contain ".." traversal: ${trimmed}`
|
|
25691
25692
|
);
|
|
25692
25693
|
}
|
|
25693
|
-
const resolved = path.resolve(
|
|
25694
|
+
const resolved = path.resolve(expanded);
|
|
25694
25695
|
const allowedRoots = [
|
|
25695
25696
|
os.homedir(),
|
|
25696
25697
|
process.env.OPENCLAW_STATE_DIR
|
|
@@ -36796,14 +36797,15 @@ function extractHost(target) {
|
|
|
36796
36797
|
const sep = withoutDns.lastIndexOf(":");
|
|
36797
36798
|
return sep > 0 ? withoutDns.slice(0, sep) : withoutDns;
|
|
36798
36799
|
}
|
|
36799
|
-
function loadSecretFromEnv() {
|
|
36800
|
+
function loadSecretFromEnv(logger) {
|
|
36800
36801
|
const secret = process.env.LIBRAVDB_AUTH_SECRET?.trim();
|
|
36801
36802
|
if (secret) return secret;
|
|
36802
36803
|
const secretPath = process.env.LIBRAVDB_AUTH_SECRET_FILE;
|
|
36803
36804
|
if (secretPath) {
|
|
36804
36805
|
try {
|
|
36805
36806
|
return fs3.readFileSync(secretPath, "utf8").trim() || void 0;
|
|
36806
|
-
} catch {
|
|
36807
|
+
} catch (error2) {
|
|
36808
|
+
logger?.warn?.(`LibraVDB: failed to read auth secret file "${secretPath}": ${formatError(error2)}`);
|
|
36807
36809
|
return void 0;
|
|
36808
36810
|
}
|
|
36809
36811
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Interceptor } from "@connectrpc/connect";
|
|
2
2
|
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
3
|
+
import type { LoggerLike } from "./types.js";
|
|
3
4
|
import type { AfterTurnKernelRequest, AfterTurnKernelResponse, AssembleContextInternalRequest, AssembleContextInternalResponse, BootstrapSessionKernelRequest, BootstrapSessionKernelResponse, CompactSessionRequest, CompactSessionResponse, DeleteAuthoredDocumentRequest, DeleteAuthoredDocumentResponse, DreamPromotionResponse, ExportMemoryRequest, ExportMemoryResponse, FlushNamespaceRequest, FlushNamespaceResponse, FlushRequest, FlushResponse, HealthRequest, HealthResponse, IngestMarkdownDocumentRequest, IngestMarkdownDocumentResponse, IngestMessageKernelRequest, IngestMessageKernelResponse, ListCollectionRequest, ListCollectionResponse, ListLifecycleJournalRequest, ListLifecycleJournalResponse, MarkMemorySupersededRequest, MarkMemorySupersededResponse, MemoryStatusRequest, MemoryStatusResponse, PromoteDreamEntriesRequest, RankCandidatesRequest, RankCandidatesResponse, RebuildIndexRequest, RebuildIndexResponse, ReindexAuthoredDocumentRequest, ReindexAuthoredDocumentResponse, SearchTextCollectionsRequest, SearchTextRequest, SearchTextResponse, SessionLifecycleHintRequest, SessionLifecycleHintResponse } from "@xdarkicex/libravdb-contracts";
|
|
4
5
|
export interface LibravDBClientOptions {
|
|
5
6
|
endpoint?: string;
|
|
@@ -56,5 +57,5 @@ export declare class LibravDBClient {
|
|
|
56
57
|
rankCandidates(req: PartialMessage<RankCandidatesRequest>): Promise<RankCandidatesResponse>;
|
|
57
58
|
close(): void;
|
|
58
59
|
}
|
|
59
|
-
export declare function loadSecretFromEnv(): string | undefined;
|
|
60
|
+
export declare function loadSecretFromEnv(logger?: LoggerLike): string | undefined;
|
|
60
61
|
export {};
|
package/dist/libravdb-client.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createGrpcTransport } from "@connectrpc/connect-node";
|
|
|
3
3
|
import { LibravDB } from "@xdarkicex/libravdb-contracts/client";
|
|
4
4
|
import { createHmac } from "node:crypto";
|
|
5
5
|
import fs from "node:fs";
|
|
6
|
+
import { formatError } from "./format-error.js";
|
|
6
7
|
import net from "node:net";
|
|
7
8
|
import os from "node:os";
|
|
8
9
|
import path from "node:path";
|
|
@@ -279,7 +280,7 @@ function extractHost(target) {
|
|
|
279
280
|
const sep = withoutDns.lastIndexOf(":");
|
|
280
281
|
return sep > 0 ? withoutDns.slice(0, sep) : withoutDns;
|
|
281
282
|
}
|
|
282
|
-
export function loadSecretFromEnv() {
|
|
283
|
+
export function loadSecretFromEnv(logger) {
|
|
283
284
|
const secret = process.env.LIBRAVDB_AUTH_SECRET?.trim();
|
|
284
285
|
if (secret)
|
|
285
286
|
return secret;
|
|
@@ -288,7 +289,8 @@ export function loadSecretFromEnv() {
|
|
|
288
289
|
try {
|
|
289
290
|
return fs.readFileSync(secretPath, "utf8").trim() || undefined;
|
|
290
291
|
}
|
|
291
|
-
catch {
|
|
292
|
+
catch (error) {
|
|
293
|
+
logger?.warn?.(`LibraVDB: failed to read auth secret file "${secretPath}": ${formatError(error)}`);
|
|
292
294
|
return undefined;
|
|
293
295
|
}
|
|
294
296
|
}
|
package/openclaw.plugin.json
CHANGED