@autorag/librarian 2.6.3 → 2.7.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.
@@ -2,7 +2,7 @@ export { RetrievalEngine, type RetrievalEngineOptions } from "./engine.js";
2
2
  export type { MergeOptions } from "./merger.js";
3
3
  export { ParallelRetriever, ResultMerger } from "./merger.js";
4
4
  export { RetrievalMethodRegistry } from "./registry.js";
5
- export { type CreateRerankerOptions, createReranker, DEFAULT_RERANK_API_KEY_ENV, DEFAULT_RERANK_MODEL, DEFAULT_RERANK_PROVIDER, OpenRouterReranker, type OpenRouterRerankerOptions, type Reranker, type RerankerDescriptor, type RerankOptions, } from "./rerank.js";
5
+ export { type CreateRerankerOptions, createReranker, DEFAULT_RERANK_API_KEY_ENV, DEFAULT_RERANK_MODEL, DEFAULT_RERANK_PROVIDER, OpenRouterReranker, type OpenRouterRerankerOptions, type Reranker, type RerankerDescriptor, type RerankOptions, SUPPORTED_RERANK_PROVIDERS, } from "./rerank.js";
6
6
  export { matchesVirtualPathScope, normalizeVirtualPath, normalizeVirtualPathScope, virtualPathScopeToRegExp, } from "./scope.js";
7
7
  export { describeRetrievalError, groupUnsearchedSurfaces, MINSYNC_SURFACE, type RetrievalSkip, retrievalSurfaceFor, } from "./skip.js";
8
8
  export type { CuratedResult, NumberedResult, RetrievalDiagnostic, RetrievalDiagnosticCode, RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult, RetrievalUnsearchedSurface, RetrievalWithDiagnostics, } from "./types.js";
@@ -18,6 +18,8 @@ export declare const DEFAULT_RERANK_MODEL = "voyageai/rerank-3-lite";
18
18
  export declare const DEFAULT_RERANK_PROVIDER = "openrouter";
19
19
  /** Default environment variable holding the OpenRouter API key. */
20
20
  export declare const DEFAULT_RERANK_API_KEY_ENV = "OPENROUTER_API_KEY";
21
+ /** Rerank providers {@link createReranker} can build. */
22
+ export declare const SUPPORTED_RERANK_PROVIDERS: readonly string[];
21
23
  /** Static description of a reranker, used for diagnostics and inspection. */
22
24
  export interface RerankerDescriptor {
23
25
  /** Stable label (e.g. `openrouter`). */
@@ -57,6 +59,8 @@ export interface RerankClient {
57
59
  documents: string[];
58
60
  topN?: number;
59
61
  };
62
+ }, options?: {
63
+ signal?: AbortSignal;
60
64
  }): Promise<RerankResponse>;
61
65
  }
62
66
  /** Response body returned by OpenRouter's rerank router. */
@@ -92,9 +96,8 @@ export interface CreateRerankerOptions extends OpenRouterRerankerOptions {
92
96
  }
93
97
  /**
94
98
  * Build the configured reranker. Returns `undefined` when reranking is disabled
95
- * or absent, or when the provider is unsupported. Provider-agnostic by design:
96
- * a local reranker implements {@link Reranker} and plugs in here without
97
- * touching the retrieval pipeline.
99
+ * or absent. Throws for a provider AutoRAG cannot build (an unsupported
100
+ * `provider` id is a configuration error, not a silent no-op).
98
101
  */
99
102
  export declare function createReranker(config: CreateRerankerOptions | false | undefined): Reranker | undefined;
100
103
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.6.3",
3
+ "version": "2.7.0",
4
4
  "description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -77,5 +77,8 @@
77
77
  "typescript": "^7.0.2",
78
78
  "vitest": "^5.0.0",
79
79
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
80
+ },
81
+ "overrides": {
82
+ "zod": "3.25.76"
80
83
  }
81
84
  }
@@ -106,9 +106,20 @@ autorag init \
106
106
  --model-id MODEL
107
107
  ```
108
108
 
109
- If the authenticated local runtime already supplies the intended model, model
110
- flags may be omitted. For a custom endpoint, add `api`, `baseUrl`, and
111
- `apiKeyEnv` to the single `model` object in the trusted config:
109
+ Model resolution runs through the pi runtime. A configured `provider`/`id` is
110
+ resolved against the pi runtime catalog — the built-in providers plus any
111
+ `~/.pi/agent/models.json`, custom, or extension providers — and credentials come
112
+ from stored pi auth (`~/.pi/agent/auth.json`, API key or OAuth established with
113
+ `pi /login`), then provider environment variables. When no `model` is
114
+ configured, AutoRAG uses pi's `defaultProvider`/`defaultModel` when that
115
+ provider has configured credentials; otherwise it falls back to the
116
+ authenticated local codex runtime. So model flags may be omitted when either pi
117
+ or the local runtime already supplies the intended model. Inspect what pi can
118
+ resolve with `autorag models list` (`--available` shows only providers with
119
+ configured credentials); it never prints credential values.
120
+
121
+ For a custom endpoint, add `api`, `baseUrl`, and `apiKeyEnv` to the single
122
+ `model` object in the trusted config:
112
123
 
113
124
  ```json
114
125
  {
@@ -123,12 +134,12 @@ flags may be omitted. For a custom endpoint, add `api`, `baseUrl`, and
123
134
  }
124
135
  ```
125
136
 
126
- When `provider`/`id` names a pi-ai catalog model, the catalog entry stays the
127
- base: `baseUrl`, `api`, and any declared `reasoning`, `input`, `contextWindow`,
128
- or `maxTokens` override only those fields, and the catalog's reasoning,
129
- thinking, and compat settings are kept. Only an id outside the catalog (private
130
- proxy, Ollama, LiteLLM) gets a generic text model with a 128k context window
131
- unless those fields are declared.
137
+ When `provider`/`id` names a pi runtime catalog model, the catalog entry stays
138
+ the base: `baseUrl`, `api`, and any declared `reasoning`, `input`,
139
+ `contextWindow`, or `maxTokens` override only those fields, and the catalog's
140
+ reasoning, thinking, and compat settings are kept. Only an id outside the
141
+ catalog (private proxy, Ollama, LiteLLM) gets a generic text model with a 128k
142
+ context window unless those fields are declared.
132
143
 
133
144
  Use `--force` only when intentionally replacing an existing config. Legacy cwd
134
145
  `autorag.config.json` is a migration source only and is never deleted by init.
@@ -1,32 +0,0 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
2
- import { Type } from "typebox";
3
- export declare const BASH_TOOL_NAME = "bash";
4
- declare const bashSchema: Type.TObject<{
5
- command: Type.TString;
6
- cwd: Type.TOptional<Type.TString>;
7
- timeoutMs: Type.TOptional<Type.TInteger>;
8
- }>;
9
- export interface BashToolOptions {
10
- /** Default working directory for spawned commands. */
11
- readonly cwd: string;
12
- /** Maximum wall-clock time per command before it is killed. */
13
- readonly timeoutMs?: number;
14
- /** Maximum captured output bytes before truncation. */
15
- readonly maxOutputBytes?: number;
16
- }
17
- export interface BashToolDetails {
18
- readonly method: "bash";
19
- readonly command: string;
20
- readonly aborted: boolean;
21
- readonly exitCode: number | undefined;
22
- readonly terminationFailed: boolean;
23
- readonly timedOut: boolean;
24
- readonly truncated: boolean;
25
- }
26
- /**
27
- * Real shell access for the librarian agent. AutoRAG navigates and reads the
28
- * configured collection directly through this tool (ls, find, grep, cat, …).
29
- * Output — including real filesystem paths — is returned to the model verbatim.
30
- */
31
- export declare function createBashTool(options: BashToolOptions): AgentTool<typeof bashSchema, BashToolDetails>;
32
- export {};
@@ -1,16 +0,0 @@
1
- import type { SlashCommand } from "@earendil-works/pi-tui";
2
- import type { TuiSessionStore } from "./tui-session-store.js";
3
- export type ParsedSlashCommand = {
4
- kind: "incomplete";
5
- } | {
6
- kind: "quit";
7
- } | {
8
- kind: "resume";
9
- sessionId: string | undefined;
10
- } | {
11
- kind: "unknown";
12
- name: string;
13
- };
14
- export declare function parseSlashCommand(input: string): ParsedSlashCommand | undefined;
15
- export declare function createTuiSlashCommands(store: TuiSessionStore): SlashCommand[];
16
- export declare function renderSlashHelp(): string;
@@ -1,16 +0,0 @@
1
- export interface TuiSessionRecord {
2
- readonly id: string;
3
- readonly query: string;
4
- readonly answer: string;
5
- readonly trace: string;
6
- readonly updatedAt: number;
7
- }
8
- export interface TuiSessionStore {
9
- list(): readonly TuiSessionRecord[];
10
- get(id: string): TuiSessionRecord | undefined;
11
- save(session: TuiSessionRecord): void;
12
- }
13
- export declare function createFileTuiSessionStore(path: string): TuiSessionStore;
14
- export declare function createMergedTuiSessionStore(...stores: readonly TuiSessionStore[]): TuiSessionStore;
15
- export declare function renderTuiSessionList(sessions: readonly TuiSessionRecord[]): string;
16
- export declare function renderRestoredTuiSession(session: TuiSessionRecord): string;