@autorag/librarian 2.5.0 → 2.5.1

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.
@@ -14,7 +14,7 @@ export interface MinSyncClientOptions {
14
14
  readonly maxChunkSize?: number;
15
15
  readonly runtime?: MinSyncRuntime;
16
16
  }
17
- /** MinSync v0.4.2 supports vector, BM25, and hybrid query modes. */
17
+ /** MinSync v0.4.5 supports native vector, BM25, and hybrid query modes. */
18
18
  export type MinSyncQueryMode = "vector" | "bm25" | "hybrid";
19
19
  export declare class MinSyncQueryError extends Error {
20
20
  readonly code: number | null;
@@ -9,6 +9,9 @@ export interface MinSyncEmbeddingIdentity {
9
9
  readonly runtimeBuild: string;
10
10
  }
11
11
  export declare const EMBEDDING_IDENTITY_FILE = "autorag-embedding-identity.json";
12
+ export declare const DEFAULT_MINSYNC_EMBEDDER_ID = "native:Qwen/Qwen3-Embedding-0.6B";
13
+ export declare const DEFAULT_MINSYNC_EMBEDDER_DIMENSION = 1024;
14
+ export declare const DEFAULT_MINSYNC_EMBEDDER_CONFIG: MinSyncEmbedderConfig;
12
15
  /**
13
16
  * MinSync config.toml lives at `<workspace>/.minsync/config.toml`.
14
17
  * After `minsync init` runs, we rewrite allowlisted embedder fields so
@@ -1,5 +1,5 @@
1
1
  export { MINSYNC_OLLAMA_MIGRATION_MESSAGE, MinSyncClient, type MinSyncClientOptions, MinSyncQueryError, type MinSyncQueryMode, } from "./client.js";
2
- export { configuredVectorDimension, MINSYNC_CONFIG_DIR, MINSYNC_CONFIG_FILE, type MinSyncEmbeddingIdentity, minSyncConfigPath, minSyncEmbeddingIdentityPath, rewriteEmbedderConfig, } from "./embedder-config.js";
2
+ export { configuredVectorDimension, DEFAULT_MINSYNC_EMBEDDER_CONFIG, DEFAULT_MINSYNC_EMBEDDER_DIMENSION, DEFAULT_MINSYNC_EMBEDDER_ID, MINSYNC_CONFIG_DIR, MINSYNC_CONFIG_FILE, type MinSyncEmbeddingIdentity, minSyncConfigPath, minSyncEmbeddingIdentityPath, rewriteEmbedderConfig, } from "./embedder-config.js";
3
3
  export { type EnsureMinSyncBinaryOptions, ensureMinSyncBinary, executableName, fetchLatestMinSyncRelease, type InstalledMinSyncBinary, MINSYNC_VERSION, type MinSyncRelease, type MinSyncReleaseAsset, MinSyncReleaseError, selectReleaseAsset, } from "./installer.js";
4
4
  export { ensureLocalEmbedder, LocalEmbedderError, type LocalEmbedderPreflightOptions, } from "./local-embedder.js";
5
5
  export { MinSyncHybridMethod, type MinSyncHybridMethodOptions, MinSyncVectorMethod, type MinSyncVectorMethodOptions, } from "./method.js";
@@ -1,4 +1,4 @@
1
- export declare const MINSYNC_VERSION = "0.4.2";
1
+ export declare const MINSYNC_VERSION = "0.4.5";
2
2
  export declare const MINSYNC_CARGO_INSTALL_TIMEOUT_MS: number;
3
3
  export interface MinSyncReleaseAsset {
4
4
  readonly name: string;
@@ -30,6 +30,7 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
30
30
  constructor(options: MinSyncVectorMethodOptions);
31
31
  describe(): RetrievalMethodDescriptor;
32
32
  sync(force?: boolean): Promise<MinSyncSyncResult>;
33
+ private syncUnlocked;
33
34
  /** Report unavailable binaries without treating auto-install as already failed. */
34
35
  isBinaryMissing(): boolean;
35
36
  /** Status distinguishes an explicit missing override from deferred resolution. */
@@ -37,6 +38,7 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
37
38
  /** A vector index is ready only after MinSync has written its cursor. */
38
39
  isReady(): boolean;
39
40
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
41
+ private retrieveUnlocked;
40
42
  /**
41
43
  * Resolve the MinSync CLI from the user's global PATH first, then the
42
44
  * workspace cache, and finally the verified auto-install fallback.
@@ -33,8 +33,14 @@ export interface MinSyncSyncResult {
33
33
  readonly workspacePath: string;
34
34
  readonly reason?: string;
35
35
  readonly diagnostic?: MinSyncDiagnostic;
36
+ /**
37
+ * Parsed-mirror ids that could not be staged for indexing because the file
38
+ * name has no canonical source-id form. Surfaced as diagnostics so an
39
+ * unindexable document is never dropped silently.
40
+ */
41
+ readonly stagingExcluded?: readonly string[];
36
42
  }
37
- export type MinSyncDiagnosticCode = "embedder-unavailable" | "no-hit" | "embedding-identity-mismatch" | "migration-required";
43
+ export type MinSyncDiagnosticCode = "embedder-unavailable" | "sync-failed" | "no-hit" | "embedding-identity-mismatch" | "migration-required";
38
44
  export interface MinSyncDiagnostic {
39
45
  readonly code: MinSyncDiagnosticCode;
40
46
  readonly message: string;
@@ -7,6 +7,12 @@ export interface MinSyncWorkspaceEntry {
7
7
  export interface MinSyncWorkspaceSyncResult {
8
8
  readonly workspacePath: string;
9
9
  readonly entries: readonly MinSyncWorkspaceEntry[];
10
+ /**
11
+ * Parsed-mirror ids that could not be staged: no canonical source-id form
12
+ * or a missing parsed output. Callers report these instead of dropping
13
+ * them silently.
14
+ */
15
+ readonly excluded: readonly string[];
10
16
  }
11
17
  export declare function syncMinSyncWorkspace(root: string, options?: {
12
18
  readonly workspacePath?: string;
@@ -7,9 +7,26 @@ export interface ParsedMirrorEntry {
7
7
  readonly sourceSizeBytes: number;
8
8
  readonly updatedAt: string;
9
9
  }
10
+ /** Why refresh deliberately left a source out of the parsed mirror. */
11
+ export type ParsedMirrorSkipReason = "duplicate-excluded" | "parser-skipped" | "parser-failed";
12
+ /**
13
+ * A source the last refresh decided not to mirror, pinned to the exact version it
14
+ * decided on. Staleness checks compare against this record instead of re-deriving
15
+ * the decision, so a deliberately skipped file is not reported as a new source.
16
+ */
17
+ export interface ParsedMirrorSkipEntry {
18
+ readonly virtualPath: string;
19
+ readonly sourcePath: string;
20
+ readonly reason: ParsedMirrorSkipReason;
21
+ readonly sourceMtimeNs: number;
22
+ readonly sourceSizeBytes: number;
23
+ readonly updatedAt: string;
24
+ }
10
25
  export interface ParsedMirrorIndex {
11
26
  readonly version: 1;
12
27
  readonly entries: Readonly<Record<string, ParsedMirrorEntry>>;
28
+ /** Deliberate skips recorded by the last refresh. Absent in indexes written before this field existed. */
29
+ readonly skipped?: Readonly<Record<string, ParsedMirrorSkipEntry>>;
13
30
  }
14
31
  export declare function emptyMirrorIndex(): ParsedMirrorIndex;
15
32
  export declare function loadMirrorIndex(root: string): ParsedMirrorIndex;
@@ -33,9 +33,12 @@ export interface ParsedMirrorSyncResult {
33
33
  export declare function syncParsedMirrors(options: ParsedMirrorSyncOptions): Promise<ParsedMirrorSyncResult>;
34
34
  /**
35
35
  * Cheap, parse-free staleness check: compares current source files (by mtime and
36
- * size only — no parsing) against the recorded mirror index. Returns a
37
- * `stale-index` diagnostic (opaque virtual path) for every supported source that
38
- * is new or changed since the last successful refresh. Safe to call outside the
39
- * query hot path (e.g. from getRefreshStatus).
36
+ * size only — no parsing) against the mirror index's own records. A source is
37
+ * current when the last refresh either indexed it or deliberately skipped it at
38
+ * this exact version, so a skipped duplicate, oversize, or unparseable file is not
39
+ * reported as a new source. Returns a `stale-index` diagnostic (opaque virtual
40
+ * path) for every supported source that is new or changed since the last
41
+ * successful refresh. Safe to call outside the query hot path (e.g. from
42
+ * getRefreshStatus).
40
43
  */
41
44
  export declare function detectMirrorStaleness(options: ParsedMirrorSyncOptions): Promise<ParsedMirrorDiagnostic[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -68,7 +68,7 @@
68
68
  "yaml": "^2.9.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@biomejs/biome": "2.5.12",
71
+ "@biomejs/biome": "2.5.13",
72
72
  "@types/mailparser": "^3.4.6",
73
73
  "@types/node": "^26.4.1",
74
74
  "@types/ws": "^8.18.1",
@@ -139,5 +139,7 @@ Never target source documents. `memory inspect` is read-only and path-opaque.
139
139
  call `autorag feedback`.
140
140
  - Do not invent CLI commands. `autorag --help` is the command list of record,
141
141
  including the shipped `gateway`, `models`, `serve`, `p2p`, `tui`, and `lite`
142
- commands. See `docs/embedding-runtime.md` for the local embedding runtime
142
+ commands. `autorag <command> --help` prints that command's own flags, and
143
+ `autorag --version` prints the installed version. See
144
+ `docs/embedding-runtime.md` for the local embedding runtime
143
145
  and gateway setup.
@@ -18,15 +18,22 @@ the memory file, and Jikji `.jikji/` caches.
18
18
 
19
19
  ## Preflight
20
20
 
21
- Retrieval requires a completed refresh. If `autorag lite retrieve` returns
22
- exit code 2 with an `index-not-ready` diagnostic, run `autorag lite refresh`
23
- (or `autorag refresh`) first, then retry. Confirm freshness with:
21
+ Retrieval needs a completed refresh. If `autorag lite retrieve` returns exit
22
+ code 2 with an `index-not-ready` diagnostic, no refresh has completed yet —
23
+ run `autorag lite refresh` (or `autorag refresh`) first, then retry. Confirm
24
+ freshness with:
24
25
 
25
26
  ```bash
26
27
  autorag lite status --json
27
28
  ```
28
29
 
29
- `status` is model-free and path-opaque.
30
+ `status` is model-free and path-opaque, and its `stale` field is read from disk,
31
+ so it answers "is indexing complete?" even from a fresh process.
32
+
33
+ A stale corpus is not a failure: `retrieve` answers from the index it has and
34
+ reports the staleness it is answering past (`"stale": true` plus `stale-index`
35
+ diagnostics). Pass `--refresh` to rebuild incrementally before answering, or
36
+ `--strict` to keep the old fail-closed behavior and exit 2 instead of answering.
30
37
 
31
38
  ## Retrieve
32
39
 
@@ -40,6 +47,7 @@ The JSON envelope is:
40
47
  {
41
48
  "ok": true,
42
49
  "query": "key findings in the Q3 report",
50
+ "stale": false,
43
51
  "results": [
44
52
  {
45
53
  "number": 1,
@@ -58,6 +66,15 @@ The JSON envelope is:
58
66
  an `{"ok": false, "error": "..."}` rejection envelope.
59
67
  - Before any refresh, the envelope is `{"ok": false, "query": ..., "diagnostics":
60
68
  [{"code": "index-not-ready", "severity": "error", ...}]}` with exit code 2.
69
+ - `stale: true` means the last refresh does not cover the current sources; the
70
+ results are still returned. Each entry in `diagnostics` with code
71
+ `stale-index` names the opaque source and a `reason` (for example
72
+ `mtime-and-size-changed`) plus `action: "refresh"`. Sources the refresh
73
+ deliberately skipped (exact duplicates, oversized or unparseable files, and
74
+ AutoRAG/Jikji product artifacts) are not stale.
75
+ - `--refresh` runs an incremental refresh before answering and reports the
76
+ corpus current; `--strict` exits 2 with the `index-not-ready` envelope when the
77
+ index is stale, for callers that must not answer from a stale index.
61
78
  - Each result carries a provenance pair: the `source` identity and the
62
79
  `method` that produced it. Source identities are source-native: real file
63
80
  paths for local files, datasource identities for datasource results. Never
@@ -68,8 +85,9 @@ The JSON envelope is:
68
85
  failed run; check `diagnostics` before trusting an empty result set.
69
86
  - `--debug` adds diagnostic detail to human output without printing real
70
87
  filesystem paths.
71
- - Exit codes: 0 on success (results may be empty), 2 for usage, config, or
72
- not-ready errors, 1 for runtime errors.
88
+ - Exit codes: 0 on success (results may be empty, and a stale index is a
89
+ warning rather than a failure), 2 for usage, config, not-ready, or
90
+ `--strict` staleness errors, 1 for runtime errors.
73
91
 
74
92
  Retrieval methods run in parallel and merge: parsed mirrors and MinSync
75
93
  lexical/vector/hybrid methods, plus configured datasource methods. Jikji is a
@@ -128,6 +128,14 @@ Retrieval requires a completed refresh. `autorag lite retrieve` before any
128
128
  refresh exits with code 2 and an `index-not-ready` diagnostic; a successful
129
129
  refresh is recorded even when the corpus is empty or only a non-parsed method
130
130
  was selected. Always refresh first, and refresh again when roots change.
131
+ Once a refresh has completed, staleness is reported rather than enforced: a
132
+ source that changed afterwards gives `"stale": true` with `stale-index`
133
+ diagnostics (and `autorag lite status` reports `stale: true`) while retrieval
134
+ still answers from the index. Sources the refresh deliberately skipped — exact
135
+ duplicates, oversized or unparseable files, and AutoRAG/Jikji product artifacts
136
+ such as `.jikji_agent_map.md` — do not count as stale. Use `autorag lite
137
+ retrieve --refresh` to rebuild incrementally before one query, or `--strict`
138
+ when a stale index must fail instead of answering.
131
139
  Jikji is a discovery/indexing preparer, not a lite retrieval method.
132
140
 
133
141
  ## Watch and scheduled freshness