@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.
Files changed (50) hide show
  1. package/README.md +45 -1
  2. package/dist/agent/search-documents.d.ts +1 -0
  3. package/dist/cli/config.d.ts +6 -0
  4. package/dist/cli/index.js +3423 -306
  5. package/dist/datasource/chunk-store.d.ts +67 -0
  6. package/dist/datasource/connector-skill.d.ts +107 -0
  7. package/dist/datasource/connector.d.ts +72 -0
  8. package/dist/datasource/http.d.ts +49 -0
  9. package/dist/datasource/index.d.ts +14 -0
  10. package/dist/datasource/skills/discord/connector.d.ts +30 -0
  11. package/dist/datasource/skills/discord/index.d.ts +2 -0
  12. package/dist/datasource/skills/discord/skill.d.ts +20 -0
  13. package/dist/datasource/skills/factory.d.ts +35 -0
  14. package/dist/datasource/skills/gdrive/connector.d.ts +30 -0
  15. package/dist/datasource/skills/gdrive/index.d.ts +3 -0
  16. package/dist/datasource/skills/gdrive/rclone-connector.d.ts +51 -0
  17. package/dist/datasource/skills/gdrive/skill.d.ts +24 -0
  18. package/dist/datasource/skills/github/connector.d.ts +28 -0
  19. package/dist/datasource/skills/github/index.d.ts +2 -0
  20. package/dist/datasource/skills/github/skill.d.ts +20 -0
  21. package/dist/datasource/skills/gmail/connector.d.ts +30 -0
  22. package/dist/datasource/skills/gmail/himalaya-connector.d.ts +40 -0
  23. package/dist/datasource/skills/gmail/index.d.ts +3 -0
  24. package/dist/datasource/skills/gmail/skill.d.ts +24 -0
  25. package/dist/datasource/skills/mail-export/connector.d.ts +21 -0
  26. package/dist/datasource/skills/mail-export/index.d.ts +2 -0
  27. package/dist/datasource/skills/mail-export/skill.d.ts +20 -0
  28. package/dist/datasource/skills/notion/connector.d.ts +26 -0
  29. package/dist/datasource/skills/notion/index.d.ts +2 -0
  30. package/dist/datasource/skills/notion/skill.d.ts +20 -0
  31. package/dist/datasource/skills/obsidian/connector.d.ts +22 -0
  32. package/dist/datasource/skills/obsidian/index.d.ts +2 -0
  33. package/dist/datasource/skills/obsidian/skill.d.ts +20 -0
  34. package/dist/datasource/skills/rss/connector.d.ts +28 -0
  35. package/dist/datasource/skills/rss/index.d.ts +2 -0
  36. package/dist/datasource/skills/rss/skill.d.ts +22 -0
  37. package/dist/datasource/skills/slack/connector.d.ts +28 -0
  38. package/dist/datasource/skills/slack/index.d.ts +2 -0
  39. package/dist/datasource/skills/slack/skill.d.ts +20 -0
  40. package/dist/datasource/skills/spotlight/connector.d.ts +59 -0
  41. package/dist/datasource/skills/spotlight/index.d.ts +2 -0
  42. package/dist/datasource/skills/spotlight/skill.d.ts +20 -0
  43. package/dist/index.js +3267 -152
  44. package/dist/parser/defaults.d.ts +2 -0
  45. package/dist/parser/hwp-markdown.d.ts +25 -0
  46. package/dist/parser/hwp.d.ts +7 -0
  47. package/dist/parser/index.d.ts +2 -1
  48. package/dist/parser/rhwp-adapter.d.ts +30 -0
  49. package/package.json +3 -2
  50. package/skills/autorag-setup/SKILL.md +52 -0
package/README.md CHANGED
@@ -128,7 +128,45 @@ Security defaults are intentionally strict:
128
128
  - model/tool arguments never grant datasource tags or scopes;
129
129
  - `search_datasource_documents` accepts only `{ query, topK?, scope? }`, and `scope` can only narrow trusted access.
130
130
 
131
- KakaoTalk is the first datasource skill. It uses the external [`katok`](https://github.com/NomaDamas/katok) CLI only — AutoRAG never reads KakaoTalk databases directly. `katok` failures return diagnostics instead of throwing, and remote embedding egress configuration is rejected before the CLI is spawned.
131
+ #### Supported datasources
132
+
133
+ | Datasource | Skill | Connects via | Notes |
134
+ |---|---|---|---|
135
+ | KakaoTalk | `katok` | external [`katok`](https://github.com/NomaDamas/katok) CLI | first datasource skill; AutoRAG never reads KakaoTalk databases directly |
136
+ | Slack | `slack` | Slack Web API (bot token) | workspace/channel history; per-channel scope failures degrade to warnings |
137
+ | Discord | `discord` | Discord REST v10 (bot token) | guild/channel messages; Hangul channel names work as scopes |
138
+ | Notion | `notion` | Notion API (integration token) | pages/databases shared with the integration; block-tree text |
139
+ | GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
140
+ | Google Drive | `gdrive` | Drive REST v3, or **[`rclone`](https://rclone.org) CLI** (`backend: "rclone"`) | Docs/Sheets exported as text; the rclone backend also opens any of rclone's 70+ remotes |
141
+ | Gmail / IMAP | `gmail` | Gmail REST v1, or **[`himalaya`](https://pimalaya.org) CLI** (`backend: "himalaya"`) | the himalaya backend indexes any IMAP/Maildir account it has configured — no OAuth plumbing |
142
+ | Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
143
+ | Obsidian vault | `obsidian` | filesystem (markdown) | frontmatter/inline tags, wiki links `[[...]]`, embeds `![[...]]` |
144
+ | RSS / news | `rss` | HTTP feed polling | RSS 2.0 + Atom, feed/category hierarchy, 24h dedupe window |
145
+
146
+ All of them share one framework: a trusted connector fetches documents at refresh time, chunks persist under `<workspace>/.autorag/datasources/<skill>/<instance>/`, and queries run against a local BM25 lexical index (Korean-aware prefix matching) through `search_datasource_documents`. Tokens are referenced by environment variable name only (e.g. `SLACK_BOT_TOKEN`), never stored in config. Auth/permission/rate-limit failures surface as path/PII-opaque diagnostics. See [docs/manual-qa-datasources.md](docs/manual-qa-datasources.md) for the QA harnesses.
147
+
148
+ Configure them in `config.json` (CLI) or pass `datasourceSkills` programmatically:
149
+
150
+ ```jsonc
151
+ {
152
+ "datasources": {
153
+ "slack": { "connector": { "tokenEnv": "SLACK_BOT_TOKEN" } },
154
+ "github": { "connector": { "repos": ["owner/repo"] } },
155
+ "gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
156
+ "gdrive": { "connector": { "backend": "rclone", "remote": "gdrive:" } },
157
+ "obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
158
+ "rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
159
+ },
160
+ "datasourceAccess": {
161
+ "allowedTags": ["slack", "github", "gmail", "gdrive", "obsidian", "rss"],
162
+ "allowedScopes": ["/slack/**", "/github/**", "/gmail/**", "/gdrive/**", "/obsidian/**", "/rss/**"]
163
+ }
164
+ }
165
+ ```
166
+
167
+ #### KakaoTalk (katok)
168
+
169
+ KakaoTalk was the first datasource skill. It uses the external [`katok`](https://github.com/NomaDamas/katok) CLI only — AutoRAG never reads KakaoTalk databases directly. `katok` failures return diagnostics instead of throwing, and remote embedding egress configuration is rejected before the CLI is spawned.
132
170
 
133
171
  ```typescript
134
172
  import { AutoRAGAgent, KatokSkill } from "@autorag/librarian";
@@ -160,6 +198,12 @@ AutoRAG is built for **non-code document retrieval**: manuals, legal docs, inter
160
198
 
161
199
  Code repositories work too (the explorer's `grep` is useful), but AutoRAG's real value shows on unstructured text where simple pattern matching isn't enough.
162
200
 
201
+ #### Legacy HWP5 parsing
202
+
203
+ AutoRAG supports searchable Markdown extraction from legacy binary `.hwp` (HWP5) files for body paragraphs and top-level table cells. Extraction is powered by the MIT-licensed [`rhwp`](https://github.com/edwardkim/rhwp) WebAssembly parser.
204
+
205
+ This is scoped text extraction, not full-fidelity document conversion. Headers, footers, notes, text boxes, nested tables, images, equations, and OCR are explicitly deferred and are not currently extracted from HWP5 files.
206
+
163
207
  ## Configuration and state
164
208
 
165
209
  The default home state is kept outside the workspace:
@@ -28,6 +28,7 @@ export interface SearchDocumentResult {
28
28
  readonly evidence: readonly SearchDocumentEvidence[];
29
29
  readonly confidence: number;
30
30
  readonly feedbackId: string;
31
+ readonly source?: string;
31
32
  }
32
33
  export interface SearchDocumentsResponse {
33
34
  readonly sessionId: string;
@@ -1,5 +1,7 @@
1
1
  import type { Api, Model } from "@earendil-works/pi-ai";
2
2
  import type { AutoRAGAgentOptions } from "../agent/agent.js";
3
+ import type { DatasourceAccessContextOptions } from "../datasource/access-context.js";
4
+ import { type DatasourcesConfig } from "../datasource/skills/factory.js";
3
5
  import type { EnsureMinSyncBinaryOptions, MinSyncEmbedderConfig } from "../minsync/index.js";
4
6
  import type { BM25Engine, BM25FallbackMode } from "../retrieval/methods/bm25.js";
5
7
  import { type LoadLocalAutoRAGModelsOptions } from "../subagents/local-models.js";
@@ -84,6 +86,10 @@ export interface CliConfig {
84
86
  bm25?: Bm25MethodConfig;
85
87
  jikji?: Record<string, unknown>;
86
88
  parserOptions?: Record<string, unknown>;
89
+ /** Trusted datasource skill configuration (skill name → config). */
90
+ datasources?: DatasourcesConfig;
91
+ /** Trusted datasource allow-tags/allow-scopes. Absent ⇒ default-deny. */
92
+ datasourceAccess?: DatasourceAccessContextOptions;
87
93
  }
88
94
  export interface ResolveConfigInput {
89
95
  flags: Record<string, string | boolean | undefined>;