@autorag/librarian 2.13.5 → 2.13.7

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.
@@ -1,12 +1,9 @@
1
1
  import { McpServer } from "@modelcontextprotocol/server";
2
2
  import type { AutoRAGLite } from "../core.js";
3
- import { type CloudFileProbe } from "../filesystem/cloud-placeholder.js";
4
3
  export interface AutoRAGMcpServerOptions {
5
4
  readonly readOnly?: boolean;
6
5
  readonly tools?: readonly string[];
7
6
  /** Test/embedded override; defaults to the current Node platform. */
8
7
  readonly platform?: NodeJS.Platform;
9
- /** Test/embedded override for the cloud probe `autorag.duplicates` uses; defaults to this platform's probe. */
10
- readonly cloudProbe?: CloudFileProbe;
11
8
  }
12
9
  export declare function createAutoRAGMcpServer(lite: AutoRAGLite, options?: AutoRAGMcpServerOptions): McpServer;
@@ -1,4 +1,4 @@
1
- export declare const MINSYNC_VERSION = "0.6.0";
1
+ export declare const MINSYNC_VERSION = "0.7.3";
2
2
  export declare const MINSYNC_CARGO_INSTALL_TIMEOUT_MS: number;
3
3
  export interface MinSyncReleaseAsset {
4
4
  readonly name: string;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Oldest `minsync` AutoRAG will run. 0.6.0 replaced the BM25 full-text index with SPLADE sparse retrieval: AutoRAG
3
- * queries `--mode sparse` and no longer passes `init --language`, which older builds reject.
3
+ * queries `--mode sparse` and no longer passes `init --language`, which older builds reject. 0.7.1 answers queries
4
+ * from every committed batch, also while the first sync is still running or was interrupted.
4
5
  */
5
- export declare const MINSYNC_MIN_VERSION = "0.6.0";
6
+ export declare const MINSYNC_MIN_VERSION = "0.7.1";
6
7
  /** A `minsync` that was found but is older than {@link MINSYNC_MIN_VERSION}, so it is never run. */
7
8
  export interface OutdatedMinSyncBinary {
8
9
  readonly path: string;
@@ -8,17 +8,18 @@ export declare const CLOUD_FINGERPRINTS_FILE = "cloud-fingerprints.json";
8
8
  export interface CloudFingerprint {
9
9
  /** The mirror's own source identity at fingerprint time (`size:mtimeNs`), so an unchanged file is not re-read. */
10
10
  readonly sourceVersion: string;
11
- /** Canonical-text hash; equals `content_hash` from `dupey scan --json`. */
11
+ /** Exact hash; equals `content_hash` from `dupey scan --json` (dupey's file-byte hash when it extracts no text). */
12
12
  readonly exact: string;
13
- /** Characters dupey extracted; `0` means no text, so {@link exact} identifies nothing. */
14
- readonly chars: number;
15
13
  /** The document's own last-modified time, or `null` when dupey records none. */
16
14
  readonly modified: string | null;
17
15
  readonly revision: string | null;
18
16
  }
19
- /** AutoRAG-owned store of cloud fingerprints, keyed by absolute source path. Not part of the MinSync stage schema. */
17
+ /**
18
+ * AutoRAG-owned store of cloud fingerprints, keyed by absolute source path. Not part of the MinSync stage schema.
19
+ * Version 2 holds hashes from dupey 0.2.0 or later (the floor AutoRAG enforces); version 1 was written by 0.1.2.
20
+ */
20
21
  export interface CloudFingerprintStore {
21
- readonly version: 1;
22
+ readonly version: 2;
22
23
  readonly entries: Readonly<Record<string, CloudFingerprint>>;
23
24
  }
24
25
  export declare function cloudFingerprintStorePath(root: string): string;
@@ -1,7 +1,7 @@
1
1
  import { type CloudFileProbe, type CloudProvider } from "../filesystem/cloud-placeholder.js";
2
- /** Placeholders one refresh may download before the rest wait for the next refresh. */
2
+ /** Placeholders one batch may download; a placeholder over the budget starts the next batch. */
3
3
  export declare const DEFAULT_CLOUD_MAX_FILES = 200;
4
- /** Placeholder bytes one refresh may download. The first file is always allowed so a large one cannot starve. */
4
+ /** Placeholder bytes one batch may download. A batch's first file is always allowed, so a large one cannot starve. */
5
5
  export declare const DEFAULT_CLOUD_MAX_BYTES: number;
6
6
  /**
7
7
  * Retries after the first failed release. A just-hydrated file is often briefly held by the provider, so the
@@ -31,9 +31,10 @@ export type CloudReleaseResult = {
31
31
  /**
32
32
  * What a refresh does with one file that needs parsing:
33
33
  * - `local`: not a placeholder; read it as always.
34
- * - `download`: a placeholder the probe can release, inside the budget; read it, then release it again.
34
+ * - `download`: a placeholder the probe can release, inside the batch's budget; read it, then release it again.
35
35
  * - `skip`: a placeholder whose provider the probe cannot release; do not read it.
36
- * - `defer`: a releasable placeholder over this refresh's budget; leave it for the next refresh.
36
+ * - `next-batch`: a releasable placeholder over this batch's budget; end the batch before it and read it first
37
+ * in the next one, whose budget starts fresh.
37
38
  */
38
39
  export type CloudDecision = {
39
40
  readonly kind: "local";
@@ -43,7 +44,7 @@ export type CloudDecision = {
43
44
  readonly kind: "skip";
44
45
  readonly provider: CloudProvider | undefined;
45
46
  } | {
46
- readonly kind: "defer";
47
+ readonly kind: "next-batch";
47
48
  };
48
49
  /**
49
50
  * One refresh's view of cloud placeholders. Reading a placeholder downloads it, so the refresh asks here
@@ -66,7 +67,9 @@ export declare class CloudGate {
66
67
  /** Look up, in one batch, which of the files about to be read are placeholders. */
67
68
  classify(paths: readonly string[]): Promise<void>;
68
69
  isPlaceholder(path: string): boolean;
69
- /** Decide, and when the answer is `download`, spend this refresh's budget on `sizeBytes`. */
70
+ /** Give the next batch a fresh download budget. */
71
+ startBatch(): void;
72
+ /** Decide, and when the answer is `download`, spend this batch's budget on `sizeBytes`. */
70
73
  decide(path: string, sizeBytes: number, directory: string): Promise<CloudDecision>;
71
74
  /**
72
75
  * Release the local copy of a file this refresh downloaded. A failed attempt is retried with doubling waits;
@@ -10,6 +10,12 @@ export declare const DEFAULT_MAX_DELETE_RATIO = 0.3;
10
10
  export declare const DEFAULT_MAX_SCANNED_ENTRIES = 2000000;
11
11
  /** Deepest directory level (search root = 0) the walk descends into. */
12
12
  export declare const DEFAULT_MAX_WALK_DEPTH = 64;
13
+ /**
14
+ * Sources parsed and committed per batch before {@link ParsedMirrorSyncOptions.onBatch}
15
+ * runs. Small enough that the first batch starts the index sync soon after parsing
16
+ * begins; later syncs fold every batch committed meanwhile into one run.
17
+ */
18
+ export declare const DEFAULT_MIRROR_BATCH_SIZE = 25;
13
19
  export interface ParsedMirrorSyncOptions {
14
20
  readonly root: string;
15
21
  readonly searchPaths: readonly string[];
@@ -36,6 +42,23 @@ export interface ParsedMirrorSyncOptions {
36
42
  readonly signal?: AbortSignal;
37
43
  /** Called before each file and once more with `processed === total` when the parse phase ends. */
38
44
  readonly onProgress?: (progress: ParsedMirrorProgress) => void;
45
+ /**
46
+ * Most sources parsed and committed per batch before {@link ParsedMirrorSyncOptions.onBatch}
47
+ * runs; a batch ends sooner when a cloud placeholder would exceed its download budget.
48
+ * Default {@link DEFAULT_MIRROR_BATCH_SIZE}.
49
+ */
50
+ readonly batchSize?: number;
51
+ /**
52
+ * Runs after each batch of sources is parsed and committed to the mirror, so
53
+ * a caller can make the batch's results searchable (sync the index). The next
54
+ * batch is read once the returned promise settles: a caller that wants parsing
55
+ * to carry on returns at once and indexes in the background, and waits only on
56
+ * the final batch. A thrown error aborts the
57
+ * refresh; returning `stop` ends the loop after this batch. Deletions of
58
+ * genuinely-removed sources wait for the final batch, so a mid-refresh call
59
+ * never drops a not-yet-reached document from the index.
60
+ */
61
+ readonly onBatch?: (batch: ParsedMirrorBatch) => Promise<ParsedMirrorBatchOutcome | undefined>;
39
62
  /**
40
63
  * Largest share of previously indexed documents one refresh may delete because their source
41
64
  * disappeared. A larger deletion (above 100 documents) is suppressed with `mass-delete-suppressed`
@@ -60,9 +83,15 @@ export interface ParsedMirrorSyncOptions {
60
83
  * platforms read every file as before. Tests inject their own probe.
61
84
  */
62
85
  readonly cloudProbe?: CloudFileProbe;
63
- /** Most placeholders one refresh may download. Default {@link DEFAULT_CLOUD_MAX_FILES}. */
86
+ /**
87
+ * Most placeholders one batch may download; the next placeholder starts a new batch, so every placeholder is
88
+ * still read in the same refresh. Default {@link DEFAULT_CLOUD_MAX_FILES}.
89
+ */
64
90
  readonly cloudMaxFiles?: number;
65
- /** Most placeholder bytes one refresh may download; the first file is always allowed. Default {@link DEFAULT_CLOUD_MAX_BYTES}. */
91
+ /**
92
+ * Most placeholder bytes one batch may download; a batch's first placeholder is always allowed, and the next
93
+ * one over the budget starts a new batch. Default {@link DEFAULT_CLOUD_MAX_BYTES}.
94
+ */
66
95
  readonly cloudMaxBytes?: number;
67
96
  /** Release a downloaded cloud file again once it is parsed and indexed. Default true. */
68
97
  readonly cloudEvictAfterParse?: boolean;
@@ -95,7 +124,7 @@ export interface ParsedMirrorProgress {
95
124
  /** The file about to be processed; absent on the final event. */
96
125
  readonly currentVirtualPath?: string;
97
126
  }
98
- export type ParsedMirrorDiagnosticCode = "unsupported-file" | "parser-skipped" | "parser-failed" | "parser-crashed" | "source-changed" | "source-vanished" | "source-unreadable" | "source-read-failed" | "mirror-write-failed" | "duplicate-excluded" | "deleted-mirror" | "stale-index" | "pdf-extract-thin" | "parser-warning" | "search-root-unavailable" | "mass-delete-suppressed" | "walk-truncated" | "directory-unreadable" | "cloud-download-deferred" | "cloud-placeholder-skipped" | "cloud-evict-failed" | "cloud-fingerprint-failed";
127
+ export type ParsedMirrorDiagnosticCode = "unsupported-file" | "parser-skipped" | "parser-failed" | "parser-crashed" | "source-changed" | "source-vanished" | "source-unreadable" | "source-read-failed" | "mirror-write-failed" | "duplicate-excluded" | "deleted-mirror" | "stale-index" | "pdf-extract-thin" | "parser-warning" | "search-root-unavailable" | "mass-delete-suppressed" | "walk-truncated" | "directory-unreadable" | "cloud-placeholder-skipped" | "cloud-evict-failed" | "cloud-fingerprint-failed";
99
128
  /**
100
129
  * Refresh diagnostic. `source` is an opaque virtual path, never a real filesystem path.
101
130
  * `message` keeps the underlying error text, which may include a filesystem path.
@@ -115,6 +144,27 @@ export interface ParsedMirrorSyncResult {
115
144
  readonly indexPath: string;
116
145
  readonly diagnostics: readonly ParsedMirrorDiagnostic[];
117
146
  }
147
+ /**
148
+ * One batch of the source listing, parsed and committed to the mirror before
149
+ * {@link ParsedMirrorSyncOptions.onBatch} runs. The last batch is the only one
150
+ * whose run reflects deletions of genuinely-removed sources.
151
+ */
152
+ export interface ParsedMirrorBatch {
153
+ /** 1-based index of this batch among the batches handed to `onBatch`. */
154
+ readonly index: number;
155
+ /** Virtual paths the refresh attempted in this batch. */
156
+ readonly virtualPaths: readonly string[];
157
+ /** The last batch: genuine deletions have by now been applied to the mirror. */
158
+ readonly final: boolean;
159
+ }
160
+ /**
161
+ * What {@link ParsedMirrorSyncOptions.onBatch} asks the refresh to do next.
162
+ * A thrown error aborts the refresh; `stop` ends the loop after this batch, so a
163
+ * systemic index failure never reads sources it knows it cannot index.
164
+ */
165
+ export interface ParsedMirrorBatchOutcome {
166
+ readonly stop?: boolean;
167
+ }
118
168
  /** Default retries for a transient per-file I/O error. Mirrors the `refresh.transientRetries` config default. */
119
169
  export declare const DEFAULT_TRANSIENT_RETRIES = 3;
120
170
  /**