@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/cli/index.js +56 -32
- package/dist/core.d.ts +5 -0
- package/dist/core.js +46 -23
- package/dist/filesystem/path-exclusions.d.ts +12 -1
- package/dist/index.js +158 -31
- package/dist/mcp/index.js +205 -34
- package/dist/mcp/reloading-lite.d.ts +25 -0
- package/dist/mcp/server.d.ts +16 -0
- package/dist/mirror/sync.d.ts +1 -0
- package/dist/profiles.js +49 -32
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -15253,6 +15253,35 @@ var init_factory = __esm(() => {
|
|
|
15253
15253
|
RETIRED_TEMPLATES = { spotlight: true };
|
|
15254
15254
|
});
|
|
15255
15255
|
|
|
15256
|
+
// src/filesystem/path-exclusions.ts
|
|
15257
|
+
import { matchesGlob as matchesGlob2, posix as posix3, win32 as win322 } from "node:path";
|
|
15258
|
+
function isGlobExclusion(entry) {
|
|
15259
|
+
return /[*?[]/u.test(entry);
|
|
15260
|
+
}
|
|
15261
|
+
function matchesGlobExclusion(path, glob) {
|
|
15262
|
+
const slashed = path.replaceAll("\\", "/");
|
|
15263
|
+
if (matchesGlob2(slashed, glob))
|
|
15264
|
+
return true;
|
|
15265
|
+
return glob.startsWith("**/") && matchesGlob2(slashed, glob.slice(3));
|
|
15266
|
+
}
|
|
15267
|
+
function createPathExclusionMatcher(excludedPaths, platform = process.platform) {
|
|
15268
|
+
const paths = platform === "win32" ? win322 : posix3;
|
|
15269
|
+
const normalize = (path) => {
|
|
15270
|
+
const absolute = paths.resolve(path);
|
|
15271
|
+
return platform === "win32" ? absolute.toLowerCase() : absolute;
|
|
15272
|
+
};
|
|
15273
|
+
const globs = excludedPaths.filter(isGlobExclusion).map((glob) => platform === "win32" ? glob.toLowerCase() : glob);
|
|
15274
|
+
const excluded = excludedPaths.filter((path) => !isGlobExclusion(path)).map((path) => {
|
|
15275
|
+
const absolute = normalize(path);
|
|
15276
|
+
return { absolute, prefix: absolute.endsWith(paths.sep) ? absolute : `${absolute}${paths.sep}` };
|
|
15277
|
+
});
|
|
15278
|
+
return (path) => {
|
|
15279
|
+
const absolute = normalize(path);
|
|
15280
|
+
return excluded.some((entry) => absolute === entry.absolute || absolute.startsWith(entry.prefix)) || globs.some((glob) => matchesGlobExclusion(absolute, glob));
|
|
15281
|
+
};
|
|
15282
|
+
}
|
|
15283
|
+
var init_path_exclusions = () => {};
|
|
15284
|
+
|
|
15256
15285
|
// src/language.ts
|
|
15257
15286
|
function supportedList() {
|
|
15258
15287
|
return AUTORAG_LANGUAGE_TAGS.join(", ");
|
|
@@ -15841,7 +15870,7 @@ function resolveExcludePaths(value, origin) {
|
|
|
15841
15870
|
if (!Array.isArray(value) || value.some((path) => typeof path !== "string" || path.length === 0)) {
|
|
15842
15871
|
throw new ConfigError("Config field 'excludePaths' must be a non-empty string array");
|
|
15843
15872
|
}
|
|
15844
|
-
return
|
|
15873
|
+
return value.map((entry) => isGlobExclusion(entry) ? entry : resolvePersistedPath(entry, origin));
|
|
15845
15874
|
}
|
|
15846
15875
|
function resolvePersistedPath(path, origin) {
|
|
15847
15876
|
return isAbsolute6(path) ? path : resolve7(origin, path);
|
|
@@ -17146,6 +17175,7 @@ var init_config5 = __esm(() => {
|
|
|
17146
17175
|
init_factory();
|
|
17147
17176
|
init_embedding();
|
|
17148
17177
|
init_file_lock();
|
|
17178
|
+
init_path_exclusions();
|
|
17149
17179
|
init_language();
|
|
17150
17180
|
init_atomic_write();
|
|
17151
17181
|
init_rerank();
|
|
@@ -18764,25 +18794,6 @@ var init_bundle = __esm(() => {
|
|
|
18764
18794
|
init_atomic_write();
|
|
18765
18795
|
});
|
|
18766
18796
|
|
|
18767
|
-
// src/filesystem/path-exclusions.ts
|
|
18768
|
-
import { posix as posix3, win32 as win322 } from "node:path";
|
|
18769
|
-
function createPathExclusionMatcher(excludedPaths, platform = process.platform) {
|
|
18770
|
-
const paths = platform === "win32" ? win322 : posix3;
|
|
18771
|
-
const normalize = (path) => {
|
|
18772
|
-
const absolute = paths.resolve(path);
|
|
18773
|
-
return platform === "win32" ? absolute.toLowerCase() : absolute;
|
|
18774
|
-
};
|
|
18775
|
-
const excluded = excludedPaths.map((path) => {
|
|
18776
|
-
const absolute = normalize(path);
|
|
18777
|
-
return { absolute, prefix: absolute.endsWith(paths.sep) ? absolute : `${absolute}${paths.sep}` };
|
|
18778
|
-
});
|
|
18779
|
-
return (path) => {
|
|
18780
|
-
const absolute = normalize(path);
|
|
18781
|
-
return excluded.some((entry) => absolute === entry.absolute || absolute.startsWith(entry.prefix));
|
|
18782
|
-
};
|
|
18783
|
-
}
|
|
18784
|
-
var init_path_exclusions = () => {};
|
|
18785
|
-
|
|
18786
18797
|
// src/filesystem/shared-exclusive-queue.ts
|
|
18787
18798
|
class SharedExclusiveQueue {
|
|
18788
18799
|
sharedSinceExclusive = [];
|
|
@@ -24363,7 +24374,7 @@ var init_cloud = __esm(() => {
|
|
|
24363
24374
|
// src/mirror/sync.ts
|
|
24364
24375
|
import { createHash as createHash17 } from "node:crypto";
|
|
24365
24376
|
import { opendir as opendir2, readFile as readFile2, stat as stat4 } from "node:fs/promises";
|
|
24366
|
-
import { basename as basename13, dirname as dirname22, extname as extname9, join as join43, resolve as resolve15
|
|
24377
|
+
import { basename as basename13, dirname as dirname22, extname as extname9, join as join43, resolve as resolve15 } from "node:path";
|
|
24367
24378
|
import { setTimeout as sleep4 } from "node:timers/promises";
|
|
24368
24379
|
function errorCode(error) {
|
|
24369
24380
|
if (!(error instanceof Error))
|
|
@@ -24910,13 +24921,14 @@ function normalizeExtension2(extension) {
|
|
|
24910
24921
|
return lower.startsWith(".") ? lower : `.${lower}`;
|
|
24911
24922
|
}
|
|
24912
24923
|
function isPathExcluded(sourcePath, excluded) {
|
|
24913
|
-
if (excluded === undefined)
|
|
24924
|
+
if (excluded === undefined || excluded.size === 0)
|
|
24914
24925
|
return false;
|
|
24915
|
-
|
|
24916
|
-
|
|
24917
|
-
|
|
24926
|
+
let matcher = matcherBySet.get(excluded);
|
|
24927
|
+
if (matcher === undefined) {
|
|
24928
|
+
matcher = createPathExclusionMatcher([...excluded]);
|
|
24929
|
+
matcherBySet.set(excluded, matcher);
|
|
24918
24930
|
}
|
|
24919
|
-
return
|
|
24931
|
+
return matcher(sourcePath);
|
|
24920
24932
|
}
|
|
24921
24933
|
function walkLimits(options) {
|
|
24922
24934
|
return {
|
|
@@ -25083,10 +25095,11 @@ async function collectFiles(state, directory, depth) {
|
|
|
25083
25095
|
warnDirectoryUnreadable(state, directory, code);
|
|
25084
25096
|
}
|
|
25085
25097
|
}
|
|
25086
|
-
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;
|
|
25098
|
+
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;
|
|
25087
25099
|
var init_sync = __esm(() => {
|
|
25088
25100
|
init_cli2();
|
|
25089
25101
|
init_cloud_placeholder();
|
|
25102
|
+
init_path_exclusions();
|
|
25090
25103
|
init_source_paths();
|
|
25091
25104
|
init_binary();
|
|
25092
25105
|
init_stage();
|
|
@@ -25145,6 +25158,7 @@ var init_sync = __esm(() => {
|
|
|
25145
25158
|
}
|
|
25146
25159
|
};
|
|
25147
25160
|
STANDALONE_OCR_IMAGE_EXTENSIONS = new Set(KORDOC_IMAGE_EXTENSIONS);
|
|
25161
|
+
matcherBySet = new WeakMap;
|
|
25148
25162
|
SEARCH_ROOT_UNAVAILABLE_MESSAGES = {
|
|
25149
25163
|
gone: "A search root no longer exists; its previously indexed documents were left untouched.",
|
|
25150
25164
|
"not-a-directory": "A search root is no longer a directory; its previously indexed documents were left untouched.",
|
|
@@ -38182,7 +38196,7 @@ var init_web_search_tool = __esm(() => {
|
|
|
38182
38196
|
// src/agent/agent.ts
|
|
38183
38197
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
38184
38198
|
import { existsSync as existsSync32, watch as fsWatch, mkdirSync as mkdirSync23, realpathSync as realpathSync8, statSync as statSync11, writeFileSync as writeFileSync17 } from "node:fs";
|
|
38185
|
-
import { basename as basename15, dirname as dirname27, join as join53, relative as relative8, resolve as resolve17, sep as
|
|
38199
|
+
import { basename as basename15, dirname as dirname27, join as join53, relative as relative8, resolve as resolve17, sep as sep9 } from "node:path";
|
|
38186
38200
|
import { clampThinkingLevel } from "@earendil-works/pi-ai/compat";
|
|
38187
38201
|
import { getAgentDir as getAgentDir5, keyText } from "@earendil-works/pi-coding-agent";
|
|
38188
38202
|
function describeDecisionModel(status) {
|
|
@@ -40855,7 +40869,7 @@ ${this.discoveryHint((tools) => `When exploring local files and folders, activel
|
|
|
40855
40869
|
return { ok: false, reason: "cloud-root-skipped", stdout: "", stderr: "", code: null };
|
|
40856
40870
|
}
|
|
40857
40871
|
const canonicalSourcePath = canonicalPath(sourcePath);
|
|
40858
|
-
const exclude = scope.nestedCloudRoots.map((root) => relative8(canonicalSourcePath, root.path).split(
|
|
40872
|
+
const exclude = scope.nestedCloudRoots.map((root) => relative8(canonicalSourcePath, root.path).split(sep9).join("/")).filter((pattern) => pattern !== "" && !pattern.startsWith(".."));
|
|
40859
40873
|
return client.prepare(sourcePath, { ...options, ...exclude.length === 0 ? {} : { exclude } });
|
|
40860
40874
|
}));
|
|
40861
40875
|
}
|
|
@@ -41369,6 +41383,8 @@ function toMinSyncReasonDiagnostic(reason) {
|
|
|
41369
41383
|
};
|
|
41370
41384
|
}
|
|
41371
41385
|
function pinExcludedPath(path) {
|
|
41386
|
+
if (isGlobExclusion(path))
|
|
41387
|
+
return path;
|
|
41372
41388
|
const resolvedPath = resolve17(path);
|
|
41373
41389
|
try {
|
|
41374
41390
|
return join53(realpathSync8(dirname27(resolvedPath)), basename15(resolvedPath));
|
|
@@ -41417,6 +41433,7 @@ var init_agent = __esm(() => {
|
|
|
41417
41433
|
init_embedding();
|
|
41418
41434
|
init_everything();
|
|
41419
41435
|
init_cloud_placeholder();
|
|
41436
|
+
init_path_exclusions();
|
|
41420
41437
|
init_fsearch();
|
|
41421
41438
|
init_diagnostics();
|
|
41422
41439
|
init_jikji();
|
|
@@ -42381,7 +42398,7 @@ async function runInit(ctx) {
|
|
|
42381
42398
|
ctx.stderr(renderError(new ConfigError("--exclude requires a non-empty path"), { json: ctx.json, debug: ctx.debug }));
|
|
42382
42399
|
return 2;
|
|
42383
42400
|
}
|
|
42384
|
-
partial.excludePaths = excludedPaths.map((path) => resolve20(ctx.cwd, path));
|
|
42401
|
+
partial.excludePaths = excludedPaths.map((path) => isGlobExclusion(path) ? path : resolve20(ctx.cwd, path));
|
|
42385
42402
|
}
|
|
42386
42403
|
if (typeof flags.workspace === "string")
|
|
42387
42404
|
partial.workspacePath = flags.workspace;
|
|
@@ -42526,6 +42543,7 @@ function parseEmbedderFlags(flags) {
|
|
|
42526
42543
|
return Object.keys(embedder).length > 0 ? embedder : undefined;
|
|
42527
42544
|
}
|
|
42528
42545
|
var init_init = __esm(() => {
|
|
42546
|
+
init_path_exclusions();
|
|
42529
42547
|
init_language();
|
|
42530
42548
|
init_config5();
|
|
42531
42549
|
init_output();
|
|
@@ -43847,7 +43865,7 @@ var init_memory2 = __esm(() => {
|
|
|
43847
43865
|
|
|
43848
43866
|
// src/cli/commands/index.ts
|
|
43849
43867
|
import { existsSync as existsSync39, lstatSync as lstatSync5, rmSync as rmSync14 } from "node:fs";
|
|
43850
|
-
import { join as join58, resolve as resolve22, sep as
|
|
43868
|
+
import { join as join58, resolve as resolve22, sep as sep10 } from "node:path";
|
|
43851
43869
|
async function runIndex2(ctx) {
|
|
43852
43870
|
const sub = ctx.positionals[0];
|
|
43853
43871
|
if (sub !== "reset" && sub !== "rebuild") {
|
|
@@ -43951,7 +43969,7 @@ function resolveResetScope(methods) {
|
|
|
43951
43969
|
};
|
|
43952
43970
|
}
|
|
43953
43971
|
function isWithin(target, base) {
|
|
43954
|
-
const prefix = base.endsWith(
|
|
43972
|
+
const prefix = base.endsWith(sep10) ? base : `${base}${sep10}`;
|
|
43955
43973
|
return target === base || target.startsWith(prefix);
|
|
43956
43974
|
}
|
|
43957
43975
|
var ALL_RESET_TARGETS, ALL_RESET_TARGET_NAMES;
|
|
@@ -44870,6 +44888,12 @@ class AutoRAGLite {
|
|
|
44870
44888
|
getMemorySchema() {
|
|
44871
44889
|
return structuredClone(this.memory.getSchema());
|
|
44872
44890
|
}
|
|
44891
|
+
convertFiles(request, signal) {
|
|
44892
|
+
return this.agent.convertFiles(request, signal);
|
|
44893
|
+
}
|
|
44894
|
+
listFileConversions(from, signal) {
|
|
44895
|
+
return this.agent.listFileConversions(from, signal);
|
|
44896
|
+
}
|
|
44873
44897
|
}
|
|
44874
44898
|
function createAutoRAGLite(options = {}) {
|
|
44875
44899
|
const input = { flags: options.flags ?? {} };
|
package/dist/core.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AutoRAGJikjiPrepareResult, AutoRAGRefreshOptions, AutoRAGRefreshRe
|
|
|
2
2
|
import type { AutoRAGResultsDetails } from "./agent/results.js";
|
|
3
3
|
import { type SearchDocumentsResponse } from "./agent/search-documents.js";
|
|
4
4
|
import { type CliConfig, type ResolveConfigInput } from "./cli/config.js";
|
|
5
|
+
import type { ConvertAndRelateResult, FileeConvertRequest } from "./convert/index.js";
|
|
5
6
|
import type { EverythingSearchRequest, EverythingSearchResult } from "./everything/index.js";
|
|
6
7
|
import type { FSearchSearchRequest, FSearchSearchResult } from "./fsearch/index.js";
|
|
7
8
|
import type { JikjiPrepareOptions } from "./jikji/index.js";
|
|
@@ -84,6 +85,10 @@ export declare class AutoRAGLite {
|
|
|
84
85
|
recordReport(query: string, details: AutoRAGResultsDetails): SearchDocumentsResponse;
|
|
85
86
|
/** Return a detached snapshot of persisted evidence state. */
|
|
86
87
|
getMemorySchema(): MemorySchema;
|
|
88
|
+
/** Convert files with Filee, then ask Dupey whether each output joins its source's family. */
|
|
89
|
+
convertFiles(request: FileeConvertRequest, signal?: AbortSignal): Promise<ConvertAndRelateResult>;
|
|
90
|
+
/** The formats Filee knows, or what one source format can become. */
|
|
91
|
+
listFileConversions(from?: string, signal?: AbortSignal): Promise<string>;
|
|
87
92
|
}
|
|
88
93
|
/** Resolve the existing CLI config and construct a model-free runtime. */
|
|
89
94
|
export declare function createAutoRAGLite(options?: AutoRAGLiteOptions): AutoRAGLite;
|
package/dist/core.js
CHANGED
|
@@ -3668,20 +3668,30 @@ var init_bundle = __esm(() => {
|
|
|
3668
3668
|
});
|
|
3669
3669
|
|
|
3670
3670
|
// src/filesystem/path-exclusions.ts
|
|
3671
|
-
import { posix as posix2, win32 as win322 } from "node:path";
|
|
3671
|
+
import { matchesGlob, posix as posix2, win32 as win322 } from "node:path";
|
|
3672
|
+
function isGlobExclusion(entry) {
|
|
3673
|
+
return /[*?[]/u.test(entry);
|
|
3674
|
+
}
|
|
3675
|
+
function matchesGlobExclusion(path, glob) {
|
|
3676
|
+
const slashed = path.replaceAll("\\", "/");
|
|
3677
|
+
if (matchesGlob(slashed, glob))
|
|
3678
|
+
return true;
|
|
3679
|
+
return glob.startsWith("**/") && matchesGlob(slashed, glob.slice(3));
|
|
3680
|
+
}
|
|
3672
3681
|
function createPathExclusionMatcher(excludedPaths, platform = process.platform) {
|
|
3673
3682
|
const paths = platform === "win32" ? win322 : posix2;
|
|
3674
3683
|
const normalize = (path) => {
|
|
3675
3684
|
const absolute = paths.resolve(path);
|
|
3676
3685
|
return platform === "win32" ? absolute.toLowerCase() : absolute;
|
|
3677
3686
|
};
|
|
3678
|
-
const
|
|
3687
|
+
const globs = excludedPaths.filter(isGlobExclusion).map((glob) => platform === "win32" ? glob.toLowerCase() : glob);
|
|
3688
|
+
const excluded = excludedPaths.filter((path) => !isGlobExclusion(path)).map((path) => {
|
|
3679
3689
|
const absolute = normalize(path);
|
|
3680
3690
|
return { absolute, prefix: absolute.endsWith(paths.sep) ? absolute : `${absolute}${paths.sep}` };
|
|
3681
3691
|
});
|
|
3682
3692
|
return (path) => {
|
|
3683
3693
|
const absolute = normalize(path);
|
|
3684
|
-
return excluded.some((entry) => absolute === entry.absolute || absolute.startsWith(entry.prefix));
|
|
3694
|
+
return excluded.some((entry) => absolute === entry.absolute || absolute.startsWith(entry.prefix)) || globs.some((glob) => matchesGlobExclusion(absolute, glob));
|
|
3685
3695
|
};
|
|
3686
3696
|
}
|
|
3687
3697
|
var init_path_exclusions = () => {};
|
|
@@ -10333,7 +10343,7 @@ var init_cloud = __esm(() => {
|
|
|
10333
10343
|
// src/mirror/sync.ts
|
|
10334
10344
|
import { createHash as createHash11 } from "node:crypto";
|
|
10335
10345
|
import { opendir, readFile, stat as stat3 } from "node:fs/promises";
|
|
10336
|
-
import { basename as basename9, dirname as dirname12, extname as extname6, join as join27, resolve as resolve11
|
|
10346
|
+
import { basename as basename9, dirname as dirname12, extname as extname6, join as join27, resolve as resolve11 } from "node:path";
|
|
10337
10347
|
import { setTimeout as sleep3 } from "node:timers/promises";
|
|
10338
10348
|
function errorCode(error) {
|
|
10339
10349
|
if (!(error instanceof Error))
|
|
@@ -10880,13 +10890,14 @@ function normalizeExtension2(extension) {
|
|
|
10880
10890
|
return lower.startsWith(".") ? lower : `.${lower}`;
|
|
10881
10891
|
}
|
|
10882
10892
|
function isPathExcluded(sourcePath, excluded) {
|
|
10883
|
-
if (excluded === undefined)
|
|
10893
|
+
if (excluded === undefined || excluded.size === 0)
|
|
10884
10894
|
return false;
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10895
|
+
let matcher = matcherBySet.get(excluded);
|
|
10896
|
+
if (matcher === undefined) {
|
|
10897
|
+
matcher = createPathExclusionMatcher([...excluded]);
|
|
10898
|
+
matcherBySet.set(excluded, matcher);
|
|
10888
10899
|
}
|
|
10889
|
-
return
|
|
10900
|
+
return matcher(sourcePath);
|
|
10890
10901
|
}
|
|
10891
10902
|
function walkLimits(options) {
|
|
10892
10903
|
return {
|
|
@@ -11053,10 +11064,11 @@ async function collectFiles(state, directory, depth) {
|
|
|
11053
11064
|
warnDirectoryUnreadable(state, directory, code);
|
|
11054
11065
|
}
|
|
11055
11066
|
}
|
|
11056
|
-
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;
|
|
11067
|
+
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;
|
|
11057
11068
|
var init_sync = __esm(() => {
|
|
11058
11069
|
init_cli2();
|
|
11059
11070
|
init_cloud_placeholder();
|
|
11071
|
+
init_path_exclusions();
|
|
11060
11072
|
init_source_paths();
|
|
11061
11073
|
init_binary();
|
|
11062
11074
|
init_stage();
|
|
@@ -11115,6 +11127,7 @@ var init_sync = __esm(() => {
|
|
|
11115
11127
|
}
|
|
11116
11128
|
};
|
|
11117
11129
|
STANDALONE_OCR_IMAGE_EXTENSIONS = new Set(KORDOC_IMAGE_EXTENSIONS);
|
|
11130
|
+
matcherBySet = new WeakMap;
|
|
11118
11131
|
SEARCH_ROOT_UNAVAILABLE_MESSAGES = {
|
|
11119
11132
|
gone: "A search root no longer exists; its previously indexed documents were left untouched.",
|
|
11120
11133
|
"not-a-directory": "A search root is no longer a directory; its previously indexed documents were left untouched.",
|
|
@@ -16189,7 +16202,7 @@ var init_automation_profiles = __esm(() => {
|
|
|
16189
16202
|
|
|
16190
16203
|
// src/automation/config.ts
|
|
16191
16204
|
import { existsSync as existsSync19, readFileSync as readFileSync14, realpathSync as realpathSync7 } from "node:fs";
|
|
16192
|
-
import { basename as basename10, dirname as dirname15, isAbsolute as isAbsolute8, join as join30, matchesGlob, relative as relative5, resolve as resolve12 } from "node:path";
|
|
16205
|
+
import { basename as basename10, dirname as dirname15, isAbsolute as isAbsolute8, join as join30, matchesGlob as matchesGlob2, relative as relative5, resolve as resolve12 } from "node:path";
|
|
16193
16206
|
function automationsConfigPath(env = process.env) {
|
|
16194
16207
|
return join30(resolveAutoRAGHome(env), "automations.json");
|
|
16195
16208
|
}
|
|
@@ -16365,9 +16378,9 @@ function deleteAutomation(configPath, id) {
|
|
|
16365
16378
|
function globMatches(relPosix, pattern) {
|
|
16366
16379
|
if (pattern === "**")
|
|
16367
16380
|
return true;
|
|
16368
|
-
if (
|
|
16381
|
+
if (matchesGlob2(relPosix, pattern))
|
|
16369
16382
|
return true;
|
|
16370
|
-
if (pattern.startsWith("**/") &&
|
|
16383
|
+
if (pattern.startsWith("**/") && matchesGlob2(relPosix, pattern.slice(3)))
|
|
16371
16384
|
return true;
|
|
16372
16385
|
return false;
|
|
16373
16386
|
}
|
|
@@ -17164,7 +17177,7 @@ var init_permission_judgment = __esm(() => {
|
|
|
17164
17177
|
|
|
17165
17178
|
// src/agent/permission-gate.ts
|
|
17166
17179
|
import { statSync as statSync7 } from "node:fs";
|
|
17167
|
-
import { isAbsolute as isAbsolute9, relative as relative6, sep as
|
|
17180
|
+
import { isAbsolute as isAbsolute9, relative as relative6, sep as sep6 } from "node:path";
|
|
17168
17181
|
import { matchesKey } from "@earendil-works/pi-tui";
|
|
17169
17182
|
function pathExists(path) {
|
|
17170
17183
|
try {
|
|
@@ -17227,7 +17240,7 @@ class PermissionController {
|
|
|
17227
17240
|
if (path === root)
|
|
17228
17241
|
return true;
|
|
17229
17242
|
const rel = relative6(root, path);
|
|
17230
|
-
if (rel !== "" && rel !== ".." && !rel.startsWith(`..${
|
|
17243
|
+
if (rel !== "" && rel !== ".." && !rel.startsWith(`..${sep6}`) && !isAbsolute9(rel))
|
|
17231
17244
|
return true;
|
|
17232
17245
|
}
|
|
17233
17246
|
return false;
|
|
@@ -18679,7 +18692,7 @@ var init_connector = () => {};
|
|
|
18679
18692
|
// src/datasource/sidecar/config.ts
|
|
18680
18693
|
import { readFileSync as readFileSync17 } from "node:fs";
|
|
18681
18694
|
import { homedir as homedir5 } from "node:os";
|
|
18682
|
-
import { dirname as dirname17, isAbsolute as isAbsolute10, join as join34, resolve as resolve14, sep as
|
|
18695
|
+
import { dirname as dirname17, isAbsolute as isAbsolute10, join as join34, resolve as resolve14, sep as sep7 } from "node:path";
|
|
18683
18696
|
import { parse as parseToml } from "smol-toml";
|
|
18684
18697
|
function resolveSidecarOptions(input) {
|
|
18685
18698
|
const { connector, workspaceRoot } = input;
|
|
@@ -18719,7 +18732,7 @@ function archivePathFromCrawlerConfig(input) {
|
|
|
18719
18732
|
function expandHome(path) {
|
|
18720
18733
|
if (path === "~")
|
|
18721
18734
|
return homedir5();
|
|
18722
|
-
const prefixed = path.startsWith("~/") ||
|
|
18735
|
+
const prefixed = path.startsWith("~/") || sep7 === "\\" && path.startsWith("~\\");
|
|
18723
18736
|
return prefixed ? join34(homedir5(), path.slice(2)) : path;
|
|
18724
18737
|
}
|
|
18725
18738
|
var init_config3 = __esm(() => {
|
|
@@ -25973,7 +25986,7 @@ import {
|
|
|
25973
25986
|
writeFileSync as writeFileSync13
|
|
25974
25987
|
} from "node:fs";
|
|
25975
25988
|
import { opendir as opendir2, stat as stat4 } from "node:fs/promises";
|
|
25976
|
-
import { basename as basename11, dirname as dirname23, extname as extname8, join as join40, relative as relative7, sep as
|
|
25989
|
+
import { basename as basename11, dirname as dirname23, extname as extname8, join as join40, relative as relative7, sep as sep8 } from "node:path";
|
|
25977
25990
|
function errnoCode2(error) {
|
|
25978
25991
|
const code = error instanceof Error ? error.code : undefined;
|
|
25979
25992
|
return typeof code === "string" ? code : "UNKNOWN";
|
|
@@ -26043,7 +26056,7 @@ async function listVaultNotes(vaultPath) {
|
|
|
26043
26056
|
return { notes, unreadableFolders, collisions };
|
|
26044
26057
|
}
|
|
26045
26058
|
function toRelative(vaultPath, path) {
|
|
26046
|
-
return relative7(vaultPath, path).split(
|
|
26059
|
+
return relative7(vaultPath, path).split(sep8).join("/").normalize("NFC");
|
|
26047
26060
|
}
|
|
26048
26061
|
function loadStagingState2(statePath) {
|
|
26049
26062
|
try {
|
|
@@ -26127,7 +26140,7 @@ function removeUnexpected(filesRoot, directory, wanted) {
|
|
|
26127
26140
|
return removed;
|
|
26128
26141
|
}
|
|
26129
26142
|
function toStagedRelative(filesRoot, path) {
|
|
26130
|
-
return relative7(filesRoot, path).split(
|
|
26143
|
+
return relative7(filesRoot, path).split(sep8).join("/").normalize("NFC");
|
|
26131
26144
|
}
|
|
26132
26145
|
var NOTE_EXTENSIONS, SKIPPED_DIRECTORIES, MAX_WALK_DEPTH = 64, VaultUnavailableError;
|
|
26133
26146
|
var init_staging = __esm(() => {
|
|
@@ -28048,7 +28061,7 @@ function resolveExcludePaths(value, origin) {
|
|
|
28048
28061
|
if (!Array.isArray(value) || value.some((path) => typeof path !== "string" || path.length === 0)) {
|
|
28049
28062
|
throw new ConfigError("Config field 'excludePaths' must be a non-empty string array");
|
|
28050
28063
|
}
|
|
28051
|
-
return
|
|
28064
|
+
return value.map((entry) => isGlobExclusion(entry) ? entry : resolvePersistedPath(entry, origin));
|
|
28052
28065
|
}
|
|
28053
28066
|
function resolvePersistedPath(path, origin) {
|
|
28054
28067
|
return isAbsolute11(path) ? path : resolve15(origin, path);
|
|
@@ -29353,6 +29366,7 @@ var init_config5 = __esm(() => {
|
|
|
29353
29366
|
init_factory();
|
|
29354
29367
|
init_embedding();
|
|
29355
29368
|
init_file_lock();
|
|
29369
|
+
init_path_exclusions();
|
|
29356
29370
|
init_language();
|
|
29357
29371
|
init_atomic_write();
|
|
29358
29372
|
init_rerank();
|
|
@@ -38606,7 +38620,7 @@ var init_web_search_tool = __esm(() => {
|
|
|
38606
38620
|
// src/agent/agent.ts
|
|
38607
38621
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
38608
38622
|
import { existsSync as existsSync34, watch as fsWatch, mkdirSync as mkdirSync24, realpathSync as realpathSync8, statSync as statSync11, writeFileSync as writeFileSync17 } from "node:fs";
|
|
38609
|
-
import { basename as basename15, dirname as dirname27, join as join55, relative as relative8, resolve as resolve18, sep as
|
|
38623
|
+
import { basename as basename15, dirname as dirname27, join as join55, relative as relative8, resolve as resolve18, sep as sep9 } from "node:path";
|
|
38610
38624
|
import { clampThinkingLevel } from "@earendil-works/pi-ai/compat";
|
|
38611
38625
|
import { getAgentDir as getAgentDir6, keyText } from "@earendil-works/pi-coding-agent";
|
|
38612
38626
|
function describeDecisionModel(status) {
|
|
@@ -41279,7 +41293,7 @@ ${this.discoveryHint((tools) => `When exploring local files and folders, activel
|
|
|
41279
41293
|
return { ok: false, reason: "cloud-root-skipped", stdout: "", stderr: "", code: null };
|
|
41280
41294
|
}
|
|
41281
41295
|
const canonicalSourcePath = canonicalPath(sourcePath);
|
|
41282
|
-
const exclude = scope.nestedCloudRoots.map((root) => relative8(canonicalSourcePath, root.path).split(
|
|
41296
|
+
const exclude = scope.nestedCloudRoots.map((root) => relative8(canonicalSourcePath, root.path).split(sep9).join("/")).filter((pattern) => pattern !== "" && !pattern.startsWith(".."));
|
|
41283
41297
|
return client.prepare(sourcePath, { ...options, ...exclude.length === 0 ? {} : { exclude } });
|
|
41284
41298
|
}));
|
|
41285
41299
|
}
|
|
@@ -41793,6 +41807,8 @@ function toMinSyncReasonDiagnostic(reason) {
|
|
|
41793
41807
|
};
|
|
41794
41808
|
}
|
|
41795
41809
|
function pinExcludedPath(path) {
|
|
41810
|
+
if (isGlobExclusion(path))
|
|
41811
|
+
return path;
|
|
41796
41812
|
const resolvedPath = resolve18(path);
|
|
41797
41813
|
try {
|
|
41798
41814
|
return join55(realpathSync8(dirname27(resolvedPath)), basename15(resolvedPath));
|
|
@@ -41841,6 +41857,7 @@ var init_agent = __esm(() => {
|
|
|
41841
41857
|
init_embedding();
|
|
41842
41858
|
init_everything();
|
|
41843
41859
|
init_cloud_placeholder();
|
|
41860
|
+
init_path_exclusions();
|
|
41844
41861
|
init_fsearch();
|
|
41845
41862
|
init_diagnostics();
|
|
41846
41863
|
init_jikji();
|
|
@@ -42001,6 +42018,12 @@ class AutoRAGLite {
|
|
|
42001
42018
|
getMemorySchema() {
|
|
42002
42019
|
return structuredClone(this.memory.getSchema());
|
|
42003
42020
|
}
|
|
42021
|
+
convertFiles(request, signal) {
|
|
42022
|
+
return this.agent.convertFiles(request, signal);
|
|
42023
|
+
}
|
|
42024
|
+
listFileConversions(from, signal) {
|
|
42025
|
+
return this.agent.listFileConversions(from, signal);
|
|
42026
|
+
}
|
|
42004
42027
|
}
|
|
42005
42028
|
function createAutoRAGLite(options = {}) {
|
|
42006
42029
|
const input = { flags: options.flags ?? {} };
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* An `excludePaths` entry with `*`, `?` or `[` is a glob over the whole absolute path (`**\/node_modules/**`,
|
|
3
|
+
* `**\/Downloads/**`, `**\/*.log`); any other entry is a file or directory path. A glob is never resolved against a
|
|
4
|
+
* directory: it would then stop matching anywhere else.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isGlobExclusion(entry: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Whether an absolute path matches a glob entry. Separators are compared as `/`, and a leading `**\/` also matches at
|
|
9
|
+
* the filesystem root, because `matchesGlob("/a.log", "**\/*.log")` differs between platforms in Node 24.
|
|
10
|
+
*/
|
|
11
|
+
export declare function matchesGlobExclusion(path: string, glob: string): boolean;
|
|
12
|
+
/** Match exact paths and directory subtrees without matching sibling prefixes, and glob entries (see {@link isGlobExclusion}). */
|
|
2
13
|
export declare function createPathExclusionMatcher(excludedPaths: readonly string[], platform?: NodeJS.Platform): (path: string) => boolean;
|