@autorag/librarian 2.13.9 → 2.13.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.
package/dist/profiles.js CHANGED
@@ -14789,6 +14789,35 @@ var init_embedding = __esm(() => {
14789
14789
  created = new Set;
14790
14790
  });
14791
14791
 
14792
+ // src/filesystem/path-exclusions.ts
14793
+ import { matchesGlob, posix as posix3, win32 as win322 } from "node:path";
14794
+ function isGlobExclusion(entry) {
14795
+ return /[*?[]/u.test(entry);
14796
+ }
14797
+ function matchesGlobExclusion(path, glob) {
14798
+ const slashed = path.replaceAll("\\", "/");
14799
+ if (matchesGlob(slashed, glob))
14800
+ return true;
14801
+ return glob.startsWith("**/") && matchesGlob(slashed, glob.slice(3));
14802
+ }
14803
+ function createPathExclusionMatcher(excludedPaths, platform = process.platform) {
14804
+ const paths = platform === "win32" ? win322 : posix3;
14805
+ const normalize = (path) => {
14806
+ const absolute = paths.resolve(path);
14807
+ return platform === "win32" ? absolute.toLowerCase() : absolute;
14808
+ };
14809
+ const globs = excludedPaths.filter(isGlobExclusion).map((glob) => platform === "win32" ? glob.toLowerCase() : glob);
14810
+ const excluded = excludedPaths.filter((path) => !isGlobExclusion(path)).map((path) => {
14811
+ const absolute = normalize(path);
14812
+ return { absolute, prefix: absolute.endsWith(paths.sep) ? absolute : `${absolute}${paths.sep}` };
14813
+ });
14814
+ return (path) => {
14815
+ const absolute = normalize(path);
14816
+ return excluded.some((entry) => absolute === entry.absolute || absolute.startsWith(entry.prefix)) || globs.some((glob) => matchesGlobExclusion(absolute, glob));
14817
+ };
14818
+ }
14819
+ var init_path_exclusions = () => {};
14820
+
14792
14821
  // src/language.ts
14793
14822
  function supportedList() {
14794
14823
  return AUTORAG_LANGUAGE_TAGS.join(", ");
@@ -15377,7 +15406,7 @@ function resolveExcludePaths(value, origin) {
15377
15406
  if (!Array.isArray(value) || value.some((path) => typeof path !== "string" || path.length === 0)) {
15378
15407
  throw new ConfigError("Config field 'excludePaths' must be a non-empty string array");
15379
15408
  }
15380
- return resolveSearchPaths(value, origin);
15409
+ return value.map((entry) => isGlobExclusion(entry) ? entry : resolvePersistedPath(entry, origin));
15381
15410
  }
15382
15411
  function resolvePersistedPath(path, origin) {
15383
15412
  return isAbsolute5(path) ? path : resolve6(origin, path);
@@ -16682,6 +16711,7 @@ var init_config4 = __esm(() => {
16682
16711
  init_factory();
16683
16712
  init_embedding();
16684
16713
  init_file_lock();
16714
+ init_path_exclusions();
16685
16715
  init_language();
16686
16716
  init_atomic_write();
16687
16717
  init_rerank();
@@ -16978,7 +17008,7 @@ var init_automation_profiles = __esm(() => {
16978
17008
 
16979
17009
  // src/automation/config.ts
16980
17010
  import { existsSync as existsSync14, readFileSync as readFileSync16, realpathSync as realpathSync2 } from "node:fs";
16981
- import { basename as basename6, dirname as dirname12, isAbsolute as isAbsolute6, join as join24, matchesGlob, relative as relative4, resolve as resolve7 } from "node:path";
17011
+ import { basename as basename6, dirname as dirname12, isAbsolute as isAbsolute6, join as join24, matchesGlob as matchesGlob2, relative as relative4, resolve as resolve7 } from "node:path";
16982
17012
  function automationsConfigPath(env = process.env) {
16983
17013
  return join24(resolveAutoRAGHome(env), "automations.json");
16984
17014
  }
@@ -17154,9 +17184,9 @@ function deleteAutomation(configPath, id) {
17154
17184
  function globMatches(relPosix, pattern) {
17155
17185
  if (pattern === "**")
17156
17186
  return true;
17157
- if (matchesGlob(relPosix, pattern))
17187
+ if (matchesGlob2(relPosix, pattern))
17158
17188
  return true;
17159
- if (pattern.startsWith("**/") && matchesGlob(relPosix, pattern.slice(3)))
17189
+ if (pattern.startsWith("**/") && matchesGlob2(relPosix, pattern.slice(3)))
17160
17190
  return true;
17161
17191
  return false;
17162
17192
  }
@@ -18612,25 +18642,6 @@ var init_bundle = __esm(() => {
18612
18642
  init_atomic_write();
18613
18643
  });
18614
18644
 
18615
- // src/filesystem/path-exclusions.ts
18616
- import { posix as posix3, win32 as win322 } from "node:path";
18617
- function createPathExclusionMatcher(excludedPaths, platform = process.platform) {
18618
- const paths = platform === "win32" ? win322 : posix3;
18619
- const normalize = (path) => {
18620
- const absolute = paths.resolve(path);
18621
- return platform === "win32" ? absolute.toLowerCase() : absolute;
18622
- };
18623
- const excluded = excludedPaths.map((path) => {
18624
- const absolute = normalize(path);
18625
- return { absolute, prefix: absolute.endsWith(paths.sep) ? absolute : `${absolute}${paths.sep}` };
18626
- });
18627
- return (path) => {
18628
- const absolute = normalize(path);
18629
- return excluded.some((entry) => absolute === entry.absolute || absolute.startsWith(entry.prefix));
18630
- };
18631
- }
18632
- var init_path_exclusions = () => {};
18633
-
18634
18645
  // src/filesystem/shared-exclusive-queue.ts
18635
18646
  class SharedExclusiveQueue {
18636
18647
  sharedSinceExclusive = [];
@@ -24211,7 +24222,7 @@ var init_cloud = __esm(() => {
24211
24222
  // src/mirror/sync.ts
24212
24223
  import { createHash as createHash17 } from "node:crypto";
24213
24224
  import { opendir as opendir2, readFile as readFile2, stat as stat4 } from "node:fs/promises";
24214
- import { basename as basename13, dirname as dirname21, extname as extname9, join as join42, resolve as resolve15, sep as sep9 } from "node:path";
24225
+ import { basename as basename13, dirname as dirname21, extname as extname9, join as join42, resolve as resolve15 } from "node:path";
24215
24226
  import { setTimeout as sleep4 } from "node:timers/promises";
24216
24227
  function errorCode(error) {
24217
24228
  if (!(error instanceof Error))
@@ -24758,13 +24769,14 @@ function normalizeExtension2(extension) {
24758
24769
  return lower.startsWith(".") ? lower : `.${lower}`;
24759
24770
  }
24760
24771
  function isPathExcluded(sourcePath, excluded) {
24761
- if (excluded === undefined)
24772
+ if (excluded === undefined || excluded.size === 0)
24762
24773
  return false;
24763
- for (const excludedPath of excluded) {
24764
- if (sourcePath === excludedPath || sourcePath.startsWith(`${excludedPath}${sep9}`))
24765
- return true;
24774
+ let matcher = matcherBySet.get(excluded);
24775
+ if (matcher === undefined) {
24776
+ matcher = createPathExclusionMatcher([...excluded]);
24777
+ matcherBySet.set(excluded, matcher);
24766
24778
  }
24767
- return false;
24779
+ return matcher(sourcePath);
24768
24780
  }
24769
24781
  function walkLimits(options) {
24770
24782
  return {
@@ -24931,10 +24943,11 @@ async function collectFiles(state, directory, depth) {
24931
24943
  warnDirectoryUnreadable(state, directory, code);
24932
24944
  }
24933
24945
  }
24934
- var DEFAULT_MAX_SOURCE_BYTES, DEFAULT_MAX_DELETE_RATIO = 0.3, MASS_DELETE_FLOOR = 100, DEFAULT_MAX_SCANNED_ENTRIES = 2000000, DEFAULT_MAX_WALK_DEPTH = 64, DEFAULT_MIRROR_BATCH_SIZE = 25, PRODUCT_ARTIFACT_FILE_NAMES, SKIP_DIR_NAMES, PARSER_FAILURE_MESSAGE = "The registered parser failed on this file; it was skipped during indexing.", PARSER_CRASH_MESSAGE = "The registered parser crashed unexpectedly on this file; it was skipped during indexing.", DEFAULT_TRANSIENT_RETRIES = 3, DEFAULT_TRANSIENT_BACKOFF_MS = 50, TRANSIENT_ERROR_CODES, WORKSPACE_ERROR_CODES, MirrorWorkspaceError, STANDALONE_OCR_IMAGE_EXTENSIONS, SEARCH_ROOT_UNAVAILABLE_MESSAGES;
24946
+ var DEFAULT_MAX_SOURCE_BYTES, DEFAULT_MAX_DELETE_RATIO = 0.3, MASS_DELETE_FLOOR = 100, DEFAULT_MAX_SCANNED_ENTRIES = 2000000, DEFAULT_MAX_WALK_DEPTH = 64, DEFAULT_MIRROR_BATCH_SIZE = 25, PRODUCT_ARTIFACT_FILE_NAMES, SKIP_DIR_NAMES, PARSER_FAILURE_MESSAGE = "The registered parser failed on this file; it was skipped during indexing.", PARSER_CRASH_MESSAGE = "The registered parser crashed unexpectedly on this file; it was skipped during indexing.", DEFAULT_TRANSIENT_RETRIES = 3, DEFAULT_TRANSIENT_BACKOFF_MS = 50, TRANSIENT_ERROR_CODES, WORKSPACE_ERROR_CODES, MirrorWorkspaceError, STANDALONE_OCR_IMAGE_EXTENSIONS, matcherBySet, SEARCH_ROOT_UNAVAILABLE_MESSAGES;
24935
24947
  var init_sync = __esm(() => {
24936
24948
  init_cli2();
24937
24949
  init_cloud_placeholder();
24950
+ init_path_exclusions();
24938
24951
  init_source_paths();
24939
24952
  init_binary();
24940
24953
  init_stage();
@@ -24993,6 +25006,7 @@ var init_sync = __esm(() => {
24993
25006
  }
24994
25007
  };
24995
25008
  STANDALONE_OCR_IMAGE_EXTENSIONS = new Set(KORDOC_IMAGE_EXTENSIONS);
25009
+ matcherBySet = new WeakMap;
24996
25010
  SEARCH_ROOT_UNAVAILABLE_MESSAGES = {
24997
25011
  gone: "A search root no longer exists; its previously indexed documents were left untouched.",
24998
25012
  "not-a-directory": "A search root is no longer a directory; its previously indexed documents were left untouched.",
@@ -38548,7 +38562,7 @@ var init_web_search_tool = __esm(() => {
38548
38562
  // src/agent/agent.ts
38549
38563
  import { randomUUID as randomUUID7 } from "node:crypto";
38550
38564
  import { existsSync as existsSync34, watch as fsWatch, mkdirSync as mkdirSync24, realpathSync as realpathSync8, statSync as statSync11, writeFileSync as writeFileSync17 } from "node:fs";
38551
- import { basename as basename15, dirname as dirname27, join as join54, relative as relative8, resolve as resolve18, sep as sep10 } from "node:path";
38565
+ import { basename as basename15, dirname as dirname27, join as join54, relative as relative8, resolve as resolve18, sep as sep9 } from "node:path";
38552
38566
  import { clampThinkingLevel } from "@earendil-works/pi-ai/compat";
38553
38567
  import { getAgentDir as getAgentDir6, keyText } from "@earendil-works/pi-coding-agent";
38554
38568
  function describeDecisionModel(status) {
@@ -41221,7 +41235,7 @@ ${this.discoveryHint((tools) => `When exploring local files and folders, activel
41221
41235
  return { ok: false, reason: "cloud-root-skipped", stdout: "", stderr: "", code: null };
41222
41236
  }
41223
41237
  const canonicalSourcePath = canonicalPath(sourcePath);
41224
- const exclude = scope.nestedCloudRoots.map((root) => relative8(canonicalSourcePath, root.path).split(sep10).join("/")).filter((pattern) => pattern !== "" && !pattern.startsWith(".."));
41238
+ const exclude = scope.nestedCloudRoots.map((root) => relative8(canonicalSourcePath, root.path).split(sep9).join("/")).filter((pattern) => pattern !== "" && !pattern.startsWith(".."));
41225
41239
  return client.prepare(sourcePath, { ...options, ...exclude.length === 0 ? {} : { exclude } });
41226
41240
  }));
41227
41241
  }
@@ -41735,6 +41749,8 @@ function toMinSyncReasonDiagnostic(reason) {
41735
41749
  };
41736
41750
  }
41737
41751
  function pinExcludedPath(path) {
41752
+ if (isGlobExclusion(path))
41753
+ return path;
41738
41754
  const resolvedPath = resolve18(path);
41739
41755
  try {
41740
41756
  return join54(realpathSync8(dirname27(resolvedPath)), basename15(resolvedPath));
@@ -41783,6 +41799,7 @@ var init_agent = __esm(() => {
41783
41799
  init_embedding();
41784
41800
  init_everything();
41785
41801
  init_cloud_placeholder();
41802
+ init_path_exclusions();
41786
41803
  init_fsearch();
41787
41804
  init_diagnostics();
41788
41805
  init_jikji();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.13.9",
3
+ "version": "2.13.11",
4
4
  "description": "Personal librarian agent for office work on the Pi framework, with pluggable retrieval methods",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {