@autorag/librarian 2.5.3 → 2.6.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.
Files changed (43) hide show
  1. package/NOTICE +10 -13
  2. package/README.md +46 -7
  3. package/dist/agent/agent.d.ts +16 -1
  4. package/dist/agent/refresh-progress.d.ts +30 -0
  5. package/dist/agent/search-documents.d.ts +1 -1
  6. package/dist/cli/commands/report.d.ts +3 -0
  7. package/dist/cli/commands/serve.d.ts +2 -1
  8. package/dist/cli/config.d.ts +1 -10
  9. package/dist/cli/index.d.ts +1 -1
  10. package/dist/cli/index.js +4927 -6925
  11. package/dist/core.d.ts +1 -1
  12. package/dist/core.js +1120 -1175
  13. package/dist/index.js +1123 -1179
  14. package/dist/language.d.ts +21 -0
  15. package/dist/memory/memory.d.ts +0 -1
  16. package/dist/mirror/paths.d.ts +2 -0
  17. package/dist/mirror/sync.d.ts +1 -1
  18. package/dist/p2p/simplex-server.d.ts +21 -5
  19. package/dist/p2p/simplex-transport.d.ts +21 -4
  20. package/dist/parser/defaults.d.ts +10 -4
  21. package/dist/parser/index.d.ts +3 -5
  22. package/dist/parser/kordoc.d.ts +53 -0
  23. package/dist/parser/ocr-engines.d.ts +12 -0
  24. package/dist/parser/ocr.d.ts +7 -1
  25. package/dist/parser/office.d.ts +1 -10
  26. package/dist/parser/types.d.ts +1 -1
  27. package/package.json +10 -10
  28. package/skills/autorag-lite-search/SKILL.md +57 -7
  29. package/skills/autorag-lite-setup/SKILL.md +2 -2
  30. package/skills/autorag-setup/SKILL.md +2 -2
  31. package/dist/cli/commands/ui.d.ts +0 -13
  32. package/dist/parser/hwp-markdown.d.ts +0 -25
  33. package/dist/parser/hwp.d.ts +0 -13
  34. package/dist/parser/opendataloader-pdf.d.ts +0 -31
  35. package/dist/parser/rhwp-adapter.d.ts +0 -30
  36. package/dist/ui/browse.d.ts +0 -11
  37. package/dist/ui/catalog.d.ts +0 -59
  38. package/dist/ui/config-store.d.ts +0 -43
  39. package/dist/ui/discover.d.ts +0 -17
  40. package/dist/ui/html.d.ts +0 -2
  41. package/dist/ui/probe.d.ts +0 -24
  42. package/dist/ui/prompt.d.ts +0 -21
  43. package/dist/ui/server.d.ts +0 -28
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Global language configuration for AutoRAG.
3
+ *
4
+ * The tag set is curated rather than free-form BCP-47: every accepted tag must
5
+ * map to a concrete OCR engine configuration (see src/parser/ocr-engines.ts).
6
+ * A tag we cannot map would be a promise the parser stack cannot keep.
7
+ */
8
+ export declare const AUTORAG_LANGUAGE_TAGS: readonly ["ko", "en", "ja", "zh-hans", "zh-hant", "fr", "de", "es", "ru", "it", "pt", "vi", "th", "ar", "hi"];
9
+ export type LanguageTag = (typeof AUTORAG_LANGUAGE_TAGS)[number];
10
+ /** Korean + English: AutoRAG's primary corpus languages. */
11
+ export declare const DEFAULT_LANGUAGES: readonly LanguageTag[];
12
+ export declare class LanguageError extends Error {
13
+ readonly name = "LanguageError";
14
+ }
15
+ /**
16
+ * Normalizes a configured language value into a non-empty, deduplicated,
17
+ * lowercase tag list. The first entry is the primary language.
18
+ */
19
+ export declare function normalizeLanguages(raw: unknown): LanguageTag[];
20
+ /** Parses a comma-separated CLI flag or environment variable value. */
21
+ export declare function parseLanguageList(value: string): LanguageTag[];
@@ -7,7 +7,6 @@ export interface SignalDefaults {
7
7
  readonly followupWeight: number;
8
8
  readonly retryWeight: number;
9
9
  readonly implicitCap: number;
10
- readonly decayHalfLifeMs?: number;
11
10
  }
12
11
  export interface EvidenceContext {
13
12
  readonly retrieverMix?: readonly string[];
@@ -2,7 +2,9 @@ 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
4
  export declare const REFRESH_READINESS_FILE = "refresh-complete.json";
5
+ export declare const REFRESH_PROGRESS_FILE = "refresh-progress.json";
5
6
  export declare function parsedMirrorRoot(root: string): string;
6
7
  export declare function parsedMirrorIndexPath(root: string): string;
7
8
  export declare function parsedOutputPath(root: string, virtualPath: string): string;
8
9
  export declare function refreshReadinessPath(root: string): string;
10
+ export declare function refreshProgressPath(root: string): string;
@@ -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" | "pdf-java-version" | "duplicate-excluded" | "deleted-mirror" | "stale-index" | "pdf-extract-thin" | "pdf-hybrid-unavailable";
16
+ export type ParsedMirrorDiagnosticCode = "unsupported-file" | "parser-skipped" | "parser-failed" | "duplicate-excluded" | "deleted-mirror" | "stale-index" | "pdf-extract-thin" | "parser-warning";
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;
@@ -4,7 +4,7 @@ import type { RetrievalOptions } from "../retrieval/types.js";
4
4
  import { type InjectionClassifierModel } from "./injection-classifier.js";
5
5
  import { type PolicyQuotas, type PolicyResolution } from "./policy.js";
6
6
  import type { PolicyResolver } from "./policy-filter.js";
7
- import type { SimplexTransport } from "./simplex-transport.js";
7
+ import { type SimplexContact, type SimplexPeerProfile, type SimplexTransport } from "./simplex-transport.js";
8
8
  import { type PeerQueryRequest, type PeerQueryResponse } from "./wire.js";
9
9
  /**
10
10
  * SimpleX message bodies have no documented byte cap, but the wire envelope
@@ -22,11 +22,15 @@ export interface SimplexPeerRecord {
22
22
  /** SimpleX contact id of the peer (stable per profile). */
23
23
  readonly contactId: number;
24
24
  readonly addedAt: string;
25
- readonly displayName?: string;
25
+ /**
26
+ * The profile this peer shared over SimpleX. It is the source of truth for
27
+ * who the contact is; only `description` below is added locally.
28
+ */
29
+ readonly profile?: SimplexPeerProfile;
30
+ /** When `profile` was last read from simplex-chat. */
31
+ readonly profileSyncedAt?: string;
32
+ /** Your own note about this contact. */
26
33
  readonly description?: string;
27
- readonly role?: string;
28
- readonly org?: string;
29
- readonly accessHint?: readonly string[];
30
34
  }
31
35
  export type SimplexPeerRegistry = Record<string, SimplexPeerRecord>;
32
36
  export interface PeerTargetMatch {
@@ -40,6 +44,18 @@ export declare function rankSimplexPeerTargets(query: string, registry: SimplexP
40
44
  export declare function loadSimplexPeerRegistry(workspacePath: string): SimplexPeerRegistry;
41
45
  /** Persist the SimpleX peer registry. */
42
46
  export declare function saveSimplexPeerRegistry(workspacePath: string, registry: SimplexPeerRegistry): void;
47
+ export interface SimplexPeerSyncResult {
48
+ /** Registry keys whose stored SimpleX profile was refreshed. */
49
+ readonly updated: readonly string[];
50
+ /** SimpleX contacts with no trusted record. Reported, never added automatically. */
51
+ readonly untrusted: readonly SimplexContact[];
52
+ }
53
+ /**
54
+ * Merge the profiles SimpleX delivered into the records you already trusted.
55
+ * Contacts that are not in the registry are reported, never trusted: the
56
+ * registry stays the allowlist for inbound peer queries.
57
+ */
58
+ export declare function syncSimplexPeers(workspacePath: string, contacts: readonly SimplexContact[], syncedAt?: string): SimplexPeerSyncResult;
43
59
  export interface P2pSearchAgent {
44
60
  readonly remoteSession: boolean;
45
61
  searchDocuments(query: string, options?: RetrievalOptions): Promise<SearchDocumentsResponse>;
@@ -9,6 +9,24 @@ export interface SimplexIncomingMessage {
9
9
  readonly text: string;
10
10
  readonly chatItemId: number;
11
11
  }
12
+ /**
13
+ * The profile a peer publishes over SimpleX. It is the identity AutoRAG stores
14
+ * for the contact; only your local name and note are added on top of it.
15
+ */
16
+ export interface SimplexPeerProfile {
17
+ readonly displayName: string;
18
+ readonly fullName?: string;
19
+ readonly shortDescr?: string;
20
+ readonly description?: string;
21
+ readonly image?: string;
22
+ }
23
+ /** A SimpleX contact: the peer's own profile plus the name you call it locally. */
24
+ export interface SimplexContact {
25
+ readonly contactId: number;
26
+ readonly localDisplayName: string;
27
+ /** The profile the peer shared; absent until the peer publishes one. */
28
+ readonly profile?: SimplexPeerProfile;
29
+ }
12
30
  export interface SimplexTransport {
13
31
  readonly dbPrefix: string;
14
32
  readonly displayName: string;
@@ -16,10 +34,7 @@ export interface SimplexTransport {
16
34
  getOrCreateAddress(): Promise<string>;
17
35
  createInvitation(): Promise<string>;
18
36
  connect(link: string): Promise<void>;
19
- listContacts(): Promise<{
20
- contactId: number;
21
- localDisplayName: string;
22
- }[]>;
37
+ listContacts(): Promise<SimplexContact[]>;
23
38
  sendMessage(contactId: number, text: string): Promise<void>;
24
39
  onMessage(handler: (message: SimplexIncomingMessage) => void): () => void;
25
40
  close(): Promise<void>;
@@ -31,6 +46,8 @@ export interface StartSimplexOptions {
31
46
  readonly port?: number;
32
47
  readonly connectTimeoutMs?: number;
33
48
  }
49
+ /** Extract the stored subset of a SimpleX `LocalProfile`; SimpleX-internal fields are dropped. */
50
+ export declare function parseSimplexProfile(value: unknown): SimplexPeerProfile | undefined;
34
51
  /**
35
52
  * Spawn `simplex-chat -p <port> -d <dbPrefix>` and connect to its WebSocket
36
53
  * bot API. Creates the local user profile if it does not exist yet.
@@ -1,10 +1,16 @@
1
- import { type HwpParserOptions } from "./hwp.js";
1
+ import { type LanguageTag } from "../language.js";
2
+ import { type KordocParserOptions } from "./kordoc.js";
2
3
  import { type OcrParserOptions } from "./ocr.js";
3
- import { type OpendataloaderPdfParserOptions } from "./opendataloader-pdf.js";
4
4
  import { ParserRegistry } from "./registry.js";
5
5
  export interface DefaultParserRegistryOptions {
6
6
  readonly ocr?: OcrParserOptions;
7
- readonly hwp?: HwpParserOptions;
8
- readonly thinExtract?: OpendataloaderPdfParserOptions["thinExtract"];
7
+ readonly kordoc?: KordocParserOptions;
8
+ /** Global document languages; drives OCR engine selection. */
9
+ readonly languages?: readonly LanguageTag[];
9
10
  }
11
+ /**
12
+ * Merges the globally configured document languages into registry options.
13
+ * An explicit `parserOptions.languages` wins over the global setting.
14
+ */
15
+ export declare function resolveParserOptions(parserOptions: DefaultParserRegistryOptions | undefined, languages: readonly LanguageTag[]): DefaultParserRegistryOptions;
10
16
  export declare function createDefaultParserRegistry(options?: DefaultParserRegistryOptions): ParserRegistry;
@@ -1,11 +1,9 @@
1
- export { createDefaultParserRegistry, type DefaultParserRegistryOptions } from "./defaults.js";
1
+ export { createDefaultParserRegistry, type DefaultParserRegistryOptions, resolveParserOptions, } from "./defaults.js";
2
2
  export { EmlParser } from "./eml.js";
3
3
  export { ParseError } from "./errors.js";
4
- export { HwpParser, type HwpParserOptions } from "./hwp.js";
4
+ export { KORDOC_EXTENSIONS, type KordocOcrProvider, type KordocParseFn, KordocParser, type KordocParserOptions, } from "./kordoc.js";
5
5
  export { ImageOcrParser, type OcrEngine, type OcrEngineInput, type OcrParserOptions } from "./ocr.js";
6
- export { DocxParser, PptxParser, XlsxParser } from "./office.js";
7
- export { OpendataloaderPdfParser, type OpendataloaderPdfParserOptions, type PdfConverter, } from "./opendataloader-pdf.js";
6
+ export { PptxParser } from "./office.js";
8
7
  export { PlainTextParser } from "./plain-text.js";
9
8
  export { ParserRegistry } from "./registry.js";
10
- export type { HwpExtractionLimits, HwpExtractor } from "./rhwp-adapter.js";
11
9
  export { type ParseDiagnostic, type ParseDiagnosticCode, type ParseInput, type ParseOutput, Parser, } from "./types.js";
@@ -0,0 +1,53 @@
1
+ import { type ParseInput, type ParseOutput, Parser } from "./types.js";
2
+ /** Image mime types kordoc hands to an injected OCR provider. */
3
+ export type KordocOcrMimeType = "image/png" | "image/jpeg" | "image/webp";
4
+ /**
5
+ * OCR seam kordoc calls per page that needs recognition. AutoRAG injects a
6
+ * tesseract-backed provider so recognition follows the configured languages
7
+ * instead of kordoc's Korean+Latin built-in model.
8
+ */
9
+ export type KordocOcrProvider = (pageImage: Uint8Array, pageNumber: number, mimeType: KordocOcrMimeType) => Promise<string>;
10
+ export interface KordocWarning {
11
+ readonly code?: string;
12
+ readonly message: string;
13
+ }
14
+ export interface KordocParseSuccess {
15
+ readonly success: true;
16
+ readonly fileType?: string;
17
+ readonly markdown: string;
18
+ readonly blocks?: readonly unknown[];
19
+ readonly warnings?: readonly KordocWarning[];
20
+ }
21
+ export interface KordocParseFailure {
22
+ readonly success: false;
23
+ readonly fileType?: string;
24
+ readonly error: string;
25
+ readonly code?: string;
26
+ }
27
+ export type KordocParseResult = KordocParseSuccess | KordocParseFailure;
28
+ export interface KordocParseCallOptions {
29
+ readonly ocr?: boolean | "force" | KordocOcrProvider;
30
+ }
31
+ /** Injection seam: the real kordoc `parse`, or a stub in tests. */
32
+ export type KordocParseFn = (bytes: Uint8Array, options: KordocParseCallOptions) => Promise<KordocParseResult>;
33
+ export interface KordocParserOptions {
34
+ /** OCR mode handed to kordoc: off, built-in engine, or an injected provider. */
35
+ readonly ocr?: boolean | "force" | KordocOcrProvider;
36
+ readonly parse?: KordocParseFn;
37
+ }
38
+ /** Document extensions kordoc parses. `.pptx` and `.eml` stay on their own parsers. */
39
+ export declare const KORDOC_EXTENSIONS: readonly [".hwp", ".hwpx", ".hml", ".hwpml", ".pdf", ".docx", ".xlsx", ".xls"];
40
+ /**
41
+ * Parses HWP/HWPX/HWPML, PDF, DOCX and XLSX/XLS through the kordoc library.
42
+ *
43
+ * kordoc reports failures as a result object; AutoRAG's contract is a thrown
44
+ * `ParseError`, so the code and message are forwarded verbatim (AGENTS.md error
45
+ * transparency) and warnings become `parser-warning` diagnostics.
46
+ */
47
+ export declare class KordocParser extends Parser {
48
+ #private;
49
+ readonly name = "kordoc";
50
+ readonly extensions: readonly [".hwp", ".hwpx", ".hml", ".hwpml", ".pdf", ".docx", ".xlsx", ".xls"];
51
+ constructor(options?: KordocParserOptions);
52
+ parse(input: ParseInput): Promise<ParseOutput>;
53
+ }
@@ -0,0 +1,12 @@
1
+ import type { LanguageTag } from "../language.js";
2
+ export type OcrProvider = (pageImage: Uint8Array, pageNumber: number, mimeType: "image/png" | "image/jpeg" | "image/webp") => Promise<string>;
3
+ export type TesseractOcrEngine = (language: string, pageImage: Uint8Array, pageNumber: number, mimeType: "image/png" | "image/jpeg" | "image/webp") => Promise<string>;
4
+ export interface TesseractOcrProviderOptions {
5
+ readonly languages: readonly LanguageTag[];
6
+ readonly timeoutMs?: number;
7
+ readonly engine?: TesseractOcrEngine;
8
+ }
9
+ /** Traineddata codes for the configured languages, order preserved and deduplicated. */
10
+ export declare function tesseractLanguageListFor(tags: readonly LanguageTag[]): string[];
11
+ export declare function tesseractLanguageFor(tags: readonly LanguageTag[]): string;
12
+ export declare function createTesseractOcrProvider(options: TesseractOcrProviderOptions): OcrProvider;
@@ -6,6 +6,10 @@ export interface OcrEngineInput {
6
6
  readonly signal: AbortSignal;
7
7
  }
8
8
  export type OcrEngine = (input: OcrEngineInput) => Promise<string>;
9
+ export type OcrOperation = {
10
+ readonly result: Promise<string>;
11
+ readonly cleanup: Promise<void>;
12
+ };
9
13
  export interface OcrParserOptions {
10
14
  readonly enabled: boolean;
11
15
  readonly languages?: readonly string[];
@@ -15,7 +19,7 @@ export interface OcrParserOptions {
15
19
  }
16
20
  export declare class ImageOcrParser extends Parser {
17
21
  readonly name = "image-ocr";
18
- readonly extensions: readonly [".jpg", ".jpeg", ".png", ".bmp", ".tiff"];
22
+ readonly extensions: readonly [".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".webp"];
19
23
  private readonly languages;
20
24
  private readonly timeoutMs;
21
25
  private readonly maxBytes;
@@ -23,3 +27,5 @@ export declare class ImageOcrParser extends Parser {
23
27
  constructor(options: OcrParserOptions);
24
28
  parse(input: ParseInput): Promise<ParseOutput>;
25
29
  }
30
+ export declare function createTesseractOcrOperation(input: OcrEngineInput): OcrOperation;
31
+ export declare function withTimeout(operation: OcrOperation, timeoutMs: number, onTimeout: () => void): Promise<string>;
@@ -1,16 +1,7 @@
1
1
  import { type ParseInput, type ParseOutput, Parser } from "./types.js";
2
- export declare class DocxParser extends Parser {
3
- readonly name = "docx";
4
- readonly extensions: readonly [".docx"];
5
- parse(input: ParseInput): Promise<ParseOutput>;
6
- }
2
+ /** PPTX stays on AutoRAG's own reader: kordoc detects pptx but does not parse it. */
7
3
  export declare class PptxParser extends Parser {
8
4
  readonly name = "pptx";
9
5
  readonly extensions: readonly [".pptx"];
10
6
  parse(input: ParseInput): Promise<ParseOutput>;
11
7
  }
12
- export declare class XlsxParser extends Parser {
13
- readonly name = "xlsx";
14
- readonly extensions: readonly [".xlsx", ".xls"];
15
- parse(input: ParseInput): Promise<ParseOutput>;
16
- }
@@ -8,7 +8,7 @@ export interface ParseOutput {
8
8
  readonly metadata?: Readonly<Record<string, unknown>>;
9
9
  readonly diagnostics?: readonly ParseDiagnostic[];
10
10
  }
11
- export type ParseDiagnosticCode = "pdf-extract-thin" | "pdf-hybrid-unavailable";
11
+ export type ParseDiagnosticCode = "pdf-extract-thin" | "parser-warning";
12
12
  export interface ParseDiagnostic {
13
13
  readonly code: ParseDiagnosticCode;
14
14
  readonly severity: "warning";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.5.3",
3
+ "version": "2.6.0",
4
4
  "description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,31 +49,31 @@
49
49
  "node": ">=24.0.0"
50
50
  },
51
51
  "dependencies": {
52
- "@earendil-works/pi-agent-core": "^0.85.1",
53
- "@earendil-works/pi-ai": "^0.85.1",
54
- "@earendil-works/pi-coding-agent": "0.85.1",
55
- "@earendil-works/pi-tui": "0.85.1",
56
- "@opendataloader/pdf": "^2.5.7",
57
- "@rhwp/core": "0.8.6",
52
+ "@earendil-works/pi-agent-core": "^0.86.1",
53
+ "@earendil-works/pi-ai": "^0.86.1",
54
+ "@earendil-works/pi-coding-agent": "0.86.1",
55
+ "@earendil-works/pi-tui": "0.86.1",
58
56
  "chardet": "^2.2.0",
59
57
  "fast-xml-parser": "^5.11.1",
60
58
  "iconv-lite": "^0.7.3",
61
59
  "jszip": "^3.10.1",
60
+ "kordoc": "^4.15.7",
62
61
  "mailparser": "^3.9.20",
62
+ "pdfjs-dist": "^6.3.289",
63
63
  "puppeteer-core": "^25.11.0",
64
64
  "slides-grab": "^1.5.1",
65
65
  "smol-toml": "1.8.0",
66
66
  "tesseract.js": "^7.0.0",
67
67
  "typebox": "^1.3.25",
68
- "xlsx": "^0.18.5",
69
68
  "yaml": "^2.9.0"
70
69
  },
71
70
  "devDependencies": {
72
- "@biomejs/biome": "2.5.13",
71
+ "@biomejs/biome": "2.5.14",
73
72
  "@types/mailparser": "^3.4.6",
74
73
  "@types/node": "^26.4.1",
75
74
  "@types/ws": "^8.18.1",
76
75
  "typescript": "^7.0.2",
77
- "vitest": "^5.0.0"
76
+ "vitest": "^5.0.0",
77
+ "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
78
78
  }
79
79
  }
@@ -138,13 +138,63 @@ autorag lite report "key findings in the Q3 report" --input report.json --json
138
138
  cat report.json | autorag lite report "key findings in the Q3 report" --json
139
139
  ```
140
140
 
141
- The input is the `emit_autorag_results` JSON schema: `answer`, numbered
142
- `results` (with `number`, `title`, `summary`, `confidence` in `[0, 1]`,
143
- optional `source`), and a `mapping` whose entries map each result number to
144
- its `method` and `source`, plus optional `evidenceRefs` and `warnings`.
145
- Result and mapping numbers must be one-to-one positive integers. Evidence
146
- confidence values must be in `[0, 1]`. Invalid input exits with code 2 and
147
- `{"ok": false, "error": "..."}`.
141
+ The input is the `emit_autorag_results` JSON schema. Every field below that is
142
+ not marked optional is required — `results[].evidence` and `mapping[].content`
143
+ are the two that are easiest to forget:
144
+
145
+ - `answer` (string) — the curated answer, citing results as `[1]`, `[2]`.
146
+ - `results` (array) — one entry per numbered knowledge unit, each with
147
+ `number` (1-based integer), `title` (string), `summary` (string),
148
+ `evidence` (array of `{"excerpt": "..."}` objects, each with an optional
149
+ `lineNumber`), and `confidence` (number in `[0, 1]`). A result carries no
150
+ `source`; source identity lives in `mapping`.
151
+ - `mapping` (array) — exactly one entry per result `number`, each with
152
+ `number`, `source` (the opaque identity carried from retrieve), `method`,
153
+ and `content` (the raw snippet kept for feedback tracking). `evidenceRefs`
154
+ is optional; each ref needs `method` and `source` and may add `excerpt`,
155
+ `content`, `chunkIndex`, `lineNumber`, `retrievalResultId`, and
156
+ `confidence` in `[0, 1]`.
157
+ - `warnings` (optional array of strings).
158
+
159
+ Result and mapping numbers must be one-to-one positive integers, and every
160
+ `confidence` must be in `[0, 1]`. A complete minimal input:
161
+
162
+ ```json
163
+ {
164
+ "answer": "[1] Refund exceptions need director approval before payout.",
165
+ "results": [
166
+ {
167
+ "number": 1,
168
+ "title": "Refund exception approval",
169
+ "summary": "Refund exceptions require director approval before payout.",
170
+ "evidence": [
171
+ {
172
+ "excerpt": "Refund exceptions require director approval.",
173
+ "lineNumber": 12
174
+ }
175
+ ],
176
+ "confidence": 0.9
177
+ }
178
+ ],
179
+ "mapping": [
180
+ {
181
+ "number": 1,
182
+ "source": "/Users/me/corpus/refund-policy.txt",
183
+ "method": "minsync",
184
+ "content": "Refund exceptions require director approval before payout."
185
+ }
186
+ ],
187
+ "warnings": []
188
+ }
189
+ ```
190
+
191
+ Invalid input exits with code 2 and `{"ok": false, "error": "..."}`. The
192
+ rejection names every field that failed, by JSON path, so fix exactly what it
193
+ points at instead of guessing:
194
+
195
+ ```text
196
+ {"ok": false, "error": "Invalid report: expected the emit_autorag_results JSON schema (/results/0: must have required properties evidence; /mapping/0: must have required properties content)"}
197
+ ```
148
198
 
149
199
  `source` values in a report are opaque identifiers carried from retrieval
150
200
  output. Report persistence performs no filesystem reads against them; it
@@ -59,7 +59,7 @@ include `AUTORAG_HOME`, `AUTORAG_CONFIG`, `AUTORAG_SEARCH_PATHS`,
59
59
 
60
60
  ## Probe and configure datasources (setup wizard)
61
61
 
62
- `autorag lite ui` is still in development — do not recommend it for datasource
62
+ A datasource setup UI is not shipped in this build — do not recommend it for datasource
63
63
  setup. Configure datasources directly in trusted config, wizard-style:
64
64
 
65
65
  1. Probe every datasource for setup feasibility before asking the user
@@ -125,7 +125,7 @@ autorag lite refresh --force --json
125
125
  different provider.
126
126
  - Exact duplicate exclusion during refresh is enabled by default via the
127
127
  external `dupey` CLI. Install dupey during setup when it is missing
128
- (`command -v dupey || cargo install dupey`) and tell the user the feature is
128
+ (`command -v dupey || cargo install dupey --locked`) and tell the user the feature is
129
129
  available; when installation is impossible, refresh continues without it
130
130
  and the user is told duplicate exclusion is off. Set
131
131
  `"excludeExactDuplicates": false` to index every copy.
@@ -138,7 +138,7 @@ Exact duplicate exclusion is enabled by default. AutoRAG invokes the external
138
138
  `dupey` CLI before parsed-mirror indexing, keeps the newest filesystem copy for
139
139
  each exact canonical-text hash, and excludes older copies from the mirror.
140
140
  Install dupey during setup when it is missing (`command -v dupey || cargo
141
- install dupey`) and tell the user the feature is available; when installation
141
+ install dupey --locked`) and tell the user the feature is available; when installation
142
142
  is impossible, refresh continues without this optimization and the user is
143
143
  told duplicate exclusion is off. Set `"excludeExactDuplicates": false` to
144
144
  index every copy.
@@ -180,7 +180,7 @@ datasources automatically:
180
180
  autorag setup --format json
181
181
  ```
182
182
 
183
- `autorag ui` is still in development — do not recommend it for datasource
183
+ A datasource setup UI is not shipped in this build — do not recommend it for datasource
184
184
  setup. Configure datasources directly in trusted config, wizard-style:
185
185
 
186
186
  1. Probe every datasource for setup feasibility before asking the user
@@ -1,13 +0,0 @@
1
- import { startUiServer, type UiServer } from "../../ui/server.js";
2
- import type { CommandContext } from "./types.js";
3
- export interface UiCommandDeps {
4
- readonly startServer?: typeof startUiServer;
5
- readonly openBrowser?: (url: string) => Promise<void>;
6
- readonly waitUntilStopped?: (server: UiServer) => Promise<void>;
7
- readonly createToken?: () => string;
8
- }
9
- /**
10
- * `autorag ui` — local loopback dashboard for folders and datasource connections.
11
- */
12
- export declare function runUi(ctx: CommandContext, deps?: UiCommandDeps): Promise<number>;
13
- export declare function openBrowser(url: string): Promise<void>;
@@ -1,25 +0,0 @@
1
- export interface HwpExtractedDocument {
2
- readonly paragraphs: readonly HwpBodyParagraph[];
3
- readonly tables: readonly HwpTable[];
4
- }
5
- export interface HwpBodyParagraph {
6
- readonly sectionIndex: number;
7
- readonly paragraphIndex: number;
8
- readonly text: string;
9
- }
10
- export interface HwpTable {
11
- readonly sectionIndex: number;
12
- readonly parentParagraphIndex: number;
13
- readonly controlIndex: number;
14
- readonly rowCount: number;
15
- readonly columnCount: number;
16
- readonly cells: readonly HwpTableCell[];
17
- }
18
- export interface HwpTableCell {
19
- readonly row: number;
20
- readonly column: number;
21
- readonly rowSpan: number;
22
- readonly columnSpan: number;
23
- readonly paragraphs: readonly string[];
24
- }
25
- export declare function renderHwpMarkdown(document: HwpExtractedDocument): string;
@@ -1,13 +0,0 @@
1
- import { type HwpExtractionLimits, type HwpExtractor } from "./rhwp-adapter.js";
2
- import { type ParseInput, type ParseOutput, Parser } from "./types.js";
3
- export interface HwpParserOptions {
4
- readonly limits?: HwpExtractionLimits;
5
- readonly extractor?: HwpExtractor;
6
- }
7
- export declare class HwpParser extends Parser {
8
- readonly name = "hwp";
9
- readonly extensions: readonly [".hwpx", ".hwp"];
10
- private readonly extractor;
11
- constructor(options?: HwpParserOptions);
12
- parse(input: ParseInput): Promise<ParseOutput>;
13
- }
@@ -1,31 +0,0 @@
1
- import type { ConvertOptions } from "@opendataloader/pdf";
2
- import { type ParseInput, type ParseOutput, Parser } from "./types.js";
3
- export type PdfConverter = (inputPath: string, options: ConvertOptions) => Promise<string>;
4
- export interface OpendataloaderPdfParserOptions {
5
- readonly converter?: PdfConverter;
6
- readonly ocr?: {
7
- readonly enabled: boolean;
8
- readonly timeoutMs?: number;
9
- readonly hybrid?: string;
10
- readonly hybridMode?: string;
11
- readonly maxBytes?: number;
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
- };
23
- }
24
- export declare class OpendataloaderPdfParser extends Parser {
25
- readonly name = "opendataloader-pdf";
26
- readonly extensions: readonly [".pdf"];
27
- private readonly options;
28
- private readonly converter;
29
- constructor(options?: OpendataloaderPdfParserOptions);
30
- parse(input: ParseInput): Promise<ParseOutput>;
31
- }
@@ -1,30 +0,0 @@
1
- import type { HwpExtractedDocument } from "./hwp-markdown.js";
2
- export interface HwpExtractionLimits {
3
- readonly maxSections?: number;
4
- readonly maxBodyParagraphs?: number;
5
- readonly maxTables?: number;
6
- readonly maxCells?: number;
7
- readonly maxCellParagraphs?: number;
8
- readonly maxCharacters?: number;
9
- }
10
- export type HwpExtractor = (bytes: Uint8Array) => Promise<HwpExtractedDocument>;
11
- export interface RhwpDocumentApi {
12
- free(): void;
13
- getCellInfo(sectionIndex: number, parentParagraphIndex: number, controlIndex: number, cellIndex: number): string;
14
- getCellParagraphCount(sectionIndex: number, parentParagraphIndex: number, controlIndex: number, cellIndex: number): number;
15
- getCellParagraphLength(sectionIndex: number, parentParagraphIndex: number, controlIndex: number, cellIndex: number, cellParagraphIndex: number): number;
16
- getPageControlLayout(pageNumber: number): string;
17
- getParagraphCount(sectionIndex: number): number;
18
- getParagraphLength(sectionIndex: number, paragraphIndex: number): number;
19
- getSectionCount(): number;
20
- getTableDimensions(sectionIndex: number, parentParagraphIndex: number, controlIndex: number): string;
21
- getTextInCell(sectionIndex: number, parentParagraphIndex: number, controlIndex: number, cellIndex: number, cellParagraphIndex: number, characterOffset: number, count: number): string;
22
- getTextRange(sectionIndex: number, paragraphIndex: number, characterOffset: number, count: number): string;
23
- pageCount(): number;
24
- }
25
- export interface RhwpRuntime {
26
- initialize(): Promise<void>;
27
- open(bytes: Uint8Array): RhwpDocumentApi;
28
- }
29
- export declare function createRhwpExtractor(runtime?: RhwpRuntime, overrides?: HwpExtractionLimits): HwpExtractor;
30
- export declare function extractHwpWithRhwp(bytes: Uint8Array, limits?: HwpExtractionLimits): Promise<HwpExtractedDocument>;
@@ -1,11 +0,0 @@
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;