@autorag/librarian 2.0.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 +104 -2
- package/dist/agent/agent.d.ts +11 -0
- package/dist/agent/search-bm25-tool.d.ts +1 -1
- package/dist/agent/search-documents.d.ts +1 -0
- package/dist/agent/search-minsync-tool.d.ts +1 -1
- package/dist/cli/config.d.ts +6 -0
- package/dist/cli/index.js +5871 -587
- 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/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/http.d.ts +49 -0
- package/dist/datasource/index.d.ts +16 -0
- 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/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/index.d.ts +15 -0
- package/dist/datasource/skills/obsidian/client.d.ts +15 -0
- package/dist/datasource/skills/obsidian/index.d.ts +6 -0
- 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 +43 -0
- package/dist/datasource/skills/obsidian/types.d.ts +90 -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/index.d.ts +15 -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/datasource/skills/telecrawl/index.d.ts +15 -0
- package/dist/datasource/skills/wacrawl/index.d.ts +15 -0
- package/dist/index.js +5971 -673
- 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/dist/retrieval/merger.d.ts +1 -0
- package/dist/retrieval/scope.d.ts +10 -0
- package/package.json +19 -18
- package/skills/autorag-setup/SKILL.md +74 -0
package/README.md
CHANGED
|
@@ -128,7 +128,58 @@ 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
|
-
|
|
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
|
+
| 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 |
|
|
141
|
+
| GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
|
|
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 |
|
|
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 |
|
|
144
|
+
| Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
|
|
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` |
|
|
146
|
+
| RSS / news | `rss` | HTTP feed polling | RSS 2.0 + Atom, feed/category hierarchy, 24h dedupe window |
|
|
147
|
+
|
|
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.
|
|
149
|
+
|
|
150
|
+
Configure them in `config.json` (CLI) or pass `datasourceSkills` programmatically:
|
|
151
|
+
|
|
152
|
+
```jsonc
|
|
153
|
+
{
|
|
154
|
+
"datasources": {
|
|
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" } },
|
|
159
|
+
"github": { "connector": { "repos": ["owner/repo"] } },
|
|
160
|
+
"gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
|
|
161
|
+
"gdrive": { "connector": { "backend": "rclone", "remote": "gdrive:" } },
|
|
162
|
+
"obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
|
|
163
|
+
"rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
|
|
164
|
+
},
|
|
165
|
+
"datasourceAccess": {
|
|
166
|
+
"allowedTags": ["whatsapp", "telegram", "slack", "notion", "github", "gmail", "gdrive", "obsidian", "rss"],
|
|
167
|
+
"allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/notion/**", "/github/**", "/gmail/**", "/gdrive/**", "/obsidian/**", "/rss/**"]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
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
|
+
|
|
180
|
+
#### KakaoTalk (katok)
|
|
181
|
+
|
|
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.
|
|
132
183
|
|
|
133
184
|
```typescript
|
|
134
185
|
import { AutoRAGAgent, KatokSkill } from "@autorag/librarian";
|
|
@@ -152,6 +203,57 @@ await agent.refresh(); // refreshes parsed mirrors, BM25/MinSync, and datasource
|
|
|
152
203
|
const results = await agent.searchDatasourceDocuments("meeting with Mina", { topK: 5 });
|
|
153
204
|
```
|
|
154
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
|
+
|
|
155
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.
|
|
156
258
|
|
|
157
259
|
### Primary target: document collections
|
|
@@ -213,7 +315,7 @@ bun add github:NomaDamas/AutoRAG-2.0
|
|
|
213
315
|
```
|
|
214
316
|
|
|
215
317
|
Git-based installs build `dist/` via the `prepare` script and require Bun on the installing machine.
|
|
216
|
-
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.
|
|
217
319
|
|
|
218
320
|
## Quick Start
|
|
219
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 {};
|
|
@@ -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;
|
|
@@ -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 {};
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -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>;
|