@autorag/librarian 2.1.0 → 2.2.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 +73 -15
- package/dist/agent/agent.d.ts +11 -0
- package/dist/agent/search-bm25-tool.d.ts +1 -1
- package/dist/agent/search-minsync-tool.d.ts +1 -1
- package/dist/cli/index.js +4206 -2039
- package/dist/datasource/connector-skill.d.ts +1 -1
- package/dist/datasource/connector.d.ts +1 -1
- package/dist/datasource/crawler-client.d.ts +9 -0
- package/dist/datasource/crawler-skill.d.ts +41 -0
- package/dist/datasource/crawler-types.d.ts +53 -0
- package/dist/datasource/index.d.ts +6 -4
- package/dist/datasource/skills/discrawl/client.d.ts +23 -0
- package/dist/datasource/skills/discrawl/config.d.ts +9 -0
- package/dist/datasource/skills/discrawl/index.d.ts +5 -0
- package/dist/datasource/skills/discrawl/methods.d.ts +55 -0
- package/dist/datasource/skills/discrawl/paths.d.ts +30 -0
- package/dist/datasource/skills/discrawl/skill.d.ts +58 -0
- package/dist/datasource/skills/discrawl/types.d.ts +198 -0
- package/dist/datasource/skills/notion/index.d.ts +15 -2
- package/dist/datasource/skills/obsidian/client.d.ts +15 -0
- package/dist/datasource/skills/obsidian/index.d.ts +6 -2
- package/dist/datasource/skills/obsidian/methods.d.ts +26 -0
- package/dist/datasource/skills/obsidian/paths.d.ts +27 -0
- package/dist/datasource/skills/obsidian/skill.d.ts +40 -17
- package/dist/datasource/skills/obsidian/types.d.ts +90 -0
- package/dist/datasource/skills/slack/index.d.ts +15 -2
- package/dist/datasource/skills/telecrawl/index.d.ts +15 -0
- package/dist/datasource/skills/wacrawl/index.d.ts +15 -0
- package/dist/index.js +4231 -2048
- package/dist/retrieval/merger.d.ts +1 -0
- package/dist/retrieval/scope.d.ts +10 -0
- package/package.json +18 -18
- package/skills/autorag-setup/SKILL.md +29 -7
- package/dist/datasource/skills/discord/connector.d.ts +0 -30
- package/dist/datasource/skills/discord/index.d.ts +0 -2
- package/dist/datasource/skills/discord/skill.d.ts +0 -20
- package/dist/datasource/skills/notion/connector.d.ts +0 -26
- package/dist/datasource/skills/notion/skill.d.ts +0 -20
- package/dist/datasource/skills/obsidian/connector.d.ts +0 -22
- package/dist/datasource/skills/slack/connector.d.ts +0 -28
- package/dist/datasource/skills/slack/skill.d.ts +0 -20
package/README.md
CHANGED
|
@@ -133,24 +133,29 @@ Security defaults are intentionally strict:
|
|
|
133
133
|
| Datasource | Skill | Connects via | Notes |
|
|
134
134
|
|---|---|---|---|
|
|
135
135
|
| KakaoTalk | `katok` | external [`katok`](https://github.com/NomaDamas/katok) CLI | first datasource skill; AutoRAG never reads KakaoTalk databases directly |
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
136
|
+
| WhatsApp | `whatsapp` | external [`wacrawl`](https://github.com/openclaw/wacrawl) CLI | local-first incremental archive + FTS5 search; live desktop ingestion is macOS-only |
|
|
137
|
+
| Telegram | `telegram` | external [`telecrawl`](https://github.com/openclaw/telecrawl) CLI | local-first archive + FTS5 search; live desktop ingestion is macOS-only |
|
|
138
|
+
| Slack | `slack` | external [`slacrawl`](https://github.com/openclaw/slacrawl) CLI | local-first workspace/channel/thread archive + FTS5 search |
|
|
139
|
+
| Discord | `discord` | external [`discrawl`](https://github.com/openclaw/discrawl) CLI | guild/channel/thread/DM archive; FTS5 + semantic + hybrid retrieval, incremental sync |
|
|
140
|
+
| Notion | `notion` | external [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | local-first page/database/block archive + FTS5 search |
|
|
139
141
|
| GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
|
|
140
142
|
| 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
143
|
| 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
144
|
| Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
|
|
143
|
-
| Obsidian vault | `obsidian` |
|
|
145
|
+
| Obsidian vault | `obsidian` | external [`qmd`](https://github.com/tobi/qmd) CLI | incremental `qmd update`, BM25 `qmd search`, semantic `qmd vsearch`; vault path via `connector.vaultPath` |
|
|
144
146
|
| RSS / news | `rss` | HTTP feed polling | RSS 2.0 + Atom, feed/category hierarchy, 24h dedupe window |
|
|
145
147
|
|
|
146
|
-
|
|
148
|
+
Connector-backed skills fetch documents into AutoRAG's local chunk store. External-crawler skills such as KakaoTalk, WhatsApp, Telegram, Slack, and Notion leave incremental archive and FTS ownership with their CLI and map query results into the same retrieval pipeline. Obsidian uses the external `qmd` CLI (incremental update + BM25 + semantic). Tokens are referenced by environment variable name only, never stored in config. Process/API failures surface as path/PII-opaque diagnostics. See [docs/manual-qa-datasources.md](docs/manual-qa-datasources.md) for the QA harnesses.
|
|
147
149
|
|
|
148
150
|
Configure them in `config.json` (CLI) or pass `datasourceSkills` programmatically:
|
|
149
151
|
|
|
150
152
|
```jsonc
|
|
151
153
|
{
|
|
152
154
|
"datasources": {
|
|
153
|
-
"
|
|
155
|
+
"whatsapp": { "instanceId": "personal", "connector": { "binaryPath": "wacrawl" } },
|
|
156
|
+
"telegram": { "instanceId": "personal", "connector": { "binaryPath": "telecrawl" } },
|
|
157
|
+
"slack": { "connector": { "binaryPath": "slacrawl", "configPath": "/path/to/slacrawl.yaml", "syncSource": "primary" } },
|
|
158
|
+
"notion": { "connector": { "binaryPath": "notcrawl", "configPath": "/path/to/notcrawl.yaml" } },
|
|
154
159
|
"github": { "connector": { "repos": ["owner/repo"] } },
|
|
155
160
|
"gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
|
|
156
161
|
"gdrive": { "connector": { "backend": "rclone", "remote": "gdrive:" } },
|
|
@@ -158,12 +163,20 @@ Configure them in `config.json` (CLI) or pass `datasourceSkills` programmaticall
|
|
|
158
163
|
"rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
|
|
159
164
|
},
|
|
160
165
|
"datasourceAccess": {
|
|
161
|
-
"allowedTags": ["slack", "github", "gmail", "gdrive", "obsidian", "rss"],
|
|
162
|
-
"allowedScopes": ["/slack/**", "/github/**", "/gmail/**", "/gdrive/**", "/obsidian/**", "/rss/**"]
|
|
166
|
+
"allowedTags": ["whatsapp", "telegram", "slack", "notion", "github", "gmail", "gdrive", "obsidian", "rss"],
|
|
167
|
+
"allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/notion/**", "/github/**", "/gmail/**", "/gdrive/**", "/obsidian/**", "/rss/**"]
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
170
|
```
|
|
166
171
|
|
|
172
|
+
Install wacrawl with `brew install openclaw/tap/wacrawl`. AutoRAG invokes `wacrawl sync` during datasource refresh and `wacrawl --json --sync never search` during retrieval. Optional trusted connector fields are `binaryPath`, `databasePath`, and `sourcePath`. The child process receives only a restricted environment; unrelated model/provider secrets are not forwarded. Live WhatsApp Desktop discovery requires macOS and the permissions documented by wacrawl, while an existing portable archive can be queried on other supported platforms.
|
|
173
|
+
|
|
174
|
+
Install telecrawl with `brew install openclaw/tap/telecrawl`. AutoRAG invokes `telecrawl import` during datasource refresh and `telecrawl --json search` during retrieval. It uses the same optional trusted connector fields and restricted child environment as wacrawl. Live Telegram Desktop discovery requires macOS and the permissions documented by telecrawl, while an existing portable archive can be queried on other supported platforms.
|
|
175
|
+
|
|
176
|
+
Install slacrawl with `brew install openclaw/tap/slacrawl`. AutoRAG invokes `slacrawl sync` during datasource refresh and `slacrawl --json search` during retrieval. Optional trusted connector fields are `binaryPath`, `configPath`, and `syncSource`. Slack credentials and source definitions remain in slacrawl's own configuration rather than AutoRAG.
|
|
177
|
+
|
|
178
|
+
Install notcrawl with `brew install openclaw/tap/notcrawl`. AutoRAG invokes `notcrawl sync` during datasource refresh and `notcrawl search --json` during retrieval. Optional trusted connector fields are `binaryPath` and `configPath`. Notion credentials and workspace definitions remain in notcrawl's own configuration rather than AutoRAG.
|
|
179
|
+
|
|
167
180
|
#### KakaoTalk (katok)
|
|
168
181
|
|
|
169
182
|
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.
|
|
@@ -190,6 +203,57 @@ await agent.refresh(); // refreshes parsed mirrors, BM25/MinSync, and datasource
|
|
|
190
203
|
const results = await agent.searchDatasourceDocuments("meeting with Mina", { topK: 5 });
|
|
191
204
|
```
|
|
192
205
|
|
|
206
|
+
#### Discord (discrawl)
|
|
207
|
+
|
|
208
|
+
Discord uses the external [`discrawl`](https://github.com/openclaw/discrawl) CLI, which owns the SQLite archive, the FTS5 index, and the message vectors. AutoRAG never calls the Discord API itself.
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
brew install openclaw/tap/discrawl
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Two archive sources are supported. `wiretap` (the default) reads the local Discord Desktop cache and needs **no token at all**; `discord` uses a bot token, which is the ToS-sanctioned automation path. AutoRAG refuses to spawn the CLI when a Discord *user* token is present in the environment — automating a user account violates Discord's Community Guidelines and can get the account terminated.
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
import { AutoRAGAgent, DiscrawlClient, DiscrawlSkill } from "@autorag/librarian";
|
|
218
|
+
|
|
219
|
+
const discord = new DiscrawlSkill({
|
|
220
|
+
client: new DiscrawlClient({ source: "wiretap", root: process.cwd() }),
|
|
221
|
+
instanceId: "community",
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const agent = new AutoRAGAgent({
|
|
225
|
+
searchPaths: ["/path/to/documents"],
|
|
226
|
+
datasourceSkills: [discord],
|
|
227
|
+
datasourceAccess: {
|
|
228
|
+
allowedTags: ["discord"],
|
|
229
|
+
allowedScopes: ["/discord/community/**"],
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Or through the trusted config factory:
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"datasources": {
|
|
239
|
+
"discord": {
|
|
240
|
+
"instanceId": "community",
|
|
241
|
+
"connector": {
|
|
242
|
+
"source": "wiretap",
|
|
243
|
+
"embeddingProvider": "ollama",
|
|
244
|
+
"embeddingModel": "embeddinggemma",
|
|
245
|
+
"defaultMode": "hybrid"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Two defaults are deliberate and worth keeping:
|
|
253
|
+
|
|
254
|
+
- **`defaultMode: "hybrid"`** — discrawl's FTS index strips newlines without substituting a space, welding words across line breaks into a single unsearchable token (measured at ~47% of post-newline words on a real archive). Semantic recall covers that gap. See [#1413](https://github.com/Marker-Inc-Korea/AutoRAG/issues/1413).
|
|
255
|
+
- **`embeddingProvider: "ollama"` + `embeddingModel: "embeddinggemma"`** — semantic search requires an embedding provider (`ollama serve && ollama pull embeddinggemma`). For workspace-managed discrawl state, AutoRAG writes these values to `.autorag/datasources/discrawl/config.toml` while preserving unrelated discrawl settings. An explicit `connector.configPath` remains operator-owned and is never rewritten. EmbeddingGemma (Gemma 3 300M, 768-dim, 100+ languages) is the same model family katok uses for KakaoTalk, so all CLI-backed datasources share one local embedder. Do **not** use `nomic-embed-text`: it is English-only and collapses non-English text into one narrow similarity band, silently degrading semantic search to noise. AutoRAG emits a diagnostic when an English-only model is configured. See [#1414](https://github.com/Marker-Inc-Korea/AutoRAG/issues/1414).
|
|
256
|
+
|
|
193
257
|
A datasource skill should provide polling/cron metadata for routine indexing, source descriptions for the agent prompt, slash-hierarchical opaque source paths such as `/kakao/personal/chunks/<chunk-id>`, and permission tags that match your server-side access policy.
|
|
194
258
|
|
|
195
259
|
### Primary target: document collections
|
|
@@ -198,12 +262,6 @@ AutoRAG is built for **non-code document retrieval**: manuals, legal docs, inter
|
|
|
198
262
|
|
|
199
263
|
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.
|
|
200
264
|
|
|
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
|
-
|
|
207
265
|
## Configuration and state
|
|
208
266
|
|
|
209
267
|
The default home state is kept outside the workspace:
|
|
@@ -257,7 +315,7 @@ bun add github:NomaDamas/AutoRAG-2.0
|
|
|
257
315
|
```
|
|
258
316
|
|
|
259
317
|
Git-based installs build `dist/` via the `prepare` script and require Bun on the installing machine.
|
|
260
|
-
External tool binaries auto-install on first use into `<workspace>/.autorag/bin`: **MinSync** downloads a verified GitHub release asset (on by default; `minSync.autoInstall: false` to opt out), and **Jikji** compiles the [`jikji-cli`](https://crates.io/crates/jikji-cli) crate via cargo (requires the [Rust toolchain](https://rustup.rs); `jikji.autoInstall: false` to opt out). New `autorag init` configs enable Jikji find-first discovery by default. KakaoTalk (`katok`)
|
|
318
|
+
External tool binaries auto-install on first use into `<workspace>/.autorag/bin`: **MinSync** downloads a verified GitHub release asset (on by default; `minSync.autoInstall: false` to opt out), and **Jikji** compiles the [`jikji-cli`](https://crates.io/crates/jikji-cli) crate via cargo (requires the [Rust toolchain](https://rustup.rs); `jikji.autoInstall: false` to opt out). New `autorag init` configs enable Jikji find-first discovery by default. KakaoTalk (`katok`) and Discord (`discrawl`) stay manual, optional installs. All of them degrade gracefully when missing — core BM25 search works without any of them.
|
|
261
319
|
|
|
262
320
|
## Quick Start
|
|
263
321
|
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -24,8 +24,14 @@ export interface AutoRAGRefreshOptions {
|
|
|
24
24
|
/** Restrict refresh to specific methods. Defaults to all when undefined. */
|
|
25
25
|
readonly methods?: readonly RefreshMethod[];
|
|
26
26
|
}
|
|
27
|
+
export interface AutoRAGMinSyncRefreshResult {
|
|
28
|
+
readonly ok: boolean;
|
|
29
|
+
readonly synced: number;
|
|
30
|
+
readonly reason?: string;
|
|
31
|
+
}
|
|
27
32
|
export interface AutoRAGRefreshResult extends ParsedMirrorSyncResult {
|
|
28
33
|
readonly bm25?: BM25SyncResult;
|
|
34
|
+
readonly minsync?: AutoRAGMinSyncRefreshResult;
|
|
29
35
|
readonly datasources?: readonly DatasourceIndexResult[];
|
|
30
36
|
}
|
|
31
37
|
export interface AutoRAGRefreshComponentStatus {
|
|
@@ -122,6 +128,9 @@ export declare class AutoRAGAgent {
|
|
|
122
128
|
private refreshing;
|
|
123
129
|
private refreshState;
|
|
124
130
|
private readonly searchPaths;
|
|
131
|
+
private readonly configuredSearchPaths;
|
|
132
|
+
private retrievalScopeBindings;
|
|
133
|
+
private readonly datasourceVirtualScopePrefixes;
|
|
125
134
|
private readonly allowedExplorerRoots;
|
|
126
135
|
private readonly workspaceProjectRoot;
|
|
127
136
|
private readonly methodRegistry;
|
|
@@ -291,4 +300,6 @@ export declare class AutoRAGAgent {
|
|
|
291
300
|
/** The retrieval method registry (posix active; vector/bm25/hybrid pluggable). */
|
|
292
301
|
getMethodRegistry(): RetrievalMethodRegistry;
|
|
293
302
|
getSystemPrompt(): string;
|
|
303
|
+
private normalizeRetrievalOptions;
|
|
304
|
+
private resolveRetrievalScope;
|
|
294
305
|
}
|
|
@@ -14,5 +14,5 @@ export interface SearchBM25DocumentsDetails {
|
|
|
14
14
|
readonly readiness: BM25Status["readiness"];
|
|
15
15
|
readonly engine: BM25Status["engine"];
|
|
16
16
|
}
|
|
17
|
-
export declare function createSearchBM25DocumentsTool(getMethod: () => BM25Method | undefined): AgentTool<typeof searchBM25Schema, SearchBM25DocumentsDetails>;
|
|
17
|
+
export declare function createSearchBM25DocumentsTool(getMethod: () => BM25Method | undefined, resolveScope?: (scope: string | undefined) => string | undefined): AgentTool<typeof searchBM25Schema, SearchBM25DocumentsDetails>;
|
|
18
18
|
export {};
|
|
@@ -20,5 +20,5 @@ export interface SearchMinSyncDocumentsDetails {
|
|
|
20
20
|
* tool returns a path-free unavailable message with `available: false` and a
|
|
21
21
|
* zero result count — never a real binary or workspace path.
|
|
22
22
|
*/
|
|
23
|
-
export declare function createSearchMinSyncDocumentsTool(getMethod: () => MinSyncVectorMethod | undefined): AgentTool<typeof searchMinSyncSchema, SearchMinSyncDocumentsDetails>;
|
|
23
|
+
export declare function createSearchMinSyncDocumentsTool(getMethod: () => MinSyncVectorMethod | undefined, resolveScope?: (scope: string | undefined) => string | undefined): AgentTool<typeof searchMinSyncSchema, SearchMinSyncDocumentsDetails>;
|
|
24
24
|
export {};
|