@xdarkicex/openclaw-memory-libravdb 1.6.4 → 1.6.6
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/dist/identity.js +1 -1
- package/dist/index.js +74 -3
- package/dist/markdown-ingest.d.ts +1 -0
- package/dist/markdown-ingest.js +105 -6
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/identity.js
CHANGED
|
@@ -56,7 +56,7 @@ function writeIdentityFile(path, userId, parts) {
|
|
|
56
56
|
const dir = dirname(path);
|
|
57
57
|
mkdirSync(dir, { recursive: true });
|
|
58
58
|
const tmp = `${path}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
59
|
-
writeFileSync(tmp, JSON.stringify(identity, null, 2) + "\n");
|
|
59
|
+
writeFileSync(tmp, JSON.stringify(identity, null, 2) + "\n", { mode: 0o600 });
|
|
60
60
|
renameSync(tmp, path);
|
|
61
61
|
}
|
|
62
62
|
export function resolveIdentity(params) {
|
package/dist/index.js
CHANGED
|
@@ -25033,7 +25033,7 @@ function writeIdentityFile(path4, userId, parts) {
|
|
|
25033
25033
|
const dir = dirname(path4);
|
|
25034
25034
|
mkdirSync(dir, { recursive: true });
|
|
25035
25035
|
const tmp = `${path4}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
25036
|
-
writeFileSync(tmp, JSON.stringify(identity, null, 2) + "\n");
|
|
25036
|
+
writeFileSync(tmp, JSON.stringify(identity, null, 2) + "\n", { mode: 384 });
|
|
25037
25037
|
renameSync(tmp, path4);
|
|
25038
25038
|
}
|
|
25039
25039
|
function resolveIdentity(params) {
|
|
@@ -33471,8 +33471,79 @@ function isMarkdownFile(fileName) {
|
|
|
33471
33471
|
return lower.endsWith(".md") || lower.endsWith(".markdown");
|
|
33472
33472
|
}
|
|
33473
33473
|
function matchesGlob(value, pattern) {
|
|
33474
|
-
const
|
|
33475
|
-
|
|
33474
|
+
const len = pattern.length;
|
|
33475
|
+
let re = "";
|
|
33476
|
+
let i = 0;
|
|
33477
|
+
while (i < len) {
|
|
33478
|
+
const ch = pattern[i];
|
|
33479
|
+
if (ch === "*" && pattern[i + 1] === "*") {
|
|
33480
|
+
i += 2;
|
|
33481
|
+
if (pattern[i] === "/") {
|
|
33482
|
+
i++;
|
|
33483
|
+
re += "(?:[^/]+/)*";
|
|
33484
|
+
} else {
|
|
33485
|
+
re += ".*?";
|
|
33486
|
+
}
|
|
33487
|
+
} else if (ch === "*") {
|
|
33488
|
+
re += "[^/]*";
|
|
33489
|
+
i++;
|
|
33490
|
+
} else if (ch === "?") {
|
|
33491
|
+
re += "[^/]";
|
|
33492
|
+
i++;
|
|
33493
|
+
} else if (ch === "[") {
|
|
33494
|
+
const end = pattern.indexOf("]", i + 1);
|
|
33495
|
+
if (end === -1) {
|
|
33496
|
+
re += "\\[";
|
|
33497
|
+
i++;
|
|
33498
|
+
} else {
|
|
33499
|
+
const cls = pattern.slice(i + 1, end).replace(/^!/, "^");
|
|
33500
|
+
re += "[" + cls + "]";
|
|
33501
|
+
i = end + 1;
|
|
33502
|
+
}
|
|
33503
|
+
} else if (ch === "{") {
|
|
33504
|
+
const end = pattern.indexOf("}", i + 1);
|
|
33505
|
+
if (end === -1) {
|
|
33506
|
+
re += "\\{";
|
|
33507
|
+
i++;
|
|
33508
|
+
} else {
|
|
33509
|
+
const inner = pattern.slice(i + 1, end);
|
|
33510
|
+
const alternatives = inner.split(",").map((s) => globToRegexFragment(s)).join("|");
|
|
33511
|
+
re += "(?:" + alternatives + ")";
|
|
33512
|
+
i = end + 1;
|
|
33513
|
+
}
|
|
33514
|
+
} else {
|
|
33515
|
+
re += ch.replace(/[.+^${}()|\\]/g, "\\$&");
|
|
33516
|
+
i++;
|
|
33517
|
+
}
|
|
33518
|
+
}
|
|
33519
|
+
return new RegExp(`^${re}$`).test(value);
|
|
33520
|
+
}
|
|
33521
|
+
function globToRegexFragment(pattern) {
|
|
33522
|
+
const len = pattern.length;
|
|
33523
|
+
let re = "";
|
|
33524
|
+
let i = 0;
|
|
33525
|
+
while (i < len) {
|
|
33526
|
+
const ch = pattern[i];
|
|
33527
|
+
if (ch === "*" && pattern[i + 1] === "*") {
|
|
33528
|
+
i += 2;
|
|
33529
|
+
if (pattern[i] === "/") {
|
|
33530
|
+
i++;
|
|
33531
|
+
re += "(?:[^/]+/)*";
|
|
33532
|
+
} else {
|
|
33533
|
+
re += ".*?";
|
|
33534
|
+
}
|
|
33535
|
+
} else if (ch === "*") {
|
|
33536
|
+
re += "[^/]*";
|
|
33537
|
+
i++;
|
|
33538
|
+
} else if (ch === "?") {
|
|
33539
|
+
re += "[^/]";
|
|
33540
|
+
i++;
|
|
33541
|
+
} else {
|
|
33542
|
+
re += ch.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
33543
|
+
i++;
|
|
33544
|
+
}
|
|
33545
|
+
}
|
|
33546
|
+
return re;
|
|
33476
33547
|
}
|
|
33477
33548
|
function matchesExcludedDirectory(relativeDir, pattern) {
|
|
33478
33549
|
const normalized = relativeDir.replace(/\/+$/, "");
|
|
@@ -45,4 +45,5 @@ export interface MarkdownIngestionSnapshot {
|
|
|
45
45
|
mtimeMs: number;
|
|
46
46
|
}
|
|
47
47
|
export declare function createMarkdownIngestionHandle(cfg: PluginConfig, getClient: ClientGetter, logger?: LoggerLike, fsApi?: FsApi): MarkdownIngestionHandle;
|
|
48
|
+
export declare function matchesGlob(value: string, pattern: string): boolean;
|
|
48
49
|
export {};
|
package/dist/markdown-ingest.js
CHANGED
|
@@ -803,12 +803,111 @@ function isMarkdownFile(fileName) {
|
|
|
803
803
|
const lower = fileName.toLowerCase();
|
|
804
804
|
return lower.endsWith(".md") || lower.endsWith(".markdown");
|
|
805
805
|
}
|
|
806
|
-
function matchesGlob(value, pattern) {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
806
|
+
export function matchesGlob(value, pattern) {
|
|
807
|
+
// Convert a glob pattern to a RegExp, supporting:
|
|
808
|
+
// **/ — match zero or more path segments
|
|
809
|
+
// ** — match any path (including /)
|
|
810
|
+
// * — match within a single segment (no slashes)
|
|
811
|
+
// ? — match a single character (no slashes)
|
|
812
|
+
// [...] — character classes (including [!...] negation → [^...])
|
|
813
|
+
// {a,b} — brace expansion (comma-separated alternatives)
|
|
814
|
+
// Anything else is matched literally.
|
|
815
|
+
const len = pattern.length;
|
|
816
|
+
let re = "";
|
|
817
|
+
let i = 0;
|
|
818
|
+
while (i < len) {
|
|
819
|
+
const ch = pattern[i];
|
|
820
|
+
if (ch === "*" && pattern[i + 1] === "*") {
|
|
821
|
+
i += 2;
|
|
822
|
+
if (pattern[i] === "/") {
|
|
823
|
+
// **/ — zero or more complete path segments ending in /
|
|
824
|
+
i++; // consume the /
|
|
825
|
+
re += "(?:[^/]+/)*";
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
// standalone ** — match any path including /
|
|
829
|
+
re += ".*?";
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
else if (ch === "*") {
|
|
833
|
+
// * matches anything except /
|
|
834
|
+
re += "[^/]*";
|
|
835
|
+
i++;
|
|
836
|
+
}
|
|
837
|
+
else if (ch === "?") {
|
|
838
|
+
// ? matches a single character except /
|
|
839
|
+
re += "[^/]";
|
|
840
|
+
i++;
|
|
841
|
+
}
|
|
842
|
+
else if (ch === "[") {
|
|
843
|
+
// Character class — find the closing ]
|
|
844
|
+
const end = pattern.indexOf("]", i + 1);
|
|
845
|
+
if (end === -1) {
|
|
846
|
+
// No closing bracket, treat literally
|
|
847
|
+
re += "\\[";
|
|
848
|
+
i++;
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
// Translate glob [!...] negation to regex [^...] notation
|
|
852
|
+
const cls = pattern.slice(i + 1, end).replace(/^!/, "^");
|
|
853
|
+
re += "[" + cls + "]";
|
|
854
|
+
i = end + 1;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
else if (ch === "{") {
|
|
858
|
+
// Brace expansion {a,b} → (?:a|b)
|
|
859
|
+
const end = pattern.indexOf("}", i + 1);
|
|
860
|
+
if (end === -1) {
|
|
861
|
+
re += "\\{";
|
|
862
|
+
i++;
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
const inner = pattern.slice(i + 1, end);
|
|
866
|
+
const alternatives = inner.split(",").map((s) => globToRegexFragment(s)).join("|");
|
|
867
|
+
re += "(?:" + alternatives + ")";
|
|
868
|
+
i = end + 1;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
// Literal character — escape regex metacharacters
|
|
873
|
+
re += ch.replace(/[.+^${}()|\\]/g, "\\$&");
|
|
874
|
+
i++;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
return new RegExp(`^${re}$`).test(value);
|
|
878
|
+
}
|
|
879
|
+
function globToRegexFragment(pattern) {
|
|
880
|
+
// Minimal version of matchesGlob for use inside brace expansions.
|
|
881
|
+
// Supports *, **, ?, and literal characters (no nested braces/classes).
|
|
882
|
+
const len = pattern.length;
|
|
883
|
+
let re = "";
|
|
884
|
+
let i = 0;
|
|
885
|
+
while (i < len) {
|
|
886
|
+
const ch = pattern[i];
|
|
887
|
+
if (ch === "*" && pattern[i + 1] === "*") {
|
|
888
|
+
i += 2;
|
|
889
|
+
if (pattern[i] === "/") {
|
|
890
|
+
i++;
|
|
891
|
+
re += "(?:[^/]+/)*";
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
re += ".*?";
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
else if (ch === "*") {
|
|
898
|
+
re += "[^/]*";
|
|
899
|
+
i++;
|
|
900
|
+
}
|
|
901
|
+
else if (ch === "?") {
|
|
902
|
+
re += "[^/]";
|
|
903
|
+
i++;
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
re += ch.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
907
|
+
i++;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return re;
|
|
812
911
|
}
|
|
813
912
|
function matchesExcludedDirectory(relativeDir, pattern) {
|
|
814
913
|
const normalized = relativeDir.replace(/\/+$/, "");
|
package/openclaw.plugin.json
CHANGED