@xdarkicex/openclaw-memory-libravdb 1.6.4 → 1.6.5

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/index.js CHANGED
@@ -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 escaped = pattern.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join(".*");
33475
- return new RegExp(`^${escaped}$`).test(value);
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 {};
@@ -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
- const escaped = pattern
808
- .split("*")
809
- .map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&"))
810
- .join(".*");
811
- return new RegExp(`^${escaped}$`).test(value);
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(/\/+$/, "");
@@ -2,7 +2,7 @@
2
2
  "id": "libravdb-memory",
3
3
  "name": "LibraVDB Memory",
4
4
  "description": "Persistent vector memory with three-tier hybrid scoring",
5
- "version": "1.6.4",
5
+ "version": "1.6.5",
6
6
  "kind": [
7
7
  "memory",
8
8
  "context-engine"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xdarkicex/openclaw-memory-libravdb",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",