@autorag/librarian 2.4.0 → 2.4.2
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/README.md +25 -3
- package/dist/agent/agent.d.ts +40 -12
- package/dist/agent/emit-results-tool.d.ts +1 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/search-documents.d.ts +11 -2
- package/dist/cli/commands/duplicates.d.ts +6 -0
- package/dist/cli/commands/evidence.d.ts +3 -0
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/lite-refresh.d.ts +10 -0
- package/dist/cli/commands/lite-retrieve.d.ts +33 -0
- package/dist/cli/commands/lite.d.ts +3 -0
- package/dist/cli/commands/refresh.d.ts +3 -4
- package/dist/cli/commands/report.d.ts +3 -0
- package/dist/cli/commands/search.d.ts +2 -2
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/tui.d.ts +1 -1
- package/dist/cli/commands/watch.d.ts +3 -1
- package/dist/cli/config.d.ts +0 -11
- package/dist/cli/index.js +1538 -1090
- package/dist/core.d.ts +67 -0
- package/dist/core.js +14786 -0
- package/dist/datasource/access-context.d.ts +1 -1
- package/dist/datasource/result-filter.d.ts +1 -1
- package/dist/datasource/skills/gmail/index.d.ts +0 -1
- package/dist/datasource/skills/gmail/skill.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4015 -3111
- package/dist/jikji/client.d.ts +2 -0
- package/dist/minsync/client.d.ts +2 -1
- package/dist/minsync/index.d.ts +1 -1
- package/dist/minsync/installer.d.ts +7 -1
- package/dist/minsync/method.d.ts +10 -19
- package/dist/mirror/index.d.ts +1 -1
- package/dist/mirror/paths.d.ts +2 -0
- package/dist/retrieval/engine.d.ts +123 -0
- package/dist/retrieval/index.d.ts +1 -2
- package/dist/retrieval/registry.d.ts +2 -2
- package/dist/retrieval/types.d.ts +1 -1
- package/dist/ui/discover.d.ts +0 -2
- package/package.json +6 -2
- package/skills/autorag/SKILL.md +19 -6
- package/skills/autorag-lite-search/SKILL.md +155 -0
- package/skills/autorag-lite-setup/SKILL.md +182 -0
- package/skills/autorag-setup/SKILL.md +62 -23
- package/dist/agent/search-bm25-tool.d.ts +0 -26
- package/dist/datasource/skills/gmail/himalaya-connector.d.ts +0 -51
- package/dist/retrieval/methods/bm25.d.ts +0 -23
package/README.md
CHANGED
|
@@ -16,6 +16,25 @@ AutoRAG itself is the specialized search agent, not a coordinator for other
|
|
|
16
16
|
model roles. You configure one model, and that model owns the complete
|
|
17
17
|
retrieval, reading, judgment, and curation loop.
|
|
18
18
|
|
|
19
|
+
## Core values
|
|
20
|
+
|
|
21
|
+
Three principles drive every design decision:
|
|
22
|
+
|
|
23
|
+
1. **Never migrate your data to search it.** AutoRAG federates CLI-owned
|
|
24
|
+
stores (katok, discrawl, qmd, msgvault, rclone, …) in place. No forced
|
|
25
|
+
ingestion into a central index, no third-party server holding a copy of
|
|
26
|
+
your corpus. Results carry source-native identities
|
|
27
|
+
(`kakao:<chat>/<sender>/<chunk>`) with scope-checked access — see the
|
|
28
|
+
[competitive landscape study](docs/competitive-landscape-2026-09.md) for
|
|
29
|
+
why this is the durable differentiator.
|
|
30
|
+
2. **Just works — no RAG degree required.** Install it and it works: minimal
|
|
31
|
+
configuration, no pipeline tuning, no vector-DB operations, no API keys.
|
|
32
|
+
The local embedder (EmbeddingGemma via Ollama) and MinSync auto-install
|
|
33
|
+
handle the "RAG plumbing" invisibly.
|
|
34
|
+
3. **Fast by design.** One configured model owns the whole loop; retrieval
|
|
35
|
+
runs locally over MinSync CDC chunks (BM25 / vector / hybrid); interactive
|
|
36
|
+
search is optimized for low latency.
|
|
37
|
+
|
|
19
38
|
## Why AutoRAG
|
|
20
39
|
|
|
21
40
|
### The problem with search tools
|
|
@@ -205,7 +224,7 @@ Security defaults are intentionally strict:
|
|
|
205
224
|
| Notion | `notion` | external [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | local-first page/database/block archive + FTS5 search |
|
|
206
225
|
| GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
|
|
207
226
|
| Cloud drives | `cloud-drive` | **[`rclone`](https://rclone.org) CLI** | Incremental Google Drive Tier-1; OneDrive/network remotes; iCloud experimental |
|
|
208
|
-
| Gmail
|
|
227
|
+
| Gmail | `gmail` | Gmail REST v1 | OAuth access token is referenced by environment variable name |
|
|
209
228
|
| Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
|
|
210
229
|
| Mail archives | `mailcrawl` | external [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | local email sync plus BM25, semantic, and hybrid retrieval |
|
|
211
230
|
| Obsidian vault | `obsidian` | external [`qmd`](https://github.com/tobi/qmd) CLI | incremental `qmd update`, BM25 `qmd search`, semantic `qmd vsearch`; vault path via `connector.vaultPath` |
|
|
@@ -223,7 +242,7 @@ Configure them in `config.json` (CLI) or pass `datasourceSkills` programmaticall
|
|
|
223
242
|
"slack": { "connector": { "binaryPath": "slacrawl", "configPath": "/path/to/slacrawl.yaml", "syncSource": "primary" } },
|
|
224
243
|
"notion": { "connector": { "binaryPath": "notcrawl", "configPath": "/path/to/notcrawl.yaml" } },
|
|
225
244
|
"github": { "connector": { "repos": ["owner/repo"] } },
|
|
226
|
-
"gmail": { "connector": { "
|
|
245
|
+
"gmail": { "connector": { "tokenEnv": "GMAIL_ACCESS_TOKEN", "labelIds": ["INBOX"] } },
|
|
227
246
|
"mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
|
|
228
247
|
"personal-google-drive": { "type": "cloud-drive", "instanceId": "personal", "connector": { "provider": "google-drive", "remote": "personal-gdrive:", "include": ["**/*.md"] } },
|
|
229
248
|
"company-onedrive": { "type": "cloud-drive", "instanceId": "work", "connector": { "provider": "onedrive", "remote": "company-onedrive:Documents" } },
|
|
@@ -253,6 +272,9 @@ in mailcrawl's native store unless the operator explicitly sets
|
|
|
253
272
|
`connector.dataDir`; Himalaya credentials and provider configuration remain
|
|
254
273
|
owned by mailcrawl. 0.1.3 and earlier fail a repeated
|
|
255
274
|
`index` after a no-op sync.
|
|
275
|
+
Use `mailcrawl` for all Himalaya-backed IMAP/Maildir retrieval. The retired
|
|
276
|
+
`gmail` connector option `backend: "himalaya"` is no longer registered; migrate
|
|
277
|
+
that configuration to an explicit `mailcrawl` datasource.
|
|
256
278
|
|
|
257
279
|
Install and authenticate rclone separately (`brew install rclone && rclone
|
|
258
280
|
config` on macOS), then configure the provider-neutral `cloud-drive` skill.
|
|
@@ -443,7 +465,7 @@ installations in `PATH` (or set `JAVA_HOME` to the Java 11+ installation and
|
|
|
443
465
|
start a new shell). Java 8 is not supported by the PDF parser.
|
|
444
466
|
|
|
445
467
|
Git-based installs build `dist/` via the `prepare` script and require Bun on the installing machine.
|
|
446
|
-
External tool binaries auto-install on first use into `<workspace>/.autorag/bin`: **MinSync**
|
|
468
|
+
External tool binaries auto-install on first use into `<workspace>/.autorag/bin`: **MinSync** installs from crates.io via `cargo install minsync` first (on by default; verified GitHub release assets are the fallback when cargo is unavailable; `minSync.autoInstall: false` to opt out), and **Jikji** compiles the [`jikji-cli`](https://crates.io/crates/jikji-cli) crate via cargo (requires the [Rust toolchain](https://rustup.rs); `jikji.autoInstall: false` to opt out). New `autorag init` configs enable Jikji find-first discovery by default. KakaoTalk (`katok`) and Discord (`discrawl`) stay manual, optional installs. All of them degrade gracefully when missing — core BM25 search works without any of them.
|
|
447
469
|
|
|
448
470
|
### Experimental TUI (beta)
|
|
449
471
|
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -5,22 +5,22 @@ import type { DatasourceIndexResult, DatasourceSkill } from "../datasource/types
|
|
|
5
5
|
import { type DupeyCliOptions } from "../dupey/index.js";
|
|
6
6
|
import { type JikjiFailureReason, type JikjiOptions } from "../jikji/index.js";
|
|
7
7
|
import type { ResultFeedback } from "../memory/memory.js";
|
|
8
|
-
import { type
|
|
8
|
+
import { type MinSyncSyncResult, type MinSyncVectorMethodOptions } from "../minsync/index.js";
|
|
9
9
|
import { type ParsedMirrorSyncResult } from "../mirror/sync.js";
|
|
10
10
|
import type { DefaultParserRegistryOptions } from "../parser/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { RetrievalEngine } from "../retrieval/engine.js";
|
|
12
12
|
import { RetrievalMethodRegistry } from "../retrieval/registry.js";
|
|
13
13
|
import type { CuratedResult, RetrievalDiagnostic, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
|
|
14
14
|
import { type ScanDuplicateDocumentsDetails } from "./dupey-tool.js";
|
|
15
15
|
import { type JikjiFindProviderResult } from "./jikji-find-tool.js";
|
|
16
|
-
import { type SearchDocumentDiagnostic, type SearchDocumentsResponse } from "./search-documents.js";
|
|
16
|
+
import { type SearchDocumentDiagnostic, type SearchDocumentsResponse, type SearchDocumentsStreamEvent } from "./search-documents.js";
|
|
17
17
|
import { type WatcherFactory, type WatchRefreshHandle } from "./watch-refresh.js";
|
|
18
18
|
export interface AutoRefreshOptions {
|
|
19
19
|
readonly intervalMs: number;
|
|
20
20
|
readonly immediate?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/** Methods that `refresh` can selectively run. Defaults to all when omitted. */
|
|
23
|
-
export type RefreshMethod = "parsed" | "
|
|
23
|
+
export type RefreshMethod = "parsed" | "minsync" | "datasources" | "jikji";
|
|
24
24
|
export interface AutoRAGRefreshOptions {
|
|
25
25
|
/** Restrict refresh to specific methods. Defaults to all when undefined. */
|
|
26
26
|
readonly methods?: readonly RefreshMethod[];
|
|
@@ -32,12 +32,10 @@ export interface AutoRAGMinSyncRefreshResult {
|
|
|
32
32
|
}
|
|
33
33
|
export interface AutoRAGRefreshResult extends Omit<ParsedMirrorSyncResult, "diagnostics"> {
|
|
34
34
|
readonly diagnostics: readonly SearchDocumentDiagnostic[];
|
|
35
|
-
readonly bm25?: BM25SyncResult;
|
|
36
35
|
readonly minsync?: AutoRAGMinSyncRefreshResult;
|
|
37
36
|
readonly datasources?: readonly DatasourceIndexResult[];
|
|
38
37
|
}
|
|
39
38
|
export interface AutoRAGRefreshComponentStatus {
|
|
40
|
-
readonly bm25?: string;
|
|
41
39
|
readonly minsync?: string;
|
|
42
40
|
readonly jikji?: string;
|
|
43
41
|
readonly datasources?: string;
|
|
@@ -78,7 +76,6 @@ export interface AutoRAGAgentOptions {
|
|
|
78
76
|
workspacePath?: string;
|
|
79
77
|
tools?: AgentTool[];
|
|
80
78
|
minSync?: Omit<MinSyncVectorMethodOptions, "root"> | false;
|
|
81
|
-
bm25?: Omit<MinSyncBM25MethodOptions, "root"> | false;
|
|
82
79
|
jikji?: JikjiOptions | false;
|
|
83
80
|
autoRefresh?: AutoRefreshOptions;
|
|
84
81
|
parserOptions?: DefaultParserRegistryOptions;
|
|
@@ -126,6 +123,10 @@ export declare class AutoRAGAgent {
|
|
|
126
123
|
private resultCapture;
|
|
127
124
|
private autoRefreshTimer;
|
|
128
125
|
private refreshing;
|
|
126
|
+
private jikjiPrepareInFlight;
|
|
127
|
+
private jikjiReady;
|
|
128
|
+
private minSyncPrepareInFlight;
|
|
129
|
+
private minSyncReady;
|
|
129
130
|
private refreshState;
|
|
130
131
|
private readonly searchPaths;
|
|
131
132
|
private readonly configuredSearchPaths;
|
|
@@ -137,7 +138,6 @@ export declare class AutoRAGAgent {
|
|
|
137
138
|
private readonly merger;
|
|
138
139
|
private readonly datasourceFilter;
|
|
139
140
|
private readonly minSyncMethod;
|
|
140
|
-
private readonly bm25Method;
|
|
141
141
|
private readonly jikjiClient;
|
|
142
142
|
private readonly datasourceSkills;
|
|
143
143
|
private readonly datasourceAccessOptions;
|
|
@@ -151,12 +151,14 @@ export declare class AutoRAGAgent {
|
|
|
151
151
|
private readonly searchTimeoutMs;
|
|
152
152
|
private readonly maxSearchToolCalls;
|
|
153
153
|
private searchToolCallCount;
|
|
154
|
+
private readonly sourceSearchCallCounts;
|
|
154
155
|
constructor(options: AutoRAGAgentOptions);
|
|
155
156
|
scanDuplicateDocuments(): Promise<ScanDuplicateDocumentsDetails>;
|
|
156
157
|
private withMemoryContext;
|
|
157
158
|
private resolveSessionModel;
|
|
158
159
|
private createSearchSession;
|
|
159
160
|
private configureSearchSession;
|
|
161
|
+
private withPerSourceSearchLimit;
|
|
160
162
|
private recordSearchToolEvent;
|
|
161
163
|
private currentSystemPromptConfig;
|
|
162
164
|
subscribe(listener: Parameters<Agent["subscribe"]>[0]): () => void;
|
|
@@ -177,6 +179,13 @@ export declare class AutoRAGAgent {
|
|
|
177
179
|
recordFeedbackByIds(usefulFeedbackIds: readonly string[], notUsefulFeedbackIds?: readonly string[]): void;
|
|
178
180
|
getResultRegistry(sessionId?: string): ReadonlyMap<number, CuratedResult>;
|
|
179
181
|
searchDocuments(query: string, options?: RetrievalOptions): Promise<SearchDocumentsResponse>;
|
|
182
|
+
/**
|
|
183
|
+
* Stream bounded progress updates while retaining the stable
|
|
184
|
+
* {@link searchDocuments} promise API. Progress is sourced from model text
|
|
185
|
+
* deltas, so callers can render it in a TUI, CLI, or parent agent and can
|
|
186
|
+
* stop by calling {@link abort}.
|
|
187
|
+
*/
|
|
188
|
+
searchDocumentsStream(query: string, options?: RetrievalOptions): AsyncGenerator<SearchDocumentsStreamEvent, void, void>;
|
|
180
189
|
private datasourceAccessContext;
|
|
181
190
|
/**
|
|
182
191
|
* Build the Pi agent-skill list for datasource skills authorized by the
|
|
@@ -191,9 +200,16 @@ export declare class AutoRAGAgent {
|
|
|
191
200
|
*/
|
|
192
201
|
loadDatasourceSkill(name: string): Skill | undefined;
|
|
193
202
|
private indexDatasources;
|
|
194
|
-
/** Path-opaque component diagnostics
|
|
203
|
+
/** Path-opaque component diagnostics for the search response. */
|
|
195
204
|
private collectComponentDiagnostics;
|
|
196
205
|
private prefetchInitialRetrievalContext;
|
|
206
|
+
/**
|
|
207
|
+
* Prepare MinSync lazily without holding up the current search. Parsed
|
|
208
|
+
* mirrors are built first because MinSync stages and indexes those mirrors.
|
|
209
|
+
*/
|
|
210
|
+
/** Prepare MinSync in the background; the returned promise is for tests. */
|
|
211
|
+
scheduleMinSyncPrepareForTest(): Promise<MinSyncSyncResult | undefined> | undefined;
|
|
212
|
+
private scheduleMinSyncPrepare;
|
|
197
213
|
buildSearchPrompt(query: string, options: RetrievalOptions, initialRetrievalContext?: string): string;
|
|
198
214
|
refresh(force?: boolean, opts?: AutoRAGRefreshOptions): Promise<AutoRAGRefreshResult>;
|
|
199
215
|
/**
|
|
@@ -221,10 +237,15 @@ export declare class AutoRAGAgent {
|
|
|
221
237
|
*/
|
|
222
238
|
private scanMirrorStaleness;
|
|
223
239
|
private exactDuplicateExclusions;
|
|
224
|
-
|
|
225
|
-
syncMinSync(): Promise<MinSyncSyncResult | undefined>;
|
|
240
|
+
syncMinSync(force?: boolean): Promise<MinSyncSyncResult | undefined>;
|
|
226
241
|
prepareJikji(): Promise<readonly AutoRAGJikjiPrepareResult[] | undefined>;
|
|
227
242
|
private executeJikjiPrepare;
|
|
243
|
+
/**
|
|
244
|
+
* Start Jikji preparation without delaying the current search turn. A
|
|
245
|
+
* subsequent turn can use the prepared index, while the child process keeps
|
|
246
|
+
* running after emit_autorag_results has terminated the agent loop.
|
|
247
|
+
*/
|
|
248
|
+
private scheduleJikjiPrepare;
|
|
228
249
|
private sanitizeJikjiPrepareResult;
|
|
229
250
|
/**
|
|
230
251
|
* Provider method for the jikji_find tool. Runs JikjiClient.find over all
|
|
@@ -283,8 +304,15 @@ export declare class AutoRAGAgent {
|
|
|
283
304
|
results: RetrievalResult[];
|
|
284
305
|
diagnostics: RetrievalDiagnostic[];
|
|
285
306
|
}>;
|
|
286
|
-
/** The retrieval method registry (posix
|
|
307
|
+
/** The retrieval method registry (posix, MinSync, and datasource methods). */
|
|
287
308
|
getMethodRegistry(): RetrievalMethodRegistry;
|
|
309
|
+
/**
|
|
310
|
+
* The standalone retrieval engine for this agent's method pipeline.
|
|
311
|
+
* Built on first access using the agent's registered methods and configured
|
|
312
|
+
* datasource access context. Model-free — no agent state required.
|
|
313
|
+
*/
|
|
314
|
+
private retrievalEngine;
|
|
315
|
+
getRetrievalEngine(): RetrievalEngine;
|
|
288
316
|
getSystemPrompt(): string;
|
|
289
317
|
private rerankWithMemory;
|
|
290
318
|
private normalizeRetrievalOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
3
|
export declare const EMIT_AUTORAG_RESULTS_TOOL_NAME = "emit_autorag_results";
|
|
4
|
-
declare const emitResultsSchema: Type.TObject<{
|
|
4
|
+
export declare const emitResultsSchema: Type.TObject<{
|
|
5
5
|
answer: Type.TString;
|
|
6
6
|
results: Type.TArray<Type.TObject<{
|
|
7
7
|
number: Type.TInteger;
|
|
@@ -86,4 +86,3 @@ export interface AutoRAGResultsDetails {
|
|
|
86
86
|
* assistant-text parsing involved.
|
|
87
87
|
*/
|
|
88
88
|
export declare function createEmitResultsTool(capture: (details: AutoRAGResultsDetails) => void): AgentTool<typeof emitResultsSchema, AutoRAGResultsDetails>;
|
|
89
|
-
export {};
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export { AutoRAGAgent } from "./agent.js";
|
|
|
3
3
|
export { buildDatasourceSkillsPrompt, createLoadDatasourceSkillTool, type DatasourceSkillProvider, datasourceSkillLocation, formatDatasourceSkillInvocation, LOAD_DATASOURCE_SKILL_TOOL_NAME, type LoadDatasourceSkillDetails, toDatasourceAgentSkill, } from "./datasource-skill.js";
|
|
4
4
|
export { createScanDuplicateDocumentsTool, SCAN_DUPLICATE_DOCUMENTS_TOOL_NAME, type ScanDuplicateDocumentsDetails, type ScanDuplicateDocumentsProvider, } from "./dupey-tool.js";
|
|
5
5
|
export type { AutoRAGEmittedResult, AutoRAGMappingEntry, AutoRAGResultsDetails, } from "./emit-results-tool.js";
|
|
6
|
-
export { createEmitResultsTool, EMIT_AUTORAG_RESULTS_TOOL_NAME } from "./emit-results-tool.js";
|
|
6
|
+
export { createEmitResultsTool, EMIT_AUTORAG_RESULTS_TOOL_NAME, emitResultsSchema, } from "./emit-results-tool.js";
|
|
7
7
|
export { createJikjiFindTool, JIKJI_FIND_TOOL_NAME, type JikjiFindDetails, type JikjiFindPerRootPolicy, type JikjiFindProvider, type JikjiFindProviderResult, type MergedJikjiPolicy, } from "./jikji-find-tool.js";
|
|
8
8
|
export { createSearchAllDocumentsTool, SEARCH_ALL_DOCUMENTS_TOOL_NAME, type SearchAllDocumentsDetails, type SearchAllDocumentsProvider, type SearchAllDocumentsResult, } from "./search-all-tool.js";
|
|
9
9
|
export { createSearchDatasourceDocumentsTool, type DatasourceSearchProvider, SEARCH_DATASOURCE_DOCUMENTS_TOOL_NAME, type SearchDatasourceDocumentsDetails, } from "./search-datasource-tool.js";
|
|
10
|
-
export type { SearchDocumentDiagnostic, SearchDocumentDiagnosticCode, SearchDocumentDiagnosticSeverity, SearchDocumentEvidence, SearchDocumentResult, SearchDocumentsResponse, SearchDocumentWarning, } from "./search-documents.js";
|
|
10
|
+
export type { SearchDocumentDiagnostic, SearchDocumentDiagnosticCode, SearchDocumentDiagnosticSeverity, SearchDocumentEvidence, SearchDocumentResult, SearchDocumentsResponse, SearchDocumentsStreamEvent, SearchDocumentWarning, } from "./search-documents.js";
|
|
11
11
|
export { createSearchMinSyncDocumentsTool, SEARCH_MINSYNC_DOCUMENTS_TOOL_NAME, type SearchMinSyncDocumentsDetails, } from "./search-minsync-tool.js";
|
|
12
12
|
export { buildSystemPrompt, type SystemPromptConfig } from "./system-prompt.js";
|
|
@@ -9,12 +9,12 @@ export type SearchDocumentDiagnosticSeverity = "info" | "warning" | "error";
|
|
|
9
9
|
* (#21/#22) does not require another source-breaking type change; codes not yet
|
|
10
10
|
* emitted are still valid members.
|
|
11
11
|
*/
|
|
12
|
-
export type SearchDocumentDiagnosticCode = "empty-query" | "unknown-warning" | "caller-tool-dropped" | "
|
|
12
|
+
export type SearchDocumentDiagnosticCode = "empty-query" | "unknown-warning" | "caller-tool-dropped" | "minsync-unavailable" | "parser-skipped" | "parser-failed" | "pdf-java-version" | "duplicate-excluded" | "unsupported-file" | "stale-index" | "deleted-mirror" | "pdf-extract-thin" | "pdf-hybrid-unavailable" | "retrieval-method-failed" | "jikji-unavailable" | "jikji-prepare-failed" | "jikji-find-failed" | "refresh-failed" | "watch-failed" | "watch-limited" | "unknown-datasource-skill";
|
|
13
13
|
export interface SearchDocumentDiagnostic {
|
|
14
14
|
readonly code: SearchDocumentDiagnosticCode;
|
|
15
15
|
readonly severity: SearchDocumentDiagnosticSeverity;
|
|
16
16
|
readonly message: string;
|
|
17
|
-
/** Component label (e.g. "sanitizer", "
|
|
17
|
+
/** Component label (e.g. "sanitizer", "minsync") or opaque virtual path — never a real filesystem path. */
|
|
18
18
|
readonly source?: string;
|
|
19
19
|
}
|
|
20
20
|
export interface SearchDocumentEvidence {
|
|
@@ -43,6 +43,15 @@ export interface SearchDocumentsResponse {
|
|
|
43
43
|
*/
|
|
44
44
|
readonly diagnostics?: readonly SearchDocumentDiagnostic[];
|
|
45
45
|
}
|
|
46
|
+
export type SearchDocumentsStreamEvent = {
|
|
47
|
+
readonly type: "progress";
|
|
48
|
+
readonly sessionId: string;
|
|
49
|
+
readonly query: string;
|
|
50
|
+
readonly text: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "complete";
|
|
53
|
+
readonly response: SearchDocumentsResponse;
|
|
54
|
+
};
|
|
46
55
|
type SearchSessions = Map<string, {
|
|
47
56
|
query: string;
|
|
48
57
|
registry: Map<number, CuratedResult>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { DupeyScanResult } from "../../dupey/index.js";
|
|
2
2
|
import type { CommandContext } from "./types.js";
|
|
3
3
|
export type DuplicateScanner = (path: string) => Promise<DupeyScanResult>;
|
|
4
|
+
/**
|
|
5
|
+
* `autorag duplicates` — scan configured roots for exact and near duplicate
|
|
6
|
+
* document families. Never deletes or moves source files.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 on success, 2 on config error, 1 on runtime error.
|
|
9
|
+
*/
|
|
4
10
|
export declare function runDuplicates(ctx: CommandContext, scanner?: DuplicateScanner): Promise<number>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommandContext } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Run the `autorag index` command. `reset` removes the parsed mirror
|
|
4
|
-
*
|
|
4
|
+
* and MinSync indexes
|
|
5
5
|
* (preserving `bin`, `datasources`, and the memory file). `rebuild` resets then re-runs a forced
|
|
6
6
|
* refresh. Returns 0 on success, 2 for usage/decline errors, 1 for runtime
|
|
7
7
|
* errors including path-escape guard violations.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandContext } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* `autorag lite refresh` — model-free index refresh using AutoRAGLite.
|
|
4
|
+
*
|
|
5
|
+
* Delegates to the agent's refresh pipeline (parsed mirrors, MinSync,
|
|
6
|
+
* datasources, Jikji) without requiring any model configuration.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 on success, 2 on config error, 1 on runtime error.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runLiteRefresh(ctx: CommandContext): Promise<number>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CommandContext } from "./types.js";
|
|
2
|
+
export interface LiteRetrieveEnvelope {
|
|
3
|
+
readonly ok: true;
|
|
4
|
+
readonly query: string;
|
|
5
|
+
readonly results: readonly LiteRetrieveResultItem[];
|
|
6
|
+
readonly diagnostics: readonly LiteRetrieveDiagnostic[];
|
|
7
|
+
}
|
|
8
|
+
export interface LiteRetrieveResultItem {
|
|
9
|
+
readonly number: number;
|
|
10
|
+
readonly source: string;
|
|
11
|
+
readonly method: string;
|
|
12
|
+
readonly score: number;
|
|
13
|
+
readonly metadata: Record<string, unknown>;
|
|
14
|
+
readonly content: string;
|
|
15
|
+
}
|
|
16
|
+
export interface LiteRetrieveDiagnostic {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly severity: string;
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly source?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Run the `autorag lite retrieve` command.
|
|
24
|
+
*
|
|
25
|
+
* Returns exit code 2 for:
|
|
26
|
+
* - Empty query
|
|
27
|
+
* - Config resolution failure
|
|
28
|
+
* - Index not ready (never refreshed)
|
|
29
|
+
*
|
|
30
|
+
* Returns exit code 0 on successful retrieval (results may be empty).
|
|
31
|
+
* Returns exit code 1 for runtime errors.
|
|
32
|
+
*/
|
|
33
|
+
export declare function runLiteRetrieve(ctx: CommandContext): Promise<number>;
|
|
@@ -2,13 +2,12 @@ import { type RefreshMethod } from "../../agent/agent.js";
|
|
|
2
2
|
import type { CommandContext } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* `autorag refresh` — parse configured search paths and resync every active
|
|
5
|
-
* index (parsed mirror,
|
|
5
|
+
* index (parsed mirror, MinSync, datasources, jikji). Model-free: no LLM
|
|
6
6
|
* is constructed. Output is rendered through the path-opaque refresh renderer;
|
|
7
7
|
* the raw result (which carries absolute `indexPath`) is never printed.
|
|
8
8
|
*
|
|
9
|
-
* `--method
|
|
10
|
-
* methods run. Parsed mirrors are always synced when
|
|
11
|
-
* (they index over the parsed mirrors).
|
|
9
|
+
* `--method minsync,parsed` restricts which methods run. When omitted, all
|
|
10
|
+
* methods run. Parsed mirrors are always synced when MinSync is selected.
|
|
12
11
|
*/
|
|
13
12
|
export declare function runRefresh(ctx: CommandContext): Promise<number>;
|
|
14
13
|
/**
|
|
@@ -21,10 +21,10 @@ export declare function classifySearchHealthHint(error: unknown): SearchHealthHi
|
|
|
21
21
|
/**
|
|
22
22
|
* Search-command dependencies. Tests inject `agentFactory` to bypass real
|
|
23
23
|
* model construction and AutoRAGAgent instantiation, returning a stub whose
|
|
24
|
-
* `
|
|
24
|
+
* `searchDocumentsStream` yields progress and a canned completion.
|
|
25
25
|
*/
|
|
26
26
|
export interface SearchDeps {
|
|
27
|
-
agentFactory?: (opts: AutoRAGAgentOptions) => Pick<AutoRAGAgent, "
|
|
27
|
+
agentFactory?: (opts: AutoRAGAgentOptions) => Pick<AutoRAGAgent, "searchDocumentsStream">;
|
|
28
28
|
modelResolver?: (config: CliConfig) => ResolvedAgentModel;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
@@ -3,5 +3,7 @@ import type { CommandContext } from "./types.js";
|
|
|
3
3
|
* `autorag status` — path-opaque snapshot of corpus freshness and index health.
|
|
4
4
|
* Runs a cheap parse-free staleness scan plus the cached last-refresh outcome.
|
|
5
5
|
* Model-free. Never emits filesystem paths; only the renderered status text.
|
|
6
|
+
*
|
|
7
|
+
* Exit codes: 0 on success, 2 on config error, 1 on runtime error.
|
|
6
8
|
*/
|
|
7
9
|
export declare function runStatus(ctx: CommandContext): Promise<number>;
|
|
@@ -24,7 +24,7 @@ export interface TuiPresenter {
|
|
|
24
24
|
status(): string;
|
|
25
25
|
reset(): void;
|
|
26
26
|
}
|
|
27
|
-
type TuiAgent = Pick<AutoRAGAgent, "
|
|
27
|
+
type TuiAgent = Pick<AutoRAGAgent, "searchDocumentsStream"> & Partial<Pick<AutoRAGAgent, "subscribe" | "abort">>;
|
|
28
28
|
export interface TuiDeps {
|
|
29
29
|
agentFactory?: (opts?: AutoRAGAgentOptions) => TuiAgent;
|
|
30
30
|
modelResolver?: (config: CliConfig) => ResolvedAgentModel;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { CommandContext } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* `autorag watch` — keep parsed/
|
|
3
|
+
* `autorag watch` — keep parsed/MinSync indexes current.
|
|
4
4
|
*
|
|
5
5
|
* - default: long-running recursive fs watch with debounced refresh
|
|
6
6
|
* - `--once`: single refresh tick (for cron / launchd / Task Scheduler)
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 on success, 2 on config error, 1 on runtime error.
|
|
7
9
|
*/
|
|
8
10
|
export declare function runWatch(ctx: CommandContext): Promise<number>;
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -10,13 +10,6 @@ export { AUTORAG_HOME_ENV, resolveAutoRAGHome } from "../config/home.js";
|
|
|
10
10
|
export declare class ConfigError extends Error {
|
|
11
11
|
constructor(message: string);
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Typed BM25 method config persisted in `config.json`. Missing `enabled` means
|
|
15
|
-
* enabled (true). `false` as a top-level value is also accepted and disables.
|
|
16
|
-
*/
|
|
17
|
-
export interface Bm25MethodConfig {
|
|
18
|
-
enabled?: boolean;
|
|
19
|
-
}
|
|
20
13
|
/**
|
|
21
14
|
* Typed MinSync method config persisted in `config.json`. Missing `enabled`
|
|
22
15
|
* means enabled (true); `autoInstall` defaults to true. `embedder` carries
|
|
@@ -25,7 +18,6 @@ export interface Bm25MethodConfig {
|
|
|
25
18
|
export interface MinSyncMethodConfig {
|
|
26
19
|
enabled?: boolean;
|
|
27
20
|
autoInstall?: boolean;
|
|
28
|
-
binaryPath?: string;
|
|
29
21
|
workspacePath?: string;
|
|
30
22
|
maxChunkSize?: number;
|
|
31
23
|
installer?: Omit<EnsureMinSyncBinaryOptions, "root">;
|
|
@@ -33,12 +25,10 @@ export interface MinSyncMethodConfig {
|
|
|
33
25
|
}
|
|
34
26
|
/** Indexing method config as it appears in a raw config file (before normalization). */
|
|
35
27
|
export interface RawIndexingMethods {
|
|
36
|
-
bm25?: Bm25MethodConfig | false;
|
|
37
28
|
minSync?: MinSyncMethodConfig | false;
|
|
38
29
|
}
|
|
39
30
|
/** Result of {@link normalizeIndexingConfig}: always fully populated. */
|
|
40
31
|
export interface NormalizedIndexingConfig {
|
|
41
|
-
bm25: Bm25MethodConfig;
|
|
42
32
|
minSync: MinSyncMethodConfig;
|
|
43
33
|
}
|
|
44
34
|
export interface UiConfig {
|
|
@@ -82,7 +72,6 @@ export interface CliConfig {
|
|
|
82
72
|
memoryPath: string;
|
|
83
73
|
model?: AgentModelConfig;
|
|
84
74
|
minSync?: MinSyncMethodConfig;
|
|
85
|
-
bm25?: Bm25MethodConfig;
|
|
86
75
|
jikji?: Record<string, unknown> | false;
|
|
87
76
|
parserOptions?: Record<string, unknown>;
|
|
88
77
|
dupey?: {
|