@autorag/librarian 2.0.0 → 2.1.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 +45 -1
- package/dist/agent/search-documents.d.ts +1 -0
- package/dist/cli/config.d.ts +6 -0
- package/dist/cli/index.js +3423 -306
- package/dist/datasource/chunk-store.d.ts +67 -0
- package/dist/datasource/connector-skill.d.ts +107 -0
- package/dist/datasource/connector.d.ts +72 -0
- package/dist/datasource/http.d.ts +49 -0
- package/dist/datasource/index.d.ts +14 -0
- package/dist/datasource/skills/discord/connector.d.ts +30 -0
- package/dist/datasource/skills/discord/index.d.ts +2 -0
- package/dist/datasource/skills/discord/skill.d.ts +20 -0
- package/dist/datasource/skills/factory.d.ts +35 -0
- package/dist/datasource/skills/gdrive/connector.d.ts +30 -0
- package/dist/datasource/skills/gdrive/index.d.ts +3 -0
- package/dist/datasource/skills/gdrive/rclone-connector.d.ts +51 -0
- package/dist/datasource/skills/gdrive/skill.d.ts +24 -0
- package/dist/datasource/skills/github/connector.d.ts +28 -0
- package/dist/datasource/skills/github/index.d.ts +2 -0
- package/dist/datasource/skills/github/skill.d.ts +20 -0
- package/dist/datasource/skills/gmail/connector.d.ts +30 -0
- package/dist/datasource/skills/gmail/himalaya-connector.d.ts +40 -0
- package/dist/datasource/skills/gmail/index.d.ts +3 -0
- package/dist/datasource/skills/gmail/skill.d.ts +24 -0
- package/dist/datasource/skills/mail-export/connector.d.ts +21 -0
- package/dist/datasource/skills/mail-export/index.d.ts +2 -0
- package/dist/datasource/skills/mail-export/skill.d.ts +20 -0
- package/dist/datasource/skills/notion/connector.d.ts +26 -0
- package/dist/datasource/skills/notion/index.d.ts +2 -0
- package/dist/datasource/skills/notion/skill.d.ts +20 -0
- package/dist/datasource/skills/obsidian/connector.d.ts +22 -0
- package/dist/datasource/skills/obsidian/index.d.ts +2 -0
- package/dist/datasource/skills/obsidian/skill.d.ts +20 -0
- package/dist/datasource/skills/rss/connector.d.ts +28 -0
- package/dist/datasource/skills/rss/index.d.ts +2 -0
- package/dist/datasource/skills/rss/skill.d.ts +22 -0
- package/dist/datasource/skills/slack/connector.d.ts +28 -0
- package/dist/datasource/skills/slack/index.d.ts +2 -0
- package/dist/datasource/skills/slack/skill.d.ts +20 -0
- package/dist/datasource/skills/spotlight/connector.d.ts +59 -0
- package/dist/datasource/skills/spotlight/index.d.ts +2 -0
- package/dist/datasource/skills/spotlight/skill.d.ts +20 -0
- package/dist/index.js +3267 -152
- package/dist/parser/defaults.d.ts +2 -0
- package/dist/parser/hwp-markdown.d.ts +25 -0
- package/dist/parser/hwp.d.ts +7 -0
- package/dist/parser/index.d.ts +2 -1
- package/dist/parser/rhwp-adapter.d.ts +30 -0
- package/package.json +3 -2
- package/skills/autorag-setup/SKILL.md +52 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type HwpParserOptions } from "./hwp.js";
|
|
1
2
|
import { type OcrParserOptions } from "./ocr.js";
|
|
2
3
|
import { ParserRegistry } from "./registry.js";
|
|
3
4
|
export interface DefaultParserRegistryOptions {
|
|
4
5
|
readonly ocr?: OcrParserOptions;
|
|
6
|
+
readonly hwp?: HwpParserOptions;
|
|
5
7
|
}
|
|
6
8
|
export declare function createDefaultParserRegistry(options?: DefaultParserRegistryOptions): ParserRegistry;
|
|
@@ -0,0 +1,25 @@
|
|
|
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;
|
package/dist/parser/hwp.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { type HwpExtractionLimits, type HwpExtractor } from "./rhwp-adapter.js";
|
|
1
2
|
import { type ParseInput, type ParseOutput, Parser } from "./types.js";
|
|
3
|
+
export interface HwpParserOptions {
|
|
4
|
+
readonly limits?: HwpExtractionLimits;
|
|
5
|
+
readonly extractor?: HwpExtractor;
|
|
6
|
+
}
|
|
2
7
|
export declare class HwpParser extends Parser {
|
|
3
8
|
readonly name = "hwp";
|
|
4
9
|
readonly extensions: readonly [".hwpx", ".hwp"];
|
|
10
|
+
private readonly extractor;
|
|
11
|
+
constructor(options?: HwpParserOptions);
|
|
5
12
|
parse(input: ParseInput): Promise<ParseOutput>;
|
|
6
13
|
}
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { createDefaultParserRegistry, type DefaultParserRegistryOptions } from "./defaults.js";
|
|
2
2
|
export { EmlParser } from "./eml.js";
|
|
3
3
|
export { ParseError } from "./errors.js";
|
|
4
|
-
export { HwpParser } from "./hwp.js";
|
|
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
7
|
export { OpendataloaderPdfParser, type PdfConverter } from "./opendataloader-pdf.js";
|
|
8
8
|
export { PlainTextParser } from "./plain-text.js";
|
|
9
9
|
export { ParserRegistry } from "./registry.js";
|
|
10
|
+
export type { HwpExtractionLimits, HwpExtractor } from "./rhwp-adapter.js";
|
|
10
11
|
export { type ParseInput, type ParseOutput, Parser } from "./types.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
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>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorag/librarian",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
|
-
"autorag": "
|
|
20
|
+
"autorag": "dist/cli/index.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@earendil-works/pi-coding-agent": "0.80.10",
|
|
45
45
|
"@opendataloader/pdf": "^2.4.7",
|
|
46
46
|
"@pngwasi/node-tantivy-binding": "^0.3.4",
|
|
47
|
+
"@rhwp/core": "0.7.19",
|
|
47
48
|
"chardet": "^2.2.0",
|
|
48
49
|
"fast-xml-parser": "^5.9.3",
|
|
49
50
|
"iconv-lite": "^0.7.2",
|
|
@@ -232,6 +232,58 @@ via the role-specific flags or:
|
|
|
232
232
|
- legacy single-model aliases: `AUTORAG_MODEL_PROVIDER` / `AUTORAG_MODEL_ID`
|
|
233
233
|
- `AUTORAG_SEARCH_PATHS`, `AUTORAG_WORKSPACE`, `AUTORAG_MEMORY_PATH`
|
|
234
234
|
|
|
235
|
+
## Configure datasource skills (optional)
|
|
236
|
+
|
|
237
|
+
External datasources (Slack, Discord, Notion, GitHub Issues/PRs, Google
|
|
238
|
+
Drive, Gmail, local mail exports, Obsidian vaults, RSS/news) are configured
|
|
239
|
+
as **datasource skills** in the trusted config file — never via model/tool
|
|
240
|
+
arguments. Add a `datasources` section (skill name → config) plus a trusted
|
|
241
|
+
`datasourceAccess` allow-list to `config.json`:
|
|
242
|
+
|
|
243
|
+
```jsonc
|
|
244
|
+
{
|
|
245
|
+
"datasources": {
|
|
246
|
+
"slack": { "connector": { "tokenEnv": "SLACK_BOT_TOKEN", "channels": ["eng"] } },
|
|
247
|
+
"discord": { "connector": { "tokenEnv": "DISCORD_BOT_TOKEN", "guildId": "..." } },
|
|
248
|
+
"notion": { "connector": { "tokenEnv": "NOTION_TOKEN" } },
|
|
249
|
+
"github": { "connector": { "repos": ["owner/repo"], "tokenEnv": "GITHUB_TOKEN" } },
|
|
250
|
+
"gdrive": { "connector": { "backend": "rclone", "remote": "gdrive:" } },
|
|
251
|
+
"gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
|
|
252
|
+
"mail-export": { "connector": { "paths": ["/path/to/exports"] } },
|
|
253
|
+
"obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
|
|
254
|
+
"rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
|
|
255
|
+
},
|
|
256
|
+
"datasourceAccess": {
|
|
257
|
+
"allowedTags": ["slack", "github", "rss"],
|
|
258
|
+
"allowedScopes": ["/slack/**", "/github/**", "/rss/**"]
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Rules:
|
|
264
|
+
|
|
265
|
+
- Tokens are configured as **environment variable names** (`tokenEnv`), never
|
|
266
|
+
raw secrets in the file. Each skill has a default env var
|
|
267
|
+
(`SLACK_BOT_TOKEN`, `DISCORD_BOT_TOKEN`, `NOTION_TOKEN`, `GITHUB_TOKEN`,
|
|
268
|
+
`GDRIVE_ACCESS_TOKEN`, `GMAIL_ACCESS_TOKEN`).
|
|
269
|
+
- **CLI-bridge backends** (recommended where available): `gmail` accepts
|
|
270
|
+
`"backend": "himalaya"` to index any IMAP/Maildir account the external
|
|
271
|
+
[himalaya](https://pimalaya.org) CLI has configured (no OAuth plumbing);
|
|
272
|
+
`gdrive` accepts `"backend": "rclone"` to index a Google Drive remote (or
|
|
273
|
+
any of rclone's 70+ backends) configured via `rclone config` — Docs/Sheets
|
|
274
|
+
are exported as text through `--drive-export-formats`. Auth lives entirely
|
|
275
|
+
in the external tool's own config, matching the katok pattern.
|
|
276
|
+
- Access is **default-deny**: without `datasourceAccess.allowedTags`, no
|
|
277
|
+
datasource skill is announced or searchable, even when configured.
|
|
278
|
+
`allowedScopes` are opaque slash-hierarchical roots like `/slack/<instance>/**`.
|
|
279
|
+
- Per-skill options: `instanceId`, `pollingIntervalMs`, `tags`, and the
|
|
280
|
+
connector-specific `connector` object. `false` or `{ "enabled": false }`
|
|
281
|
+
disables an entry. Unknown skill names fail config resolution.
|
|
282
|
+
- `autorag refresh --method datasources` indexes them; chunks persist under
|
|
283
|
+
`<workspace>/.autorag/datasources/<skill>/<instance>/`.
|
|
284
|
+
- Verify with the manual QA harness: `bun scripts/manual-qa/run-qa.ts`
|
|
285
|
+
(see `docs/manual-qa-datasources.md`).
|
|
286
|
+
|
|
235
287
|
## Build indexes after install
|
|
236
288
|
|
|
237
289
|
Installation + `init` alone does **not** make search useful. Immediately after
|