@autorag/librarian 2.3.0 → 2.4.0
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 +119 -14
- package/dist/agent/agent.d.ts +19 -7
- package/dist/agent/bash-tool.d.ts +2 -0
- package/dist/agent/search-bm25-tool.d.ts +11 -3
- package/dist/agent/search-documents.d.ts +2 -2
- package/dist/agent/search-minsync-tool.d.ts +2 -2
- package/dist/cli/commands/index.d.ts +3 -3
- package/dist/cli/commands/tui.d.ts +36 -0
- package/dist/cli/commands/ui.d.ts +13 -0
- package/dist/cli/config.d.ts +17 -8
- package/dist/cli/index.js +14474 -10610
- package/dist/cli/tui-commands.d.ts +16 -0
- package/dist/cli/tui-session-store.d.ts +16 -0
- package/dist/datasource/access-context.d.ts +6 -12
- package/dist/datasource/crawler-types.d.ts +2 -0
- package/dist/datasource/described-skill.d.ts +17 -0
- package/dist/datasource/index.d.ts +3 -3
- package/dist/datasource/result-filter.d.ts +2 -1
- package/dist/datasource/skills/clawgallery/client.d.ts +9 -0
- package/dist/datasource/skills/clawgallery/index.d.ts +5 -0
- package/dist/datasource/skills/clawgallery/methods.d.ts +19 -0
- package/dist/datasource/skills/clawgallery/paths.d.ts +7 -0
- package/dist/datasource/skills/clawgallery/skill.d.ts +35 -0
- package/dist/datasource/skills/clawgallery/types.d.ts +58 -0
- package/dist/datasource/skills/cloud-drive/index.d.ts +1 -0
- package/dist/datasource/skills/{gdrive → cloud-drive}/rclone-connector.d.ts +4 -0
- package/dist/datasource/skills/cloud-drive/skill.d.ts +1 -1
- package/dist/datasource/skills/discrawl/types.d.ts +4 -8
- package/dist/datasource/skills/factory.d.ts +2 -0
- package/dist/datasource/skills/gmail/himalaya-connector.d.ts +12 -1
- package/dist/datasource/skills/katok/methods.d.ts +6 -4
- package/dist/datasource/skills/katok/types.d.ts +8 -26
- package/dist/datasource/skills/mailcrawl/client.d.ts +15 -0
- package/dist/datasource/skills/mailcrawl/config.d.ts +2 -0
- package/dist/datasource/skills/mailcrawl/index.d.ts +4 -0
- package/dist/datasource/skills/mailcrawl/methods.d.ts +15 -0
- package/dist/datasource/skills/mailcrawl/skill.d.ts +34 -0
- package/dist/datasource/skills/mailcrawl/types.d.ts +71 -0
- package/dist/datasource/skills/obsidian/skill.d.ts +1 -0
- package/dist/datasource/skills/obsidian/types.d.ts +2 -0
- package/dist/datasource/types.d.ts +5 -2
- package/dist/filesystem/cloud-placeholder.d.ts +26 -0
- package/dist/index.js +2463 -1048
- package/dist/jikji/client.d.ts +1 -0
- package/dist/minsync/client.d.ts +5 -1
- package/dist/minsync/embedder-config.d.ts +4 -1
- package/dist/minsync/index.d.ts +4 -4
- package/dist/minsync/installer.d.ts +1 -0
- package/dist/minsync/method.d.ts +22 -1
- package/dist/minsync/types.d.ts +5 -0
- package/dist/mirror/sync.d.ts +1 -1
- package/dist/parser/defaults.d.ts +2 -0
- package/dist/parser/index.d.ts +2 -2
- package/dist/parser/opendataloader-pdf.d.ts +10 -0
- package/dist/parser/types.d.ts +7 -0
- package/dist/retrieval/index.d.ts +2 -2
- package/dist/retrieval/methods/bm25.d.ts +7 -36
- package/dist/ui/browse.d.ts +11 -0
- package/dist/ui/catalog.d.ts +59 -0
- package/dist/ui/config-store.d.ts +43 -0
- package/dist/ui/discover.d.ts +19 -0
- package/dist/ui/html.d.ts +2 -0
- package/dist/ui/probe.d.ts +24 -0
- package/dist/ui/prompt.d.ts +21 -0
- package/dist/ui/server.d.ts +28 -0
- package/package.json +13 -12
- package/skills/autorag/SKILL.md +48 -40
- package/skills/autorag-setup/SKILL.md +67 -36
- package/dist/datasource/skills/discrawl/config.d.ts +0 -9
- package/dist/datasource/skills/gdrive/connector.d.ts +0 -30
- package/dist/datasource/skills/gdrive/index.d.ts +0 -3
- package/dist/datasource/skills/gdrive/skill.d.ts +0 -24
package/dist/jikji/client.d.ts
CHANGED
package/dist/minsync/client.d.ts
CHANGED
|
@@ -3,12 +3,16 @@ export interface MinSyncClientOptions {
|
|
|
3
3
|
readonly binaryPath: string;
|
|
4
4
|
readonly workspacePath: string;
|
|
5
5
|
readonly embedder?: MinSyncEmbedderConfig;
|
|
6
|
+
readonly maxChunkSize?: number;
|
|
6
7
|
}
|
|
8
|
+
export type MinSyncQueryMode = "vector" | "bm25" | "hybrid";
|
|
7
9
|
export declare class MinSyncClient {
|
|
8
10
|
private readonly binaryPath;
|
|
9
11
|
private readonly workspacePath;
|
|
10
12
|
private readonly embedder;
|
|
13
|
+
private readonly maxChunkSize;
|
|
11
14
|
constructor(options: MinSyncClientOptions);
|
|
12
15
|
sync(): Promise<MinSyncSyncResult>;
|
|
13
|
-
query(text: string, topK: number): Promise<readonly MinSyncQueryHit[]>;
|
|
16
|
+
query(text: string, topK: number, mode?: MinSyncQueryMode): Promise<readonly MinSyncQueryHit[]>;
|
|
17
|
+
private spawn;
|
|
14
18
|
}
|
|
@@ -7,6 +7,7 @@ import type { MinSyncEmbedderConfig } from "./types.js";
|
|
|
7
7
|
export declare const MINSYNC_CONFIG_DIR = ".minsync";
|
|
8
8
|
export declare const MINSYNC_CONFIG_FILE = "config.toml";
|
|
9
9
|
export declare function minSyncConfigPath(workspacePath: string): string;
|
|
10
|
+
export declare function configuredMaxChunkSize(workspacePath: string): number | undefined;
|
|
10
11
|
/**
|
|
11
12
|
* Atomically rewrite allowlisted embedder fields in MinSync config.toml.
|
|
12
13
|
* Reads the existing file, merges the allowlisted fields from `embedder`,
|
|
@@ -19,4 +20,6 @@ export declare function minSyncConfigPath(workspacePath: string): string;
|
|
|
19
20
|
*
|
|
20
21
|
* Returns true if the file was rewritten, false if the file does not exist.
|
|
21
22
|
*/
|
|
22
|
-
export declare function rewriteEmbedderConfig(workspacePath: string, embedder: MinSyncEmbedderConfig
|
|
23
|
+
export declare function rewriteEmbedderConfig(workspacePath: string, embedder: MinSyncEmbedderConfig, chunkerConfig?: {
|
|
24
|
+
readonly maxChunkSize?: number;
|
|
25
|
+
}): boolean;
|
package/dist/minsync/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { MinSyncClient, type MinSyncClientOptions } from "./client.js";
|
|
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
|
-
export { type EnsureMinSyncBinaryOptions, ensureMinSyncBinary, executableName, fetchLatestMinSyncRelease, type InstalledMinSyncBinary, type MinSyncRelease, type MinSyncReleaseAsset, MinSyncReleaseError, selectReleaseAsset, } from "./installer.js";
|
|
4
|
-
export { MinSyncVectorMethod, type MinSyncVectorMethodOptions } from "./method.js";
|
|
3
|
+
export { type EnsureMinSyncBinaryOptions, ensureMinSyncBinary, executableName, fetchLatestMinSyncRelease, type InstalledMinSyncBinary, MINSYNC_VERSION, type MinSyncRelease, type MinSyncReleaseAsset, MinSyncReleaseError, selectReleaseAsset, } from "./installer.js";
|
|
4
|
+
export { MinSyncBM25Method, type MinSyncBM25MethodOptions, MinSyncHybridMethod, type MinSyncHybridMethodOptions, MinSyncVectorMethod, type MinSyncVectorMethodOptions, } from "./method.js";
|
|
5
5
|
export { MINSYNC_FILES_SUBDIR, MINSYNC_SUBDIR, minSyncDocumentPath, minSyncWorkspaceRoot } from "./paths.js";
|
|
6
|
-
export type { MinSyncEmbedderConfig, MinSyncOptions, MinSyncQueryHit, MinSyncSyncResult } from "./types.js";
|
|
6
|
+
export type { MinSyncChunkerConfig, MinSyncEmbedderConfig, MinSyncOptions, MinSyncQueryHit, MinSyncSyncResult, } from "./types.js";
|
|
7
7
|
export { buildMinSyncPathMap, type MinSyncWorkspaceEntry, type MinSyncWorkspaceSyncResult, syncMinSyncWorkspace, } from "./workspace.js";
|
package/dist/minsync/method.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type BM25Status, type BM25SyncResult } from "../retrieval/methods/bm25.js";
|
|
1
2
|
import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
|
|
3
|
+
import type { MinSyncQueryMode } from "./client.js";
|
|
2
4
|
import { type EnsureMinSyncBinaryOptions } from "./installer.js";
|
|
3
5
|
import type { MinSyncEmbedderConfig, MinSyncSyncResult } from "./types.js";
|
|
4
6
|
export interface MinSyncVectorMethodOptions {
|
|
@@ -8,7 +10,11 @@ export interface MinSyncVectorMethodOptions {
|
|
|
8
10
|
readonly installer?: Omit<EnsureMinSyncBinaryOptions, "root">;
|
|
9
11
|
readonly autoInstall?: boolean;
|
|
10
12
|
readonly embedder?: MinSyncEmbedderConfig;
|
|
13
|
+
readonly maxChunkSize?: number;
|
|
14
|
+
readonly mode?: MinSyncQueryMode;
|
|
11
15
|
}
|
|
16
|
+
export type MinSyncBM25MethodOptions = Omit<MinSyncVectorMethodOptions, "mode">;
|
|
17
|
+
export type MinSyncHybridMethodOptions = Omit<MinSyncVectorMethodOptions, "mode">;
|
|
12
18
|
export declare class MinSyncVectorMethod implements RetrievalMethod {
|
|
13
19
|
private readonly root;
|
|
14
20
|
private readonly binaryPath;
|
|
@@ -16,6 +22,8 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
|
|
|
16
22
|
private readonly installer;
|
|
17
23
|
private readonly autoInstall;
|
|
18
24
|
private readonly embedder;
|
|
25
|
+
private readonly maxChunkSize;
|
|
26
|
+
private readonly mode;
|
|
19
27
|
constructor(options: MinSyncVectorMethodOptions);
|
|
20
28
|
describe(): RetrievalMethodDescriptor;
|
|
21
29
|
sync(): Promise<MinSyncSyncResult>;
|
|
@@ -33,5 +41,18 @@ export declare class MinSyncVectorMethod implements RetrievalMethod {
|
|
|
33
41
|
* Returns: string path on success, undefined for missing-binary, or a MinSyncSyncResult
|
|
34
42
|
* for install-failed.
|
|
35
43
|
*/
|
|
36
|
-
|
|
44
|
+
protected resolveBinary(): Promise<string | undefined | MinSyncSyncResult>;
|
|
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
|
+
export declare class MinSyncHybridMethod extends MinSyncVectorMethod {
|
|
56
|
+
constructor(options: MinSyncHybridMethodOptions);
|
|
57
|
+
describe(): RetrievalMethodDescriptor;
|
|
37
58
|
}
|
package/dist/minsync/types.d.ts
CHANGED
|
@@ -13,12 +13,17 @@ export interface MinSyncEmbedderConfig {
|
|
|
13
13
|
readonly maxRetries?: number;
|
|
14
14
|
readonly maxConcurrent?: number;
|
|
15
15
|
}
|
|
16
|
+
/** MinSync chunker settings exposed by AutoRAG's public configuration. */
|
|
17
|
+
export interface MinSyncChunkerConfig {
|
|
18
|
+
readonly maxChunkSize?: number;
|
|
19
|
+
}
|
|
16
20
|
export interface MinSyncOptions {
|
|
17
21
|
readonly root: string;
|
|
18
22
|
readonly binaryPath?: string;
|
|
19
23
|
readonly workspacePath?: string;
|
|
20
24
|
readonly autoInstall?: boolean;
|
|
21
25
|
readonly embedder?: MinSyncEmbedderConfig;
|
|
26
|
+
readonly maxChunkSize?: number;
|
|
22
27
|
}
|
|
23
28
|
export interface MinSyncSyncResult {
|
|
24
29
|
readonly ok: boolean;
|
package/dist/mirror/sync.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface ParsedMirrorSyncOptions {
|
|
|
13
13
|
/** Absolute source paths omitted from parsed mirrors (for example exact duplicate copies). */
|
|
14
14
|
readonly excludeSourcePaths?: ReadonlySet<string>;
|
|
15
15
|
}
|
|
16
|
-
export type ParsedMirrorDiagnosticCode = "unsupported-file" | "parser-skipped" | "parser-failed" | "duplicate-excluded" | "deleted-mirror" | "stale-index";
|
|
16
|
+
export type ParsedMirrorDiagnosticCode = "unsupported-file" | "parser-skipped" | "parser-failed" | "pdf-java-version" | "duplicate-excluded" | "deleted-mirror" | "stale-index" | "pdf-extract-thin" | "pdf-hybrid-unavailable";
|
|
17
17
|
/** Path-opaque refresh diagnostic. `source` is an opaque virtual path, never a real fs path. */
|
|
18
18
|
export interface ParsedMirrorDiagnostic {
|
|
19
19
|
readonly code: ParsedMirrorDiagnosticCode;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type HwpParserOptions } from "./hwp.js";
|
|
2
2
|
import { type OcrParserOptions } from "./ocr.js";
|
|
3
|
+
import { type OpendataloaderPdfParserOptions } from "./opendataloader-pdf.js";
|
|
3
4
|
import { ParserRegistry } from "./registry.js";
|
|
4
5
|
export interface DefaultParserRegistryOptions {
|
|
5
6
|
readonly ocr?: OcrParserOptions;
|
|
6
7
|
readonly hwp?: HwpParserOptions;
|
|
8
|
+
readonly thinExtract?: OpendataloaderPdfParserOptions["thinExtract"];
|
|
7
9
|
}
|
|
8
10
|
export declare function createDefaultParserRegistry(options?: DefaultParserRegistryOptions): ParserRegistry;
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export { ParseError } from "./errors.js";
|
|
|
4
4
|
export { HwpParser, type HwpParserOptions } from "./hwp.js";
|
|
5
5
|
export { ImageOcrParser, type OcrEngine, type OcrEngineInput, type OcrParserOptions } from "./ocr.js";
|
|
6
6
|
export { DocxParser, PptxParser, XlsxParser } from "./office.js";
|
|
7
|
-
export { OpendataloaderPdfParser, type PdfConverter } from "./opendataloader-pdf.js";
|
|
7
|
+
export { OpendataloaderPdfParser, type OpendataloaderPdfParserOptions, type PdfConverter, } from "./opendataloader-pdf.js";
|
|
8
8
|
export { PlainTextParser } from "./plain-text.js";
|
|
9
9
|
export { ParserRegistry } from "./registry.js";
|
|
10
10
|
export type { HwpExtractionLimits, HwpExtractor } from "./rhwp-adapter.js";
|
|
11
|
-
export { type ParseInput, type ParseOutput, Parser } from "./types.js";
|
|
11
|
+
export { type ParseDiagnostic, type ParseDiagnosticCode, type ParseInput, type ParseOutput, Parser, } from "./types.js";
|
|
@@ -10,6 +10,16 @@ export interface OpendataloaderPdfParserOptions {
|
|
|
10
10
|
readonly hybridMode?: string;
|
|
11
11
|
readonly maxBytes?: number;
|
|
12
12
|
};
|
|
13
|
+
/** Quality gate for multi-page PDFs whose local markdown yield is abnormally thin. */
|
|
14
|
+
readonly thinExtract?: {
|
|
15
|
+
readonly enabled?: boolean;
|
|
16
|
+
readonly minPages?: number;
|
|
17
|
+
readonly minChars?: number;
|
|
18
|
+
readonly minCharsPerPage?: number;
|
|
19
|
+
readonly timeoutMs?: number;
|
|
20
|
+
readonly hybrid?: string;
|
|
21
|
+
readonly hybridMode?: string;
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
export declare class OpendataloaderPdfParser extends Parser {
|
|
15
25
|
readonly name = "opendataloader-pdf";
|
package/dist/parser/types.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export interface ParseInput {
|
|
|
6
6
|
export interface ParseOutput {
|
|
7
7
|
readonly markdown: string;
|
|
8
8
|
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
9
|
+
readonly diagnostics?: readonly ParseDiagnostic[];
|
|
10
|
+
}
|
|
11
|
+
export type ParseDiagnosticCode = "pdf-extract-thin" | "pdf-hybrid-unavailable";
|
|
12
|
+
export interface ParseDiagnostic {
|
|
13
|
+
readonly code: ParseDiagnosticCode;
|
|
14
|
+
readonly severity: "warning";
|
|
15
|
+
readonly message: string;
|
|
9
16
|
}
|
|
10
17
|
export declare abstract class Parser {
|
|
11
18
|
abstract readonly name: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { MergeOptions } from "./merger.js";
|
|
2
2
|
export { ParallelRetriever, ResultMerger } from "./merger.js";
|
|
3
|
-
export type { BM25Engine,
|
|
4
|
-
export {
|
|
3
|
+
export type { BM25Engine, BM25ReadinessState, BM25Status, BM25SyncResult } from "./methods/bm25.js";
|
|
4
|
+
export { BM25_SUBDIR, BM25UnavailableError, hasLegacyBm25Artifacts, removeLegacyBm25Artifacts, } from "./methods/bm25.js";
|
|
5
5
|
export { RetrievalMethodRegistry } from "./registry.js";
|
|
6
6
|
export { matchesVirtualPathScope, normalizeVirtualPath, normalizeVirtualPathScope, virtualPathScopeToRegExp, } from "./scope.js";
|
|
7
7
|
export type { CuratedResult, NumberedResult, RetrievalDiagnostic, RetrievalDiagnosticCode, RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult, RetrievalWithDiagnostics, } from "./types.js";
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type BM25Engine = "
|
|
4
|
-
export type BM25FallbackMode = "typescript" | "disabled";
|
|
5
|
-
export interface BM25MethodOptions {
|
|
6
|
-
readonly root: string;
|
|
7
|
-
readonly indexPath?: string;
|
|
8
|
-
readonly enabled?: boolean;
|
|
9
|
-
readonly fallback?: BM25FallbackMode;
|
|
10
|
-
readonly forceEngine?: Exclude<BM25Engine, "none">;
|
|
11
|
-
readonly importBinding?: () => Promise<TantivyBinding>;
|
|
12
|
-
}
|
|
1
|
+
export type BM25ReadinessState = "disabled" | "dependency_unavailable" | "index_missing" | "indexing" | "ready" | "error";
|
|
2
|
+
/** Local BM25 is always MinSync-backed when enabled. */
|
|
3
|
+
export type BM25Engine = "minsync" | "none";
|
|
13
4
|
export interface BM25SyncResult {
|
|
14
5
|
readonly indexPath: string;
|
|
15
6
|
readonly indexedChunks: number;
|
|
@@ -21,32 +12,12 @@ export interface BM25Status {
|
|
|
21
12
|
readonly engine: BM25Engine;
|
|
22
13
|
readonly message?: string;
|
|
23
14
|
}
|
|
24
|
-
|
|
15
|
+
/** Legacy AutoRAG-local BM25 artifact directory. Never an active index. */
|
|
25
16
|
export declare const BM25_SUBDIR: string;
|
|
26
17
|
export declare class BM25UnavailableError extends Error {
|
|
27
18
|
readonly readiness: BM25ReadinessState;
|
|
28
19
|
constructor(readiness: BM25ReadinessState, message: string);
|
|
29
20
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
private readonly fallback;
|
|
34
|
-
private readonly forceEngine;
|
|
35
|
-
private readonly importBinding;
|
|
36
|
-
private status;
|
|
37
|
-
constructor(options: BM25MethodOptions);
|
|
38
|
-
describe(): RetrievalMethodDescriptor;
|
|
39
|
-
getStatus(): BM25Status;
|
|
40
|
-
sync(): Promise<BM25SyncResult>;
|
|
41
|
-
retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
|
|
42
|
-
private writeTantivyIndex;
|
|
43
|
-
private retrieveTantivy;
|
|
44
|
-
private writeFallbackIndex;
|
|
45
|
-
private retrieveFallback;
|
|
46
|
-
private readFallbackIndex;
|
|
47
|
-
private hasFallbackIndex;
|
|
48
|
-
private tantivyIndexPath;
|
|
49
|
-
private fallbackIndexPath;
|
|
50
|
-
private syncResult;
|
|
51
|
-
}
|
|
52
|
-
export {};
|
|
21
|
+
/** Remove leftover `.autorag/bm25` artifacts from the pre-MinSync BM25 path. */
|
|
22
|
+
export declare function removeLegacyBm25Artifacts(root: string): void;
|
|
23
|
+
export declare function hasLegacyBm25Artifacts(root: string): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BrowseEntry {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly directory: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface BrowseResult {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly parent: string | null;
|
|
9
|
+
readonly entries: readonly BrowseEntry[];
|
|
10
|
+
}
|
|
11
|
+
export declare function browseDirectory(inputPath: string | undefined): BrowseResult;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator-facing connection catalog for the local datasource UI.
|
|
3
|
+
*
|
|
4
|
+
* Each built-in factory key gets a small form: paths, env-var *names*,
|
|
5
|
+
* feed/repo lists, and optional CLI binary paths. Secret values are never
|
|
6
|
+
* catalog fields.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LOCAL_FOLDERS_ID = "local-folders";
|
|
9
|
+
export type CatalogFieldKind = "text" | "path" | "path-list" | "env" | "textarea" | "select" | "checkbox";
|
|
10
|
+
export interface CatalogField {
|
|
11
|
+
readonly key: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly kind: CatalogFieldKind;
|
|
14
|
+
readonly help?: string;
|
|
15
|
+
readonly required?: boolean;
|
|
16
|
+
readonly placeholder?: string;
|
|
17
|
+
readonly options?: readonly {
|
|
18
|
+
readonly value: string;
|
|
19
|
+
readonly label: string;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
export interface DatasourceTypeCatalog {
|
|
23
|
+
readonly type: string;
|
|
24
|
+
readonly title: string;
|
|
25
|
+
readonly summary: string;
|
|
26
|
+
readonly defaultTags: readonly string[];
|
|
27
|
+
readonly binaryName?: string;
|
|
28
|
+
readonly installHint?: string;
|
|
29
|
+
readonly fields: readonly CatalogField[];
|
|
30
|
+
}
|
|
31
|
+
export declare const DATASOURCE_TYPE_CATALOG: readonly DatasourceTypeCatalog[];
|
|
32
|
+
export declare function getDatasourceType(type: string): DatasourceTypeCatalog | undefined;
|
|
33
|
+
export type SourcePickerKind = "folders" | "index" | "datasource";
|
|
34
|
+
export interface SourcePickerEntry {
|
|
35
|
+
readonly type: string;
|
|
36
|
+
readonly title: string;
|
|
37
|
+
readonly summary: string;
|
|
38
|
+
readonly kind: SourcePickerKind;
|
|
39
|
+
readonly binaryName?: string;
|
|
40
|
+
readonly installHint?: string;
|
|
41
|
+
/** False for sources that cannot attach a second account (KakaoTalk). */
|
|
42
|
+
readonly supportsMultiple: boolean;
|
|
43
|
+
readonly extras: readonly PickerExtra[];
|
|
44
|
+
}
|
|
45
|
+
export type PickerExtraKind = "text" | "textarea" | "select" | "path";
|
|
46
|
+
export interface PickerExtra {
|
|
47
|
+
readonly key: string;
|
|
48
|
+
readonly label: string;
|
|
49
|
+
readonly kind: PickerExtraKind;
|
|
50
|
+
readonly placeholder?: string;
|
|
51
|
+
readonly help?: string;
|
|
52
|
+
readonly choices?: "rclone-remotes" | "mail-accounts";
|
|
53
|
+
readonly allowOther?: boolean;
|
|
54
|
+
/** Asked in the coding-agent prompt when this extra is left blank. */
|
|
55
|
+
readonly question: string;
|
|
56
|
+
}
|
|
57
|
+
export declare const SOURCE_PICKER: readonly SourcePickerEntry[];
|
|
58
|
+
export declare function getPickerEntry(type: string): SourcePickerEntry | undefined;
|
|
59
|
+
export declare function assertCatalogCoversBuiltins(): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trusted config mutations for the local datasource UI.
|
|
3
|
+
*
|
|
4
|
+
* Reads/writes the operator `config.json` on disk. Never persists secret
|
|
5
|
+
* values — only env-var names, paths, and lists. Enabling a connection
|
|
6
|
+
* recomputes `datasourceAccess` from catalog tags + `/${alias}/**` scopes.
|
|
7
|
+
*/
|
|
8
|
+
import { DATASOURCE_TYPE_CATALOG, SOURCE_PICKER } from "./catalog.js";
|
|
9
|
+
import { type ProbeResult } from "./probe.js";
|
|
10
|
+
export interface ConnectionInput {
|
|
11
|
+
readonly alias: string;
|
|
12
|
+
readonly type: string;
|
|
13
|
+
readonly enabled?: boolean;
|
|
14
|
+
readonly instanceId?: string;
|
|
15
|
+
readonly connector?: Record<string, unknown>;
|
|
16
|
+
readonly tags?: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export interface UiConnection {
|
|
19
|
+
readonly alias: string;
|
|
20
|
+
readonly type: string;
|
|
21
|
+
readonly enabled: boolean;
|
|
22
|
+
readonly instanceId?: string;
|
|
23
|
+
readonly connector: Record<string, unknown>;
|
|
24
|
+
readonly tags: readonly string[];
|
|
25
|
+
readonly probe: ProbeResult;
|
|
26
|
+
}
|
|
27
|
+
export interface UiState {
|
|
28
|
+
readonly searchPaths: readonly string[];
|
|
29
|
+
readonly connections: readonly UiConnection[];
|
|
30
|
+
readonly catalog: typeof DATASOURCE_TYPE_CATALOG;
|
|
31
|
+
readonly picker: typeof SOURCE_PICKER;
|
|
32
|
+
readonly access: {
|
|
33
|
+
readonly allowedTags: readonly string[];
|
|
34
|
+
readonly allowedScopes: readonly string[];
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare function listUiState(configPath: string, env?: NodeJS.ProcessEnv): UiState;
|
|
38
|
+
export declare function upsertConnection(configPath: string, input: ConnectionInput): UiState;
|
|
39
|
+
export declare function toggleConnection(configPath: string, alias: string, enabled: boolean): UiState;
|
|
40
|
+
export declare function removeConnection(configPath: string, alias: string): UiState;
|
|
41
|
+
export declare function setSearchPaths(configPath: string, searchPaths: readonly string[]): UiState;
|
|
42
|
+
export declare function normalizeAlias(alias: string): string;
|
|
43
|
+
export declare function stripSecrets<T>(value: T): T;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort local account/remote discovery for the datasource UI.
|
|
3
|
+
* Spawns operator CLIs with a short timeout. Failures return empty lists.
|
|
4
|
+
*/
|
|
5
|
+
export interface Choice {
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
}
|
|
9
|
+
export type DiscoverRun = (binary: string, args: readonly string[]) => Promise<{
|
|
10
|
+
ok: boolean;
|
|
11
|
+
stdout: string;
|
|
12
|
+
}>;
|
|
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
|
+
export declare function choicesForType(type: string, run?: DiscoverRun): Promise<{
|
|
17
|
+
rcloneRemotes: readonly Choice[];
|
|
18
|
+
mailAccounts: readonly Choice[];
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local, side-effect-free connection probes for the datasource UI.
|
|
3
|
+
*
|
|
4
|
+
* Checks env-var presence, path existence, and CLI binaries on PATH.
|
|
5
|
+
* Never returns secret values.
|
|
6
|
+
*/
|
|
7
|
+
export type ProbeStatus = "ready" | "auth-missing" | "binary-missing" | "path-missing" | "not-configured" | "unknown-type";
|
|
8
|
+
export interface ProbeResult {
|
|
9
|
+
readonly ok: boolean;
|
|
10
|
+
readonly status: ProbeStatus;
|
|
11
|
+
readonly detail: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ProbeConnectionInput {
|
|
14
|
+
readonly alias: string;
|
|
15
|
+
readonly type: string;
|
|
16
|
+
readonly enabled?: boolean;
|
|
17
|
+
readonly connector?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface ProbeDeps {
|
|
20
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
21
|
+
readonly pathExists?: (path: string) => boolean;
|
|
22
|
+
readonly binaryExists?: (binaryName: string, binaryPath?: string) => boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function probeConnection(input: ProbeConnectionInput, deps?: ProbeDeps): ProbeResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Short copy-paste prompt for a coding agent.
|
|
3
|
+
*
|
|
4
|
+
* The operator picks a type, names it, and may fill optional extras
|
|
5
|
+
* (repos, remotes, mailbox). Blank extras become questions the agent
|
|
6
|
+
* must ask the user.
|
|
7
|
+
*/
|
|
8
|
+
export interface RegistrationPromptInput {
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly alias?: string;
|
|
11
|
+
readonly note?: string;
|
|
12
|
+
readonly extras?: Readonly<Record<string, string>>;
|
|
13
|
+
}
|
|
14
|
+
export interface RegistrationPrompt {
|
|
15
|
+
readonly type: string;
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly alias: string;
|
|
18
|
+
readonly prompt: string;
|
|
19
|
+
readonly questions: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function buildRegistrationPrompt(input: RegistrationPromptInput): RegistrationPrompt;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loopback-only HTTP server for the datasource UI.
|
|
3
|
+
*
|
|
4
|
+
* Binds 127.0.0.1 / ::1, requires a session token, and never returns secret
|
|
5
|
+
* connector values. This is a trusted local control plane — the same trust
|
|
6
|
+
* boundary as editing config.json by hand.
|
|
7
|
+
*/
|
|
8
|
+
export interface StartUiServerOptions {
|
|
9
|
+
readonly configPath: string;
|
|
10
|
+
readonly host?: string;
|
|
11
|
+
readonly port?: number;
|
|
12
|
+
readonly token: string;
|
|
13
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
14
|
+
readonly allowRemote?: boolean;
|
|
15
|
+
readonly publicOrigin?: string;
|
|
16
|
+
readonly corsOrigins?: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
export interface UiServer {
|
|
19
|
+
readonly url: string;
|
|
20
|
+
readonly origin: string;
|
|
21
|
+
readonly host: string;
|
|
22
|
+
readonly port: number;
|
|
23
|
+
readonly token: string;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
27
|
+
export declare function isLoopbackAddress(address: string | undefined): boolean;
|
|
28
|
+
export declare function startUiServer(options: StartUiServerOptions): Promise<UiServer>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorag/librarian",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,27 +41,28 @@
|
|
|
41
41
|
"node": ">=24.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@earendil-works/pi-agent-core": "^0.84.
|
|
45
|
-
"@earendil-works/pi-ai": "^0.84.
|
|
46
|
-
"@earendil-works/pi-coding-agent": "0.84.
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
44
|
+
"@earendil-works/pi-agent-core": "^0.84.4",
|
|
45
|
+
"@earendil-works/pi-ai": "^0.84.4",
|
|
46
|
+
"@earendil-works/pi-coding-agent": "0.84.4",
|
|
47
|
+
"@earendil-works/pi-tui": "0.84.4",
|
|
48
|
+
"@opendataloader/pdf": "^2.5.7",
|
|
49
49
|
"@rhwp/core": "0.8.4",
|
|
50
50
|
"chardet": "^2.2.0",
|
|
51
|
-
"fast-xml-parser": "^5.11.
|
|
51
|
+
"fast-xml-parser": "^5.11.1",
|
|
52
52
|
"iconv-lite": "^0.7.3",
|
|
53
53
|
"jszip": "^3.10.1",
|
|
54
|
-
"mailparser": "^3.9.
|
|
55
|
-
"slides-grab": "^1.5.
|
|
54
|
+
"mailparser": "^3.9.20",
|
|
55
|
+
"slides-grab": "^1.5.1",
|
|
56
56
|
"smol-toml": "1.8.0",
|
|
57
57
|
"tesseract.js": "^7.0.0",
|
|
58
|
-
"typebox": "^1.3.
|
|
58
|
+
"typebox": "^1.3.25",
|
|
59
|
+
"xlsx": "^0.18.5",
|
|
59
60
|
"yaml": "^2.9.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@biomejs/biome": "2.5.
|
|
63
|
+
"@biomejs/biome": "2.5.12",
|
|
63
64
|
"@types/mailparser": "^3.4.6",
|
|
64
|
-
"@types/node": "^26.
|
|
65
|
+
"@types/node": "^26.4.1",
|
|
65
66
|
"typescript": "^7.0.2",
|
|
66
67
|
"vitest": "^4.1.11"
|
|
67
68
|
}
|