@autorag/librarian 2.6.2 → 2.6.3

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.
Files changed (46) hide show
  1. package/NOTICE +12 -0
  2. package/README.md +12 -3
  3. package/dist/agent/agent.d.ts +135 -6
  4. package/dist/agent/everything-search-tool.d.ts +35 -0
  5. package/dist/agent/fsearch-search-tool.d.ts +35 -0
  6. package/dist/agent/jikji-find-tool.d.ts +2 -0
  7. package/dist/agent/refresh-progress.d.ts +1 -1
  8. package/dist/agent/search-documents.d.ts +1 -1
  9. package/dist/cli/commands/refresh.d.ts +1 -1
  10. package/dist/cli/config.d.ts +51 -3
  11. package/dist/cli/index.js +2392 -527
  12. package/dist/core.js +2530 -693
  13. package/dist/datasource/connector-timeouts.d.ts +19 -0
  14. package/dist/datasource/crawler-types.d.ts +10 -0
  15. package/dist/datasource/skills/cloud-drive/rclone-connector.d.ts +2 -0
  16. package/dist/datasource/skills/lazykatok/client.d.ts +2 -0
  17. package/dist/datasource/skills/lazykatok/index.d.ts +1 -1
  18. package/dist/datasource/skills/lazykatok/types.d.ts +17 -1
  19. package/dist/datasource/skills/rss/connector.d.ts +2 -0
  20. package/dist/datasource/skills/spotlight/connector.d.ts +2 -0
  21. package/dist/dupey/filter.d.ts +7 -1
  22. package/dist/everything/bundle.d.ts +62 -0
  23. package/dist/everything/client.d.ts +123 -0
  24. package/dist/everything/index.d.ts +2 -0
  25. package/dist/fsearch/client.d.ts +173 -0
  26. package/dist/fsearch/index.d.ts +2 -0
  27. package/dist/fsearch/walk.d.ts +22 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +2555 -693
  30. package/dist/minsync/method.d.ts +6 -0
  31. package/dist/retrieval/engine.d.ts +14 -0
  32. package/dist/retrieval/index.d.ts +1 -0
  33. package/dist/retrieval/rerank.d.ts +114 -0
  34. package/dist/retrieval/types.d.ts +1 -1
  35. package/licenses/es-MIT.txt +21 -0
  36. package/licenses/everything-MIT-and-PCRE-BSD.txt +51 -0
  37. package/package.json +4 -2
  38. package/skills/autorag/SKILL.md +4 -3
  39. package/skills/autorag-doctor/SKILL.md +2 -0
  40. package/skills/autorag-lite-setup/SKILL.md +3 -2
  41. package/skills/autorag-setup/SKILL.md +53 -3
  42. package/vendor/everything/ES-1.1.0.38.ARM64.zip +0 -0
  43. package/vendor/everything/ES-1.1.0.38.x64.zip +0 -0
  44. package/vendor/everything/Everything-1.4.1.1032.ARM64.en-US.zip +0 -0
  45. package/vendor/everything/Everything-1.4.1.1032.x64.en-US.zip +0 -0
  46. package/vendor/everything/manifest.json +30 -0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Timeout policy shared by CLI-backed datasource connectors.
3
+ *
4
+ * `sync`/`index` are not interactive. A first run over a real archive routinely
5
+ * takes minutes — mailcrawl measured ~12 minutes for a Gmail INBOX, lazykatok
6
+ * ~11 minutes for a ~50k-message semantic index — so a 60-second interactive
7
+ * default truncates the step before it can finish. A timed-out step never
8
+ * commits its cursor, so every subsequent refresh restarts from scratch instead
9
+ * of making progress. Interactive reads (`search`, `doctor`, chunk lookups) keep
10
+ * the short default.
11
+ */
12
+ /** Non-interactive budget for a connector `sync`/`index` step (30 minutes). */
13
+ export declare const DEFAULT_CONNECTOR_SYNC_TIMEOUT_MS = 1800000;
14
+ /**
15
+ * Operator-facing hint appended to a sync/index diagnostic when the connector
16
+ * timeout killed the step. It names the override and explains why the next
17
+ * refresh restarts rather than resumes.
18
+ */
19
+ export declare function connectorSyncTimeoutHint(): string;
@@ -39,7 +39,17 @@ export interface CrawlerCliOptions {
39
39
  readonly sourcePath?: string;
40
40
  readonly configPath?: string;
41
41
  readonly syncSource?: string;
42
+ /**
43
+ * Spawn timeout for interactive search in milliseconds. Default 60_000.
44
+ * `sync` is non-interactive and uses {@link indexTimeoutMs} instead.
45
+ */
42
46
  readonly timeoutMs?: number;
47
+ /**
48
+ * Spawn timeout for `sync` in milliseconds. Default 1_800_000 (30 min): a first
49
+ * full import over a real archive can take many minutes, and a timed-out sync
50
+ * restarts from scratch on the next refresh.
51
+ */
52
+ readonly indexTimeoutMs?: number;
43
53
  readonly maxBufferBytes?: number;
44
54
  readonly env?: Readonly<Record<string, string | undefined>>;
45
55
  /** Working directory for the native CLI process, when explicitly needed. */
@@ -28,6 +28,8 @@ export interface RcloneConnectorOptions {
28
28
  readonly exportFormats?: string;
29
29
  readonly maxDocuments?: number;
30
30
  readonly maxBytesPerFile?: number;
31
+ /** Characters kept per document body. Default 100000. */
32
+ readonly maxContentChars?: number;
31
33
  readonly concurrency?: number;
32
34
  readonly bandwidthLimit?: string;
33
35
  readonly dryRun?: boolean;
@@ -16,6 +16,8 @@ export declare class LazykatokClient {
16
16
  chunkGet(chunkId: string, signal?: AbortSignal): Promise<LazykatokChunkResult>;
17
17
  context(chunkId: string, signal?: AbortSignal): Promise<LazykatokContextResult>;
18
18
  parent(chunkId: string, signal?: AbortSignal): Promise<LazykatokParentResult>;
19
+ /** `sync`/`index` are non-interactive and share the long budget; reads keep `timeoutMs`. */
20
+ private syncTimeoutMs;
19
21
  /** Single retrieval pipeline: build env, spawn, parse-free raw result. */
20
22
  private run;
21
23
  }
@@ -9,4 +9,4 @@ export { LazykatokClient } from "./client.js";
9
9
  export { LazykatokBm25Method, type LazykatokMethodOptions, type LazykatokSearchClient, LazykatokSemanticMethod, } from "./methods.js";
10
10
  export { LazykatokSkill, type LazykatokSkillClient, type LazykatokSkillOptions } from "./skill.js";
11
11
  export type { LazykatokChunkResult, LazykatokDoctorResult, LazykatokFailureReason, LazykatokHit, LazykatokIndexResult, LazykatokOptions, LazykatokSearchMode, LazykatokSearchOptions, LazykatokSearchResult, LazykatokSyncResult, } from "./types.js";
12
- export { DEFAULT_LAZYKATOK_OPTIONS } from "./types.js";
12
+ export { DEFAULT_LAZYKATOK_INDEX_TIMEOUT_MS, DEFAULT_LAZYKATOK_OPTIONS } from "./types.js";
@@ -15,8 +15,18 @@ export type LazykatokSearchMode = "semantic" | "keyword" | "hybrid";
15
15
  export interface LazykatokOptions {
16
16
  /** Explicit path to the `lazykatok` binary. Defaults to a bare `lazykatok` PATH lookup. */
17
17
  readonly binaryPath?: string;
18
- /** Spawn timeout in milliseconds. Default 60_000 (sync/index over large archives can be slow). */
18
+ /**
19
+ * Spawn timeout for interactive invocations (`doctor`, `search`, chunk lookups)
20
+ * in milliseconds. Default 60_000. `sync`/`index` are non-interactive and use
21
+ * {@link indexTimeoutMs} instead.
22
+ */
19
23
  readonly timeoutMs?: number;
24
+ /**
25
+ * Spawn timeout for `sync`/`index` in milliseconds. Default 1_800_000 (30 min):
26
+ * the first semantic index over a large archive was measured at ~11 minutes, and
27
+ * a timed-out build restarts from scratch on the next refresh.
28
+ */
29
+ readonly indexTimeoutMs?: number;
20
30
  /** Max stdout/stderr bytes retained. Default 16 MiB (an `index --json` report alone is multiple MB on a real archive). */
21
31
  readonly maxBufferBytes?: number;
22
32
  /** Explicit native lazykatok data directory, passed as `--data-dir`. */
@@ -36,6 +46,12 @@ export interface LazykatokOptions {
36
46
  }
37
47
  export declare const DEFAULT_LAZYKATOK_BINARY = "lazykatok";
38
48
  export declare const DEFAULT_LAZYKATOK_TIMEOUT_MS = 60000;
49
+ /**
50
+ * `sync`/`index` default budget. They are non-interactive, so they must not share
51
+ * the 60-second interactive default: a first semantic index over a large archive
52
+ * was measured at ~11 minutes.
53
+ */
54
+ export declare const DEFAULT_LAZYKATOK_INDEX_TIMEOUT_MS = 1800000;
39
55
  /** The live macOS adapter `sync` names by default on darwin. */
40
56
  export declare const DEFAULT_LAZYKATOK_SOURCE = "macos";
41
57
  export declare const DEFAULT_LAZYKATOK_MAX_BUFFER_BYTES: number;
@@ -19,6 +19,8 @@ export interface RssConnectorOptions {
19
19
  readonly fetchImpl?: typeof fetch;
20
20
  readonly maxDocuments?: number;
21
21
  readonly maxItemsPerFeed?: number;
22
+ /** Characters kept per item body. Default 20000. */
23
+ readonly maxContentChars?: number;
22
24
  }
23
25
  export declare class RssConnector implements DatasourceConnector {
24
26
  private readonly options;
@@ -38,6 +38,8 @@ export interface SpotlightConnectorOptions {
38
38
  readonly maxResultsPerQuery?: number;
39
39
  /** Total documents hydrated per fetch. Default 300. */
40
40
  readonly maxDocuments?: number;
41
+ /** Characters kept per document body. Default 100000. */
42
+ readonly maxContentChars?: number;
41
43
  /** Files larger than this are skipped. Default 256 KiB. */
42
44
  readonly maxBytesPerFile?: number;
43
45
  /** Per-process timeout in ms. Default 15s. */
@@ -4,5 +4,11 @@ export interface ExactDuplicateFilterResult {
4
4
  readonly keepers: ReadonlySet<string>;
5
5
  readonly errors: readonly string[];
6
6
  }
7
- /** Selects the newest filesystem copy for each exact canonical-text hash. */
7
+ /** Selects the newest copy for each exact canonical-text hash.
8
+ *
9
+ * Uses dupey's own latest-copy ranking — the most recent internal document
10
+ * modification time, falling back to filesystem mtime when a document records
11
+ * none — so AutoRAG and dupey never disagree about which copy is newest.
12
+ * Filesystem mtime is consulted only when dupey supplies no ranking.
13
+ */
8
14
  export declare function selectExactDuplicateExclusions(root: string, scan: DupeyScanResult, isUnavailable?: (path: string) => boolean): Promise<ExactDuplicateFilterResult>;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * voidtools Everything (MIT, closed source) and its MIT-licensed ES command
3
+ * line client ship inside the AutoRAG package as pinned portable ZIPs under
4
+ * `vendor/everything`. On Windows they are extracted, SHA-256 verified, into
5
+ * `<workspace>/.autorag/everything/<version>/<arch>/`. Nothing is downloaded
6
+ * and nothing is installed system-wide.
7
+ */
8
+ export type EverythingArch = "x64" | "arm64";
9
+ export interface EverythingArchAssets {
10
+ readonly everythingArchive: string;
11
+ readonly everythingArchiveSha256: string;
12
+ readonly everythingMember: string;
13
+ readonly everythingSha256: string;
14
+ readonly esArchive: string;
15
+ readonly esArchiveSha256: string;
16
+ readonly esMember: string;
17
+ readonly esSha256: string;
18
+ }
19
+ export interface EverythingBundleManifest {
20
+ readonly everythingVersion: string;
21
+ readonly esVersion: string;
22
+ readonly licenseFiles: readonly string[];
23
+ readonly architectures: Partial<Record<EverythingArch, EverythingArchAssets>>;
24
+ }
25
+ export interface EnsureEverythingBinariesOptions {
26
+ /** Workspace root; binaries are cached under `<root>/.autorag/everything`. */
27
+ readonly root: string;
28
+ readonly platform?: NodeJS.Platform;
29
+ readonly arch?: string;
30
+ /** Directory holding the bundled ZIPs. Defaults to the packaged `vendor/everything`. */
31
+ readonly bundleDir?: string;
32
+ /** Bundle manifest. Defaults to `<bundleDir>/manifest.json`. */
33
+ readonly manifest?: EverythingBundleManifest;
34
+ }
35
+ export type EnsureEverythingBinariesResult = {
36
+ readonly ok: true;
37
+ readonly everythingPath: string;
38
+ readonly esPath: string;
39
+ readonly source: "cached" | "installed";
40
+ } | {
41
+ readonly ok: false;
42
+ readonly reason: "unsupported-platform" | "bundle-missing" | "install-failed";
43
+ readonly message: string;
44
+ };
45
+ /**
46
+ * Locate the packaged `vendor/everything` directory by walking up from this
47
+ * module. The source tree (`src/everything/`) and the bundled outputs
48
+ * (`dist/index.js`, `dist/cli/index.js`) sit at different depths.
49
+ */
50
+ export declare function resolveEverythingBundleDir(): string | undefined;
51
+ export declare function everythingArch(arch: string): EverythingArch | undefined;
52
+ /** Deterministic cache location of the extracted binaries for one workspace. */
53
+ export declare function everythingBinaryPaths(root: string, version: string, arch: EverythingArch): {
54
+ readonly everythingPath: string;
55
+ readonly esPath: string;
56
+ };
57
+ export declare function loadEverythingBundleManifest(bundleDir: string): EverythingBundleManifest;
58
+ /**
59
+ * Extract and verify the bundled Everything + ES binaries for this Windows
60
+ * host. Never throws: every failure is reported with its underlying message.
61
+ */
62
+ export declare function ensureEverythingBinaries(options: EnsureEverythingBinariesOptions): Promise<EnsureEverythingBinariesResult>;
@@ -0,0 +1,123 @@
1
+ import { type EnsureEverythingBinariesResult } from "./bundle.js";
2
+ /**
3
+ * Drives a private, user-level Everything instance per AutoRAG workspace.
4
+ *
5
+ * Permission model: the instance indexes only the configured search folders
6
+ * (Everything "folder indexing"), which needs no administrator rights. It never
7
+ * requests elevation, never installs the Everything service, never indexes
8
+ * whole NTFS/ReFS volumes, and never enables the HTTP/ETP servers. Settings and
9
+ * the database live under `<workspace>/.autorag/everything/`, and the named
10
+ * instance keeps it isolated from any Everything the user already runs.
11
+ *
12
+ * Search goes through the bundled ES CLI over Everything's IPC window.
13
+ */
14
+ export interface EverythingEntry {
15
+ readonly path: string;
16
+ readonly type: "file" | "folder";
17
+ readonly size: number | undefined;
18
+ readonly dateModified: string | undefined;
19
+ }
20
+ export type EverythingSort = "name-ascending" | "name-descending" | "path-ascending" | "path-descending" | "size-ascending" | "size-descending" | "date-modified-ascending" | "date-modified-descending";
21
+ export interface EverythingSearchRequest {
22
+ /** Everything search syntax (wildcards, `ext:`, `dm:`, `size:`, `|`, `!`, quotes for phrases). */
23
+ readonly query: string;
24
+ readonly regex?: boolean;
25
+ readonly matchCase?: boolean;
26
+ readonly matchPath?: boolean;
27
+ readonly wholeWord?: boolean;
28
+ readonly kind?: "files" | "folders";
29
+ /** Restrict to items under this absolute folder. */
30
+ readonly path?: string;
31
+ readonly sort?: EverythingSort;
32
+ readonly offset?: number;
33
+ readonly maxResults?: number;
34
+ }
35
+ export type EverythingFailureReason = "unsupported-platform" | "bundle-missing" | "install-failed" | "startup-failed" | "index-failed" | "search-failed";
36
+ export interface EverythingFailure {
37
+ readonly ok: false;
38
+ readonly reason: EverythingFailureReason;
39
+ readonly message: string;
40
+ }
41
+ export type EverythingSearchResult = {
42
+ readonly ok: true;
43
+ readonly results: readonly EverythingEntry[];
44
+ } | EverythingFailure;
45
+ export type EverythingIndexResult = {
46
+ readonly ok: true;
47
+ readonly indexedFolders: readonly string[];
48
+ readonly indexedItems: number;
49
+ } | EverythingFailure;
50
+ export interface EverythingRunResult {
51
+ readonly code: number | null;
52
+ readonly stdout: string;
53
+ readonly stderr: string;
54
+ }
55
+ export type EverythingRunner = (command: string, args: readonly string[], timeoutMs: number) => Promise<EverythingRunResult>;
56
+ export type EverythingLauncher = (command: string, args: readonly string[]) => void;
57
+ export interface EverythingOptions {
58
+ /** Set false to disable Everything on Windows. */
59
+ readonly enabled?: boolean;
60
+ /** Per ES invocation timeout. Default 30s. */
61
+ readonly timeoutMs?: number;
62
+ /** How long to wait for a freshly launched instance to answer IPC. Default 20s. */
63
+ readonly startupTimeoutMs?: number;
64
+ /** How long indexing waits for the database to finish loading. Default 10 minutes. */
65
+ readonly indexTimeoutMs?: number;
66
+ }
67
+ export interface EverythingClientOptions extends EverythingOptions {
68
+ /** Workspace root; state lives under `<root>/.autorag/everything`. */
69
+ readonly root: string;
70
+ /** Folders Everything indexes (the configured search paths). */
71
+ readonly folders: readonly string[];
72
+ readonly platform?: NodeJS.Platform;
73
+ readonly resolveBinaries?: () => Promise<EnsureEverythingBinariesResult>;
74
+ readonly run?: EverythingRunner;
75
+ readonly launch?: EverythingLauncher;
76
+ readonly pollIntervalMs?: number;
77
+ }
78
+ /** Stable, workspace-scoped Everything instance name. */
79
+ export declare function everythingInstanceName(root: string): string;
80
+ /**
81
+ * Everything.ini that confines indexing to the given folders. List values are
82
+ * double-quoted with `\` escaped, per the Everything INI list syntax.
83
+ */
84
+ export declare function buildEverythingIni(input: {
85
+ readonly folders: readonly string[];
86
+ readonly excludeFolders: readonly string[];
87
+ }): string;
88
+ /**
89
+ * ES argv for one search. `-argv` makes ES split arguments exactly like
90
+ * CommandLineToArgvW, which is how Node quotes child-process arguments, so a
91
+ * query's own double quotes survive as Everything phrase quotes. The query is
92
+ * placed after `--` so a leading dash is never parsed as an ES switch.
93
+ */
94
+ export declare function buildEverythingSearchArgs(instance: string, request: EverythingSearchRequest, timeoutMs?: number): string[];
95
+ /** Parse `es -json -full-path-and-name -size -date-modified` output. */
96
+ export declare function parseEverythingJson(stdout: string): EverythingEntry[];
97
+ export declare class EverythingClient {
98
+ readonly instanceName: string;
99
+ private readonly options;
100
+ private readonly platform;
101
+ private readonly run;
102
+ private readonly launch;
103
+ private readonly stateDir;
104
+ private binaries;
105
+ private operation;
106
+ constructor(options: EverythingClientOptions);
107
+ isSupported(): boolean;
108
+ /** Start the instance when needed and search it. */
109
+ search(request: EverythingSearchRequest): Promise<EverythingSearchResult>;
110
+ /**
111
+ * (Re)write the folder configuration, restart the instance so Everything
112
+ * loads it, and wait until the database finished indexing.
113
+ */
114
+ index(): Promise<EverythingIndexResult>;
115
+ /** Exit this workspace's Everything instance if it is running. */
116
+ stop(): Promise<void>;
117
+ private serialize;
118
+ private resolveBinaries;
119
+ private ensureRunning;
120
+ /** Exit code 0 only when the instance answered with its version. */
121
+ private ping;
122
+ private failure;
123
+ }
@@ -0,0 +1,2 @@
1
+ export { type EnsureEverythingBinariesOptions, type EnsureEverythingBinariesResult, type EverythingArch, type EverythingArchAssets, type EverythingBundleManifest, ensureEverythingBinaries, everythingArch, everythingBinaryPaths, loadEverythingBundleManifest, resolveEverythingBundleDir, } from "./bundle.js";
2
+ export { buildEverythingIni, buildEverythingSearchArgs, EverythingClient, type EverythingClientOptions, type EverythingEntry, type EverythingFailure, type EverythingFailureReason, type EverythingIndexResult, type EverythingLauncher, type EverythingOptions, type EverythingRunner, type EverythingRunResult, type EverythingSearchRequest, type EverythingSearchResult, type EverythingSort, everythingInstanceName, parseEverythingJson, } from "./client.js";
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Drives the user's fsearch-cli (FSearch) as a separate process per AutoRAG
3
+ * workspace.
4
+ *
5
+ * License model: FSearch and fsearch-cli are GPL-2.0-or-later and are NOT
6
+ * bundled with AutoRAG. The user installs fsearch-cli separately
7
+ * (`brew install NomaDamas/tap/fsearch-cli`, or the Linux build from
8
+ * https://github.com/NomaDamas/fsearch-mac) and AutoRAG only spawns it,
9
+ * communicating over its CLI and daemon socket — mere aggregation per the
10
+ * FSF FAQ, never a combined work.
11
+ *
12
+ * Permission model: the database indexes only the configured search folders
13
+ * and lives under `<workspace>/.autorag/fsearch/`, isolated from any FSearch
14
+ * app database the user keeps. A `fsearch-cli watch` daemon per workspace
15
+ * keeps the index live from FSEvents (macOS) or inotify/fanotify (Linux) and
16
+ * serves searches over its socket; without the daemon, `fsearch-cli search`
17
+ * loads the database file directly. When fsearch-cli is not installed,
18
+ * searches degrade to a bounded slow filesystem walk over the same folders.
19
+ */
20
+ export interface FSearchEntry {
21
+ readonly path: string;
22
+ readonly name: string;
23
+ readonly type: "file" | "folder";
24
+ readonly size: number | undefined;
25
+ readonly dateModified: string | undefined;
26
+ }
27
+ export type FSearchSort = "name-ascending" | "name-descending" | "path-ascending" | "path-descending" | "size-ascending" | "size-descending" | "date-modified-ascending" | "date-modified-descending";
28
+ export interface FSearchSearchRequest {
29
+ /** FSearch query syntax (wildcards, AND/OR/NOT, `ext:`, `size:`, `path:`). */
30
+ readonly query: string;
31
+ readonly regex?: boolean;
32
+ readonly matchCase?: boolean;
33
+ readonly matchPath?: boolean;
34
+ readonly kind?: "files" | "folders";
35
+ /** Restrict to items under this absolute folder (client-side prefix filter). */
36
+ readonly path?: string;
37
+ readonly sort?: FSearchSort;
38
+ readonly offset?: number;
39
+ readonly maxResults?: number;
40
+ }
41
+ export type FSearchFailureReason = "unsupported-platform" | "binary-missing" | "index-failed" | "search-failed";
42
+ export interface FSearchFailure {
43
+ readonly ok: false;
44
+ readonly reason: FSearchFailureReason;
45
+ readonly message: string;
46
+ }
47
+ /** Which backend answered a search: the fsearch-cli index or the slow walk. */
48
+ export type FSearchBackend = "fsearch-cli" | "walk";
49
+ export type FSearchSearchResult = {
50
+ readonly ok: true;
51
+ readonly backend: FSearchBackend;
52
+ readonly results: readonly FSearchEntry[];
53
+ /** Total matches reported by fsearch-cli (may exceed results length). */
54
+ readonly total?: number;
55
+ readonly truncated?: boolean;
56
+ /** Degradation note, e.g. why the slow walk answered instead. */
57
+ readonly note?: string;
58
+ } | FSearchFailure;
59
+ export type FSearchIndexResult = {
60
+ readonly ok: true;
61
+ readonly indexedFolders: readonly string[];
62
+ readonly indexedItems: number;
63
+ /** Whether the live watch daemon serves the database after indexing. */
64
+ readonly watchLive?: boolean;
65
+ } | FSearchFailure;
66
+ export interface FSearchRunResult {
67
+ readonly code: number | null;
68
+ readonly stdout: string;
69
+ readonly stderr: string;
70
+ }
71
+ export type FSearchRunner = (command: string, args: readonly string[], timeoutMs: number) => Promise<FSearchRunResult>;
72
+ /** Launches a detached daemon; returns its pid when known. */
73
+ export type FSearchLauncher = (command: string, args: readonly string[]) => number | undefined;
74
+ export interface FSearchOptions {
75
+ /** Set false to disable FSearch on macOS/Linux. */
76
+ readonly enabled?: boolean;
77
+ /** fsearch-cli binary to spawn; defaults to PATH lookup. */
78
+ readonly binaryPath?: string;
79
+ /** Per fsearch-cli invocation timeout. Default 30s. */
80
+ readonly timeoutMs?: number;
81
+ /** How long indexing waits for the watch daemon to serve. Default 10s. */
82
+ readonly startupTimeoutMs?: number;
83
+ /** How long an index run may take. Default 10 minutes. */
84
+ readonly indexTimeoutMs?: number;
85
+ /** Keep a `fsearch-cli watch` daemon live after indexing. Default true. */
86
+ readonly watch?: boolean;
87
+ }
88
+ export interface FSearchClientOptions extends FSearchOptions {
89
+ /** Workspace root; state lives under `<root>/.autorag/fsearch`. */
90
+ readonly root: string;
91
+ /** Folders FSearch indexes (the configured search paths). */
92
+ readonly folders: readonly string[];
93
+ readonly platform?: NodeJS.Platform;
94
+ readonly run?: FSearchRunner;
95
+ readonly launch?: FSearchLauncher;
96
+ readonly isProcessAlive?: (pid: number) => boolean;
97
+ readonly killProcess?: (pid: number) => void;
98
+ readonly pollIntervalMs?: number;
99
+ /** Slow-walk bounds used when fsearch-cli is missing. */
100
+ readonly walkMaxVisited?: number;
101
+ readonly walkDeadlineMs?: number;
102
+ }
103
+ /**
104
+ * Short, stable daemon socket path for a database. fsearch-cli's default
105
+ * `<db>.sock` overflows the 104-byte unix sun_path limit for deep workspace
106
+ * paths — the daemon then binds a truncated name its own clients cannot
107
+ * derive, and daemon/client rendezvous silently breaks (observed on macOS
108
+ * with `/private/var/folders/...` workspaces). An explicit short path keyed
109
+ * by the database's realpath keeps the daemon, stats, and search rendezvous
110
+ * consistent regardless of which symlinked spelling a caller used.
111
+ */
112
+ export declare function fsearchSocketPath(dbPath: string): string;
113
+ /**
114
+ * fsearch-cli argv for one search. The query goes after `--` so a leading
115
+ * dash is never parsed as a switch. fsearch-cli has no offset flag, so the
116
+ * caller fetches offset+maxResults (or the cap when a path filter needs
117
+ * client-side prefix filtering) and pages locally.
118
+ */
119
+ export declare function buildFSearchSearchArgs(dbPath: string, socketPath: string, request: FSearchSearchRequest): string[];
120
+ /** fsearch-cli argv for one index build over the given folders. */
121
+ export declare function buildFSearchIndexArgs(dbPath: string, folders: readonly string[], excludeFolders: readonly string[]): string[];
122
+ /** Parse `fsearch-cli search --json` JSON-lines output, dropping the trailing done line. */
123
+ export declare function parseFSearchJsonLines(stdout: string): {
124
+ entries: FSearchEntry[];
125
+ total: number | undefined;
126
+ };
127
+ /** Parse `fsearch-cli stats` JSON output. */
128
+ export declare function parseFSearchStats(stdout: string): {
129
+ files: number;
130
+ folders: number;
131
+ live: boolean;
132
+ };
133
+ export declare class FSearchClient {
134
+ private readonly options;
135
+ private readonly platform;
136
+ private readonly run;
137
+ private readonly launch;
138
+ private readonly isAlive;
139
+ private readonly kill;
140
+ private readonly stateDir;
141
+ private readonly dbPath;
142
+ private readonly pidPath;
143
+ private binary;
144
+ private operation;
145
+ constructor(options: FSearchClientOptions);
146
+ isSupported(): boolean;
147
+ /** Search the workspace database, building it on first use; walks when fsearch-cli is missing. */
148
+ search(request: FSearchSearchRequest): Promise<FSearchSearchResult>;
149
+ /** (Re)build the database over the configured folders and keep the watch daemon live. */
150
+ index(): Promise<FSearchIndexResult>;
151
+ /** Terminate this workspace's watch daemon when it is running. No-op otherwise. */
152
+ stop(): Promise<void>;
153
+ private indexLocked;
154
+ /**
155
+ * Restart the live watch daemon against the freshly indexed database.
156
+ * Index-time always recycles the tracked daemon (Everything parity: a
157
+ * config-changed index must be the one served); a daemon that serves the
158
+ * socket without a pid file is adopted, not replaced, because it cannot be
159
+ * signaled. Searches work without any daemon (fsearch-cli loads the
160
+ * database file), so a daemon that never serves degrades answer latency,
161
+ * not correctness.
162
+ */
163
+ private ensureWatch;
164
+ /** True when a watch daemon answers searches for this database over its socket. */
165
+ private serving;
166
+ /** Computed per call: the database realpath only exists after indexing ran. */
167
+ private socketPath;
168
+ private readWatchPid;
169
+ private unsupportedFailure;
170
+ private resolveBinary;
171
+ private serialize;
172
+ private failure;
173
+ }
@@ -0,0 +1,2 @@
1
+ export { buildFSearchIndexArgs, buildFSearchSearchArgs, type FSearchBackend, FSearchClient, type FSearchClientOptions, type FSearchEntry, type FSearchFailure, type FSearchFailureReason, type FSearchIndexResult, type FSearchLauncher, type FSearchOptions, type FSearchRunner, type FSearchRunResult, type FSearchSearchRequest, type FSearchSearchResult, type FSearchSort, fsearchSocketPath, parseFSearchJsonLines, parseFSearchStats, } from "./client.js";
2
+ export { type FSearchWalkOptions, type FSearchWalkResult, walkFileSearch } from "./walk.js";
@@ -0,0 +1,22 @@
1
+ import type { FSearchEntry, FSearchSearchRequest } from "./client.js";
2
+ /**
3
+ * Graceful-degradation backend for hosts without fsearch-cli: a bounded,
4
+ * slow filesystem walk over the configured search folders. It supports a
5
+ * deliberate subset of the fsearch-cli surface — substring (or regex) name
6
+ * matching, kind/path filters, and in-memory sorting — and skips AutoRAG
7
+ * state directories (`.autorag`) the same way the index excludes them.
8
+ */
9
+ export interface FSearchWalkOptions {
10
+ /** Directory entries to visit before giving up. Default 500k. */
11
+ readonly maxVisited?: number;
12
+ /** Wall-clock budget. Default 20s. */
13
+ readonly deadlineMs?: number;
14
+ /** Matches to collect before giving up. Default 10k. */
15
+ readonly maxMatches?: number;
16
+ }
17
+ export interface FSearchWalkResult {
18
+ readonly entries: FSearchEntry[];
19
+ readonly visited: number;
20
+ readonly truncated: boolean;
21
+ }
22
+ export declare function walkFileSearch(folders: readonly string[], request: FSearchSearchRequest, options?: FSearchWalkOptions): Promise<FSearchWalkResult>;
package/dist/index.d.ts CHANGED
@@ -4,6 +4,8 @@ export { buildSystemPrompt, type SystemPromptConfig } from "./agent/system-promp
4
4
  export { AutoRAGLite, type AutoRAGLiteOptions, buildAgentOptions, type CliConfig, createAutoRAGLite, type ResolveConfigInput, resolveConfig, resolveConfigReadOnly, writeConfigObject, writeDefaultConfig, } from "./core.js";
5
5
  export * from "./datasource/index.js";
6
6
  export * from "./dupey/index.js";
7
+ export * from "./everything/index.js";
8
+ export * from "./fsearch/index.js";
7
9
  export * from "./jikji/index.js";
8
10
  export * from "./manifest/index.js";
9
11
  export * from "./memory/index.js";