@autorag/librarian 2.10.4 → 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
@@ -153,6 +153,7 @@ The app is one way in. The same librarian runs everywhere else:
153
153
  |---|---|---|
154
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) |
155
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) |
156
157
  | **CLI** | Scripts, indexing, health checks | [CLI Command Reference](#cli-command-reference) |
157
158
  | **MCP server** | Feeding retrieval to Claude Code, Codex, and other agents | [AutoRAG Lite MCP Server](#autorag-lite-mcp-server) |
158
159
  | **TypeScript API** | Embedding the librarian in your own app | [Programmatic usage](#3-programmatic-usage-typescript-api) |
@@ -199,7 +200,7 @@ AutoRAG Agent orchestrates five integrated subsystems:
199
200
 
200
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).
201
202
  2. **Pluggable Multi-Method Retrieval:**
202
- - **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).
203
204
  - **Semantic Vector Search:** Dense vector retrieval over CDC chunks via the built-in embedding gateway.
204
205
  - **Hybrid Search:** Combines BM25 and vector ranking via Reciprocal Rank Fusion (RRF).
205
206
  - **Jikji Find-First Discovery:** Local CLI-backed fast discovery answer packs.
@@ -222,6 +223,18 @@ Update notices are AutoRAG's, not Pi's: `autorag tui` suppresses Pi's "run `pi u
222
223
 
223
224
  ---
224
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
+
225
238
  ## Installation & Setup
226
239
 
227
240
  AutoRAG Agent is published as `@autorag/librarian` (requires Node.js ≥ 24 or Bun):
@@ -454,7 +467,7 @@ mirrored are kept and not re-parsed on the next run. `onProgress` reports `parse
454
467
  | `autorag health` | Check model provider authentication, token validity, and API reachability |
455
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 |
456
469
  | `autorag update-check` | Compare the running `autorag` against the published npm version (also runs on `autorag tui` launch) |
457
- | `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 |
458
471
  | `autorag duplicates [DIR]` | Read-only scan for exact and near-duplicate document families with `dupey` |
459
472
  | `autorag lite ...` | CLI bootstrap, indexing repair, terminal maintenance, and fallback interface; agents use MCP for normal Lite operation |
460
473
  | `autorag memory inspect` | Render a read-only, path-opaque snapshot of retrieval memory (judged evidence, curated results, evidence chunks, insights); model-free |
@@ -675,6 +688,7 @@ Deep dive into AutoRAG Agent's architecture, security, and integration guides:
675
688
  - **[MinSync Setup & Embedding QA](docs/minsync-setup.md):** Automatic binary installation, CDC chunking, and local embedding verification.
676
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).
677
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.
678
692
  - **[Datasource Skills Reference](docs/datasource-skills.md):** Full configuration contracts, connection aliases, and connector options.
679
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.
680
694
  - **[Manual QA & Datasource Test Harnesses](docs/manual-qa-datasources.md):** Real-world testing guides for Discord, KakaoTalk, Slack, Notion, and email.
@@ -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;
@@ -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.