@autorag/librarian 2.10.6 → 2.11.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/NOTICE +8 -0
- package/README.md +46 -7
- package/dist/agent/agent.d.ts +6 -1
- package/dist/agent/answer-guidelines.d.ts +22 -1
- package/dist/agent/mcp-client.d.ts +27 -0
- package/dist/agent/pi-session.d.ts +8 -0
- package/dist/agent/search-progress.d.ts +96 -0
- package/dist/agent/welcome-header.d.ts +35 -0
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/index.js +11740 -10176
- package/dist/cli/setup.d.ts +9 -0
- package/dist/core.js +1841 -865
- package/dist/datasource/errors.d.ts +1 -1
- package/dist/datasource/index.d.ts +2 -1
- package/dist/datasource/skills/factory.d.ts +3 -0
- package/dist/datasource/skills/hister/client.d.ts +83 -0
- package/dist/datasource/skills/hister/embedding.d.ts +64 -0
- package/dist/datasource/skills/hister/index.d.ts +2 -0
- package/dist/datasource/skills/hister/setup.d.ts +87 -0
- package/dist/datasource/skills/hister/skill.d.ts +63 -0
- package/dist/datasource/skills/obsidian/index.d.ts +4 -6
- package/dist/datasource/skills/obsidian/methods.d.ts +13 -17
- package/dist/datasource/skills/obsidian/paths.d.ts +24 -24
- package/dist/datasource/skills/obsidian/skill.d.ts +10 -15
- package/dist/datasource/skills/obsidian/staging.d.ts +50 -0
- package/dist/datasource/skills/obsidian/vault-index.d.ts +44 -0
- package/dist/index.js +1894 -915
- package/dist/mcp/index.js +1891 -915
- package/dist/minsync/workspace-lock.d.ts +7 -0
- package/dist/process/terminate-tree.d.ts +4 -5
- package/licenses/hister-AGPL-3.0-notice.txt +47 -0
- package/package.json +2 -2
- package/skills/autorag/SKILL.md +6 -3
- package/skills/autorag-doctor/SKILL.md +5 -4
- package/skills/autorag-lite-setup/SKILL.md +23 -5
- package/skills/autorag-setup/SKILL.md +60 -3
- package/dist/datasource/skills/obsidian/client.d.ts +0 -15
- package/dist/datasource/skills/obsidian/types.d.ts +0 -92
package/NOTICE
CHANGED
|
@@ -77,3 +77,11 @@ licenses/everything-MIT-and-PCRE-BSD.txt
|
|
|
77
77
|
ES 1.1.0.38 command-line interface (voidtools)
|
|
78
78
|
License: MIT
|
|
79
79
|
licenses/es-MIT.txt
|
|
80
|
+
|
|
81
|
+
Separate programs AutoRAG talks to (not bundled, not distributed, not linked):
|
|
82
|
+
Hister (https://github.com/asciimoo/hister, asciimoo and Hister contributors)
|
|
83
|
+
License: AGPL-3.0-or-later
|
|
84
|
+
AutoRAG ships no Hister code. Users install the unmodified Hister release themselves and AutoRAG only sends
|
|
85
|
+
search requests to its public HTTP API (GET /search, GET /api/config), as a separate program over a network
|
|
86
|
+
socket. AutoRAG does not modify Hister and never hides that Hister is the backend of the `hister` datasource.
|
|
87
|
+
licenses/hister-AGPL-3.0-notice.txt
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
> [!IMPORTANT]
|
|
20
20
|
> **Looking for the original AutoRAG (RAG AutoML / pipeline optimization tool)?**
|
|
21
|
-
> This repository now hosts **AutoRAG 2.0**, a complete reimagining of AutoRAG as a
|
|
21
|
+
> This repository now hosts **AutoRAG 2.0**, a complete reimagining of AutoRAG as a personal librarian agent for your office work. The original Python-based AutoRAG — the RAG AutoML tool for automatically finding an optimal RAG pipeline for your data — now lives in the [`legacy/`](legacy/) directory of this repository.
|
|
22
22
|
>
|
|
23
23
|
> **The legacy AutoRAG is NOT abandoned.** It continues to be maintained (bug fixes, dependency updates, and PyPI releases via `pip install AutoRAG`) in maintenance mode. Existing users can keep using it exactly as before — see the [legacy README](legacy/README.md) for its documentation, and file issues in this repository as usual. New feature development is focused on AutoRAG Agent (2.0).
|
|
24
24
|
|
|
@@ -166,7 +166,7 @@ The app is one way in. The same librarian runs everywhere else:
|
|
|
166
166
|
|
|
167
167
|
Search tools dump file paths and matching lines — forcing you to open files, read context, and synthesize answers yourself.
|
|
168
168
|
|
|
169
|
-
**AutoRAG Agent is a
|
|
169
|
+
**AutoRAG Agent is a personal librarian agent that helps with your office work.** Built on the [Pi](https://github.com/earendil-works/pi-mono) agent framework, a single configured model searches your files, mail, chats, and notes in place, opens source documents directly via `bash` to verify ground truth, and curates answers into clean, numbered knowledge units. Because it works for you rather than only on your index, it can also act on your files when you ask, such as organizing, renaming, moving, or editing them with a record of every change:
|
|
170
170
|
|
|
171
171
|
```text
|
|
172
172
|
You ask: "What changes were made to the cloud infrastructure contract in Q3?"
|
|
@@ -187,7 +187,7 @@ AutoRAG Agent:
|
|
|
187
187
|
|
|
188
188
|
Three principles drive every design decision in AutoRAG Agent:
|
|
189
189
|
|
|
190
|
-
1. **Never migrate your data to search it.** Traditional RAG systems force you to upload, ETL, and duplicate your files into a centralized vector database. AutoRAG Agent federates your data **in place**, querying CLI-native stores (`lazykatok`, `discrawl`, `slacrawl`, `mailcrawl`, `rclone
|
|
190
|
+
1. **Never migrate your data to search it.** Traditional RAG systems force you to upload, ETL, and duplicate your files into a centralized vector database. AutoRAG Agent federates your data **in place**, querying CLI-native stores (`lazykatok`, `discrawl`, `slacrawl`, `mailcrawl`, `rclone`) where your data already lives. Results retain opaque, source-native identities (`/kakao/...`, `/slack/...`) that preserve local access control and privacy. *(See our [Competitive Landscape Study](docs/competitive-landscape-2026-09.md) on why in-place federation is the durable differentiator).*
|
|
191
191
|
|
|
192
192
|
2. **Just works — no RAG degree required.** No pipeline tuning, no vector-DB maintenance, and no remote embedding keys required. AutoRAG Agent automatically manages [MinSync](docs/minsync-setup.md) for incremental Change Data Capture (CDC) chunking and provides a local [embedding backend](docs/minsync-setup.md#embedding-backends) out of the box with zero external telemetry. A [remote rerank model](docs/rerank.md) (the hosted Dazzi Models reranker when signed in, else OpenRouter `voyageai/rerank-3-lite`) is an opt-in extra.
|
|
193
193
|
|
|
@@ -218,8 +218,12 @@ AutoRAG uses `@earendil-works/pi-coding-agent` as the runtime host for model ses
|
|
|
218
218
|
|
|
219
219
|
The CLI TUI (`autorag tui`) is Pi's interactive mode hosted on the AutoRAG librarian: there is no separate AutoRAG renderer. Pi owns the terminal UI and its native in-session commands — `/login`/`/logout`, `/model`, `/resume`, `/new`, `/tree`, `/compact`, and `/settings` — so provider sign-in and model selection work on first launch even when no AutoRAG model is configured. AutoRAG registers its retrieval tools and runs the two-phase search in the same Pi session, where the model's progress notes, first answer, and final answer are ordinary assistant messages, so resume and two-phase search keep working together.
|
|
220
220
|
|
|
221
|
+
A fresh session — at launch and after `/new` (or `/reload`) — opens on AutoRAG's own welcome screen: the AutoRAG logo, the version, and three rotating tips, centered and scaled down to a smaller logo or a plain wordmark on narrow terminals. Pi's own logo, key-hint list, and loaded skills/prompts/extensions listing are hidden by default (`quietStartup: "header"`). A `quietStartup` saved in Pi's global or project `settings.json` wins: `true` removes the banner, `false` brings Pi's resource listing back.
|
|
222
|
+
|
|
221
223
|
Typing while a search runs works like steering one of Pi's own turns. **Enter** steers the running search: AutoRAG treats the text as a correction of a search that is going wrong, delivers it before the search's next model request (also between phases, where no turn is streaming), cuts in-flight retrieval short so the correction lands promptly, and always runs the verification phase so the answer reflects the correction. **Alt+Enter** queues a new question that runs after the current search answers. **Esc** stops the search instead of letting it continue into its next phase. Pi's registered `/` commands still run during a search; any other line starting with `/` (a path, for example) is a steer like any other text. A query typed after a search answers is a new search in the same session, as before.
|
|
222
224
|
|
|
225
|
+
From the moment a question is submitted, a live progress widget sits above the editor: a spinner, the elapsed time, and one line per step the search is running (routing, splitting the question, each retrieval source with its hit count and time, ranking, the first answer, verification). A slow source shows its own running timer, a failing source shows its error text verbatim, and the widget disappears when the answer is final or **Esc** stops the search. While the model streams, Pi's own `Working` loader takes over and the widget keeps only the header and steps.
|
|
226
|
+
|
|
223
227
|
Update notices are AutoRAG's, not Pi's: `autorag tui` suppresses Pi's "run `pi update`" banner (Pi is a bundled host, not a separate install) and instead checks the published `@autorag/librarian` release, showing a one-line notice in the session when a newer version exists. Set `AUTORAG_NO_UPDATE_CHECK=1` to skip the lookup; `AUTORAG_UPDATE_CHECK_URL` overrides the registry endpoint.
|
|
224
228
|
|
|
225
229
|
---
|
|
@@ -501,6 +505,36 @@ Core Lite tools include `autorag.status`, `autorag.search`,
|
|
|
501
505
|
integrated datasources expose additional scoped search tools. Read-only MCP
|
|
502
506
|
mode omits mutating tools such as refresh and report.
|
|
503
507
|
|
|
508
|
+
## Using external MCP servers and agent skills
|
|
509
|
+
|
|
510
|
+
AutoRAG is also an MCP *client*. Servers listed in the pi agent directory's `mcp.json`
|
|
511
|
+
(`~/.pi/agent/mcp.json`, or `<piAgentDir>/mcp.json` when the agent is given one) are connected
|
|
512
|
+
when a TUI session or a one-shot `autorag search` starts, and their tools reach the model next to
|
|
513
|
+
AutoRAG's own tools. The file uses the format shared by other MCP clients:
|
|
514
|
+
|
|
515
|
+
```json
|
|
516
|
+
{
|
|
517
|
+
"mcpServers": {
|
|
518
|
+
"filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] },
|
|
519
|
+
"docs": { "url": "https://example.com/mcp", "headers": { "Authorization": "Bearer ${DOCS_TOKEN}" } }
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
- **Exposure.** By default a server's tools are reached through the `codemode` tool (the model
|
|
525
|
+
writes a short script that calls them); `"exposure": "direct"` declares them to the model
|
|
526
|
+
like built-in tools, `"deferred"` loads them on demand through `tool_search`, and `"hidden"`
|
|
527
|
+
turns a server off. `description` is shown to the model so it knows when to use the server.
|
|
528
|
+
- **Only the user-level file is read.** A project `.pi/mcp.json` is ignored on purpose: it would
|
|
529
|
+
let any folder AutoRAG starts in choose which processes run.
|
|
530
|
+
- **Failures are reported verbatim.** An invalid entry or a server that fails to start is
|
|
531
|
+
reported at session start with pi's own message; the other servers keep working.
|
|
532
|
+
- **Inside the TUI**, `/mcp` lists servers, reconnects them, signs in to OAuth servers, and
|
|
533
|
+
changes exposure. Pi's `/skill:<name>` commands and `<available_skills>` list also work for
|
|
534
|
+
any agent skill installed under the agent directory.
|
|
535
|
+
- MCP results are data from an external server. AutoRAG tells the model never to follow
|
|
536
|
+
instructions found in them.
|
|
537
|
+
|
|
504
538
|
---
|
|
505
539
|
|
|
506
540
|
## ⚡ AutoRAG Lite: Model-Free Retrieval Engine
|
|
@@ -584,7 +618,8 @@ Do not copy or retain the removed `autorag-lite-search` skill.
|
|
|
584
618
|
autorag search "your question" --json
|
|
585
619
|
```
|
|
586
620
|
4. **Safety Guidelines for Agents:**
|
|
587
|
-
- **
|
|
621
|
+
- **Setup, diagnostics, indexing, and refresh never modify your documents.** An agent that installs, configures, or repairs AutoRAG (Claude Code, Codex, and similar) must not move, rename, edit, or delete user documents as part of that work. That rule is about those procedures; it is not a limit on the librarian itself, which may organize, create, or modify files in local sessions when the user asks (see `Local File Organization` in the system prompt).
|
|
622
|
+
- **Never permanently delete.** Deletion goes to the OS trash, and every change is listed as old path → new path so it can be undone.
|
|
588
623
|
- AutoRAG writes index artifacts into `<workspace>/.autorag/` and Jikji's central store (`<OS data dir>/jikji/`, override with `JIKJI_DATA_DIR`). Jikji also drops a `.jikji_agent_map.md` guide into each indexed root.
|
|
589
624
|
- Never print or leak API keys, tokens, or credential values into stdout or logs.
|
|
590
625
|
|
|
@@ -605,13 +640,14 @@ AutoRAG Agent connects to external tools and communication platforms using dedic
|
|
|
605
640
|
| **Notion** | `notion` | [`notcrawl`](https://github.com/openclaw/notcrawl) CLI | Local page/database/block archive + FTS5 | Lexical FTS5 |
|
|
606
641
|
| **Email Archives** | `mailcrawl` | [`mailcrawl`](https://github.com/NomaDamas/mailcrawl) CLI | Local Gmail, IMAP, and Maildir storage | BM25, Semantic, Hybrid |
|
|
607
642
|
| **Local Mail Export**| `mail-export` | Built-in `.mbox` / `.eml` parser | Local filesystem mailboxes | Lexical |
|
|
608
|
-
| **Obsidian Vaults** | `obsidian` |
|
|
643
|
+
| **Obsidian Vaults** | `obsidian` | Indexed with MinSync in its own workspace (no external CLI) | Markdown notes, folder-scopable | Lexical (BM25), Semantic, Scoped |
|
|
609
644
|
| **GitHub** | `github` | GitHub REST API | In-memory fetched Issues and Pull Requests | Lexical, Scoped |
|
|
610
645
|
| **GitHub Gists** | `github-gist` | GitHub REST API | Incremental local index of own-account public and permitted secret Gist content/metadata; token not stored | Lexical (BM25), Local Semantic, Scoped |
|
|
611
646
|
| **Cloud Drives** | `cloud-drive` | [`rclone`](https://rclone.org) CLI | Google Drive (Tier-1), OneDrive, Dropbox, etc. | Incremental Mirror + BM25 |
|
|
612
647
|
| **Photos & Shots** | `clawgallery` | `clawgallery` CLI | Local screenshot and photo store | Hybrid OCR/Visual Search |
|
|
613
648
|
| **RSS / News** | `rss` | Native HTTP Poller | RSS 2.0 & Atom feeds (24h deduplication) | Lexical |
|
|
614
649
|
| **macOS Spotlight** | `spotlight` | Native `mdfind` CLI | macOS system metadata and content index | System Native |
|
|
650
|
+
| **Browser History** | `hister` | [Hister](https://github.com/asciimoo/hister) server (AGPL-3.0-or-later, separate program, HTTP API) | Pages visited in Chrome/Chromium/Firefox, captured by Hister's own extension and indexed by Hister (web pages only; its local-file indexing is never used) | Lexical full-text; optional Semantic via Hister's own embedding endpoint |
|
|
615
651
|
|
|
616
652
|
For configuration syntax and connector details, see [docs/datasource-skills.md](docs/datasource-skills.md). Non-interactive `sync`/`index` steps get a 30-minute per-connector budget (`connector.indexTimeoutMs`) because first-run imports routinely take minutes; interactive search keeps its 60-second default.
|
|
617
653
|
|
|
@@ -692,6 +728,7 @@ Deep dive into AutoRAG Agent's architecture, security, and integration guides:
|
|
|
692
728
|
- **[Discord Remote Control](docs/discord.md):** Ask the librarian from a Discord channel through a running `autorag tui --discord` session: bot setup, permissions, and limits.
|
|
693
729
|
- **[Telegram Remote Control](docs/telegram.md):** Ask the librarian from a Telegram chat through a running `autorag tui --telegram` session: setup, commands, and keeping it alive.
|
|
694
730
|
- **[Datasource Skills Reference](docs/datasource-skills.md):** Full configuration contracts, connection aliases, and connector options.
|
|
731
|
+
- **[Apple Calendar & Reminders via EventKit MCP](docs/eventkit-mcp.md):** macOS-only: read Calendar events and Reminders (Google/iCloud/Exchange accounts already in Calendar.app) by running `mcp-server-apple-events` beside `autorag-mcp`. Live, read-only; not indexed.
|
|
695
732
|
- **[Jev Decisions](docs/jev-decisions.md):** Jev query pipeline, **on by default** via Dazzi Models when signed in (OpenRouter otherwise): it routes each question to a direct answer (intrinsic knowledge) or local search (everything needing more information; web search is left to the agent after the fast answer), splits multi-part questions into up to five parallel searches (`dazzi/openai/gpt-6-luna` when signed in, else `openrouter/qwen/qwen3.7-flash`), picks which registered datasources to search before the fast answer, and ends the run after the fast answer when that answer is complete. Also covers the `jev` judgment tool, backends (OpenRouter, TypeSafe, Vercel AI Gateway), and how to opt out.
|
|
696
733
|
- **[Manual QA & Datasource Test Harnesses](docs/manual-qa-datasources.md):** Real-world testing guides for Discord, KakaoTalk, Slack, Notion, and email.
|
|
697
734
|
- **[Supply Chain Security & License Audits](docs/supply-chain.md):** Software bill of materials (SBOM) and dependency gate policies.
|
|
@@ -719,8 +756,9 @@ AutoRAG Agent stands on the shoulders of fantastic open-source projects:
|
|
|
719
756
|
- **[Jikji](https://github.com/NomaDamas/jikji)** by [NomaDamas](https://github.com/NomaDamas) — High-performance find-first local document discovery.
|
|
720
757
|
- **[Everything](https://www.voidtools.com/)** and **[ES](https://github.com/voidtools/ES)** by voidtools (David Carpenter) — Instant Windows file-name indexing and its command-line interface, bundled under the MIT License.
|
|
721
758
|
- **[FSearch](https://github.com/cboxdoerfer/fsearch)** and **[fsearch-cli](https://github.com/NomaDamas/fsearch-mac)** — Everything-style file-name search for macOS/Linux (GPL-2.0-or-later). Never bundled or linked: users install fsearch-cli separately and AutoRAG spawns it as a separate process (mere aggregation per the FSF GPL FAQ).
|
|
759
|
+
- **[Hister](https://github.com/asciimoo/hister)** by [asciimoo](https://github.com/asciimoo) and contributors — Self-hosted browser web-history search (AGPL-3.0-or-later). Never bundled, linked, copied, or modified: users run Hister as a separate program and AutoRAG only calls its public HTTP search API (mere aggregation). Hister is always named as the backend of the `hister` datasource.
|
|
722
760
|
- **[dupey](https://github.com/NomaDamas/dupey)** by [NomaDamas](https://github.com/NomaDamas) — Fast duplicate and near-duplicate document family detection.
|
|
723
|
-
- **Federated CLI Authors:** External datasource tools [`lazykatok`](https://github.com/changeroa/lazykatok), [`discrawl`](https://github.com/openclaw/discrawl), [`mailcrawl`](https://github.com/NomaDamas/mailcrawl), [`wacrawl`](https://github.com/openclaw/wacrawl), [`telecrawl`](https://github.com/openclaw/telecrawl), [`slacrawl`](https://github.com/openclaw/slacrawl), [`notcrawl`](https://github.com/openclaw/notcrawl),
|
|
761
|
+
- **Federated CLI Authors:** External datasource tools [`lazykatok`](https://github.com/changeroa/lazykatok), [`discrawl`](https://github.com/openclaw/discrawl), [`mailcrawl`](https://github.com/NomaDamas/mailcrawl), [`wacrawl`](https://github.com/openclaw/wacrawl), [`telecrawl`](https://github.com/openclaw/telecrawl), [`slacrawl`](https://github.com/openclaw/slacrawl), [`notcrawl`](https://github.com/openclaw/notcrawl), and [`rclone`](https://rclone.org).
|
|
724
762
|
- **[kordoc](https://github.com/chrisryugj/kordoc)** by [chrisryugj](https://github.com/chrisryugj) — HWP/HWPX/HWPML, PDF, DOCX and XLSX parsing with nested-table fidelity, used as AutoRAG's default document parser.
|
|
725
763
|
|
|
726
764
|
---
|
|
@@ -765,7 +803,7 @@ Common failures and their fix:
|
|
|
765
803
|
| Windows file-name search fails during refresh | `everything-index-failed` | read the ES exit code and stderr in the message, then `autorag refresh --method everything --json` |
|
|
766
804
|
| Every search does a full local search and verification, even for small talk | `query-route-fallback` | sign in to Dazzi Models with `/login`, or set `OPENROUTER_API_KEY` (Jev routing and decomposition are on by default) |
|
|
767
805
|
|
|
768
|
-
Native datasource stores stay owned by their CLIs — AutoRAG never rebuilds them. Fix a broken archive with `lazykatok doctor`, `discrawl --json metadata`, `slacrawl --json doctor`, `wacrawl --json doctor`, `telecrawl --json doctor`, `notcrawl doctor`,
|
|
806
|
+
Native datasource stores stay owned by their CLIs — AutoRAG never rebuilds them. Fix a broken archive with `lazykatok doctor`, `discrawl --json metadata`, `slacrawl --json doctor`, `wacrawl --json doctor`, `telecrawl --json doctor`, `notcrawl doctor`, or `mailcrawl doctor`, then re-run `autorag refresh --method datasources --json`.
|
|
769
807
|
|
|
770
808
|
---
|
|
771
809
|
|
|
@@ -776,3 +814,4 @@ Native datasource stores stay owned by their CLIs — AutoRAG never rebuilds the
|
|
|
776
814
|
- Production third-party notices and licenses are documented in [`NOTICE`](NOTICE).
|
|
777
815
|
- The bundled Windows binaries keep their own licenses: Everything (MIT, plus PCRE BSD-3-Clause) in [`licenses/everything-MIT-and-PCRE-BSD.txt`](licenses/everything-MIT-and-PCRE-BSD.txt) and ES (MIT) in [`licenses/es-MIT.txt`](licenses/es-MIT.txt). Everything's source code is not public; AutoRAG redistributes the unmodified voidtools portable ZIPs.
|
|
778
816
|
- FSearch/fsearch-cli (GPL-2.0-or-later) are **not** distributed with AutoRAG: no code is copied, linked, or bundled. Users install fsearch-cli themselves and AutoRAG communicates with it only through its command-line interface and daemon socket — separate programs, per the [FSF mere-aggregation FAQ](https://www.gnu.org/licenses/gpl-faq.html#MereAggregation). Source: https://github.com/NomaDamas/fsearch-mac.
|
|
817
|
+
- Hister (AGPL-3.0-or-later) is **not** distributed with AutoRAG: no Hister code is copied, linked, bundled, or modified. Users install an unmodified Hister release themselves and AutoRAG talks to that separate process only over its public HTTP API. Notice: [`licenses/hister-AGPL-3.0-notice.txt`](licenses/hister-AGPL-3.0-notice.txt). If you run Hister as a service for other people, AGPL section 13 applies to you as its operator.
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -345,6 +345,8 @@ export interface AutoRAGAgentOptions {
|
|
|
345
345
|
* a launch.
|
|
346
346
|
*/
|
|
347
347
|
updateNotice?: () => Promise<string | undefined>;
|
|
348
|
+
/** Interactive only: show the AutoRAG welcome banner (with this version) instead of pi's startup header. */
|
|
349
|
+
welcomeVersion?: string;
|
|
348
350
|
/** Extension entry files (installed pi packages) loaded into the interactive session. */
|
|
349
351
|
piExtensionPaths?: readonly string[];
|
|
350
352
|
/** Flag values for the flags those extensions register. */
|
|
@@ -379,7 +381,7 @@ export interface AutoRAGSearchSession {
|
|
|
379
381
|
readonly piSession?: AutoRAGPiSession["session"];
|
|
380
382
|
prompt(text: string): Promise<void>;
|
|
381
383
|
abort(): Promise<void> | void;
|
|
382
|
-
dispose(): void
|
|
384
|
+
dispose(): void | Promise<void>;
|
|
383
385
|
}
|
|
384
386
|
export type AutoRAGJikjiPrepareResult = {
|
|
385
387
|
readonly ok: true;
|
|
@@ -414,6 +416,8 @@ export declare class AutoRAGAgent {
|
|
|
414
416
|
* state for `searchDocuments()` / `searchDocumentsStream()` callers.
|
|
415
417
|
*/
|
|
416
418
|
private readonly interactive;
|
|
419
|
+
/** What the running search is doing, shown as a live widget in the TUI. */
|
|
420
|
+
private readonly searchProgress;
|
|
417
421
|
/** Aborted by {@link abort} and by the run's timeout: gates publishing and the run's own requests. */
|
|
418
422
|
private activeRunAbort;
|
|
419
423
|
private modelNativeSearchAuth;
|
|
@@ -475,6 +479,7 @@ export declare class AutoRAGAgent {
|
|
|
475
479
|
private readonly piSessionDir;
|
|
476
480
|
private readonly persistPiSessions;
|
|
477
481
|
private readonly updateNotice;
|
|
482
|
+
private readonly welcomeVersion;
|
|
478
483
|
private readonly piExtensionPaths;
|
|
479
484
|
private readonly piExtensionFlags;
|
|
480
485
|
private readonly telegram;
|
|
@@ -10,6 +10,27 @@ export declare const ANSWER_IMAGE_EMBED_RULE = "**Images**: when a retrieved res
|
|
|
10
10
|
* already showed.
|
|
11
11
|
*/
|
|
12
12
|
export declare const ANSWER_IMAGE_DELTA_RULE = "An image already embedded in the first answer must not be embedded again.";
|
|
13
|
+
/**
|
|
14
|
+
* Answer readability rules. Every surface that tells the model how to write the
|
|
15
|
+
* answer (system prompt, fast/complete/delta/search phase prompts, report
|
|
16
|
+
* schema) carries the same wording, so the answer's shape does not depend on
|
|
17
|
+
* which phase produced it. Each rule yields to an explicit user request for a
|
|
18
|
+
* different format.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Conclusion first. Only complete answers get a lead line: a delta answer holds
|
|
22
|
+
* only corrections and new findings, and a lead conclusion would restate the
|
|
23
|
+
* first answer. The lead is outside the 5-bullet cap so the cap stays intact.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ANSWER_LEAD_RULE = "**Lead with the conclusion**: unless the user explicitly requests a different format, start the answer with one line that states the conclusion in **bold**, followed by the supporting bullet points. The lead line is not counted in the 5-bullet cap. When the whole answer is a single fact, the lead line alone is enough and no bullets are needed.";
|
|
26
|
+
/** One claim per bullet; flat list. */
|
|
27
|
+
export declare const ANSWER_BULLET_RULE = "**One claim per bullet**: each bullet makes one claim in one or two sentences. Never nest bullets; split a bullet that carries two claims into two bullets.";
|
|
28
|
+
/** Bold the values a reader scans for; tabulate real comparisons. */
|
|
29
|
+
export declare const ANSWER_EMPHASIS_RULE = "**Emphasis**: put the values a reader scans for (dates, amounts, names, statuses, deadlines) in **bold**, and nothing else. When comparing three or more items across the same attributes, use a markdown table instead of bullets.";
|
|
30
|
+
/** Answer language follows the question, not the sources. */
|
|
31
|
+
export declare const ANSWER_LANGUAGE_RULE = "**Answer language**: write the answer in the language of the user's question (a Korean question gets a Korean answer) even when the sources are in another language; if the user asks for a specific language, use that one. Keep proper nouns, identifiers, code, and terms quoted from sources in their original form.";
|
|
32
|
+
/** Uncertainty goes last so it never buries the conclusion. */
|
|
33
|
+
export declare const ANSWER_UNCERTAINTY_RULE = "**Uncertainty placement**: when the answer is incomplete or uncertain, state that in one short sentence on the last line of the answer, never before or ahead of the conclusion. Do not hedge the conclusion itself.";
|
|
13
34
|
/**
|
|
14
35
|
* Inline evidence citations. The model writes the id the retrieval tools print
|
|
15
36
|
* next to each result; the harness resolves it to the recorded source and
|
|
@@ -27,7 +48,7 @@ export declare const ANSWER_CITATION_RULE = "**Citations**: cite supporting evid
|
|
|
27
48
|
* concise by stating the created file's location and briefly summarizing what
|
|
28
49
|
* was generated (citing only the underlying source evidence).
|
|
29
50
|
*/
|
|
30
|
-
export declare const ANSWER_DELIVERABLE_RULE = "**Deliverables and artifacts**: if the user asks you to draft, write, generate, or prepare a deliverable or artifact (a reply email, letter, legal opinion, summary document, standard-format case citation block, checklist, report, or workflow document \u2014 including requests phrased as \"how should I reply...\" to a specific message), produce the finished, ready-to-use artifact as a file (using `write`, `edit`, or `bash` in local sessions
|
|
51
|
+
export declare const ANSWER_DELIVERABLE_RULE = "**Deliverables and artifacts**: if the user asks you to draft, write, generate, or prepare a deliverable or artifact (a reply email, letter, legal opinion, summary document, standard-format case citation block, checklist, report, or workflow document \u2014 including requests phrased as \"how should I reply...\" to a specific message), produce the finished, ready-to-use artifact as a file (using `write`, `edit`, or `bash` in local sessions) in a file format, extension, and structure aligned with the context and domain (e.g. `.eml` or `.md`/`.txt` with headers for an email reply; `.md`, `.txt`, `.docx`, `.hwp`, or `.pdf` matching workspace conventions for a legal opinion, insertable case-citation block, or summary document; `.csv`, `.xlsx`, or `.json` for structured tabular data), containing the complete unabridged artifact (including required headers, precedent passages, pinpoint paragraphs, and standard-format citations) inside the file instead of merely describing how to produce it. Do NOT dump the full artifact text into your reply: unless the user explicitly requests otherwise, keep your reply concise within the at-most-5-bullet direct-answer format, clearly stating the created file's exact path/location and briefly summarizing what was generated with inline citations to the underlying source evidence (`[eN]` or `[file:<source path>]`); never cite the newly created deliverable file itself as `[file:...]`.";
|
|
31
52
|
/**
|
|
32
53
|
* Verification-phase deliverable rule: create the context-aligned deliverable
|
|
33
54
|
* file (in local sessions) and report its location and concise summary if the
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ExtensionFactory } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
/** pi's system-prompt section naming the MCP servers whose tools the model does not see declared. */
|
|
3
|
+
export declare const MCP_SERVERS_SECTION = "mcp_servers";
|
|
4
|
+
/**
|
|
5
|
+
* Tools pi's MCP integration owns. pi's `tools` allow-list keeps only named tools active, so every
|
|
6
|
+
* one of them has to be named: `mcp__*` covers each server tool, the rest are the codemode and
|
|
7
|
+
* tool-search entry points and the resource readers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MCP_TOOL_NAMES: string[];
|
|
10
|
+
export interface AutoRAGMcpClient {
|
|
11
|
+
/** Extensions that connect the servers; the host registers them next to its own. */
|
|
12
|
+
readonly extensionFactories: readonly ExtensionFactory[];
|
|
13
|
+
/** Entries the session's `tools` allow-list needs so the extensions' tools stay active. */
|
|
14
|
+
readonly toolNames: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Connects the user's external MCP servers to an AutoRAG pi session, or returns `undefined` when
|
|
18
|
+
* `<agentDir>/mcp.json` is absent or names no enabled server, leaving the tool surface unchanged.
|
|
19
|
+
*
|
|
20
|
+
* Only the user-level file is read. pi would also load a project `.pi/mcp.json`, but that lets any
|
|
21
|
+
* directory AutoRAG starts in choose which processes run, so it is ignored by design. Entries go
|
|
22
|
+
* through `pi.registerMcpServer`, which validates them with pi's own rules; a rejected entry or an
|
|
23
|
+
* unreadable file is reported verbatim at session start and never stops the other servers.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createAutoRAGMcpClient(agentDir: string): AutoRAGMcpClient | undefined;
|
|
26
|
+
/** The prompt block for the servers pi reported in `sections`, or "" when it reported none. */
|
|
27
|
+
export declare function mcpPromptAddendum(sections: Readonly<Record<string, string>> | undefined): string;
|
|
@@ -81,11 +81,19 @@ export interface AutoRAGPiInteractiveRuntimeOptions extends Omit<AutoRAGPiSessio
|
|
|
81
81
|
* launch.
|
|
82
82
|
*/
|
|
83
83
|
readonly updateNotice?: () => Promise<string | undefined>;
|
|
84
|
+
/**
|
|
85
|
+
* AutoRAG version shown on the welcome banner. Set only by the TUI: when present,
|
|
86
|
+
* every session start (launch, `/new`, `/resume`, `/reload`) replaces pi's startup
|
|
87
|
+
* header with the AutoRAG banner and hides pi's loaded-resource listing.
|
|
88
|
+
*/
|
|
89
|
+
readonly welcomeVersion?: string;
|
|
84
90
|
}
|
|
85
91
|
export interface AutoRAGPiSession {
|
|
86
92
|
readonly session: AgentSession;
|
|
87
93
|
readonly baseToolNames: readonly string[];
|
|
88
94
|
readonly sessionFile: string | undefined;
|
|
95
|
+
/** Stops what extensions started (MCP server processes), then disposes the session. */
|
|
96
|
+
readonly dispose: () => Promise<void>;
|
|
89
97
|
}
|
|
90
98
|
/** Adapts a pi-agent-core {@link AgentTool} to pi's extension {@link ToolDefinition}. */
|
|
91
99
|
export declare function toToolDefinition(tool: AgentTool): ToolDefinition;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { ExtensionFactory, ExtensionUIContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
/** Where pi shows the progress widget: its own slot above the editor, where the submitted question lands. */
|
|
3
|
+
export declare const SEARCH_PROGRESS_WIDGET_KEY = "autorag-search-progress";
|
|
4
|
+
export type SearchProgressStatus = "running" | "done" | "failed";
|
|
5
|
+
/** One unit of work the search is doing (routing, one retrieval source, a model phase, …). */
|
|
6
|
+
export interface SearchProgressStep {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly status: SearchProgressStatus;
|
|
10
|
+
/** Outcome text: the result count, the route, or the failure's own message. */
|
|
11
|
+
readonly detail?: string;
|
|
12
|
+
readonly startedAt: number;
|
|
13
|
+
readonly endedAt?: number;
|
|
14
|
+
}
|
|
15
|
+
/** An immutable view of the running search, handed to subscribers on every change. */
|
|
16
|
+
export interface SearchProgressSnapshot {
|
|
17
|
+
readonly active: boolean;
|
|
18
|
+
readonly query: string;
|
|
19
|
+
readonly startedAt: number;
|
|
20
|
+
/** A model turn streams: pi's own working loader is on screen then. */
|
|
21
|
+
readonly modelStreaming: boolean;
|
|
22
|
+
readonly steps: readonly SearchProgressStep[];
|
|
23
|
+
}
|
|
24
|
+
/** Options of {@link SearchProgressTracker.track}. */
|
|
25
|
+
export interface TrackOptions<T> {
|
|
26
|
+
/** How many hits a settled job returned; the step reports the sum. */
|
|
27
|
+
readonly count?: (value: T) => number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* What the running search is doing right now, in the user's terms. The agent
|
|
31
|
+
* reports into it; the TUI renders it so a silent first retrieval is visibly
|
|
32
|
+
* alive. Reports outside a begun search are ignored, so the library path
|
|
33
|
+
* (`searchDocuments()` with no UI) pays nothing.
|
|
34
|
+
*/
|
|
35
|
+
export declare class SearchProgressTracker {
|
|
36
|
+
private active;
|
|
37
|
+
private query;
|
|
38
|
+
private startedAt;
|
|
39
|
+
private modelStreaming;
|
|
40
|
+
/** Bumped by every {@link begin}: a job that settles after its search ended must not touch the next one. */
|
|
41
|
+
private run;
|
|
42
|
+
private steps;
|
|
43
|
+
private readonly listeners;
|
|
44
|
+
private readonly now;
|
|
45
|
+
constructor(now?: () => number);
|
|
46
|
+
begin(query: string): void;
|
|
47
|
+
end(): void;
|
|
48
|
+
setModelStreaming(streaming: boolean): void;
|
|
49
|
+
/** Starts (or restarts) a step that the caller closes with {@link endStep}. */
|
|
50
|
+
beginStep(id: string, label: string): void;
|
|
51
|
+
endStep(id: string, status: Exclude<SearchProgressStatus, "running">, detail?: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Runs `work` as step `id`: running while it is in flight, done with
|
|
54
|
+
* `detail(value)` when it resolves, failed with the error's own message when
|
|
55
|
+
* it rejects (the rejection still propagates).
|
|
56
|
+
*/
|
|
57
|
+
step<T>(id: string, label: string, work: () => Promise<T>, detail?: (value: T) => string | undefined): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Follows one job as part of step `id`. Jobs sharing an id (the same source
|
|
60
|
+
* searched for several queries) form one step that ends when the last one
|
|
61
|
+
* settles. The job's result and rejection pass through untouched.
|
|
62
|
+
*/
|
|
63
|
+
track<T>(id: string, label: string, work: Promise<T>, options?: TrackOptions<T>): Promise<T>;
|
|
64
|
+
snapshot(): SearchProgressSnapshot;
|
|
65
|
+
/** Notified after every change. Not called on subscribe: read {@link snapshot} for the current state. */
|
|
66
|
+
subscribe(listener: (snapshot: SearchProgressSnapshot) => void): () => void;
|
|
67
|
+
private open;
|
|
68
|
+
private emit;
|
|
69
|
+
}
|
|
70
|
+
/** `7s` under a minute, `1:01` after. */
|
|
71
|
+
export declare function formatElapsed(ms: number): string;
|
|
72
|
+
/** Colour hooks for {@link renderSearchProgress}; pi's theme supplies them, tests pass identity. */
|
|
73
|
+
export interface SearchProgressPalette {
|
|
74
|
+
readonly accent: (text: string) => string;
|
|
75
|
+
readonly muted: (text: string) => string;
|
|
76
|
+
readonly success: (text: string) => string;
|
|
77
|
+
readonly error: (text: string) => string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The widget's lines at time `now`. Pure so the TUI and the tests render the
|
|
81
|
+
* same thing: a spinner header with the elapsed time, then one line per step.
|
|
82
|
+
* More steps than fit keep every running step and the newest finished ones.
|
|
83
|
+
*/
|
|
84
|
+
export declare function renderSearchProgress(snapshot: SearchProgressSnapshot, now: number, palette: SearchProgressPalette, width: number, interruptKey: string): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Binds the tracker to pi's widget slot: the widget appears when a search
|
|
87
|
+
* begins and disappears when it ends. `isCurrent` lets a replaced session's
|
|
88
|
+
* late notifications be dropped.
|
|
89
|
+
*/
|
|
90
|
+
export declare function bindSearchProgressWidget(ui: Pick<ExtensionUIContext, "setWidget">, tracker: SearchProgressTracker, interruptKey: () => string): () => void;
|
|
91
|
+
/**
|
|
92
|
+
* pi extension that shows the tracker as a widget while a search runs. The
|
|
93
|
+
* widget slot is rebound on every `session_start` (resume, `/new`, fork) and
|
|
94
|
+
* released on shutdown, so a replaced session is never written to.
|
|
95
|
+
*/
|
|
96
|
+
export declare function createSearchProgressExtension(tracker: SearchProgressTracker, interruptKey: () => string): ExtensionFactory;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ExtensionFactory, SettingsManager, Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
/**
|
|
3
|
+
* One is shown per session, picked at random. Each fits on one line of an
|
|
4
|
+
* 80-column terminal after the `Tip · ` label, and is true of the TUI as shipped.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WELCOME_TIPS: readonly string[];
|
|
7
|
+
export interface WelcomeBannerOptions {
|
|
8
|
+
readonly width: number;
|
|
9
|
+
readonly version: string;
|
|
10
|
+
readonly theme: Pick<Theme, "fg" | "bold">;
|
|
11
|
+
/** Source of the rotating tip offset. Default `Math.random`. */
|
|
12
|
+
readonly random?: () => number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The first screen of `autorag tui`: the logo, the version, and one random tip,
|
|
16
|
+
* centered on `width`. The logo is centered as one block so its shape holds;
|
|
17
|
+
* the version and the tip are centered on their own. The tip is always one line
|
|
18
|
+
* and is cut with `...` when the terminal is narrower than it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderWelcomeBanner({ width, version, theme, random }: WelcomeBannerOptions): string[];
|
|
21
|
+
/** The slice of pi's settings the banner reads and adjusts. */
|
|
22
|
+
type WelcomeSettings = Pick<SettingsManager, "applyOverrides" | "getGlobalSettings" | "getProjectSettings" | "getQuietStartup">;
|
|
23
|
+
export interface WelcomeHeaderOptions {
|
|
24
|
+
readonly version: string;
|
|
25
|
+
readonly settings: WelcomeSettings;
|
|
26
|
+
readonly random?: () => number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Replaces pi's startup header (its logo, key hints) with the AutoRAG banner on
|
|
30
|
+
* every session start: launch, `/new`, `/resume`, `/fork`, `/reload`. pi
|
|
31
|
+
* restores its built-in header before each session start, so there is nothing
|
|
32
|
+
* to clean up. A user who saved `quietStartup: true` gets no banner.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createWelcomeHeader(options: WelcomeHeaderOptions): ExtensionFactory;
|
|
35
|
+
export {};
|