@autorag/librarian 2.10.3 → 2.10.5

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 CHANGED
@@ -18,6 +18,9 @@ License: MIT
18
18
  @earendil-works/pi-tui@1.2.0
19
19
  License: MIT
20
20
 
21
+ @llblab/pi-telegram@0.57.2
22
+ License: MIT
23
+
21
24
  @modelcontextprotocol/server@2.3.1
22
25
  License: Apache-2.0
23
26
 
package/README.md CHANGED
@@ -140,8 +140,9 @@ does, and searches them right alongside your files:
140
140
  or connect your own provider key and pay the provider directly.
141
141
 
142
142
  > [!TIP]
143
- > **The app's source lives in [NomaDamas/AutoRAG-app](https://github.com/NomaDamas/AutoRAG-app)**
144
- > (Electron + React, AGPL-3.0). It depends on `@autorag/librarian` from this
143
+ > **The Dazzi desktop app's source lives in [NomaDamas/AutoRAG-app](https://github.com/NomaDamas/AutoRAG-app)**
144
+ > (Electron + React, [Fair Source](https://fair.io/) under `FSL-1.1-MIT`). It
145
+ > depends on the open-source `@autorag/librarian` engine (Apache-2.0) from this
145
146
  > repository; build, run, and file app issues there.
146
147
 
147
148
  ### One engine, every surface
@@ -150,8 +151,9 @@ The app is one way in. The same librarian runs everywhere else:
150
151
 
151
152
  | Surface | Use it for | Start here |
152
153
  |---|---|---|
153
- | **Desktop app** | Browsing and asking in one window | [NomaDamas/AutoRAG-app](https://github.com/NomaDamas/AutoRAG-app) |
154
+ | **Desktop app (Dazzi)** | Browsing and asking in one window | [NomaDamas/AutoRAG-app](https://github.com/NomaDamas/AutoRAG-app) (Fair Source, FSL-1.1-MIT) |
154
155
  | **Terminal UI** | Interactive, steerable search sessions | [`autorag tui`](#2-search-from-cli) |
156
+ | **Messenger** | Asking the librarian from a chat app | [Telegram](#messenger-connections) |
155
157
  | **CLI** | Scripts, indexing, health checks | [CLI Command Reference](#cli-command-reference) |
156
158
  | **MCP server** | Feeding retrieval to Claude Code, Codex, and other agents | [AutoRAG Lite MCP Server](#autorag-lite-mcp-server) |
157
159
  | **TypeScript API** | Embedding the librarian in your own app | [Programmatic usage](#3-programmatic-usage-typescript-api) |
@@ -198,7 +200,7 @@ AutoRAG Agent orchestrates five integrated subsystems:
198
200
 
199
201
  1. **Retrieval Memory (`check_memory`):** After each answer, cited evidence Jev judges to genuinely support it is stored in `~/.autorag/memory.json`. Later searches receive this conversation's evidence, similar past questions, and long-term insights as **advisory reference** — it never reorders results or overrides current evidence. See [docs/retrieval-memory.md](docs/retrieval-memory.md).
200
202
  2. **Pluggable Multi-Method Retrieval:**
201
- - **BM25 Lexical Search:** Fast keyword ranking via MinSync over parsed markdown mirrors.
203
+ - **BM25 Lexical Search:** Fast keyword ranking via MinSync over parsed markdown mirrors. AutoRAG always uses MinSync's `multilingual` tokenizer, which keeps each original word and adds Korean morphemes (via the [Kiwi](https://github.com/bab2min/Kiwi) library), so both `연구목표` and `인증서를` → `인증서` match; without Kiwi AutoRAG warns and tokenizes on whitespace. See [docs/minsync-setup.md](docs/minsync-setup.md#bm25-tokenizer).
202
204
  - **Semantic Vector Search:** Dense vector retrieval over CDC chunks via the built-in embedding gateway.
203
205
  - **Hybrid Search:** Combines BM25 and vector ranking via Reciprocal Rank Fusion (RRF).
204
206
  - **Jikji Find-First Discovery:** Local CLI-backed fast discovery answer packs.
@@ -221,6 +223,18 @@ Update notices are AutoRAG's, not Pi's: `autorag tui` suppresses Pi's "run `pi u
221
223
 
222
224
  ---
223
225
 
226
+ ## Messenger Connections
227
+
228
+ | Messenger | Status | Start here |
229
+ |---|---|---|
230
+ | **Telegram** | Supported | [`autorag tui --telegram`](docs/telegram.md) |
231
+ | **WhatsApp** | Supported (unofficial client) | [`autorag tui --whatsapp`](docs/whatsapp.md) |
232
+ | Discord, Slack, others | Not supported yet | |
233
+
234
+ Telegram runs through the [`@llblab/pi-telegram`](https://github.com/llblab/pi-telegram) bridge inside a running `autorag tui` session: questions you send the bot get the same routing and two-phase search as the terminal. Setup, commands, and keeping it running are in [docs/telegram.md](docs/telegram.md).
235
+
236
+ WhatsApp runs through the pinned [`whatsapp-pi`](https://www.npmjs.com/package/whatsapp-pi) extension the same way; see [docs/whatsapp.md](docs/whatsapp.md).
237
+
224
238
  ## Installation & Setup
225
239
 
226
240
  AutoRAG Agent is published as `@autorag/librarian` (requires Node.js ≥ 24 or Bun):
@@ -263,6 +277,25 @@ autorag refresh
263
277
  autorag status
264
278
  ```
265
279
 
280
+ ### Excluding files and folders
281
+
282
+ Leave generated workspaces or archives out when initializing:
283
+
284
+ ```bash
285
+ autorag init --search-paths "$HOME/Documents" \
286
+ --exclude "$HOME/Documents/Build output" \
287
+ --exclude "$HOME/Documents/Archive, old"
288
+ ```
289
+
290
+ Repeat `--exclude` for each file or folder. Each argument is one complete path,
291
+ including spaces and commas; relative paths resolve from the current directory.
292
+ Excluding a folder also excludes its descendants. Paths are literal, not globs.
293
+
294
+ For an existing configuration, edit its `excludePaths` array and run
295
+ `autorag refresh` to update the indexes. File-name search applies exclusions to
296
+ native fsearch and Everything results as well as the filesystem walk. See the
297
+ [exclusion configuration examples](docs/minsync-setup.md#excluding-files-and-folders).
298
+
266
299
  ### Document languages and parsers
267
300
 
268
301
  One global `languages` setting describes the corpus. It is resolved from
@@ -434,7 +467,7 @@ mirrored are kept and not re-parsed on the next run. `onProgress` reports `parse
434
467
  | `autorag health` | Check model provider authentication, token validity, and API reachability |
435
468
  | `autorag models list` | List chat models the pi runtime can resolve (built-ins, `models.json`, custom/extension providers) with provider auth status; never prints credential values |
436
469
  | `autorag update-check` | Compare the running `autorag` against the published npm version (also runs on `autorag tui` launch) |
437
- | `autorag tui` | Open Pi's interactive librarian TUI (`/login`, `/model`, `/resume`, …) |
470
+ | `autorag tui` | Open Pi's interactive librarian TUI (`/login`, `/model`, `/resume`, …); `--telegram` / `--whatsapp` add the Telegram / WhatsApp remote-control bridges |
438
471
  | `autorag duplicates [DIR]` | Read-only scan for exact and near-duplicate document families with `dupey` |
439
472
  | `autorag lite ...` | CLI bootstrap, indexing repair, terminal maintenance, and fallback interface; agents use MCP for normal Lite operation |
440
473
  | `autorag memory inspect` | Render a read-only, path-opaque snapshot of retrieval memory (judged evidence, curated results, evidence chunks, insights); model-free |
@@ -655,6 +688,7 @@ Deep dive into AutoRAG Agent's architecture, security, and integration guides:
655
688
  - **[MinSync Setup & Embedding QA](docs/minsync-setup.md):** Automatic binary installation, CDC chunking, and local embedding verification.
656
689
  - **[Local Embedding Runtime & Gateway](docs/embedding-runtime.md):** AutoRAG-owned local gateway, model prefetching, and zero-egress semantic search. Model card: [`qwen3-embedding-0.6b`](docs/model-cards/qwen3-embedding-0.6b.md).
657
690
  - **[Hosted Dazzi Models Provider](docs/cloud-provider.md):** The hosted `dazzi` model provider — PKCE `/login`, `AUTORAG_BASE_URL`, live model discovery, and offline catalog snapshots.
691
+ - **[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.
658
692
  - **[Datasource Skills Reference](docs/datasource-skills.md):** Full configuration contracts, connection aliases, and connector options.
659
693
  - **[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.
660
694
  - **[Manual QA & Datasource Test Harnesses](docs/manual-qa-datasources.md):** Real-world testing guides for Discord, KakaoTalk, Slack, Notion, and email.
@@ -247,7 +247,7 @@ export interface AutoRAGAgentOptions {
247
247
  * `searchPaths`). Enabled by default on Windows; ignored elsewhere.
248
248
  * `false` disables it. The remaining fields are test seams.
249
249
  */
250
- everything?: Omit<EverythingClientOptions, "root" | "folders"> | false;
250
+ everything?: Omit<EverythingClientOptions, "root" | "folders" | "excludeFolders"> | false;
251
251
  /**
252
252
  * macOS/Linux-only instant file/folder name search through the user's
253
253
  * fsearch-cli (FSearch, GPL — spawned as a separate process, never
@@ -263,9 +263,10 @@ export interface AutoRAGAgentOptions {
263
263
  * provider-chain web module. Default enabled and credential-free: the
264
264
  * chain leads with providers that need no user-issued key — model-native
265
265
  * search reusing the agent's own model credentials (Gemini grounding,
266
- * Anthropic/OpenAI/xAI web_search), the anonymous Perplexity ask
267
- * endpoint, and Parallel's keyless MCP — then scraped engines with
268
- * headless-browser escalation for bot challenges. A self-hosted
266
+ * Anthropic/OpenAI/xAI web_search), Parallel's keyless MCP, and the
267
+ * DuckDuckGo HTML form — then the anonymous Perplexity ask endpoint and
268
+ * the other scraped engines with headless-browser escalation for bot
269
+ * challenges. A self-hosted
269
270
  * SEARXNG_ENDPOINT is the only env-gated option. `false` disables both
270
271
  * tools. The `fetch` sub-option tunes or disables `web_fetch` alone.
271
272
  * Web tools are always omitted for remote P2P sessions.
@@ -366,6 +367,17 @@ export interface AutoRAGAgentOptions {
366
367
  * a launch.
367
368
  */
368
369
  updateNotice?: () => Promise<string | undefined>;
370
+ /** Extension entry files (installed pi packages) loaded into the interactive session. */
371
+ piExtensionPaths?: readonly string[];
372
+ /** Flag values for the flags those extensions register. */
373
+ piExtensionFlags?: Readonly<Record<string, string | boolean>>;
374
+ /**
375
+ * Load the `@llblab/pi-telegram` bridge into the interactive session so a
376
+ * paired Telegram chat can start, steer, and read answers from it. The
377
+ * bridge adds `/telegram-setup` and `/telegram-connect`; its bot token and
378
+ * owner pairing live in pi's `telegram.json`, never in AutoRAG config.
379
+ */
380
+ telegram?: boolean;
369
381
  }
370
382
  /** Post-merge reranking options. Mirrors the CLI `RerankConfig` (secrets via env). */
371
383
  export interface RerankAgentOptions {
@@ -483,6 +495,9 @@ export declare class AutoRAGAgent {
483
495
  private readonly piSessionDir;
484
496
  private readonly persistPiSessions;
485
497
  private readonly updateNotice;
498
+ private readonly piExtensionPaths;
499
+ private readonly piExtensionFlags;
500
+ private readonly telegram;
486
501
  private boundPiRuntime;
487
502
  /** Embeds past questions for similar-question search; undefined keeps memory search keyword-only. */
488
503
  private readonly memoryEmbedder;
@@ -17,3 +17,20 @@ export declare const ANSWER_IMAGE_DELTA_RULE = "An image already embedded in the
17
17
  * caller only ever sees numbered citations backed by recorded evidence.
18
18
  */
19
19
  export declare const ANSWER_CITATION_RULE = "**Citations**: cite supporting evidence inline with the evidence id shown next to each retrieved result, in square brackets (e.g. [e3], or [e3][e7] for two). Copy ids exactly; never invent one. For a local file you opened yourself with `bash`, cite `[file:<absolute path>]`. Cite the evidence that backs a sentence at the end of that sentence. Do not cite numbers, paths, or anything else.";
20
+ /**
21
+ * Deliverable/artifact rule (issue #1832). The 5-bullet cap and direct-answer
22
+ * format remain the default unless the user explicitly asks otherwise; when the
23
+ * caller requests a deliverable (a reply email, letter, legal opinion, summary
24
+ * document, insertable case citation block, checklist, report, or workflow
25
+ * document), the agent produces the complete finished artifact as a file in a
26
+ * format aligned with the context and domain, and keeps the answer itself
27
+ * concise by stating the created file's location and briefly summarizing what
28
+ * was generated (citing only the underlying source evidence).
29
+ */
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, without overwriting existing source files) 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
+ /**
32
+ * Verification-phase deliverable rule: create the context-aligned deliverable
33
+ * file (in local sessions) and report its location and concise summary if the
34
+ * fast-phase draft could not write the file yet or only gave advice about it.
35
+ */
36
+ export declare const ANSWER_DELIVERABLE_DELTA_RULE = "If a deliverable or artifact was requested and the first answer could not write the file yet (the fast phase runs without tool calls) or only gave advice about it, create the complete context-aligned deliverable file now during verification and report the created file's location and a brief summary concisely.";
@@ -25,6 +25,10 @@ export interface AutoRAGPiSessionOptions {
25
25
  * extension. Each factory registers its tools, commands, and events with pi.
26
26
  */
27
27
  readonly extensionFactories?: readonly ExtensionFactory[];
28
+ /** Extension entry files (e.g. an installed pi package's extension) loaded into the interactive session. */
29
+ readonly extensionPaths?: readonly string[];
30
+ /** CLI-style flag values for the flags those extensions register (`--name` / `--name value`). */
31
+ readonly extensionFlags?: Readonly<Record<string, string | boolean>>;
28
32
  /**
29
33
  * Tool names registered by {@link extensionFactories}. pi's `tools`
30
34
  * allow-list keeps only named tools active, so every extension tool that
@@ -86,6 +90,23 @@ export interface AutoRAGPiSession {
86
90
  }
87
91
  /** Adapts a pi-agent-core {@link AgentTool} to pi's extension {@link ToolDefinition}. */
88
92
  export declare function toToolDefinition(tool: AgentTool): ToolDefinition;
93
+ /**
94
+ * Prefix `@llblab/pi-telegram` puts on every prompt it injects from a Telegram
95
+ * chat. The bridge hands them to pi through `pi.sendUserMessage`, so pi tags
96
+ * them `source: "extension"`, the same source AutoRAG's own phase prompts use.
97
+ * The prefix is what tells a person typing on a phone from AutoRAG talking to
98
+ * itself.
99
+ */
100
+ export declare const TELEGRAM_INPUT_PREFIX = "[telegram]";
101
+ /** `whatsapp-pi` frames every inbound chat message as `Message from <name> (<number>)`. */
102
+ export declare const WHATSAPP_INPUT_PREFIX = "Message from ";
103
+ /**
104
+ * The user's own words from a bridged Telegram prompt: the bridge's `[telegram]`
105
+ * prefix and its `[time]` line are envelope, not the question, so a Telegram
106
+ * question reaches the librarian exactly as the same text typed in the TUI.
107
+ * Attachment blocks stay: they are part of what the user sent.
108
+ */
109
+ export declare function stripTelegramEnvelope(text: string): string;
89
110
  /** Creates a pi session with AutoRAG's tools and prompt. */
90
111
  export declare function createAutoRAGPiSession(options: AutoRAGPiSessionOptions): Promise<AutoRAGPiSession>;
91
112
  export interface AutoRAGPiInteractiveRuntime {
@@ -9,7 +9,7 @@ export type SearchDocumentDiagnosticSeverity = "info" | "warning" | "error";
9
9
  * (#21/#22) does not require another source-breaking type change; codes not yet
10
10
  * emitted are still valid members.
11
11
  */
12
- export type SearchDocumentDiagnosticCode = "empty-query" | "no-verified-results" | "unknown-warning" | "caller-tool-dropped" | "minsync-staging-excluded" | "minsync-file-skipped" | "minsync-sync-failed" | "minsync-lock-held" | "embedder-unavailable" | "embedding-identity-mismatch" | "parser-skipped" | "parser-failed" | "parser-crashed" | "source-vanished" | "source-unreadable" | "source-read-failed" | "mirror-write-failed" | "parser-warning" | "duplicate-excluded" | "unsupported-file" | "stale-index" | "deleted-mirror" | "search-root-unavailable" | "mass-delete-suppressed" | "walk-truncated" | "directory-unreadable" | "pdf-extract-thin" | "retrieval-method-failed" | "rerank-failed" | "jikji-unavailable" | "jikji-prepare-failed" | "jikji-find-failed" | "everything-index-failed" | "fsearch-index-failed" | "fsearch-binary-missing" | "refresh-failed" | "refresh-interrupted" | "watch-failed" | "watch-limited" | "unknown-datasource-skill" | "no-final-answer" | "model-request-failed" | "tool-call-burst" | "query-routed" | "query-route-fallback" | "query-decomposition-failed" | "follow-up-skipped" | "follow-up-check-fallback" | "datasources-selected" | "datasource-selection-fallback" | "citation-without-result" | "evidence-judged" | "evidence-judgment-fallback" | "memory-search-fallback" | "self-config-unavailable" | "self-config-rolled-back";
12
+ export type SearchDocumentDiagnosticCode = "empty-query" | "no-verified-results" | "unknown-warning" | "caller-tool-dropped" | "minsync-staging-excluded" | "minsync-file-skipped" | "minsync-sync-failed" | "minsync-lock-held" | "embedder-unavailable" | "embedding-identity-mismatch" | "lexical-tokenizer-unavailable" | "parser-skipped" | "parser-failed" | "parser-crashed" | "source-vanished" | "source-unreadable" | "source-read-failed" | "mirror-write-failed" | "parser-warning" | "duplicate-excluded" | "unsupported-file" | "stale-index" | "deleted-mirror" | "search-root-unavailable" | "mass-delete-suppressed" | "walk-truncated" | "directory-unreadable" | "pdf-extract-thin" | "retrieval-method-failed" | "rerank-failed" | "jikji-unavailable" | "jikji-prepare-failed" | "jikji-find-failed" | "everything-index-failed" | "fsearch-index-failed" | "fsearch-binary-missing" | "refresh-failed" | "refresh-interrupted" | "watch-failed" | "watch-limited" | "unknown-datasource-skill" | "no-final-answer" | "model-request-failed" | "tool-call-burst" | "query-routed" | "query-route-fallback" | "query-decomposition-failed" | "follow-up-skipped" | "follow-up-check-fallback" | "datasources-selected" | "datasource-selection-fallback" | "citation-without-result" | "evidence-judged" | "evidence-judgment-fallback" | "memory-search-fallback" | "self-config-unavailable" | "self-config-rolled-back";
13
13
  export interface SearchDocumentDiagnostic {
14
14
  readonly code: SearchDocumentDiagnosticCode;
15
15
  readonly severity: SearchDocumentDiagnosticSeverity;
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * LLM-facing wrapper around the oh-my-pi-style provider chain in
5
5
  * `src/web/search/`: credential-free end to end (model-native search on the
6
- * agent's own model credential, the anonymous Perplexity ask endpoint,
7
- * Parallel's keyless MCP, then the scraped engines), where quota/auth/bot
6
+ * agent's own model credential, Parallel's keyless MCP, DuckDuckGo, then
7
+ * the anonymous Perplexity ask endpoint and the other scraped engines), where quota/auth/bot
8
8
  * failures automatically fall back down the chain. The model only supplies
9
9
  * `query` plus optional hints; provider selection and credentials are never
10
10
  * exposed through tool arguments.
@@ -1,6 +1,8 @@
1
1
  export interface CommandContext {
2
2
  positionals: string[];
3
3
  flags: Record<string, string | boolean | undefined>;
4
+ /** All values of repeatable flags, in command-line order. */
5
+ repeatedFlags?: Readonly<Record<string, readonly string[]>>;
4
6
  json: boolean;
5
7
  debug: boolean;
6
8
  cwd: string;
@@ -5,6 +5,7 @@ export type { CommandName };
5
5
  interface ParsedArgs {
6
6
  positionals: string[];
7
7
  flags: Record<string, string | boolean>;
8
+ repeatedFlags?: Readonly<Record<string, readonly string[]>>;
8
9
  }
9
10
  export declare function parseArgs(argv: readonly string[]): ParsedArgs | {
10
11
  error: string;