@autorag/librarian 2.13.6 → 2.13.8

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 (52) hide show
  1. package/README.md +15 -0
  2. package/dist/agent/agent.d.ts +35 -5
  3. package/dist/agent/calculator-tool.d.ts +39 -0
  4. package/dist/agent/dupey-tool.d.ts +0 -2
  5. package/dist/agent/evidence-ledger.d.ts +11 -0
  6. package/dist/agent/index-schedule.d.ts +45 -0
  7. package/dist/agent/index.d.ts +1 -0
  8. package/dist/agent/pipelined-sync.d.ts +34 -0
  9. package/dist/agent/result-render.d.ts +43 -0
  10. package/dist/agent/search-all-tool.d.ts +2 -1
  11. package/dist/agent/search-documents.d.ts +1 -1
  12. package/dist/agent/search-minsync-tool.d.ts +2 -1
  13. package/dist/agent/search-single-datasource-tool.d.ts +2 -1
  14. package/dist/agent/watch-refresh.d.ts +2 -0
  15. package/dist/calculator/civil.d.ts +27 -0
  16. package/dist/calculator/decimal.d.ts +47 -0
  17. package/dist/calculator/errors.d.ts +4 -0
  18. package/dist/calculator/expression.d.ts +11 -0
  19. package/dist/calculator/index.d.ts +17 -0
  20. package/dist/calculator/operations.d.ts +36 -0
  21. package/dist/calculator/temporal.d.ts +18 -0
  22. package/dist/calculator/timezone.d.ts +19 -0
  23. package/dist/cli/commands/duplicates.d.ts +2 -3
  24. package/dist/cli/commands/index.d.ts +1 -1
  25. package/dist/cli/commands/lite-refresh.d.ts +1 -1
  26. package/dist/cli/commands/refresh.d.ts +4 -0
  27. package/dist/cli/commands/watch.d.ts +2 -1
  28. package/dist/cli/index.js +3617 -1480
  29. package/dist/cli/signal-abort.d.ts +21 -0
  30. package/dist/core.d.ts +2 -0
  31. package/dist/core.js +4144 -2097
  32. package/dist/datasource/skills/factory.d.ts +4 -1
  33. package/dist/dupey/filter.d.ts +0 -2
  34. package/dist/dupey/index.d.ts +0 -1
  35. package/dist/dupey/version.d.ts +17 -0
  36. package/dist/index.js +4183 -2144
  37. package/dist/mcp/index.js +4182 -2142
  38. package/dist/mcp/server.d.ts +0 -3
  39. package/dist/minsync/installer.d.ts +1 -1
  40. package/dist/minsync/method.d.ts +7 -0
  41. package/dist/minsync/version.d.ts +3 -2
  42. package/dist/mirror/cloud-fingerprints.d.ts +6 -5
  43. package/dist/mirror/cloud.d.ts +9 -6
  44. package/dist/mirror/sync.d.ts +28 -15
  45. package/dist/profiles.js +3463 -1421
  46. package/dist/retrieval/engine.d.ts +7 -0
  47. package/dist/retrieval/merger.d.ts +6 -0
  48. package/dist/retrieval/record-cut.d.ts +101 -0
  49. package/package.json +1 -1
  50. package/skills/autorag/SKILL.md +28 -0
  51. package/skills/autorag-setup/SKILL.md +39 -0
  52. package/dist/dupey/scan-plan.d.ts +0 -23
@@ -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,3 +1,4 @@
1
+ import { type RecordCut } from "../retrieval/record-cut.js";
1
2
  import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
2
3
  import type { MinSyncQueryMode } from "./client.js";
3
4
  import type { EnsureMinSyncBinaryOptions } from "./installer.js";
@@ -16,6 +17,11 @@ export interface MinSyncVectorMethodOptions {
16
17
  readonly defaultTopK?: number;
17
18
  /** Fetch cap applied when a scope narrows the query. Default 100. */
18
19
  readonly scopedTopK?: number;
20
+ /**
21
+ * Fuse deeper and cut the hits by document, so one long document cannot take every one of `topK` slots
22
+ * (see {@link RecordCut}). Unset asks MinSync for `topK` and cuts by chunk.
23
+ */
24
+ readonly recordCut?: RecordCut;
19
25
  }
20
26
  export type MinSyncHybridMethodOptions = Omit<MinSyncVectorMethodOptions, "mode">;
21
27
  export declare class MinSyncVectorMethod implements RetrievalMethod {
@@ -29,6 +35,7 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
29
35
  private readonly mode;
30
36
  private readonly defaultTopK;
31
37
  private readonly scopedTopK;
38
+ private readonly recordCut;
32
39
  constructor(options: MinSyncVectorMethodOptions);
33
40
  describe(): RetrievalMethodDescriptor;
34
41
  sync(force?: boolean, signal?: AbortSignal, onProgress?: (progress: MinSyncSyncProgress) => void): Promise<MinSyncSyncResult>;
@@ -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;
@@ -12,8 +12,8 @@ export declare const DEFAULT_MAX_SCANNED_ENTRIES = 2000000;
12
12
  export declare const DEFAULT_MAX_WALK_DEPTH = 64;
13
13
  /**
14
14
  * Sources parsed and committed per batch before {@link ParsedMirrorSyncOptions.onBatch}
15
- * runs. Small enough that a corpus becomes searchable after its first slice,
16
- * large enough to amortize one index sync's startup.
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
17
  */
18
18
  export declare const DEFAULT_MIRROR_BATCH_SIZE = 25;
19
19
  export interface ParsedMirrorSyncOptions {
@@ -28,6 +28,15 @@ export interface ParsedMirrorSyncOptions {
28
28
  readonly maxSourceBytes?: number;
29
29
  /** Absolute source paths omitted from parsed mirrors (for example exact duplicate copies). */
30
30
  readonly excludeSourcePaths?: ReadonlySet<string>;
31
+ /**
32
+ * Read-only freshness checks only: omit the sources the last refresh already recorded as
33
+ * `duplicate-excluded` instead of requiring a fresh duplicate scan. Duplicate selection needs
34
+ * a content scan of every root, which is the dominant cost of a status or retrieve call.
35
+ * A recorded copy is only omitted while its mtime and size still match the record, so an
36
+ * edited copy is still reported stale. Copies that became duplicates after the last refresh
37
+ * are not known here; see `AutoRAGAgent.scanMirrorStaleness`.
38
+ */
39
+ readonly reuseRecordedDuplicateExclusions?: boolean;
31
40
  /** Absolute source paths or directories omitted by the user. */
32
41
  readonly userExcludedSourcePaths?: ReadonlySet<string>;
33
42
  /**
@@ -43,14 +52,17 @@ export interface ParsedMirrorSyncOptions {
43
52
  /** Called before each file and once more with `processed === total` when the parse phase ends. */
44
53
  readonly onProgress?: (progress: ParsedMirrorProgress) => void;
45
54
  /**
46
- * Sources parsed and committed per batch before {@link ParsedMirrorSyncOptions.onBatch}
47
- * runs. Default {@link DEFAULT_MIRROR_BATCH_SIZE}.
55
+ * Most sources parsed and committed per batch before {@link ParsedMirrorSyncOptions.onBatch}
56
+ * runs; a batch ends sooner when a cloud placeholder would exceed its download budget.
57
+ * Default {@link DEFAULT_MIRROR_BATCH_SIZE}.
48
58
  */
49
59
  readonly batchSize?: number;
50
60
  /**
51
- * Runs after each batch of sources is parsed and committed to the mirror, and
52
- * before the next batch is read, so a caller can make the batch's results
53
- * searchable (stage them and sync the index). A thrown error aborts the
61
+ * Runs after each batch of sources is parsed and committed to the mirror, so
62
+ * a caller can make the batch's results searchable (sync the index). The next
63
+ * batch is read once the returned promise settles: a caller that wants parsing
64
+ * to carry on returns at once and indexes in the background, and waits only on
65
+ * the final batch. A thrown error aborts the
54
66
  * refresh; returning `stop` ends the loop after this batch. Deletions of
55
67
  * genuinely-removed sources wait for the final batch, so a mid-refresh call
56
68
  * never drops a not-yet-reached document from the index.
@@ -80,9 +92,15 @@ export interface ParsedMirrorSyncOptions {
80
92
  * platforms read every file as before. Tests inject their own probe.
81
93
  */
82
94
  readonly cloudProbe?: CloudFileProbe;
83
- /** Most placeholders one refresh may download. Default {@link DEFAULT_CLOUD_MAX_FILES}. */
95
+ /**
96
+ * Most placeholders one batch may download; the next placeholder starts a new batch, so every placeholder is
97
+ * still read in the same refresh. Default {@link DEFAULT_CLOUD_MAX_FILES}.
98
+ */
84
99
  readonly cloudMaxFiles?: number;
85
- /** Most placeholder bytes one refresh may download; the first file is always allowed. Default {@link DEFAULT_CLOUD_MAX_BYTES}. */
100
+ /**
101
+ * Most placeholder bytes one batch may download; a batch's first placeholder is always allowed, and the next
102
+ * one over the budget starts a new batch. Default {@link DEFAULT_CLOUD_MAX_BYTES}.
103
+ */
86
104
  readonly cloudMaxBytes?: number;
87
105
  /** Release a downloaded cloud file again once it is parsed and indexed. Default true. */
88
106
  readonly cloudEvictAfterParse?: boolean;
@@ -115,7 +133,7 @@ export interface ParsedMirrorProgress {
115
133
  /** The file about to be processed; absent on the final event. */
116
134
  readonly currentVirtualPath?: string;
117
135
  }
118
- 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";
136
+ 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";
119
137
  /**
120
138
  * Refresh diagnostic. `source` is an opaque virtual path, never a real filesystem path.
121
139
  * `message` keeps the underlying error text, which may include a filesystem path.
@@ -143,11 +161,6 @@ export interface ParsedMirrorSyncResult {
143
161
  export interface ParsedMirrorBatch {
144
162
  /** 1-based index of this batch among the batches handed to `onBatch`. */
145
163
  readonly index: number;
146
- /**
147
- * Batches the listing was divided into. A batch that wrote and deleted no
148
- * mirror output is not handed to `onBatch`; the final batch always is.
149
- */
150
- readonly total: number;
151
164
  /** Virtual paths the refresh attempted in this batch. */
152
165
  readonly virtualPaths: readonly string[];
153
166
  /** The last batch: genuine deletions have by now been applied to the mirror. */