@autorag/librarian 2.4.0 → 2.4.2
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 +25 -3
- package/dist/agent/agent.d.ts +40 -12
- package/dist/agent/emit-results-tool.d.ts +1 -2
- package/dist/agent/index.d.ts +2 -2
- package/dist/agent/search-documents.d.ts +11 -2
- package/dist/cli/commands/duplicates.d.ts +6 -0
- package/dist/cli/commands/evidence.d.ts +3 -0
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/lite-refresh.d.ts +10 -0
- package/dist/cli/commands/lite-retrieve.d.ts +33 -0
- package/dist/cli/commands/lite.d.ts +3 -0
- package/dist/cli/commands/refresh.d.ts +3 -4
- package/dist/cli/commands/report.d.ts +3 -0
- package/dist/cli/commands/search.d.ts +2 -2
- package/dist/cli/commands/status.d.ts +2 -0
- package/dist/cli/commands/tui.d.ts +1 -1
- package/dist/cli/commands/watch.d.ts +3 -1
- package/dist/cli/config.d.ts +0 -11
- package/dist/cli/index.js +1538 -1090
- package/dist/core.d.ts +67 -0
- package/dist/core.js +14786 -0
- package/dist/datasource/access-context.d.ts +1 -1
- package/dist/datasource/result-filter.d.ts +1 -1
- package/dist/datasource/skills/gmail/index.d.ts +0 -1
- package/dist/datasource/skills/gmail/skill.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4015 -3111
- package/dist/jikji/client.d.ts +2 -0
- package/dist/minsync/client.d.ts +2 -1
- package/dist/minsync/index.d.ts +1 -1
- package/dist/minsync/installer.d.ts +7 -1
- package/dist/minsync/method.d.ts +10 -19
- package/dist/mirror/index.d.ts +1 -1
- package/dist/mirror/paths.d.ts +2 -0
- package/dist/retrieval/engine.d.ts +123 -0
- package/dist/retrieval/index.d.ts +1 -2
- package/dist/retrieval/registry.d.ts +2 -2
- package/dist/retrieval/types.d.ts +1 -1
- package/dist/ui/discover.d.ts +0 -2
- package/package.json +6 -2
- package/skills/autorag/SKILL.md +19 -6
- package/skills/autorag-lite-search/SKILL.md +155 -0
- package/skills/autorag-lite-setup/SKILL.md +182 -0
- package/skills/autorag-setup/SKILL.md +62 -23
- package/dist/agent/search-bm25-tool.d.ts +0 -26
- package/dist/datasource/skills/gmail/himalaya-connector.d.ts +0 -51
- package/dist/retrieval/methods/bm25.d.ts +0 -23
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: autorag-lite-setup
|
|
3
|
+
description: Initialize, index, refresh, and maintain the model-free AutoRAG Lite lifecycle (config, roots, datasources, refresh, watch, status, index reset/rebuild) without configuring any model. Use when autorag lite init/refresh/status is needed, indexes are missing or stale, or the user wants local document indexing without a search model.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AutoRAG Lite setup
|
|
8
|
+
|
|
9
|
+
Use this skill when the user wants AutoRAG's indexing lifecycle without a
|
|
10
|
+
model: initialize a config, build and refresh indexes, watch roots, and inspect
|
|
11
|
+
index health. Everything here is model-free. Use `autorag-setup` instead when a
|
|
12
|
+
search model must be configured or repaired. Use `autorag-lite-search` for
|
|
13
|
+
retrieval, reports, evidence, and feedback.
|
|
14
|
+
|
|
15
|
+
## Safety
|
|
16
|
+
|
|
17
|
+
- Inspect only non-secret config metadata: `searchPaths`, `workspacePath`,
|
|
18
|
+
`memoryPath`, `minSync`, `jikji`, `datasources`, `datasourceAccess`.
|
|
19
|
+
- Never print, copy, migrate, compare, or persist credential values. Store only
|
|
20
|
+
environment-variable names such as `tokenEnv` or `apiKeyEnv`.
|
|
21
|
+
- Never move, rename, edit, or delete source documents. Lite commands write
|
|
22
|
+
indexes only under the configured workspace `.autorag/` directory and
|
|
23
|
+
Jikji's per-source `.jikji/` caches.
|
|
24
|
+
- Do not index system trees, app bundles, caches, credential stores,
|
|
25
|
+
`node_modules`, `.git`, `dist`, `build`, `target`, `.cache`, `.autorag`, or
|
|
26
|
+
`.jikji`.
|
|
27
|
+
|
|
28
|
+
## Install the CLI if needed
|
|
29
|
+
|
|
30
|
+
The CLI is `@autorag/librarian` (`autorag`). Runtime is Node.js >= 24 or Bun.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
command -v autorag >/dev/null || bun install -g @autorag/librarian
|
|
34
|
+
autorag lite --help
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If Bun is unavailable, `npm install -g @autorag/librarian` is acceptable.
|
|
38
|
+
|
|
39
|
+
## Initialize a model-free config
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
autorag lite init \
|
|
43
|
+
--search-paths "/path/to/documents,/path/to/notes" \
|
|
44
|
+
--workspace "/path/to/workspace" \
|
|
45
|
+
--memory-path "/path/to/memory.json"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`lite init` writes the configured model-free lifecycle config. Use `--force`
|
|
49
|
+
only when intentionally replacing an existing config. Explicit user paths win;
|
|
50
|
+
otherwise propose one to three document-dense roots and get approval before
|
|
51
|
+
indexing. Supported parsed formats are `md`, `markdown`, `txt`, `text`, `pdf`,
|
|
52
|
+
`docx`, `pptx`, `xlsx`, `xls`, `hwp`, `hwpx`, and `eml`. Legacy `.doc` is not
|
|
53
|
+
a supported parsed format.
|
|
54
|
+
|
|
55
|
+
Config resolution follows the usual order: `--config`, `AUTORAG_CONFIG`,
|
|
56
|
+
`$AUTORAG_HOME/config.json`, or `~/.autorag/config.json`. Environment overrides
|
|
57
|
+
include `AUTORAG_HOME`, `AUTORAG_CONFIG`, `AUTORAG_SEARCH_PATHS`,
|
|
58
|
+
`AUTORAG_WORKSPACE`, and `AUTORAG_MEMORY_PATH`.
|
|
59
|
+
|
|
60
|
+
## Probe and configure datasources (setup wizard)
|
|
61
|
+
|
|
62
|
+
`autorag lite ui` is still in development — do not recommend it for datasource
|
|
63
|
+
setup. Configure datasources directly in trusted config, wizard-style:
|
|
64
|
+
|
|
65
|
+
1. Probe every datasource for setup feasibility before asking the user
|
|
66
|
+
anything: the backing CLI exists (`katok`, `discrawl`, `slacrawl`,
|
|
67
|
+
`wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`), its
|
|
68
|
+
local store or archive is present, and any credentials it needs are
|
|
69
|
+
available as environment variables or in the tool's own external
|
|
70
|
+
configuration.
|
|
71
|
+
2. Auto-configure every datasource that probes feasible — write its trusted
|
|
72
|
+
`datasources` / `datasourceAccess` entries without asking. For example,
|
|
73
|
+
when Slack (`slacrawl`) and Discord (`discrawl`) are installed, set both up
|
|
74
|
+
automatically.
|
|
75
|
+
3. Skip every datasource that probes infeasible (for example Notion or
|
|
76
|
+
Telegram when their CLIs are not installed) and always report the skipped
|
|
77
|
+
list to the user, with what is missing for each.
|
|
78
|
+
4. Set up a skipped datasource only when the user explicitly asks for it:
|
|
79
|
+
install or authenticate the backing CLI first, then configure it.
|
|
80
|
+
5. E-mail datasources (`gmail`, `mail-export`, `mailcrawl`) matter to most
|
|
81
|
+
users — always probe them and report their status, even when they end up
|
|
82
|
+
skipped.
|
|
83
|
+
|
|
84
|
+
Datasource skills belong in trusted config and remain default-deny.
|
|
85
|
+
|
|
86
|
+
Config keys may be builtin template names (`kakao`, `whatsapp`, `telegram`,
|
|
87
|
+
`slack`, `discord`, `clawgallery`, `notion`, `github`, `cloud-drive`, `gmail`,
|
|
88
|
+
`mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`) or connection
|
|
89
|
+
aliases with `"type": "<template>"`. Unknown names are skipped with an
|
|
90
|
+
`unknown-datasource-skill` warning; they do not fail config resolution.
|
|
91
|
+
`datasourceAccess.allowedTags` and `allowedScopes` narrow trusted access and
|
|
92
|
+
can never grant it. Store only env-var names such as `tokenEnv` or
|
|
93
|
+
`apiKeyEnv`, never credential values.
|
|
94
|
+
|
|
95
|
+
## Build and refresh indexes
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
autorag lite refresh --json
|
|
99
|
+
autorag lite refresh --method parsed,minsync --json
|
|
100
|
+
autorag lite refresh --full --json
|
|
101
|
+
autorag lite refresh --force --json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- A plain `refresh` is incremental: it syncs parsed mirrors, MinSync, Jikji,
|
|
105
|
+
and configured datasources against what changed.
|
|
106
|
+
- `--full` and `--force` both request a full resync. Use them only when
|
|
107
|
+
incremental refresh is not enough, such as after config changes to roots or
|
|
108
|
+
index settings.
|
|
109
|
+
- `--method <csv>` deliberately narrows the refresh. Valid values are
|
|
110
|
+
`parsed`, `minsync`, `datasources`, `jikji`, and `all`. Omit the flag to run
|
|
111
|
+
all methods. Unknown values are rejected.
|
|
112
|
+
- MinSync and Jikji auto-install on first use by default. If they are missing
|
|
113
|
+
or broken, run a full refresh or return to setup rather than silently
|
|
114
|
+
degrading to lexical-only search.
|
|
115
|
+
- MinSync's default embedder is local EmbeddingGemma (768 dimensions, served
|
|
116
|
+
locally via Ollama): no embedder flags and no API key are needed, and no
|
|
117
|
+
corpus text leaves the machine. During setup, verify the local model is
|
|
118
|
+
available (`ollama pull embeddinggemma` with `ollama serve` running);
|
|
119
|
+
override it only when intentionally using a remote embedder.
|
|
120
|
+
- Exact duplicate exclusion during refresh is enabled by default via the
|
|
121
|
+
external `dupey` CLI. Install dupey during setup when it is missing
|
|
122
|
+
(`command -v dupey || cargo install dupey`) and tell the user the feature is
|
|
123
|
+
available; when installation is impossible, refresh continues without it
|
|
124
|
+
and the user is told duplicate exclusion is off. Set
|
|
125
|
+
`"excludeExactDuplicates": false` to index every copy.
|
|
126
|
+
|
|
127
|
+
Retrieval requires a completed refresh. `autorag lite retrieve` before any
|
|
128
|
+
refresh exits with code 2 and an `index-not-ready` diagnostic; a successful
|
|
129
|
+
refresh is recorded even when the corpus is empty or only a non-parsed method
|
|
130
|
+
was selected. Always refresh first, and refresh again when roots change.
|
|
131
|
+
Jikji is a discovery/indexing preparer, not a lite retrieval method.
|
|
132
|
+
|
|
133
|
+
## Watch and scheduled freshness
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
autorag lite watch --once --json
|
|
137
|
+
autorag lite watch
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Prefer non-daemon `autorag lite watch --once` from cron, launchd, a systemd
|
|
141
|
+
user timer, or Task Scheduler, hourly by default (every 1 hour; shorten only
|
|
142
|
+
when the user asks for fresher indexes). Use the same config as retrieval,
|
|
143
|
+
avoid overlapping runs, and keep logs outside source trees. `--immediate`
|
|
144
|
+
triggers a first refresh on start and `--debounce-ms N` tunes change
|
|
145
|
+
coalescing. Once the schedule is installed, tell the user right away that
|
|
146
|
+
hourly freshness is set up.
|
|
147
|
+
|
|
148
|
+
## Status and index maintenance
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
autorag lite status --json
|
|
152
|
+
autorag lite health --json
|
|
153
|
+
autorag lite index rebuild --yes --json
|
|
154
|
+
autorag lite index reset --method parsed --yes --json
|
|
155
|
+
autorag lite duplicates --json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- `status` shows path-opaque corpus freshness and index health. `health` is an
|
|
159
|
+
alias of `status`; neither resolves a model.
|
|
160
|
+
- `index reset` and `index rebuild` remove or rebuild only workspace
|
|
161
|
+
`.autorag` indexes selected by `--method`. They never target source
|
|
162
|
+
documents.
|
|
163
|
+
- `duplicates` scans duplicate document families read-only and never deletes
|
|
164
|
+
or moves files.
|
|
165
|
+
|
|
166
|
+
## Unavailable components and failure handling
|
|
167
|
+
|
|
168
|
+
Missing optional components degrade gracefully: refresh and retrieval continue
|
|
169
|
+
with path-opaque diagnostics such as `minsync-unavailable` or
|
|
170
|
+
`retrieval-method-failed` instead of failing the whole run. Exit codes are 0
|
|
171
|
+
on success, 2 for config or usage errors, and 1 for runtime errors. When a
|
|
172
|
+
component stays unavailable after a full refresh, return to setup rather than
|
|
173
|
+
accepting silently degraded search.
|
|
174
|
+
|
|
175
|
+
## Completion condition
|
|
176
|
+
|
|
177
|
+
Setup is complete only when the CLI is installed, roots are approved, a
|
|
178
|
+
non-secret model-free config is written, every datasource has been probed and
|
|
179
|
+
the auto-configured and skipped lists reported to the user, dupey is installed
|
|
180
|
+
or its absence reported, `refresh` has built the requested indexes, `status`
|
|
181
|
+
reports healthy indexes, and any requested watch schedule is installed or
|
|
182
|
+
verified with the user told it is active.
|
|
@@ -127,7 +127,7 @@ Use `--force` only when intentionally replacing an existing config. Legacy cwd
|
|
|
127
127
|
|
|
128
128
|
### Retrieval defaults
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
MinSync and Jikji are enabled by default. Leave them enabled unless the
|
|
131
131
|
user explicitly asks otherwise. MinSync auto-installs a verified GitHub release
|
|
132
132
|
into `<workspace>/.autorag/bin` on first use (`minSync.autoInstall` defaults to
|
|
133
133
|
true). Set `"autoInstall": false` only when managing the binary yourself. Jikji
|
|
@@ -136,11 +136,21 @@ defaults to true; requires the Rust toolchain).
|
|
|
136
136
|
|
|
137
137
|
Exact duplicate exclusion is enabled by default. AutoRAG invokes the external
|
|
138
138
|
`dupey` CLI before parsed-mirror indexing, keeps the newest filesystem copy for
|
|
139
|
-
each exact canonical-text hash, and excludes older copies from the mirror.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
each exact canonical-text hash, and excludes older copies from the mirror.
|
|
140
|
+
Install dupey during setup when it is missing (`command -v dupey || cargo
|
|
141
|
+
install dupey`) and tell the user the feature is available; when installation
|
|
142
|
+
is impossible, refresh continues without this optimization and the user is
|
|
143
|
+
told duplicate exclusion is off. Set `"excludeExactDuplicates": false` to
|
|
144
|
+
index every copy.
|
|
145
|
+
|
|
146
|
+
MinSync's default embedder is local EmbeddingGemma (768 dimensions, served
|
|
147
|
+
locally via Ollama). The default needs no embedder flags and no API key, and
|
|
148
|
+
no corpus text is sent to a remote embedding service. During setup, verify the
|
|
149
|
+
local model is available (`ollama pull embeddinggemma` with `ollama serve`
|
|
150
|
+
running) instead of silently falling back.
|
|
151
|
+
|
|
152
|
+
Override the embedder only when intentionally using a different, for example
|
|
153
|
+
remote, provider:
|
|
144
154
|
|
|
145
155
|
```bash
|
|
146
156
|
autorag init \
|
|
@@ -152,14 +162,32 @@ autorag init \
|
|
|
152
162
|
```
|
|
153
163
|
|
|
154
164
|
Only store the environment-variable name, never its value. Dimension and batch
|
|
155
|
-
size must be positive integers
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
`
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
size must be positive integers, and the dimension must match the embedder
|
|
166
|
+
(EmbeddingGemma is 768; text-embedding-3-small is 1536).
|
|
167
|
+
|
|
168
|
+
## Probe and configure datasource skills (setup wizard)
|
|
169
|
+
|
|
170
|
+
`autorag ui` is still in development — do not recommend it for datasource
|
|
171
|
+
setup. Configure datasources directly in trusted config, wizard-style:
|
|
172
|
+
|
|
173
|
+
1. Probe every datasource for setup feasibility before asking the user
|
|
174
|
+
anything: the backing CLI exists (`katok`, `discrawl`, `slacrawl`,
|
|
175
|
+
`wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`), its
|
|
176
|
+
local store or archive is present, and any credentials it needs are
|
|
177
|
+
available as environment variables or in the tool's own external
|
|
178
|
+
configuration.
|
|
179
|
+
2. Auto-configure every datasource that probes feasible — write its trusted
|
|
180
|
+
`datasources` / `datasourceAccess` entries without asking. For example,
|
|
181
|
+
when Slack (`slacrawl`) and Discord (`discrawl`) are installed, set both up
|
|
182
|
+
automatically.
|
|
183
|
+
3. Skip every datasource that probes infeasible (for example Notion or
|
|
184
|
+
Telegram when their CLIs are not installed) and always report the skipped
|
|
185
|
+
list to the user, with what is missing for each.
|
|
186
|
+
4. Set up a skipped datasource only when the user explicitly asks for it:
|
|
187
|
+
install or authenticate the backing CLI first, then configure it.
|
|
188
|
+
5. E-mail datasources (`gmail`, `mail-export`, `mailcrawl`) matter to most
|
|
189
|
+
users — always probe them and report their status, even when they end up
|
|
190
|
+
skipped.
|
|
163
191
|
|
|
164
192
|
Datasource skills belong in trusted config and remain default-deny. Builtin
|
|
165
193
|
template names are `kakao`, `whatsapp`, `telegram`, `slack`, `discord`,
|
|
@@ -175,7 +203,7 @@ aliases with `"type": "<template>"`. Unknown names are skipped with an
|
|
|
175
203
|
"github": { "connector": { "repos": ["owner/repo"], "tokenEnv": "GITHUB_TOKEN" } },
|
|
176
204
|
"google-drive": { "type": "cloud-drive", "connector": { "provider": "google-drive", "remote": "gdrive:" } },
|
|
177
205
|
"archive-drive": { "type": "cloud-drive", "connector": { "remote": "archive:" } },
|
|
178
|
-
"gmail": { "connector": { "
|
|
206
|
+
"gmail": { "connector": { "tokenEnv": "GMAIL_ACCESS_TOKEN", "labelIds": ["INBOX"] } },
|
|
179
207
|
"mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
|
|
180
208
|
"obsidian": { "connector": { "vaultPath": "/path/to/vault" } },
|
|
181
209
|
"rss": { "connector": { "feeds": [{ "url": "https://example.com/feed.xml" }] } }
|
|
@@ -195,6 +223,9 @@ and configured through its own Himalaya account. AutoRAG runs its local `sync`
|
|
|
195
223
|
and `index` lifecycle, then uses the mailcrawl CLI for BM25, semantic, or
|
|
196
224
|
hybrid search. Do not use 0.1.3 or earlier: a no-op sync followed by `index`
|
|
197
225
|
fails with `text array must be non-empty`.
|
|
226
|
+
Use mailcrawl for Himalaya-backed IMAP/Maildir retrieval. The legacy
|
|
227
|
+
`gmail` connector option `backend: "himalaya"` is no longer registered; migrate
|
|
228
|
+
that configuration to an explicit `mailcrawl` datasource.
|
|
198
229
|
|
|
199
230
|
## Verify and build indexes
|
|
200
231
|
|
|
@@ -212,20 +243,25 @@ autorag search "summarize the collection" --top-k 3 --json --debug
|
|
|
212
243
|
performs one live completion probe.
|
|
213
244
|
- `health --skip-probes` is only for intentionally offline validation and does
|
|
214
245
|
not prove live provider access.
|
|
215
|
-
- `refresh` syncs parsed mirrors,
|
|
246
|
+
- `refresh` syncs parsed mirrors, MinSync, Jikji, and authorized
|
|
216
247
|
datasources. `--method <csv>` may deliberately narrow it
|
|
217
|
-
(`parsed,
|
|
248
|
+
(`parsed,minsync,datasources,jikji,all`).
|
|
218
249
|
- Use `refresh --force` for a full resync only when incremental refresh is not
|
|
219
250
|
enough. Keep destructive reset/rebuild operations scoped to workspace
|
|
220
251
|
`.autorag` indexes, never source documents.
|
|
252
|
+
- After a search, use `autorag evidence <sessionId> --json` to inspect the
|
|
253
|
+
exact source chunks behind numbered results, including source, method,
|
|
254
|
+
stable evidence ID, excerpt/content, chunk index, and line number.
|
|
221
255
|
|
|
222
256
|
## Keep indexes fresh
|
|
223
257
|
|
|
224
258
|
For continuous freshness, create or verify an OS-appropriate scheduled
|
|
225
|
-
`autorag watch --once` job,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
outside source trees.
|
|
259
|
+
`autorag watch --once` job, hourly by default (every 1 hour; shorten only when
|
|
260
|
+
the user asks for fresher indexes). Prefer cron or launchd on macOS, cron or a
|
|
261
|
+
user systemd timer on Linux, and Task Scheduler on Windows. Use the same
|
|
262
|
+
config as search, avoid overlapping runs, and keep logs outside source trees.
|
|
263
|
+
Once the schedule is installed, tell the user right away that hourly freshness
|
|
264
|
+
is set up.
|
|
229
265
|
|
|
230
266
|
## Environment overrides
|
|
231
267
|
|
|
@@ -240,6 +276,9 @@ outside source trees.
|
|
|
240
276
|
## Completion condition
|
|
241
277
|
|
|
242
278
|
Setup is complete only when the CLI is installed, roots are approved, a
|
|
243
|
-
non-secret single-model config is written,
|
|
279
|
+
non-secret single-model config is written, every datasource has been probed
|
|
280
|
+
and the auto-configured and skipped lists reported to the user, dupey is
|
|
281
|
+
installed or its absence reported, `status` is acceptable, live `health`
|
|
244
282
|
passes, `refresh` builds the requested indexes, one real structured search
|
|
245
|
-
succeeds, and any requested ongoing schedule is installed or verified
|
|
283
|
+
succeeds, and any requested ongoing schedule is installed or verified with the
|
|
284
|
+
user told it is active.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import { Type } from "typebox";
|
|
3
|
-
import type { BM25Status } from "../retrieval/methods/bm25.js";
|
|
4
|
-
import type { RetrievalResult } from "../retrieval/types.js";
|
|
5
|
-
export declare const SEARCH_BM25_DOCUMENTS_TOOL_NAME = "lexical_search_local_docs";
|
|
6
|
-
declare const searchBM25Schema: Type.TObject<{
|
|
7
|
-
query: Type.TString;
|
|
8
|
-
topK: Type.TOptional<Type.TInteger>;
|
|
9
|
-
scope: Type.TOptional<Type.TString>;
|
|
10
|
-
}>;
|
|
11
|
-
export interface SearchBM25DocumentsDetails {
|
|
12
|
-
readonly method: "bm25";
|
|
13
|
-
readonly resultCount: number;
|
|
14
|
-
readonly sources: readonly string[];
|
|
15
|
-
readonly readiness: BM25Status["readiness"];
|
|
16
|
-
readonly engine: BM25Status["engine"];
|
|
17
|
-
}
|
|
18
|
-
export interface BM25SearchMethod {
|
|
19
|
-
getStatus(): BM25Status;
|
|
20
|
-
retrieve(query: string, options: {
|
|
21
|
-
topK?: number;
|
|
22
|
-
scope?: string;
|
|
23
|
-
}): Promise<RetrievalResult[]>;
|
|
24
|
-
}
|
|
25
|
-
export declare function createSearchBM25DocumentsTool(getMethod: () => BM25SearchMethod | undefined, resolveScope?: (scope: string | undefined) => string | undefined): AgentTool<typeof searchBM25Schema, SearchBM25DocumentsDetails>;
|
|
26
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Himalaya-backed mail connector (issue #1304, IMAP path).
|
|
3
|
-
*
|
|
4
|
-
* Uses the external `himalaya` CLI (https://pimalaya.org) as the trusted
|
|
5
|
-
* bridge to any IMAP/Maildir account it has configured — Gmail included —
|
|
6
|
-
* so no OAuth token plumbing is needed here. Mirrors the katok pattern:
|
|
7
|
-
* AutoRAG never opens the mailbox itself; it spawns the CLI, parses JSON
|
|
8
|
-
* envelopes, and reads message bodies. Never throws; failures map onto the
|
|
9
|
-
* coarse connector failure union with path/PII-opaque messages.
|
|
10
|
-
*/
|
|
11
|
-
import { type ConnectorFetchResult, type DatasourceConnector } from "../../connector.js";
|
|
12
|
-
export interface HimalayaRunResult {
|
|
13
|
-
readonly ok: boolean;
|
|
14
|
-
readonly stdout: string;
|
|
15
|
-
readonly stderr: string;
|
|
16
|
-
readonly code: number | null;
|
|
17
|
-
}
|
|
18
|
-
export type HimalayaRunner = (args: readonly string[], timeoutMs: number) => Promise<HimalayaRunResult>;
|
|
19
|
-
export interface HimalayaConnectorOptions {
|
|
20
|
-
/** Path to the himalaya binary. Default bare `himalaya` PATH lookup. */
|
|
21
|
-
readonly binaryPath?: string;
|
|
22
|
-
/** Himalaya account name (`himalaya account list`). Default account when omitted. */
|
|
23
|
-
readonly account?: string;
|
|
24
|
-
/** Mail folder, e.g. `INBOX`. Himalaya's default folder when omitted. */
|
|
25
|
-
readonly folder?: string;
|
|
26
|
-
/** Envelopes per listing page. Default 100. */
|
|
27
|
-
readonly pageSize?: number;
|
|
28
|
-
/** Max messages whose bodies are fetched per run. Default 50. */
|
|
29
|
-
readonly maxDocuments?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Workspace root for the connector's envelope fingerprint state. When set,
|
|
32
|
-
* subsequent refreshes fetch only new or changed envelopes and update the
|
|
33
|
-
* shared chunk store incrementally.
|
|
34
|
-
*/
|
|
35
|
-
readonly workspaceRoot?: string;
|
|
36
|
-
/** Per-spawn timeout. Default 30s (IMAP fetches can be slow). */
|
|
37
|
-
readonly timeoutMs?: number;
|
|
38
|
-
/** Injectable process runner for tests. */
|
|
39
|
-
readonly runner?: HimalayaRunner;
|
|
40
|
-
/** Explicit operator-owned config path, passed read-only to Himalaya. */
|
|
41
|
-
readonly configPath?: string;
|
|
42
|
-
}
|
|
43
|
-
export declare class HimalayaConnector implements DatasourceConnector {
|
|
44
|
-
private readonly options;
|
|
45
|
-
private readonly runner;
|
|
46
|
-
constructor(options?: HimalayaConnectorOptions);
|
|
47
|
-
fetch(): Promise<ConnectorFetchResult>;
|
|
48
|
-
private loadState;
|
|
49
|
-
private saveState;
|
|
50
|
-
private statePath;
|
|
51
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type BM25ReadinessState = "disabled" | "dependency_unavailable" | "index_missing" | "indexing" | "ready" | "error";
|
|
2
|
-
/** Local BM25 is always MinSync-backed when enabled. */
|
|
3
|
-
export type BM25Engine = "minsync" | "none";
|
|
4
|
-
export interface BM25SyncResult {
|
|
5
|
-
readonly indexPath: string;
|
|
6
|
-
readonly indexedChunks: number;
|
|
7
|
-
readonly readiness: BM25ReadinessState;
|
|
8
|
-
readonly engine: BM25Engine;
|
|
9
|
-
}
|
|
10
|
-
export interface BM25Status {
|
|
11
|
-
readonly readiness: BM25ReadinessState;
|
|
12
|
-
readonly engine: BM25Engine;
|
|
13
|
-
readonly message?: string;
|
|
14
|
-
}
|
|
15
|
-
/** Legacy AutoRAG-local BM25 artifact directory. Never an active index. */
|
|
16
|
-
export declare const BM25_SUBDIR: string;
|
|
17
|
-
export declare class BM25UnavailableError extends Error {
|
|
18
|
-
readonly readiness: BM25ReadinessState;
|
|
19
|
-
constructor(readiness: BM25ReadinessState, message: string);
|
|
20
|
-
}
|
|
21
|
-
/** Remove leftover `.autorag/bm25` artifacts from the pre-MinSync BM25 path. */
|
|
22
|
-
export declare function removeLegacyBm25Artifacts(root: string): void;
|
|
23
|
-
export declare function hasLegacyBm25Artifacts(root: string): boolean;
|