@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/dist/jikji/client.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export declare class JikjiClient {
|
|
|
3
3
|
private readonly options;
|
|
4
4
|
private resolvedCommand;
|
|
5
5
|
constructor(options?: JikjiOptions);
|
|
6
|
+
/** Jikji stores prepared corpus metadata under a hidden directory in each root. */
|
|
7
|
+
isPrepared(root: string): boolean;
|
|
6
8
|
/**
|
|
7
9
|
* Resolve the jikji command following the priority chain:
|
|
8
10
|
* 1. explicit binaryPath
|
package/dist/minsync/client.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface MinSyncClientOptions {
|
|
|
5
5
|
readonly embedder?: MinSyncEmbedderConfig;
|
|
6
6
|
readonly maxChunkSize?: number;
|
|
7
7
|
}
|
|
8
|
+
/** MinSync v0.4.2 supports vector, BM25, and hybrid query modes. */
|
|
8
9
|
export type MinSyncQueryMode = "vector" | "bm25" | "hybrid";
|
|
9
10
|
export declare class MinSyncClient {
|
|
10
11
|
private readonly binaryPath;
|
|
@@ -12,7 +13,7 @@ export declare class MinSyncClient {
|
|
|
12
13
|
private readonly embedder;
|
|
13
14
|
private readonly maxChunkSize;
|
|
14
15
|
constructor(options: MinSyncClientOptions);
|
|
15
|
-
sync(): Promise<MinSyncSyncResult>;
|
|
16
|
+
sync(force?: boolean): Promise<MinSyncSyncResult>;
|
|
16
17
|
query(text: string, topK: number, mode?: MinSyncQueryMode): Promise<readonly MinSyncQueryHit[]>;
|
|
17
18
|
private spawn;
|
|
18
19
|
}
|
package/dist/minsync/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { MinSyncClient, type MinSyncClientOptions, type MinSyncQueryMode } from "./client.js";
|
|
2
2
|
export { MINSYNC_CONFIG_DIR, MINSYNC_CONFIG_FILE, minSyncConfigPath, 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
|
-
export {
|
|
4
|
+
export { MinSyncHybridMethod, type MinSyncHybridMethodOptions, MinSyncVectorMethod, type MinSyncVectorMethodOptions, } from "./method.js";
|
|
5
5
|
export { MINSYNC_FILES_SUBDIR, MINSYNC_SUBDIR, minSyncDocumentPath, minSyncWorkspaceRoot } from "./paths.js";
|
|
6
6
|
export type { MinSyncChunkerConfig, MinSyncEmbedderConfig, MinSyncOptions, MinSyncQueryHit, MinSyncSyncResult, } from "./types.js";
|
|
7
7
|
export { buildMinSyncPathMap, type MinSyncWorkspaceEntry, type MinSyncWorkspaceSyncResult, syncMinSyncWorkspace, } from "./workspace.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare const MINSYNC_VERSION = "0.
|
|
1
|
+
export declare const MINSYNC_VERSION = "0.4.2";
|
|
2
|
+
export declare const MINSYNC_CARGO_INSTALL_TIMEOUT_MS: number;
|
|
2
3
|
export interface MinSyncReleaseAsset {
|
|
3
4
|
readonly name: string;
|
|
4
5
|
readonly downloadUrl: string;
|
|
@@ -18,6 +19,11 @@ export interface EnsureMinSyncBinaryOptions {
|
|
|
18
19
|
readonly arch?: NodeJS.Architecture;
|
|
19
20
|
readonly releaseProvider?: () => Promise<MinSyncRelease>;
|
|
20
21
|
readonly assetInstaller?: (asset: MinSyncReleaseAsset, destination: string) => Promise<void>;
|
|
22
|
+
/** Test seam: cargo-first installer. Return undefined to fall back to GitHub. */
|
|
23
|
+
readonly cargoInstaller?: (destination: string) => Promise<InstalledMinSyncBinary | undefined>;
|
|
24
|
+
/** Test seam: locate cargo on PATH. */
|
|
25
|
+
readonly cargoLocator?: (env: NodeJS.ProcessEnv) => string | undefined;
|
|
26
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
21
27
|
}
|
|
22
28
|
export declare function ensureMinSyncBinary(options: EnsureMinSyncBinaryOptions): Promise<InstalledMinSyncBinary>;
|
|
23
29
|
export declare function fetchLatestMinSyncRelease(): Promise<MinSyncRelease>;
|
package/dist/minsync/method.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type BM25Status, type BM25SyncResult } from "../retrieval/methods/bm25.js";
|
|
2
1
|
import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
|
|
3
2
|
import type { MinSyncQueryMode } from "./client.js";
|
|
4
3
|
import { type EnsureMinSyncBinaryOptions } from "./installer.js";
|
|
5
4
|
import type { MinSyncEmbedderConfig, MinSyncSyncResult } from "./types.js";
|
|
6
5
|
export interface MinSyncVectorMethodOptions {
|
|
7
6
|
readonly root: string;
|
|
7
|
+
/** Test/embedded override; CLI config intentionally does not persist this. */
|
|
8
8
|
readonly binaryPath?: string;
|
|
9
9
|
readonly workspacePath?: string;
|
|
10
10
|
readonly installer?: Omit<EnsureMinSyncBinaryOptions, "root">;
|
|
@@ -13,7 +13,6 @@ export interface MinSyncVectorMethodOptions {
|
|
|
13
13
|
readonly maxChunkSize?: number;
|
|
14
14
|
readonly mode?: MinSyncQueryMode;
|
|
15
15
|
}
|
|
16
|
-
export type MinSyncBM25MethodOptions = Omit<MinSyncVectorMethodOptions, "mode">;
|
|
17
16
|
export type MinSyncHybridMethodOptions = Omit<MinSyncVectorMethodOptions, "mode">;
|
|
18
17
|
export declare class MinSyncVectorMethod implements RetrievalMethod {
|
|
19
18
|
private readonly root;
|
|
@@ -24,34 +23,26 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
|
|
|
24
23
|
private readonly embedder;
|
|
25
24
|
private readonly maxChunkSize;
|
|
26
25
|
private readonly mode;
|
|
26
|
+
private installFailed;
|
|
27
27
|
constructor(options: MinSyncVectorMethodOptions);
|
|
28
28
|
describe(): RetrievalMethodDescriptor;
|
|
29
|
-
sync(): Promise<MinSyncSyncResult>;
|
|
30
|
-
/**
|
|
29
|
+
sync(force?: boolean): Promise<MinSyncSyncResult>;
|
|
30
|
+
/** Report unavailable binaries without treating auto-install as already failed. */
|
|
31
31
|
isBinaryMissing(): boolean;
|
|
32
|
+
/** Status distinguishes an explicit missing override from deferred resolution. */
|
|
33
|
+
isExplicitBinaryMissing(): boolean;
|
|
34
|
+
/** A vector index is ready only after MinSync has written its cursor. */
|
|
35
|
+
isReady(): boolean;
|
|
32
36
|
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
33
37
|
/**
|
|
34
|
-
* Resolve the
|
|
35
|
-
*
|
|
36
|
-
* 2. PATH lookup for `minsync`
|
|
37
|
-
* 3. cached join(root, '.autorag', 'bin', execName) if exists
|
|
38
|
-
* 4. if autoInstall===true, try ensureMinSyncBinary in try/catch => install-failed degrade
|
|
39
|
-
* 5. else return undefined (missing-binary degrade)
|
|
38
|
+
* Resolve the MinSync CLI from the user's global PATH first, then the
|
|
39
|
+
* workspace cache, and finally the verified auto-install fallback.
|
|
40
40
|
*
|
|
41
41
|
* Returns: string path on success, undefined for missing-binary, or a MinSyncSyncResult
|
|
42
42
|
* for install-failed.
|
|
43
43
|
*/
|
|
44
44
|
protected resolveBinary(): Promise<string | undefined | MinSyncSyncResult>;
|
|
45
45
|
}
|
|
46
|
-
export declare class MinSyncBM25Method extends MinSyncVectorMethod {
|
|
47
|
-
private status;
|
|
48
|
-
constructor(options: MinSyncBM25MethodOptions);
|
|
49
|
-
describe(): RetrievalMethodDescriptor;
|
|
50
|
-
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
51
|
-
syncFromMinSync(result: MinSyncSyncResult): BM25SyncResult;
|
|
52
|
-
getStatus(): BM25Status;
|
|
53
|
-
private resolveBinaryForRetrieve;
|
|
54
|
-
}
|
|
55
46
|
export declare class MinSyncHybridMethod extends MinSyncVectorMethod {
|
|
56
47
|
constructor(options: MinSyncHybridMethodOptions);
|
|
57
48
|
describe(): RetrievalMethodDescriptor;
|
package/dist/mirror/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ParsedMirrorEntry, ParsedMirrorIndex } from "./index-store.js";
|
|
2
2
|
export { emptyMirrorIndex, loadMirrorIndex, saveMirrorIndex } from "./index-store.js";
|
|
3
|
-
export { parsedMirrorIndexPath, parsedMirrorRoot, parsedOutputPath } from "./paths.js";
|
|
3
|
+
export { parsedMirrorIndexPath, parsedMirrorRoot, parsedOutputPath, refreshReadinessPath } from "./paths.js";
|
|
4
4
|
export type { ParsedMirrorDiagnostic, ParsedMirrorDiagnosticCode, ParsedMirrorSyncOptions, ParsedMirrorSyncResult, } from "./sync.js";
|
|
5
5
|
export { DEFAULT_MAX_SOURCE_BYTES, detectMirrorStaleness, syncParsedMirrors } from "./sync.js";
|
package/dist/mirror/paths.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const PARSED_MIRROR_SUBDIR: string;
|
|
2
2
|
export declare const PARSED_FILES_SUBDIR = "files";
|
|
3
3
|
export declare const PARSED_INDEX_FILE = "index.json";
|
|
4
|
+
export declare const REFRESH_READINESS_FILE = "refresh-complete.json";
|
|
4
5
|
export declare function parsedMirrorRoot(root: string): string;
|
|
5
6
|
export declare function parsedMirrorIndexPath(root: string): string;
|
|
6
7
|
export declare function parsedOutputPath(root: string, virtualPath: string): string;
|
|
8
|
+
export declare function refreshReadinessPath(root: string): string;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RetrievalEngine — standalone typed seam for model-free retrieval.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing retrieval pipeline (registry, parallel retriever,
|
|
5
|
+
* datasource result filter, and merger) into a single public entry point.
|
|
6
|
+
* Exposes a deterministic, self-contained retrieval API with diagnostics.
|
|
7
|
+
*
|
|
8
|
+
* Security invariants (delegated to {@link DatasourceAccessContext} and
|
|
9
|
+
* {@link DatasourceResultFilter}):
|
|
10
|
+
* - Access is default-deny: when no trusted allow-tags are configured,
|
|
11
|
+
* every datasource method result is dropped.
|
|
12
|
+
* - Deny is always an explicit empty result array, never `undefined`.
|
|
13
|
+
* - Model/tool arguments (`allowedTags`, `allowedScopes`) cannot widen the
|
|
14
|
+
* trusted access context constructed during engine creation.
|
|
15
|
+
*/
|
|
16
|
+
import { DatasourceAccessContext, type DatasourceAccessContextOptions } from "../datasource/access-context.js";
|
|
17
|
+
import { RetrievalMethodRegistry } from "./registry.js";
|
|
18
|
+
import type { RetrievalDiagnostic, RetrievalMethod, RetrievalOptions, RetrievalResult } from "./types.js";
|
|
19
|
+
/** Options for constructing a standalone {@link RetrievalEngine}. */
|
|
20
|
+
export interface RetrievalEngineOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Datasource access configuration. Default-deny when omitted.
|
|
23
|
+
* @default { allowedTags: undefined, allowedScopes: undefined }
|
|
24
|
+
*/
|
|
25
|
+
readonly datasourceAccess?: DatasourceAccessContextOptions;
|
|
26
|
+
/** Default `topK` when the caller omits it. @default 20 */
|
|
27
|
+
readonly defaultTopK?: number;
|
|
28
|
+
/** Default deduplication flag. @default true */
|
|
29
|
+
readonly defaultDedup?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Optional predicate that returns `true` when the MinSync binary is missing.
|
|
32
|
+
* When set, the engine checks every method named `"minsync"`: if the binary
|
|
33
|
+
* is unavailable the method returns empty results without throwing, the engine
|
|
34
|
+
* emits a `minsync-unavailable` diagnostic with full method-agnostic path
|
|
35
|
+
* preservation — matching the existing {@link AutoRAGAgent} behavior.
|
|
36
|
+
*/
|
|
37
|
+
readonly isMinSyncBinaryMissing?: () => boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Model-free retrieval pipeline.
|
|
41
|
+
*
|
|
42
|
+
* The engine composes the standard AutoRAG retrieval chain:
|
|
43
|
+
* ```
|
|
44
|
+
* methods = registry.list()
|
|
45
|
+
* byMethod = retriever.retrieveWithDiagnostics(methods, query, options)
|
|
46
|
+
* filtered = filter.filter(byMethod, methods, ctx, options.scope)
|
|
47
|
+
* merged = merger.merge(filtered, { topK, dedup: true })
|
|
48
|
+
* → { results: merged, diagnostics }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Exposes two paths:
|
|
52
|
+
* 1. `retrieve(query, options?)` — merged results + diagnostics (the standard
|
|
53
|
+
* pipeline).
|
|
54
|
+
* 2. `retrieveByMethod(query, options?)` — per-method results (unmerged) with
|
|
55
|
+
* diagnostics, for callers that need the raw per-method view.
|
|
56
|
+
*
|
|
57
|
+
* The engine does NOT handle refresh lifecycle, MinSync sync, Jikji, or
|
|
58
|
+
* agent-level concerns. It is purely the retrieval composition seam.
|
|
59
|
+
*/
|
|
60
|
+
export declare class RetrievalEngine {
|
|
61
|
+
private readonly registry;
|
|
62
|
+
private readonly retriever;
|
|
63
|
+
private readonly filter;
|
|
64
|
+
private readonly merger;
|
|
65
|
+
private readonly accessContext;
|
|
66
|
+
private readonly defaultTopK;
|
|
67
|
+
private readonly defaultDedup;
|
|
68
|
+
private readonly isMinSyncBinaryMissing;
|
|
69
|
+
constructor(options?: RetrievalEngineOptions);
|
|
70
|
+
/** The underlying method registry. Intentionally public for tooling. */
|
|
71
|
+
getMethodRegistry(): RetrievalMethodRegistry;
|
|
72
|
+
/** The underlying datasource access context. Read-only for inspection. */
|
|
73
|
+
getAccessContext(): DatasourceAccessContext;
|
|
74
|
+
/**
|
|
75
|
+
* Register a retrieval method. Overrides the registered-once check from
|
|
76
|
+
* {@link RetrievalMethodRegistry} per caller requirement.
|
|
77
|
+
*
|
|
78
|
+
* @throws {Error} if a method with the same name is already registered.
|
|
79
|
+
*/
|
|
80
|
+
register(method: RetrievalMethod): void;
|
|
81
|
+
/**
|
|
82
|
+
* Register multiple methods in one call. Stop-on-first-error semantics:
|
|
83
|
+
* registration fails atomically if any method conflicts with an already-
|
|
84
|
+
* registered name; earlier methods in the batch are not retained.
|
|
85
|
+
*
|
|
86
|
+
* @throws {Error} if any method name duplicates an existing or in-batch registration.
|
|
87
|
+
*/
|
|
88
|
+
registerMany(methods: readonly RetrievalMethod[]): void;
|
|
89
|
+
/**
|
|
90
|
+
* Run the full retrieval pipeline — parallel retrieve, datasource filter,
|
|
91
|
+
* merge — and return merged results with diagnostics.
|
|
92
|
+
*/
|
|
93
|
+
retrieve(query: string, options?: RetrievalOptions): Promise<{
|
|
94
|
+
results: RetrievalResult[];
|
|
95
|
+
diagnostics: RetrievalDiagnostic[];
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Run retrieval and return results keyed per method (unmerged) with
|
|
99
|
+
* diagnostics. Unlike {@link retrieve}, this does NOT merge or sort —
|
|
100
|
+
* callers get the raw per-method view after datasource filtering.
|
|
101
|
+
*/
|
|
102
|
+
retrieveByMethod(query: string, options?: RetrievalOptions): Promise<{
|
|
103
|
+
byMethod: Map<string, RetrievalResult[]>;
|
|
104
|
+
diagnostics: RetrievalDiagnostic[];
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Post-check for MinSync binary-missing diagnostic.
|
|
108
|
+
*
|
|
109
|
+
* When a registered method named `"minsync"` fails to throw (the method returns
|
|
110
|
+
* `[]` because the binary is missing), {@link ParallelRetriever} cannot record
|
|
111
|
+
* a diagnostic. This method checks whether the minsync binary is unavailable
|
|
112
|
+
* and emits a `minsync-unavailable` diagnostic when every minsync method's
|
|
113
|
+
* result set is empty, exactly matching the existing {@link AutoRAGAgent}
|
|
114
|
+
* behavior (see `agent.src/agent/agent.ts` `retrieveWithDiagnostics`).
|
|
115
|
+
*/
|
|
116
|
+
private appendMinSyncUnavailableDiagnostic;
|
|
117
|
+
/**
|
|
118
|
+
* Build a datasource access context scoped to the caller's options.
|
|
119
|
+
* Model/tool arguments (allowedTags, allowedScopes) from options can only
|
|
120
|
+
* further restrict the trusted context, never widen it.
|
|
121
|
+
*/
|
|
122
|
+
private accessContextFor;
|
|
123
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
export { RetrievalEngine, type RetrievalEngineOptions } from "./engine.js";
|
|
1
2
|
export type { MergeOptions } from "./merger.js";
|
|
2
3
|
export { ParallelRetriever, ResultMerger } from "./merger.js";
|
|
3
|
-
export type { BM25Engine, BM25ReadinessState, BM25Status, BM25SyncResult } from "./methods/bm25.js";
|
|
4
|
-
export { BM25_SUBDIR, BM25UnavailableError, hasLegacyBm25Artifacts, removeLegacyBm25Artifacts, } from "./methods/bm25.js";
|
|
5
4
|
export { RetrievalMethodRegistry } from "./registry.js";
|
|
6
5
|
export { matchesVirtualPathScope, normalizeVirtualPath, normalizeVirtualPathScope, virtualPathScopeToRegExp, } from "./scope.js";
|
|
7
6
|
export type { CuratedResult, NumberedResult, RetrievalDiagnostic, RetrievalDiagnosticCode, RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult, RetrievalWithDiagnostics, } from "./types.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { RetrievalMethod } from "./types.js";
|
|
1
|
+
import type { RetrievalMethod, RetrievalMethodDescriptor } from "./types.js";
|
|
2
2
|
export declare class RetrievalMethodRegistry {
|
|
3
3
|
private readonly methods;
|
|
4
4
|
register(method: RetrievalMethod): void;
|
|
5
5
|
get(name: string): RetrievalMethod | undefined;
|
|
6
6
|
list(): RetrievalMethod[];
|
|
7
|
-
getByType(type: "
|
|
7
|
+
getByType(type: RetrievalMethodDescriptor["type"]): RetrievalMethod[];
|
|
8
8
|
}
|
|
@@ -26,7 +26,7 @@ export interface RetrievalMethod {
|
|
|
26
26
|
describe(): RetrievalMethodDescriptor;
|
|
27
27
|
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
28
28
|
}
|
|
29
|
-
export type RetrievalDiagnosticCode = "retrieval-method-failed" | "minsync-unavailable"
|
|
29
|
+
export type RetrievalDiagnosticCode = "retrieval-method-failed" | "minsync-unavailable";
|
|
30
30
|
/** Path-opaque diagnostic emitted by the multi-method retrieval pipeline. */
|
|
31
31
|
export interface RetrievalDiagnostic {
|
|
32
32
|
code: RetrievalDiagnosticCode;
|
package/dist/ui/discover.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export type DiscoverRun = (binary: string, args: readonly string[]) => Promise<{
|
|
|
11
11
|
stdout: string;
|
|
12
12
|
}>;
|
|
13
13
|
export declare function listRcloneRemotes(run?: DiscoverRun): Promise<readonly Choice[]>;
|
|
14
|
-
export declare function listMailAccounts(run?: DiscoverRun): Promise<readonly Choice[]>;
|
|
15
|
-
export declare function listHimalayaAccounts(run?: DiscoverRun): Promise<readonly Choice[]>;
|
|
16
14
|
export declare function choicesForType(type: string, run?: DiscoverRun): Promise<{
|
|
17
15
|
rcloneRemotes: readonly Choice[];
|
|
18
16
|
mailAccounts: readonly Choice[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorag/librarian",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
".": {
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./core": {
|
|
19
|
+
"types": "./dist/core.d.ts",
|
|
20
|
+
"default": "./dist/core.js"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"bin": {
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
"access": "public"
|
|
29
33
|
},
|
|
30
34
|
"scripts": {
|
|
31
|
-
"build": "bun build src/index.ts src/cli/index.ts --outdir dist --target node --packages external && tsc -p tsconfig.build.json && node scripts/fixup-dts.mjs",
|
|
35
|
+
"build": "bun build src/index.ts src/core.ts src/cli/index.ts --outdir dist --target node --packages external && tsc -p tsconfig.build.json && node scripts/fixup-dts.mjs",
|
|
32
36
|
"prepublishOnly": "bun run typecheck && bun run build",
|
|
33
37
|
"prepare": "bun run build",
|
|
34
38
|
"test": "node scripts/run-test-files.mjs",
|
package/skills/autorag/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@ summarize, compare, or answer questions from local PDFs, wikis, notes, research
|
|
|
11
11
|
papers, knowledge bases, or authorized datasources.
|
|
12
12
|
|
|
13
13
|
AutoRAG is the specialized librarian agent. One configured model plans the
|
|
14
|
-
search, calls
|
|
14
|
+
search, calls MinSync, Jikji, datasource, and filesystem tools, reads
|
|
15
15
|
sources, judges evidence, and curates the final answer. There is no subagent or
|
|
16
16
|
separate model role.
|
|
17
17
|
|
|
@@ -46,7 +46,7 @@ checks credential presence, and normally probes one live completion. If the
|
|
|
46
46
|
model, authentication, configuration, or indexes are unhealthy, use
|
|
47
47
|
`autorag-setup` rather than guessing private provider details.
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
MinSync and Jikji should normally be healthy. MinSync and Jikji
|
|
50
50
|
auto-install on first use by default. If they are missing or stale, run a full
|
|
51
51
|
`autorag refresh` or return to setup rather than silently degrading to
|
|
52
52
|
lexical-only search.
|
|
@@ -65,15 +65,28 @@ autorag search "what were the key findings in the Q3 report" --top-k 5 --json --
|
|
|
65
65
|
`summary`, optional `source`), and `sessionId`. Use that `sessionId` for
|
|
66
66
|
feedback. `--json` without `--debug` is only `answer` plus `results`.
|
|
67
67
|
|
|
68
|
+
To inspect the exact persisted evidence behind numbered results, use:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
autorag evidence <sessionId> --result 1 --json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The response includes the original source, retrieval method, stable evidence
|
|
75
|
+
ID, raw excerpt/content, and any available `chunkIndex`, `lineNumber`,
|
|
76
|
+
`retrievalResultId`, and metadata. Omit `--result` to inspect every result in
|
|
77
|
+
the session. Prefer this command whenever the caller wants detailed chunk text
|
|
78
|
+
rather than only the curated summary.
|
|
79
|
+
|
|
68
80
|
- `--scope` narrows datasource retrieval to a requested sub-path; it cannot
|
|
69
81
|
grant access.
|
|
70
82
|
- `--tags` further narrows already-authorized datasource results and never
|
|
71
83
|
grants new access.
|
|
72
84
|
- `--json` is required for programmatic consumption.
|
|
73
|
-
- `--debug` is required for `sessionId
|
|
85
|
+
- `--debug` is required for `sessionId` and diagnostics in search output.
|
|
86
|
+
- `autorag evidence` is the detailed source/chunk inspection path.
|
|
74
87
|
|
|
75
88
|
Do not bypass the librarian with ad hoc raw search when the user requested
|
|
76
|
-
AutoRAG. The search loop can use Jikji,
|
|
89
|
+
AutoRAG. The search loop can use Jikji, MinSync lexical/vector/hybrid retrieval, datasource retrieval, and
|
|
77
90
|
direct source reading as appropriate. If search fails because of model,
|
|
78
91
|
provider, auth, or timeout problems, diagnose with `autorag health --json`.
|
|
79
92
|
|
|
@@ -99,9 +112,9 @@ autorag index reset --method bm25 --yes --json
|
|
|
99
112
|
autorag memory inspect --json
|
|
100
113
|
```
|
|
101
114
|
|
|
102
|
-
Prefer a full refresh so parsed mirrors,
|
|
115
|
+
Prefer a full refresh so parsed mirrors, MinSync, Jikji, and configured
|
|
103
116
|
datasources stay aligned. `--method` accepts
|
|
104
|
-
`parsed,
|
|
117
|
+
`parsed,minsync,datasources,jikji,all`. Use it only for deliberate
|
|
105
118
|
narrowing. Scheduled maintenance should use non-daemon `autorag watch --once`,
|
|
106
119
|
typically every 15–30 minutes, with the same config used by search and no
|
|
107
120
|
overlapping runs.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autorag-lite-search
|
|
3
|
+
description: Retrieve documents from an indexed AutoRAG Lite corpus without a model, then persist externally curated reports, inspect evidence, and record numbered feedback. Use when the user wants model-free search, scoped or tag-narrowed retrieval, or the report/evidence/feedback workflow over local documents and authorized datasources.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AutoRAG Lite search
|
|
8
|
+
|
|
9
|
+
Use this skill when AutoRAG Lite is already configured and indexed, and the
|
|
10
|
+
user wants model-free retrieval, or wants to persist an externally curated
|
|
11
|
+
report, inspect its evidence, or record feedback. Use `autorag-lite-setup`
|
|
12
|
+
when config, indexing, or refresh is missing or broken. Use the `autorag`
|
|
13
|
+
skill when a model-backed curated answer is requested.
|
|
14
|
+
|
|
15
|
+
AutoRAG Lite never mutates sources. Retrieval reads local source documents and
|
|
16
|
+
authorized datasource content; writes go only to workspace `.autorag/` indexes,
|
|
17
|
+
the memory file, and Jikji `.jikji/` caches.
|
|
18
|
+
|
|
19
|
+
## Preflight
|
|
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:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
autorag lite status --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`status` is model-free and path-opaque.
|
|
30
|
+
|
|
31
|
+
## Retrieve
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
autorag lite retrieve "key findings in the Q3 report" --top-k 5 --json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The JSON envelope is:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"ok": true,
|
|
42
|
+
"query": "key findings in the Q3 report",
|
|
43
|
+
"results": [
|
|
44
|
+
{
|
|
45
|
+
"number": 1,
|
|
46
|
+
"source": "<opaque source identifier>",
|
|
47
|
+
"method": "minsync",
|
|
48
|
+
"score": 0.83,
|
|
49
|
+
"metadata": {},
|
|
50
|
+
"content": "..."
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"diagnostics": []
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- `--top-k N` must be a positive integer. Invalid values exit with code 2 and
|
|
58
|
+
an `{"ok": false, "error": "..."}` rejection envelope.
|
|
59
|
+
- Before any refresh, the envelope is `{"ok": false, "query": ..., "diagnostics":
|
|
60
|
+
[{"code": "index-not-ready", "severity": "error", ...}]}` with exit code 2.
|
|
61
|
+
- Each result carries a provenance pair: the `source` identity and the
|
|
62
|
+
`method` that produced it. Source identities are source-native: real file
|
|
63
|
+
paths for local files, datasource identities for datasource results. Never
|
|
64
|
+
rewrite, guess, or flatten them.
|
|
65
|
+
- `diagnostics` are path-opaque: `source` is a component or method label,
|
|
66
|
+
never a real filesystem path. Codes include `retrieval-method-failed` and
|
|
67
|
+
`minsync-unavailable`. A degraded component produces a diagnostic, not a
|
|
68
|
+
failed run; check `diagnostics` before trusting an empty result set.
|
|
69
|
+
- `--debug` adds diagnostic detail to human output without printing real
|
|
70
|
+
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.
|
|
73
|
+
|
|
74
|
+
Retrieval methods run in parallel and merge: parsed mirrors and MinSync
|
|
75
|
+
lexical/vector/hybrid methods, plus configured datasource methods. Jikji is a
|
|
76
|
+
local discovery/indexing preparer, not a retrieval method in the lite registry.
|
|
77
|
+
`--method` selection applies to refresh, not retrieve; retrieval always queries
|
|
78
|
+
every active retrieval method.
|
|
79
|
+
|
|
80
|
+
## Scope and tag narrowing (default-deny)
|
|
81
|
+
|
|
82
|
+
Datasource access is default-deny from trusted config
|
|
83
|
+
(`datasourceAccess.allowedTags`, `allowedScopes`). Retrieval flags can only
|
|
84
|
+
narrow that access, never widen it:
|
|
85
|
+
|
|
86
|
+
- `--scope SCOPE` narrows datasource retrieval to a requested sub-path; it
|
|
87
|
+
cannot grant access to anything the config does not already allow.
|
|
88
|
+
- `--tags tag1,tag2` further narrows already-authorized datasource results by
|
|
89
|
+
intersecting with configured allowed tags; it never grants new access.
|
|
90
|
+
|
|
91
|
+
## Persisting a curated report
|
|
92
|
+
|
|
93
|
+
An external agent curates the raw retrieval results, then persists the
|
|
94
|
+
structured report so evidence and feedback commands work against it:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
autorag lite report "key findings in the Q3 report" --input report.json --json
|
|
98
|
+
cat report.json | autorag lite report "key findings in the Q3 report" --json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The input is the `emit_autorag_results` JSON schema: `answer`, numbered
|
|
102
|
+
`results` (with `number`, `title`, `summary`, `confidence` in `[0, 1]`,
|
|
103
|
+
optional `source`), and a `mapping` whose entries map each result number to
|
|
104
|
+
its `method` and `source`, plus optional `evidenceRefs` and `warnings`.
|
|
105
|
+
Result and mapping numbers must be one-to-one positive integers. Evidence
|
|
106
|
+
confidence values must be in `[0, 1]`. Invalid input exits with code 2 and
|
|
107
|
+
`{"ok": false, "error": "..."}`.
|
|
108
|
+
|
|
109
|
+
`source` values in a report are opaque identifiers carried from retrieval
|
|
110
|
+
output. Report persistence performs no filesystem reads against them; it
|
|
111
|
+
stores the identifiers as given. Preserve the exact source-native identities
|
|
112
|
+
from the retrieve envelope.
|
|
113
|
+
|
|
114
|
+
On success the JSON envelope is:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"ok": true,
|
|
119
|
+
"sessionId": "<uuid>",
|
|
120
|
+
"query": "key findings in the Q3 report",
|
|
121
|
+
"answer": "...",
|
|
122
|
+
"resultCount": 3
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Use the returned `sessionId` for evidence inspection and feedback.
|
|
127
|
+
|
|
128
|
+
## Evidence and feedback
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
autorag evidence <sessionId> --result 1 --json
|
|
132
|
+
autorag feedback <sessionId> --useful 1,3 --not-useful 2 --json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- `evidence` shows the persisted source, retrieval method, stable evidence ID,
|
|
136
|
+
excerpt or content, and any `chunkIndex`, `lineNumber`, and
|
|
137
|
+
`retrievalResultId` behind a numbered result. Omit `--result` to inspect the
|
|
138
|
+
whole session.
|
|
139
|
+
- `feedback` records numbered usefulness so retrieval memory can learn.
|
|
140
|
+
Numbers refer to the report's result numbers. Supply at least one feedback
|
|
141
|
+
list.
|
|
142
|
+
- Preserve real source mapping and numbered identifiers end to end: retrieve
|
|
143
|
+
output feeds the report, the report's session feeds evidence and feedback.
|
|
144
|
+
|
|
145
|
+
## Rules
|
|
146
|
+
|
|
147
|
+
- Refresh before retrieval; refresh again when roots change.
|
|
148
|
+
- Use only configured and approved search paths and datasources.
|
|
149
|
+
- Never move, rename, edit, or delete source documents.
|
|
150
|
+
- Never expose provider credentials or authentication payloads.
|
|
151
|
+
- Treat report `source` values as opaque: persist them verbatim, never read
|
|
152
|
+
the filesystem through them.
|
|
153
|
+
- Keep diagnostics path-opaque; do not reconstruct or disclose real paths
|
|
154
|
+
from them.
|
|
155
|
+
- Prefer `--json` whenever another agent consumes the output.
|