@autorag/librarian 2.1.0 → 2.3.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 +155 -55
- package/dist/agent/agent.d.ts +27 -41
- package/dist/agent/bash-tool.d.ts +0 -11
- package/dist/agent/dupey-tool.d.ts +15 -0
- package/dist/agent/emit-results-tool.d.ts +14 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/local-model.d.ts +12 -0
- package/dist/agent/search-bm25-tool.d.ts +1 -1
- package/dist/agent/search-documents.d.ts +1 -1
- package/dist/agent/search-minsync-tool.d.ts +1 -1
- package/dist/agent/system-prompt.d.ts +1 -2
- package/dist/cli/commands/duplicates.d.ts +4 -0
- package/dist/cli/commands/health.d.ts +9 -65
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/search.d.ts +2 -2
- package/dist/cli/config.d.ts +10 -14
- package/dist/cli/index.js +10652 -9947
- package/dist/datasource/aliased-skill.d.ts +28 -0
- package/dist/datasource/chunk-store.d.ts +2 -0
- package/dist/datasource/connector-skill.d.ts +4 -1
- package/dist/datasource/connector.d.ts +5 -1
- package/dist/datasource/crawler-client.d.ts +9 -0
- package/dist/datasource/crawler-skill.d.ts +47 -0
- package/dist/datasource/crawler-types.d.ts +53 -0
- package/dist/datasource/index.d.ts +8 -4
- package/dist/datasource/skills/cloud-drive/index.d.ts +1 -0
- package/dist/datasource/skills/cloud-drive/skill.d.ts +14 -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 +61 -0
- package/dist/datasource/skills/discrawl/types.d.ts +198 -0
- package/dist/datasource/skills/factory.d.ts +7 -0
- package/dist/datasource/skills/gdrive/rclone-connector.d.ts +16 -24
- 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 +41 -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/dupey/cli.d.ts +40 -0
- package/dist/dupey/filter.d.ts +8 -0
- package/dist/dupey/index.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7774 -7409
- package/dist/memory/check-memory-tool.d.ts +1 -0
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/memory.d.ts +33 -3
- package/dist/memory/renderer.d.ts +2 -1
- package/dist/mirror/sync.d.ts +3 -1
- package/dist/observability/run-log.d.ts +1 -26
- package/dist/process/portable-spawn.d.ts +10 -0
- package/dist/retrieval/merger.d.ts +1 -0
- package/dist/retrieval/scope.d.ts +10 -0
- package/package.json +21 -20
- package/skills/autorag/SKILL.md +59 -96
- package/skills/autorag-setup/SKILL.md +144 -378
- 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/dist/subagents/contracts.d.ts +0 -90
- package/dist/subagents/dispatch-templates.d.ts +0 -104
- package/dist/subagents/dispatch-validation.d.ts +0 -169
- package/dist/subagents/explorer-tools-extension.d.ts +0 -4
- package/dist/subagents/explorer-tools-extension.js +0 -130
- package/dist/subagents/local-models.d.ts +0 -14
- package/dist/subagents/model-policy.d.ts +0 -31
- package/dist/subagents/runtime.d.ts +0 -52
package/README.md
CHANGED
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
AutoRAG searches your PDFs, wikis, notes, research papers, and knowledge bases — then curates the results into clean, numbered knowledge units. No raw grep dumps. Just answers.
|
|
12
12
|
|
|
13
|
-
AutoRAG is a customized [Pi](https://github.com/earendil-works/pi-mono) agent — the Pi agent loop configured into a librarian.
|
|
13
|
+
AutoRAG is a customized [Pi](https://github.com/earendil-works/pi-mono) agent — the Pi agent loop configured into a librarian. The AutoRAG librarian retrieves candidates, reads source files directly, judges the evidence, and curates the structured answer. Its model and provider come from the user's authenticated runtime; AutoRAG does not ship a private provider default.
|
|
14
|
+
|
|
15
|
+
AutoRAG itself is the specialized search agent, not a coordinator for other
|
|
16
|
+
model roles. You configure one model, and that model owns the complete
|
|
17
|
+
retrieval, reading, judgment, and curation loop.
|
|
14
18
|
|
|
15
19
|
## Why AutoRAG
|
|
16
20
|
|
|
@@ -61,31 +65,19 @@ Different documents need different search strategies:
|
|
|
61
65
|
| Legal documents, specifications | BM25 (keyword ranking) | Handles domain terminology well |
|
|
62
66
|
| Mixed collections | Hybrid (vector + BM25) | Combines precision and recall |
|
|
63
67
|
|
|
64
|
-
AutoRAG supports **pluggable retrieval methods**. It ships with lexical **BM25** and semantic **MinSync** methods wired through the `RetrievalMethodRegistry`, and the architecture is ready for additional vector and hybrid backends. The
|
|
68
|
+
AutoRAG supports **pluggable retrieval methods**. It ships with lexical **BM25** and semantic **MinSync** methods wired through the `RetrievalMethodRegistry`, and the architecture is ready for additional vector and hybrid backends. The librarian invokes retrieval tools, reads the underlying documents directly through `bash`, and curates one unified result set after `ResultMerger` score normalization and deduplication.
|
|
65
69
|
|
|
66
70
|
BM25 and MinSync are **enabled by default** — no explicit configuration is needed for standard lexical + semantic retrieval. Both can be disabled by setting `"bm25": false` or `"minSync": false` in the config file. MinSync uses a pre-installed binary (`autoInstall: false`); configure `minSync.embedder` via `autorag init --embedder-*` flags for remote embedding endpoints. AutoRAG never forces TEI or any external embedding service.
|
|
67
71
|
|
|
68
72
|
### Real directory access
|
|
69
73
|
|
|
70
|
-
AutoRAG reads configured source directories through
|
|
71
|
-
|
|
72
|
-
Each explorer `task` contains an Assignment V1 block — a sentinel-wrapped JSON body with `originalQuery` (the caller query verbatim), `method` (the selected retrieval path), and `queryVariants` (a nonempty array), followed by canonical role lines requiring `retrievedAt` and temporal metadata:
|
|
73
|
-
|
|
74
|
-
```text
|
|
75
|
-
<<<AUTORAG_ASSIGNMENT_V1>>>
|
|
76
|
-
{"originalQuery":"<caller query verbatim>","method":"<selected retrieval method>","queryVariants":["<variant 1>","<variant 2>"]}
|
|
77
|
-
<<<END_AUTORAG_ASSIGNMENT_V1>>>
|
|
78
|
-
Required handoff: include retrievedAt.
|
|
79
|
-
Required handoff: include temporal metadata.
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
A legacy labeled format (`Original query:`, `Selected retrieval method:`, `Query variants:`) is accepted for compatibility. Missing or null top-level `artifacts`, `agentScope`, and leaf `model` fields are safely autofilled before validation; explicit wrong values (`artifacts: true`, `agentScope: "project"`, a non-configured model) remain rejected. There is no single-agent fallback. See [docs/subagent-orchestration.md](docs/subagent-orchestration.md) for the full dispatch contract, templates, anti-examples, and stable coded dispatch errors.
|
|
74
|
+
AutoRAG reads configured source directories directly through its built-in `bash` tool. Retrieval tools can supply candidate paths, but the same agent opens the source material before curating. Answers are returned as a structured `SearchDocumentsResponse`; results carry their real source (file path or datasource id) in the internal mapping for feedback and curation. BM25 and MinSync index parsed markdown mirrors under `.autorag`.
|
|
83
75
|
|
|
84
76
|
### Optional Jikji discovery and indexing
|
|
85
77
|
|
|
86
78
|
AutoRAG can opt into [Jikji](https://github.com/NomaDamas/jikji) as a local CLI-backed **find-first discovery and indexing** layer. Jikji is optional: AutoRAG does not vendor it, install it, or register it as a retrieval backend when enabled.
|
|
87
79
|
|
|
88
|
-
When Jikji is configured, AutoRAG calls `jikji find ROOT "query" --json` via
|
|
80
|
+
When Jikji is configured, AutoRAG calls `jikji find ROOT "query" --json` via the `jikji_find` tool. The tool parses and validates the upstream answer pack and exposes its `handoff_action`, `tool_call_policy`, and `agent_should_not_rerank` to the librarian. Direct file reading remains available for source verification. `prepare`/`refresh` remain for indexing only and do not answer queries directly.
|
|
89
81
|
|
|
90
82
|
Programmatic use:
|
|
91
83
|
|
|
@@ -97,6 +89,35 @@ const agent = new AutoRAGAgent({
|
|
|
97
89
|
await agent.prepareJikji();
|
|
98
90
|
```
|
|
99
91
|
|
|
92
|
+
### Duplicate document management with dupey
|
|
93
|
+
|
|
94
|
+
AutoRAG can use the external [`dupey`](https://github.com/NomaDamas/dupey) CLI
|
|
95
|
+
to detect exact, near, and containment document families.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
autorag duplicates /path/to/documents
|
|
99
|
+
autorag duplicates --json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The command is read-only: it reports exact duplicate groups and review
|
|
103
|
+
guidance, but never moves or deletes source files. The `scan_duplicate_documents`
|
|
104
|
+
Agent tool exposes the same read-only scan to the orchestrator.
|
|
105
|
+
|
|
106
|
+
Exact duplicate exclusion is enabled by default during parsed-mirror refresh.
|
|
107
|
+
For each exact canonical-text hash, the newest filesystem copy is indexed and
|
|
108
|
+
older copies are omitted. Disable it in `config.json` when both copies must be
|
|
109
|
+
searchable:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"dupey": { "enabled": true },
|
|
114
|
+
"excludeExactDuplicates": false
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
If `dupey` is not installed or fails, refresh continues without exclusion and
|
|
119
|
+
reports no destructive action; install it with `cargo install dupey`.
|
|
120
|
+
|
|
100
121
|
The same `.autorag/jikji.json` shape configures Jikji when present:
|
|
101
122
|
|
|
102
123
|
```json
|
|
@@ -122,6 +143,14 @@ The upstream Rust `PrepareArgs` defines reference defaults that AutoRAG does not
|
|
|
122
143
|
|
|
123
144
|
Datasource skills let AutoRAG search external, server-configured data sources through the same retrieval pipeline as local documents. A skill describes what it indexes, how it should be refreshed, what source instances exist, and which permission tags/scopes bound access. Retrieval still flows through `RetrievalMethodRegistry` → `ParallelRetriever` → datasource result filtering → `ResultMerger`; datasource skills do not create a parallel search path.
|
|
124
145
|
|
|
146
|
+
Every datasource can be registered multiple times through a connection alias:
|
|
147
|
+
use the config key as the unique name and set `type` to the reusable backend
|
|
148
|
+
(`gmail`, `github`, `slack`, `discord`, `kakao`, `cloud-drive`, and so on).
|
|
149
|
+
Each alias becomes an independently loadable agent skill with its own source
|
|
150
|
+
scope and workspace namespace. Chat aliases search all channels by default;
|
|
151
|
+
trusted `channels.ids` / `channels.names` allowlists can expose a particular
|
|
152
|
+
channel or group chat as its own datasource.
|
|
153
|
+
|
|
125
154
|
Security defaults are intentionally strict:
|
|
126
155
|
|
|
127
156
|
- datasource access is default-deny unless trusted server/API configuration supplies `datasourceAccess.allowedTags` and `datasourceAccess.allowedScopes`;
|
|
@@ -133,37 +162,66 @@ Security defaults are intentionally strict:
|
|
|
133
162
|
| Datasource | Skill | Connects via | Notes |
|
|
134
163
|
|---|---|---|---|
|
|
135
164
|
| KakaoTalk | `katok` | external [`katok`](https://github.com/NomaDamas/katok) CLI | first datasource skill; AutoRAG never reads KakaoTalk databases directly |
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
165
|
+
| WhatsApp | `whatsapp` | external [`wacrawl`](https://github.com/openclaw/wacrawl) CLI | local-first incremental archive + FTS5 search; live desktop ingestion is macOS-only |
|
|
166
|
+
| Telegram | `telegram` | external [`telecrawl`](https://github.com/openclaw/telecrawl) CLI | local-first archive + FTS5 search; live desktop ingestion is macOS-only |
|
|
167
|
+
| Slack | `slack` | external [`slacrawl`](https://github.com/openclaw/slacrawl) CLI | local-first workspace/channel/thread archive + FTS5 search |
|
|
168
|
+
| Discord | `discord` | external [`discrawl`](https://github.com/openclaw/discrawl) CLI | guild/channel/thread/DM archive; FTS5 + semantic + hybrid retrieval, incremental sync |
|
|
169
|
+
| Notion | `notion` | external [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | local-first page/database/block archive + FTS5 search |
|
|
139
170
|
| GitHub Issues/PRs | `github` | GitHub REST (token optional) | issues + PR bodies per `owner/repo`; public repos work unauthenticated |
|
|
140
|
-
|
|
|
171
|
+
| Cloud drives | `cloud-drive` | **[`rclone`](https://rclone.org) CLI** | Incremental Google Drive Tier-1; OneDrive/network remotes; iCloud experimental |
|
|
141
172
|
| 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
173
|
| Local mail exports | `mail-export` | filesystem (`.mbox` / `.eml`) | classic `From_` splitting, mailparser-based; count-only warnings |
|
|
143
|
-
| Obsidian vault | `obsidian` |
|
|
174
|
+
| 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
175
|
| RSS / news | `rss` | HTTP feed polling | RSS 2.0 + Atom, feed/category hierarchy, 24h dedupe window |
|
|
145
176
|
|
|
146
|
-
|
|
177
|
+
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
178
|
|
|
148
179
|
Configure them in `config.json` (CLI) or pass `datasourceSkills` programmatically:
|
|
149
180
|
|
|
150
181
|
```jsonc
|
|
151
182
|
{
|
|
152
183
|
"datasources": {
|
|
153
|
-
"
|
|
184
|
+
"whatsapp": { "instanceId": "personal", "connector": { "binaryPath": "wacrawl" } },
|
|
185
|
+
"telegram": { "instanceId": "personal", "connector": { "binaryPath": "telecrawl" } },
|
|
186
|
+
"slack": { "connector": { "binaryPath": "slacrawl", "configPath": "/path/to/slacrawl.yaml", "syncSource": "primary" } },
|
|
187
|
+
"notion": { "connector": { "binaryPath": "notcrawl", "configPath": "/path/to/notcrawl.yaml" } },
|
|
154
188
|
"github": { "connector": { "repos": ["owner/repo"] } },
|
|
155
189
|
"gmail": { "connector": { "backend": "himalaya", "account": "gmail", "folder": "INBOX" } },
|
|
156
|
-
"
|
|
190
|
+
"personal-google-drive": { "type": "cloud-drive", "instanceId": "personal", "connector": { "provider": "google-drive", "remote": "personal-gdrive:", "include": ["**/*.md"] } },
|
|
191
|
+
"company-onedrive": { "type": "cloud-drive", "instanceId": "work", "connector": { "provider": "onedrive", "remote": "company-onedrive:Documents" } },
|
|
157
192
|
"obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
|
|
158
193
|
"rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
|
|
159
194
|
},
|
|
160
195
|
"datasourceAccess": {
|
|
161
|
-
"allowedTags": ["slack", "github", "gmail", "
|
|
162
|
-
"allowedScopes": ["/slack/**", "/github/**", "/gmail/**", "/
|
|
196
|
+
"allowedTags": ["whatsapp", "telegram", "slack", "notion", "github", "gmail", "cloud-drive", "obsidian", "rss"],
|
|
197
|
+
"allowedScopes": ["/whatsapp/**", "/telegram/**", "/slack/**", "/notion/**", "/github/**", "/gmail/**", "/personal-google-drive/**", "/company-onedrive/**", "/obsidian/**", "/rss/**"]
|
|
163
198
|
}
|
|
164
199
|
}
|
|
165
200
|
```
|
|
166
201
|
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
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.
|
|
205
|
+
|
|
206
|
+
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.
|
|
207
|
+
|
|
208
|
+
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.
|
|
209
|
+
|
|
210
|
+
Install and authenticate rclone separately (`brew install rclone && rclone
|
|
211
|
+
config` on macOS), then configure the provider-neutral `cloud-drive` skill.
|
|
212
|
+
`cloud-drive` is a reusable `type`: each datasource config key is a connection
|
|
213
|
+
alias and becomes a separate agent skill and scope. Multiple Google accounts,
|
|
214
|
+
or Google Drive plus OneDrive/iCloud, can therefore be loaded and searched
|
|
215
|
+
independently.
|
|
216
|
+
AutoRAG inventories with `rclone lsjson`, keeps a workspace-local manifest and
|
|
217
|
+
managed mirror, and downloads only added or changed indexable files. Google
|
|
218
|
+
Drive is Tier-1. OneDrive, Dropbox, SMB/SFTP/WebDAV, and mounted drives share
|
|
219
|
+
the same manifest contract. iCloud Drive is experimental because rclone marks
|
|
220
|
+
that backend Tier 4 and Apple ID/2FA sessions periodically require
|
|
221
|
+
reauthentication. See [docs/datasource-skills.md](docs/datasource-skills.md)
|
|
222
|
+
for filtering, size, concurrency, bandwidth, dry-run, and agent tool-calling
|
|
223
|
+
details.
|
|
224
|
+
|
|
167
225
|
#### KakaoTalk (katok)
|
|
168
226
|
|
|
169
227
|
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,19 +248,64 @@ await agent.refresh(); // refreshes parsed mirrors, BM25/MinSync, and datasource
|
|
|
190
248
|
const results = await agent.searchDatasourceDocuments("meeting with Mina", { topK: 5 });
|
|
191
249
|
```
|
|
192
250
|
|
|
193
|
-
|
|
251
|
+
#### Discord (discrawl)
|
|
194
252
|
|
|
195
|
-
|
|
253
|
+
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.
|
|
196
254
|
|
|
197
|
-
|
|
255
|
+
```bash
|
|
256
|
+
brew install openclaw/tap/discrawl
|
|
257
|
+
```
|
|
198
258
|
|
|
199
|
-
|
|
259
|
+
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.
|
|
200
260
|
|
|
201
|
-
|
|
261
|
+
```typescript
|
|
262
|
+
import { AutoRAGAgent, DiscrawlClient, DiscrawlSkill } from "@autorag/librarian";
|
|
263
|
+
|
|
264
|
+
const discord = new DiscrawlSkill({
|
|
265
|
+
client: new DiscrawlClient({ source: "wiretap", root: process.cwd() }),
|
|
266
|
+
instanceId: "community",
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
const agent = new AutoRAGAgent({
|
|
270
|
+
searchPaths: ["/path/to/documents"],
|
|
271
|
+
datasourceSkills: [discord],
|
|
272
|
+
datasourceAccess: {
|
|
273
|
+
allowedTags: ["discord"],
|
|
274
|
+
allowedScopes: ["/discord/community/**"],
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Or through the trusted config factory:
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
{
|
|
283
|
+
"datasources": {
|
|
284
|
+
"discord": {
|
|
285
|
+
"instanceId": "community",
|
|
286
|
+
"connector": {
|
|
287
|
+
"source": "wiretap",
|
|
288
|
+
"embeddingProvider": "ollama",
|
|
289
|
+
"embeddingModel": "embeddinggemma",
|
|
290
|
+
"defaultMode": "hybrid"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Two defaults are deliberate and worth keeping:
|
|
202
298
|
|
|
203
|
-
|
|
299
|
+
- **`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).
|
|
300
|
+
- **`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).
|
|
204
301
|
|
|
205
|
-
|
|
302
|
+
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.
|
|
303
|
+
|
|
304
|
+
### Primary target: document collections
|
|
305
|
+
|
|
306
|
+
AutoRAG is built for **non-code document retrieval**: manuals, legal docs, internal wikis, meeting notes, research literature, knowledge bases, PDFs.
|
|
307
|
+
|
|
308
|
+
Code repositories work too (direct `grep` is useful), but AutoRAG's real value shows on unstructured text where simple pattern matching isn't enough.
|
|
206
309
|
|
|
207
310
|
## Configuration and state
|
|
208
311
|
|
|
@@ -212,38 +315,39 @@ The default home state is kept outside the workspace:
|
|
|
212
315
|
~/.autorag/
|
|
213
316
|
├── config.json
|
|
214
317
|
├── memory.json
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
└── pi-agent/
|
|
218
|
-
├── auth.json
|
|
219
|
-
├── models.json
|
|
220
|
-
├── settings.json
|
|
221
|
-
└── sessions/
|
|
318
|
+
└── logs/
|
|
319
|
+
└── runs.jsonl
|
|
222
320
|
```
|
|
223
321
|
|
|
224
|
-
`config.json` selects sources, the workspace, memory path, retrieval settings, and the
|
|
322
|
+
`config.json` selects sources, the workspace, memory path, retrieval settings, and the agent model. Provider and model IDs must refer to a model available in the user's authenticated runtime:
|
|
225
323
|
|
|
226
324
|
```json
|
|
227
325
|
{
|
|
228
326
|
"searchPaths": ["/path/to/documents"],
|
|
229
327
|
"workspacePath": "/path/to/workspace",
|
|
230
328
|
"memoryPath": "/Users/you/.autorag/memory.json",
|
|
231
|
-
"
|
|
232
|
-
"orchestrator": { "provider": "provider-name", "id": "reasoning-model" },
|
|
233
|
-
"explorer": { "provider": "provider-name", "id": "exploration-model" }
|
|
234
|
-
}
|
|
329
|
+
"model": { "provider": "provider-name", "id": "reasoning-model" }
|
|
235
330
|
}
|
|
236
331
|
```
|
|
237
332
|
|
|
238
|
-
`autorag init` leaves `
|
|
333
|
+
`autorag init` leaves `model` unset when no model flags are supplied. At search time AutoRAG resolves an authenticated local provider when possible; otherwise configure the model explicitly.
|
|
334
|
+
|
|
335
|
+
For fast interactive search, prefer a model with reliable tool calling, high
|
|
336
|
+
output TPS, and low first-token latency. A query can require several short
|
|
337
|
+
model turns while AutoRAG alternates between retrieval tools and direct source
|
|
338
|
+
reading, so model throughput has a visible effect on end-to-end response time.
|
|
339
|
+
It does not accelerate BM25, MinSync, Jikji, filesystem access, or indexing
|
|
340
|
+
itself. Larger reasoning models remain useful for difficult synthesis,
|
|
341
|
+
conflicting evidence, and specialized domain judgment, but they are not a
|
|
342
|
+
requirement for ordinary retrieval.
|
|
239
343
|
|
|
240
344
|
Config path precedence is `--config` > `AUTORAG_CONFIG` > `~/.autorag/config.json`. When the home config is absent and `<cwd>/autorag.config.json` exists, AutoRAG copies the legacy file to `~/.autorag/config.json` without deleting or modifying the legacy file. The legacy cwd file is a migration source, not the default location.
|
|
241
345
|
|
|
242
|
-
`memory.json` stores retrieval memory
|
|
346
|
+
`memory.json` stores retrieval memory and `logs/runs.jsonl` records run events. Model authentication remains with the user's configured provider or authenticated local runtime. Corpus indexes remain workspace-local: refresh keeps parsed mirrors and BM25/MinSync indexes under `<workspace>/.autorag`.
|
|
243
347
|
|
|
244
348
|
`autorag refresh` and `autorag index reset|rebuild` accept `--method <csv>` (e.g. `--method bm25,minsync,parsed`) to scope which indexing methods run or which index directories are removed. When omitted, all methods run. `autorag init` accepts `--embedder-*` flags to configure the MinSync embedder endpoint in the config file.
|
|
245
349
|
|
|
246
|
-
`autorag health` checks model/provider auth
|
|
350
|
+
`autorag health` checks model/provider auth before a search — it resolves the model, verifies credential presence, and optionally probes one completion call. Use it to diagnose model, provider, auth, or timeout failures. `autorag status` remains the model-free index-health command (corpus freshness and BM25/MinSync readiness). When `autorag search` fails for a model/provider reason, the error output includes a hint pointing to `autorag health`.
|
|
247
351
|
|
|
248
352
|
## Installation
|
|
249
353
|
|
|
@@ -257,7 +361,7 @@ bun add github:NomaDamas/AutoRAG-2.0
|
|
|
257
361
|
```
|
|
258
362
|
|
|
259
363
|
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`)
|
|
364
|
+
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
365
|
|
|
262
366
|
## Quick Start
|
|
263
367
|
|
|
@@ -287,15 +391,11 @@ agent.recordFeedbackByNumbers(response.sessionId, [1, 3], [2]);
|
|
|
287
391
|
│
|
|
288
392
|
▼
|
|
289
393
|
┌──────────────┐
|
|
290
|
-
│ Plan +
|
|
291
|
-
└──────┬───────┘
|
|
292
|
-
▼
|
|
293
|
-
┌──────────────┐
|
|
294
|
-
│ Delegate │ ← pi-subagents → gpt-5.6-luna explorer
|
|
394
|
+
│ Plan + search│ ← check_memory, Jikji, and retrieval tools
|
|
295
395
|
└──────┬───────┘
|
|
296
396
|
▼
|
|
297
397
|
┌──────────────┐
|
|
298
|
-
│
|
|
398
|
+
│ Direct read │ ← bash find/grep/cat
|
|
299
399
|
└──────┬──────┘
|
|
300
400
|
▼
|
|
301
401
|
┌─────────────┐
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Agent, type AgentTool, type Skill } from "@earendil-works/pi-agent-core
|
|
|
2
2
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
3
3
|
import { type DatasourceAccessContextOptions } from "../datasource/access-context.js";
|
|
4
4
|
import type { DatasourceIndexResult, DatasourceSkill } from "../datasource/types.js";
|
|
5
|
+
import { type DupeyCliOptions } from "../dupey/index.js";
|
|
5
6
|
import { type JikjiFailureReason, type JikjiOptions } from "../jikji/index.js";
|
|
6
7
|
import type { ResultFeedback } from "../memory/memory.js";
|
|
7
8
|
import { type MinSyncSyncResult, type MinSyncVectorMethodOptions } from "../minsync/index.js";
|
|
@@ -10,7 +11,7 @@ import type { DefaultParserRegistryOptions } from "../parser/index.js";
|
|
|
10
11
|
import { type BM25MethodOptions, type BM25SyncResult } from "../retrieval/methods/bm25.js";
|
|
11
12
|
import { RetrievalMethodRegistry } from "../retrieval/registry.js";
|
|
12
13
|
import type { CuratedResult, RetrievalDiagnostic, RetrievalOptions, RetrievalResult } from "../retrieval/types.js";
|
|
13
|
-
import { type
|
|
14
|
+
import { type ScanDuplicateDocumentsDetails } from "./dupey-tool.js";
|
|
14
15
|
import { type JikjiFindProviderResult } from "./jikji-find-tool.js";
|
|
15
16
|
import { type SearchDocumentDiagnostic, type SearchDocumentsResponse } from "./search-documents.js";
|
|
16
17
|
import { type WatcherFactory, type WatchRefreshHandle } from "./watch-refresh.js";
|
|
@@ -24,8 +25,14 @@ export interface AutoRAGRefreshOptions {
|
|
|
24
25
|
/** Restrict refresh to specific methods. Defaults to all when undefined. */
|
|
25
26
|
readonly methods?: readonly RefreshMethod[];
|
|
26
27
|
}
|
|
28
|
+
export interface AutoRAGMinSyncRefreshResult {
|
|
29
|
+
readonly ok: boolean;
|
|
30
|
+
readonly synced: number;
|
|
31
|
+
readonly reason?: string;
|
|
32
|
+
}
|
|
27
33
|
export interface AutoRAGRefreshResult extends ParsedMirrorSyncResult {
|
|
28
34
|
readonly bm25?: BM25SyncResult;
|
|
35
|
+
readonly minsync?: AutoRAGMinSyncRefreshResult;
|
|
29
36
|
readonly datasources?: readonly DatasourceIndexResult[];
|
|
30
37
|
}
|
|
31
38
|
export interface AutoRAGRefreshComponentStatus {
|
|
@@ -62,7 +69,6 @@ export interface AutoRAGWatchRefreshOptions {
|
|
|
62
69
|
export type AutoRAGWatchRefreshHandle = WatchRefreshHandle;
|
|
63
70
|
export interface AutoRAGAgentOptions {
|
|
64
71
|
model?: Model<Api>;
|
|
65
|
-
explorerModel?: Model<Api>;
|
|
66
72
|
apiKey?: string;
|
|
67
73
|
providerApiKeys?: Readonly<Record<string, string>>;
|
|
68
74
|
searchPaths: string[];
|
|
@@ -75,9 +81,10 @@ export interface AutoRAGAgentOptions {
|
|
|
75
81
|
jikji?: JikjiOptions;
|
|
76
82
|
autoRefresh?: AutoRefreshOptions;
|
|
77
83
|
parserOptions?: DefaultParserRegistryOptions;
|
|
84
|
+
dupey?: DupeyCliOptions | false;
|
|
85
|
+
excludeExactDuplicates?: boolean;
|
|
78
86
|
datasourceSkills?: readonly DatasourceSkill[];
|
|
79
87
|
datasourceAccess?: DatasourceAccessContextOptions;
|
|
80
|
-
sessionFactory?: AutoRAGSessionFactory;
|
|
81
88
|
}
|
|
82
89
|
export interface AutoRAGSearchSession {
|
|
83
90
|
readonly agent: Agent;
|
|
@@ -85,7 +92,6 @@ export interface AutoRAGSearchSession {
|
|
|
85
92
|
abort(): Promise<void> | void;
|
|
86
93
|
dispose(): void;
|
|
87
94
|
}
|
|
88
|
-
export type AutoRAGSessionFactory = (options: MandatorySubagentSessionOptions) => Promise<AutoRAGSearchSession>;
|
|
89
95
|
export type AutoRAGJikjiPrepareResult = {
|
|
90
96
|
readonly ok: true;
|
|
91
97
|
readonly code: number;
|
|
@@ -100,17 +106,10 @@ export declare class AutoRAGAgent {
|
|
|
100
106
|
private readonly innerAgent;
|
|
101
107
|
private readonly tools;
|
|
102
108
|
private readonly configuredModel;
|
|
103
|
-
private readonly configuredExplorerModel;
|
|
104
109
|
private readonly apiKey;
|
|
105
110
|
private readonly providerApiKeys;
|
|
106
|
-
private readonly sessionFactory;
|
|
107
111
|
private readonly listeners;
|
|
108
112
|
private activeSession;
|
|
109
|
-
private readonly pendingSubagentCalls;
|
|
110
|
-
private readonly dispatchSequenceBySession;
|
|
111
|
-
private readonly dispatchArgsTracker;
|
|
112
|
-
private dispatchSyntheticCounter;
|
|
113
|
-
private successfulExplorerCalls;
|
|
114
113
|
private readonly memory;
|
|
115
114
|
private readonly runLogger;
|
|
116
115
|
private lastQuery;
|
|
@@ -122,7 +121,9 @@ export declare class AutoRAGAgent {
|
|
|
122
121
|
private refreshing;
|
|
123
122
|
private refreshState;
|
|
124
123
|
private readonly searchPaths;
|
|
125
|
-
private readonly
|
|
124
|
+
private readonly configuredSearchPaths;
|
|
125
|
+
private retrievalScopeBindings;
|
|
126
|
+
private readonly datasourceVirtualScopePrefixes;
|
|
126
127
|
private readonly workspaceProjectRoot;
|
|
127
128
|
private readonly methodRegistry;
|
|
128
129
|
private readonly retriever;
|
|
@@ -135,23 +136,17 @@ export declare class AutoRAGAgent {
|
|
|
135
136
|
private readonly datasourceAccessOptions;
|
|
136
137
|
private readonly datasourceAgentSkills;
|
|
137
138
|
private readonly parserOptions;
|
|
139
|
+
private readonly dupeyOptions;
|
|
140
|
+
private readonly excludeExactDuplicates;
|
|
138
141
|
private readonly baseSystemPromptConfig;
|
|
139
|
-
/** Run-scoped merged Jikji policy, set during searchDocuments; cleared after. */
|
|
140
|
-
private activeJikjiPolicy;
|
|
141
|
-
private activeExplorerModel;
|
|
142
|
-
/** Run-scoped jikji_find call count for the two-phase raw-fallback gate. */
|
|
143
|
-
private jikjiFindCallCount;
|
|
144
142
|
private readonly droppedCallerToolNames;
|
|
145
143
|
constructor(options: AutoRAGAgentOptions);
|
|
144
|
+
scanDuplicateDocuments(): Promise<ScanDuplicateDocumentsDetails>;
|
|
146
145
|
private withMemoryContext;
|
|
147
146
|
private resolveSessionModel;
|
|
147
|
+
private createSearchSession;
|
|
148
148
|
private configureSearchSession;
|
|
149
149
|
private recordSearchToolEvent;
|
|
150
|
-
private nextDispatchSequence;
|
|
151
|
-
private resolveToolCallId;
|
|
152
|
-
private emitDispatchAutofilled;
|
|
153
|
-
private emitDispatchRejected;
|
|
154
|
-
private emitDispatchRejectedFromRejection;
|
|
155
150
|
private currentSystemPromptConfig;
|
|
156
151
|
subscribe(listener: Parameters<Agent["subscribe"]>[0]): () => void;
|
|
157
152
|
abort(): void;
|
|
@@ -168,6 +163,7 @@ export declare class AutoRAGAgent {
|
|
|
168
163
|
submitFeedback(sessionId: string | undefined, satisfied: boolean): void;
|
|
169
164
|
recordResultFeedback(feedback: ResultFeedback[]): void;
|
|
170
165
|
recordFeedbackByNumbers(sessionId: string, usefulNumbers: number[], notUsefulNumbers?: number[]): void;
|
|
166
|
+
recordFeedbackByIds(usefulFeedbackIds: readonly string[], notUsefulFeedbackIds?: readonly string[]): void;
|
|
171
167
|
getResultRegistry(sessionId?: string): ReadonlyMap<number, CuratedResult>;
|
|
172
168
|
searchDocuments(query: string, options?: RetrievalOptions): Promise<SearchDocumentsResponse>;
|
|
173
169
|
private datasourceAccessContext;
|
|
@@ -186,7 +182,7 @@ export declare class AutoRAGAgent {
|
|
|
186
182
|
private indexDatasources;
|
|
187
183
|
/** Path-opaque component diagnostics (e.g. BM25 readiness) for the search response. */
|
|
188
184
|
private collectComponentDiagnostics;
|
|
189
|
-
buildSearchPrompt(query: string, options: RetrievalOptions
|
|
185
|
+
buildSearchPrompt(query: string, options: RetrievalOptions): string;
|
|
190
186
|
refresh(force?: boolean, opts?: AutoRAGRefreshOptions): Promise<AutoRAGRefreshResult>;
|
|
191
187
|
/**
|
|
192
188
|
* Path-opaque snapshot of corpus freshness and the last refresh outcome. Runs
|
|
@@ -212,6 +208,7 @@ export declare class AutoRAGAgent {
|
|
|
212
208
|
* so the refresh result and status remain consistent.
|
|
213
209
|
*/
|
|
214
210
|
private scanMirrorStaleness;
|
|
211
|
+
private exactDuplicateExclusions;
|
|
215
212
|
syncBM25(): Promise<BM25SyncResult | undefined>;
|
|
216
213
|
syncMinSync(): Promise<MinSyncSyncResult | undefined>;
|
|
217
214
|
prepareJikji(): Promise<readonly AutoRAGJikjiPrepareResult[] | undefined>;
|
|
@@ -220,12 +217,9 @@ export declare class AutoRAGAgent {
|
|
|
220
217
|
/**
|
|
221
218
|
* Provider method for the jikji_find tool. Runs JikjiClient.find over all
|
|
222
219
|
* configured search roots, normalizes answer paths against planned source
|
|
223
|
-
* roots, merges per-root answer packs using least-privilege
|
|
224
|
-
* wins) semantics
|
|
225
|
-
*
|
|
226
|
-
* run is active; direct out-of-run calls compute and return the result
|
|
227
|
-
* without persisting. When jikji is unavailable or all roots fail, returns
|
|
228
|
-
* an unavailable result and leaves the policy undefined (bash is allowed).
|
|
220
|
+
* roots, and merges per-root answer packs using least-privilege
|
|
221
|
+
* (restrictive-wins) semantics. Jikji policy metadata remains visible to the
|
|
222
|
+
* model, but it does not gate the librarian's direct file-reading tools.
|
|
229
223
|
*/
|
|
230
224
|
findJikji(query: string, opts?: {
|
|
231
225
|
readonly topK?: number;
|
|
@@ -244,20 +238,9 @@ export declare class AutoRAGAgent {
|
|
|
244
238
|
* - stopAfterFind: OR
|
|
245
239
|
* - agentShouldNotRerank: OR
|
|
246
240
|
* - handoffAction: MOST RESTRICTIVE (direct_use < jikji_retry < raw_fallback_after_retry)
|
|
247
|
-
* - rawFallbackAllowed: handoffAction===raw_fallback_after_retry
|
|
241
|
+
* - rawFallbackAllowed: handoffAction===raw_fallback_after_retry
|
|
248
242
|
*/
|
|
249
243
|
private mergePolicy;
|
|
250
|
-
/**
|
|
251
|
-
* Deny-by-default bash gate. When jikji is configured but no jikji_find has
|
|
252
|
-
* run yet this run (count===0), bash is blocked so the agent discovers local
|
|
253
|
-
* files via jikji_find first. After a find, the run-scoped activeJikjiPolicy
|
|
254
|
-
* applies: when no policy is active, bash behaves exactly as before
|
|
255
|
-
* (allowed). Under an active policy, bash is denied unless handoffAction is
|
|
256
|
-
* raw_fallback_after_retry AND rawFallbackAllowed is true (after a second
|
|
257
|
-
* jikji_find). When jikji is not configured, the find-first branch is
|
|
258
|
-
* skipped entirely (bash unchanged).
|
|
259
|
-
*/
|
|
260
|
-
private bashGate;
|
|
261
244
|
/**
|
|
262
245
|
* Programmatic retrieval across all registered methods, merged via min-max
|
|
263
246
|
* normalization + source dedup. Activates the RetrievalMethodRegistry /
|
|
@@ -291,4 +274,7 @@ export declare class AutoRAGAgent {
|
|
|
291
274
|
/** The retrieval method registry (posix active; vector/bm25/hybrid pluggable). */
|
|
292
275
|
getMethodRegistry(): RetrievalMethodRegistry;
|
|
293
276
|
getSystemPrompt(): string;
|
|
277
|
+
private rerankWithMemory;
|
|
278
|
+
private normalizeRetrievalOptions;
|
|
279
|
+
private resolveRetrievalScope;
|
|
294
280
|
}
|
|
@@ -13,16 +13,6 @@ export interface BashToolOptions {
|
|
|
13
13
|
readonly timeoutMs?: number;
|
|
14
14
|
/** Maximum captured output bytes before truncation. */
|
|
15
15
|
readonly maxOutputBytes?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Optional deny-by-default gate. When present and returns
|
|
18
|
-
* `{ allowed: false }`, the command is NOT spawned; the tool returns the
|
|
19
|
-
* gate message with `blockedByJikjiPolicy: true`. Used by the Jikji policy
|
|
20
|
-
* to enforce stop_after_find / direct_use / forbidden bash restrictions.
|
|
21
|
-
*/
|
|
22
|
-
readonly gate?: () => {
|
|
23
|
-
allowed: boolean;
|
|
24
|
-
message: string;
|
|
25
|
-
};
|
|
26
16
|
}
|
|
27
17
|
export interface BashToolDetails {
|
|
28
18
|
readonly method: "bash";
|
|
@@ -30,7 +20,6 @@ export interface BashToolDetails {
|
|
|
30
20
|
readonly exitCode: number | undefined;
|
|
31
21
|
readonly timedOut: boolean;
|
|
32
22
|
readonly truncated: boolean;
|
|
33
|
-
readonly blockedByJikjiPolicy?: boolean;
|
|
34
23
|
}
|
|
35
24
|
/**
|
|
36
25
|
* Real shell access for the librarian agent. AutoRAG navigates and reads the
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import type { DupeyScanResult } from "../dupey/index.js";
|
|
4
|
+
export declare const SCAN_DUPLICATE_DOCUMENTS_TOOL_NAME = "scan_duplicate_documents";
|
|
5
|
+
export interface ScanDuplicateDocumentsDetails {
|
|
6
|
+
readonly scans: readonly DupeyScanResult[];
|
|
7
|
+
readonly familyCount: number;
|
|
8
|
+
readonly exactDuplicateCount: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ScanDuplicateDocumentsProvider {
|
|
11
|
+
scanDuplicateDocuments(): Promise<ScanDuplicateDocumentsDetails>;
|
|
12
|
+
}
|
|
13
|
+
declare const scanDuplicateDocumentsSchema: Type.TObject<{}>;
|
|
14
|
+
export declare function createScanDuplicateDocumentsTool(provider: ScanDuplicateDocumentsProvider): AgentTool<typeof scanDuplicateDocumentsSchema, ScanDuplicateDocumentsDetails>;
|
|
15
|
+
export {};
|
|
@@ -27,6 +27,13 @@ declare const emitResultsSchema: Type.TObject<{
|
|
|
27
27
|
chunkIndex: Type.TOptional<Type.TInteger>;
|
|
28
28
|
lineNumber: Type.TOptional<Type.TInteger>;
|
|
29
29
|
stableEvidenceId: Type.TOptional<Type.TString>;
|
|
30
|
+
retrieverMix: Type.TOptional<Type.TArray<Type.TString>>;
|
|
31
|
+
parserType: Type.TOptional<Type.TString>;
|
|
32
|
+
documentType: Type.TOptional<Type.TString>;
|
|
33
|
+
documentArea: Type.TOptional<Type.TString>;
|
|
34
|
+
evidenceType: Type.TOptional<Type.TString>;
|
|
35
|
+
evidenceLocation: Type.TOptional<Type.TString>;
|
|
36
|
+
confidence: Type.TOptional<Type.TNumber>;
|
|
30
37
|
}>>>;
|
|
31
38
|
}>>;
|
|
32
39
|
warnings: Type.TOptional<Type.TArray<Type.TString>>;
|
|
@@ -51,6 +58,13 @@ export interface AutoRAGEvidenceRef {
|
|
|
51
58
|
readonly chunkIndex?: number;
|
|
52
59
|
readonly lineNumber?: number;
|
|
53
60
|
readonly stableEvidenceId?: string;
|
|
61
|
+
readonly retrieverMix?: readonly string[];
|
|
62
|
+
readonly parserType?: string;
|
|
63
|
+
readonly documentType?: string;
|
|
64
|
+
readonly documentArea?: string;
|
|
65
|
+
readonly evidenceType?: string;
|
|
66
|
+
readonly evidenceLocation?: string;
|
|
67
|
+
readonly confidence?: number;
|
|
54
68
|
}
|
|
55
69
|
export interface AutoRAGMappingEntry {
|
|
56
70
|
readonly number: number;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { AutoRAGAgentOptions, AutoRefreshOptions } from "./agent.js";
|
|
2
2
|
export { AutoRAGAgent } from "./agent.js";
|
|
3
3
|
export { buildDatasourceSkillsPrompt, createLoadDatasourceSkillTool, type DatasourceSkillProvider, datasourceSkillLocation, formatDatasourceSkillInvocation, LOAD_DATASOURCE_SKILL_TOOL_NAME, type LoadDatasourceSkillDetails, toDatasourceAgentSkill, } from "./datasource-skill.js";
|
|
4
|
+
export { createScanDuplicateDocumentsTool, SCAN_DUPLICATE_DOCUMENTS_TOOL_NAME, type ScanDuplicateDocumentsDetails, type ScanDuplicateDocumentsProvider, } from "./dupey-tool.js";
|
|
4
5
|
export type { AutoRAGEmittedResult, AutoRAGMappingEntry, AutoRAGResultsDetails, } from "./emit-results-tool.js";
|
|
5
6
|
export { createEmitResultsTool, EMIT_AUTORAG_RESULTS_TOOL_NAME } from "./emit-results-tool.js";
|
|
6
7
|
export { createJikjiFindTool, JIKJI_FIND_TOOL_NAME, type JikjiFindDetails, type JikjiFindPerRootPolicy, type JikjiFindProvider, type JikjiFindProviderResult, type MergedJikjiPolicy, } from "./jikji-find-tool.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Model } from "@earendil-works/pi-ai";
|
|
2
|
+
export interface LocalAutoRAGModel {
|
|
3
|
+
readonly provider: string;
|
|
4
|
+
readonly apiKey: string;
|
|
5
|
+
readonly model: Model<"openai-responses">;
|
|
6
|
+
}
|
|
7
|
+
export interface LoadLocalAutoRAGModelOptions {
|
|
8
|
+
readonly configPath?: string;
|
|
9
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
10
|
+
readonly modelId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function loadLocalAutoRAGModel(options?: LoadLocalAutoRAGModelOptions): LocalAutoRAGModel;
|