@autorag/librarian 2.6.2 → 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.
Files changed (56) hide show
  1. package/NOTICE +12 -0
  2. package/README.md +22 -5
  3. package/dist/agent/agent.d.ts +151 -8
  4. package/dist/agent/everything-search-tool.d.ts +35 -0
  5. package/dist/agent/fsearch-search-tool.d.ts +35 -0
  6. package/dist/agent/jikji-find-tool.d.ts +2 -0
  7. package/dist/agent/pi-session.d.ts +35 -0
  8. package/dist/agent/refresh-progress.d.ts +1 -1
  9. package/dist/agent/search-documents.d.ts +1 -1
  10. package/dist/cli/commands/health.d.ts +2 -3
  11. package/dist/cli/commands/models.d.ts +20 -0
  12. package/dist/cli/commands/refresh.d.ts +1 -1
  13. package/dist/cli/commands/search.d.ts +2 -2
  14. package/dist/cli/commands/serve.d.ts +2 -2
  15. package/dist/cli/commands/tui.d.ts +12 -35
  16. package/dist/cli/config.d.ts +67 -7
  17. package/dist/cli/index.js +3064 -1726
  18. package/dist/core.d.ts +1 -1
  19. package/dist/core.js +3056 -1223
  20. package/dist/datasource/connector-timeouts.d.ts +19 -0
  21. package/dist/datasource/crawler-types.d.ts +10 -0
  22. package/dist/datasource/skills/cloud-drive/rclone-connector.d.ts +2 -0
  23. package/dist/datasource/skills/lazykatok/client.d.ts +2 -0
  24. package/dist/datasource/skills/lazykatok/index.d.ts +1 -1
  25. package/dist/datasource/skills/lazykatok/types.d.ts +17 -1
  26. package/dist/datasource/skills/rss/connector.d.ts +2 -0
  27. package/dist/datasource/skills/spotlight/connector.d.ts +2 -0
  28. package/dist/dupey/filter.d.ts +7 -1
  29. package/dist/everything/bundle.d.ts +62 -0
  30. package/dist/everything/client.d.ts +123 -0
  31. package/dist/everything/index.d.ts +2 -0
  32. package/dist/fsearch/client.d.ts +173 -0
  33. package/dist/fsearch/index.d.ts +2 -0
  34. package/dist/fsearch/walk.d.ts +22 -0
  35. package/dist/index.d.ts +2 -0
  36. package/dist/index.js +3082 -1223
  37. package/dist/minsync/method.d.ts +6 -0
  38. package/dist/retrieval/engine.d.ts +14 -0
  39. package/dist/retrieval/index.d.ts +1 -0
  40. package/dist/retrieval/rerank.d.ts +117 -0
  41. package/dist/retrieval/types.d.ts +1 -1
  42. package/licenses/es-MIT.txt +21 -0
  43. package/licenses/everything-MIT-and-PCRE-BSD.txt +51 -0
  44. package/package.json +7 -2
  45. package/skills/autorag/SKILL.md +4 -3
  46. package/skills/autorag-doctor/SKILL.md +2 -0
  47. package/skills/autorag-lite-setup/SKILL.md +3 -2
  48. package/skills/autorag-setup/SKILL.md +67 -6
  49. package/vendor/everything/ES-1.1.0.38.ARM64.zip +0 -0
  50. package/vendor/everything/ES-1.1.0.38.x64.zip +0 -0
  51. package/vendor/everything/Everything-1.4.1.1032.ARM64.en-US.zip +0 -0
  52. package/vendor/everything/Everything-1.4.1.1032.x64.en-US.zip +0 -0
  53. package/vendor/everything/manifest.json +30 -0
  54. package/dist/agent/bash-tool.d.ts +0 -32
  55. package/dist/cli/tui-commands.d.ts +0 -16
  56. package/dist/cli/tui-session-store.d.ts +0 -16
@@ -1,14 +1,14 @@
1
1
  import type { InjectionClassifierModel } from "../../p2p/injection-classifier.js";
2
2
  import { type SimplexPeerServer, startSimplexPeerServer, syncSimplexPeers } from "../../p2p/simplex-server.js";
3
3
  import { type SimplexTransport, type StartSimplexOptions } from "../../p2p/simplex-transport.js";
4
- import { type ResolvedAgentModel, resolveAgentModel } from "../config.js";
4
+ import { type CliConfig, type ResolveAgentModelOptions, type ResolvedAgentModel } from "../config.js";
5
5
  import type { CommandContext } from "./types.js";
6
6
  export interface ServeCommandDeps {
7
7
  readonly startSimplexPeerServer?: typeof startSimplexPeerServer;
8
8
  readonly startSimplexChat?: (options: StartSimplexOptions) => Promise<SimplexTransport>;
9
9
  readonly syncSimplexPeers?: typeof syncSimplexPeers;
10
10
  readonly waitUntilStopped?: (server: SimplexPeerServer) => Promise<void>;
11
- readonly modelResolver?: typeof resolveAgentModel;
11
+ readonly modelResolver?: (config: CliConfig, options?: ResolveAgentModelOptions) => ResolvedAgentModel | Promise<ResolvedAgentModel>;
12
12
  }
13
13
  export declare function createInjectionClassifierModel(resolved: ResolvedAgentModel): InjectionClassifierModel;
14
14
  /**
@@ -1,36 +1,13 @@
1
- import type { AgentEvent } from "@earendil-works/pi-agent-core";
2
- import { AutoRAGAgent, type AutoRAGAgentOptions } from "../../agent/agent.js";
3
- import { type CliConfig, type ResolvedAgentModel } from "../config.js";
4
- import { type TuiSessionRecord, type TuiSessionStore } from "../tui-session-store.js";
5
1
  import type { CommandContext } from "./types.js";
6
- export { parseSlashCommand } from "../tui-commands.js";
7
- export interface TuiDriver {
8
- submissions: string[];
9
- rendered: string[];
10
- started: boolean;
11
- stopped: boolean;
12
- onSubmit?: (text: string) => void | Promise<void>;
13
- onExit?: () => void;
14
- onEvent?: (event: AgentEvent) => void;
15
- onInput?: (data: string) => void;
16
- }
17
- export interface TuiPresenter {
18
- handle(event: AgentEvent): void;
19
- lines(): readonly string[];
20
- working(): boolean;
21
- setWorking(active: boolean): void;
22
- beginRun(): void;
23
- interrupt(): void;
24
- status(): string;
25
- reset(): void;
26
- }
27
- type TuiAgent = Pick<AutoRAGAgent, "searchDocumentsStream"> & Partial<Pick<AutoRAGAgent, "subscribe" | "abort">>;
28
- export interface TuiDeps {
29
- agentFactory?: (opts?: Partial<AutoRAGAgentOptions>) => TuiAgent;
30
- modelResolver?: (config: CliConfig) => ResolvedAgentModel;
31
- tuiFactory?: (ctx: CommandContext) => TuiDriver;
32
- sessionStore?: TuiSessionStore;
33
- }
34
- export declare function createTuiPresenter(): TuiPresenter;
35
- export declare function renderTuiSessionView(session: TuiSessionRecord | undefined, input: string): string;
36
- export declare function runTui(ctx: CommandContext, deps?: TuiDeps): Promise<number>;
2
+ /**
3
+ * Run `autorag tui`: Pi's interactive mode over the AutoRAG librarian.
4
+ *
5
+ * Pi owns the terminal UI, `read`/`bash`/`edit`/`write`/`grep`/`find`/`ls`
6
+ * tools, provider credentials/OAuth, model selection, session persistence and
7
+ * resume/fork/compaction, settings, and extension loading. AutoRAG registers
8
+ * its domain tools and streams progress, preliminary answers, and final results
9
+ * into the same session through the agent's interactive runtime. The native
10
+ * `/login`, `/model`, `/resume`, `/new`, `/tree`, `/compact`, and `/settings`
11
+ * commands are therefore always available.
12
+ */
13
+ export declare function runTui(ctx: CommandContext): Promise<number>;
@@ -1,5 +1,6 @@
1
1
  import type { Api, Model } from "@earendil-works/pi-ai";
2
- import type { AutoRAGAgentOptions } from "../agent/agent.js";
2
+ import { ModelRuntime } from "@earendil-works/pi-coding-agent";
3
+ import type { AutoRAGAgentOptions, AutoRAGRetrievalLimits } from "../agent/agent.js";
3
4
  import { type LoadLocalAutoRAGModelOptions } from "../agent/local-model.js";
4
5
  import type { DatasourceAccessContextOptions } from "../datasource/access-context.js";
5
6
  import { type DatasourcesConfig } from "../datasource/skills/factory.js";
@@ -50,6 +51,28 @@ export interface WebSearchCliConfig {
50
51
  timeoutSeconds?: number;
51
52
  } | false;
52
53
  }
54
+ /**
55
+ * Post-merge reranking config. Routes merged evidence through a dedicated
56
+ * rerank model. `provider` is `openrouter` today; `model` is the OpenRouter
57
+ * wire id (default `voyageai/rerank-3-lite`). Secrets never appear here — only
58
+ * the environment-variable name that holds the provider API key.
59
+ */
60
+ export interface RerankConfig {
61
+ /** `false` disables reranking. Missing means enabled when the block is present. */
62
+ enabled?: boolean;
63
+ /** Provider id. @default "openrouter" */
64
+ provider?: string;
65
+ /** Wire model id. @default "voyageai/rerank-3-lite" */
66
+ model?: string;
67
+ /** Environment variable holding the provider API key. @default "OPENROUTER_API_KEY" */
68
+ apiKeyEnv?: string;
69
+ /** Override the provider base URL (e.g. a gateway). */
70
+ baseUrl?: string;
71
+ /** Return only the top N merged results. Omitted ⇒ all distinct results are reordered. */
72
+ topN?: number;
73
+ /** Per-request timeout in milliseconds. */
74
+ timeoutMs?: number;
75
+ }
53
76
  export interface P2pConfig {
54
77
  enabled?: boolean;
55
78
  port?: number;
@@ -81,8 +104,10 @@ export interface AgentModelConfig {
81
104
  */
82
105
  api?: Api;
83
106
  /**
84
- * Endpoint base URL. When set, AutoRAG builds a Model from this config
85
- * instead of requiring a pi-ai catalog entry. Omit for catalog/local models.
107
+ * Endpoint base URL. For a pi-ai catalog `provider/id`, it overrides only the
108
+ * catalog endpoint and keeps the catalog's reasoning, compat, and limits. For an
109
+ * id outside the catalog, AutoRAG builds a generic Model from this config.
110
+ * Omit for catalog/local models that use the catalog endpoint.
86
111
  */
87
112
  baseUrl?: string;
88
113
  /**
@@ -103,7 +128,25 @@ export interface CliConfig {
103
128
  model?: AgentModelConfig;
104
129
  minSync?: MinSyncMethodConfig;
105
130
  jikji?: Record<string, unknown> | false;
131
+ /** Windows-only bundled Everything file-name search. Default enabled on Windows; `false` disables. */
132
+ everything?: {
133
+ enabled?: boolean;
134
+ timeoutMs?: number;
135
+ startupTimeoutMs?: number;
136
+ indexTimeoutMs?: number;
137
+ } | false;
138
+ /** macOS/Linux fsearch-cli file-name search. Default enabled on macOS/Linux; `false` disables. */
139
+ fsearch?: {
140
+ enabled?: boolean;
141
+ binaryPath?: string;
142
+ timeoutMs?: number;
143
+ startupTimeoutMs?: number;
144
+ indexTimeoutMs?: number;
145
+ watch?: boolean;
146
+ } | false;
106
147
  webSearch?: WebSearchCliConfig;
148
+ /** Post-merge reranking. Absent ⇒ reranking disabled. `false` disables it. */
149
+ rerank?: RerankConfig | false;
107
150
  parserOptions?: Record<string, unknown>;
108
151
  dupey?: {
109
152
  enabled?: boolean;
@@ -113,6 +156,8 @@ export interface CliConfig {
113
156
  excludeExactDuplicates?: boolean;
114
157
  /** Absolute or workspace-relative files/directories omitted from local indexing. */
115
158
  excludePaths?: string[];
159
+ /** Hard caps on retrieval, baseline prefetch, and model-facing candidate lists. */
160
+ limits?: AutoRAGRetrievalLimits;
116
161
  /** Trusted datasource skill configuration (skill name → config). */
117
162
  datasources?: DatasourcesConfig;
118
163
  /** Trusted datasource allow-tags/allow-scopes. Absent ⇒ default-deny. */
@@ -151,6 +196,8 @@ export declare function normalizeEmbedder(raw: unknown, path: string): MinSyncEm
151
196
  * {@link ConfigError}.
152
197
  */
153
198
  export declare function normalizeIndexingConfig(raw: RawIndexingMethods): NormalizedIndexingConfig;
199
+ /** Validate the `limits` section and map it onto the agent option. */
200
+ export declare function normalizeLimitsConfig(raw: unknown): AutoRAGRetrievalLimits;
154
201
  export declare function resolveConfig(input: ResolveConfigInput): CliConfig;
155
202
  /**
156
203
  * Resolve config without writing, migrating, or locking. Health and other
@@ -158,8 +205,21 @@ export declare function resolveConfig(input: ResolveConfigInput): CliConfig;
158
205
  * would resolve them but never copied into `~/.autorag/config.json`.
159
206
  */
160
207
  export declare function resolveConfigReadOnly(input: ResolveConfigInput): CliConfig;
208
+ /** Normalize and validate the `rerank` config section, filling in defaults. */
209
+ export declare function normalizeRerankConfig(raw: unknown, path: string): RerankConfig | false;
161
210
  export declare function buildAgentOptions(config: CliConfig): Omit<AutoRAGAgentOptions, "model">;
162
- export declare function resolveModel(config: CliConfig): Model<Api>;
211
+ /**
212
+ * Extra resolution inputs beyond the local codex-runtime options. `agentDir`
213
+ * points at the pi agent home (`~/.pi/agent` by default) that owns
214
+ * `auth.json`, `models.json`, and `settings.json`.
215
+ */
216
+ export interface ResolveAgentModelOptions extends LoadLocalAutoRAGModelOptions {
217
+ readonly agentDir?: string;
218
+ readonly cwd?: string;
219
+ /** Pre-built pi model runtime, for callers that already own one (and tests). */
220
+ readonly runtime?: ModelRuntime;
221
+ }
222
+ export declare function resolveModel(config: CliConfig, options?: ResolveAgentModelOptions): Promise<Model<Api>>;
163
223
  export interface ResolvedAgentModel {
164
224
  readonly model: Model<Api>;
165
225
  readonly apiKey?: string;
@@ -168,7 +228,7 @@ export interface ResolvedAgentModel {
168
228
  export type AgentModelResolutionSource = "config" | "flags" | "env" | "local_runtime" | "catalog" | "configured_alias" | "mixed";
169
229
  export interface AgentModelAuth {
170
230
  readonly present: boolean;
171
- readonly source: "env" | "local_runtime" | "catalog" | "none" | "unknown";
231
+ readonly source: "env" | "local_runtime" | "pi_auth" | "catalog" | "none" | "unknown";
172
232
  readonly envName?: string;
173
233
  }
174
234
  export interface ResolvedAgentModelRole {
@@ -192,8 +252,8 @@ export interface ResolvedAgentModelDetailed {
192
252
  readonly providerApiKeys?: Readonly<Record<string, string>>;
193
253
  readonly role: ResolvedAgentModelRole;
194
254
  }
195
- export declare function resolveAgentModel(config: CliConfig, localOptions?: LoadLocalAutoRAGModelOptions): ResolvedAgentModel;
196
- export declare function resolveAgentModelDetailed(config: CliConfig, localOptions?: LoadLocalAutoRAGModelOptions): ResolvedAgentModelDetailed;
255
+ export declare function resolveAgentModel(config: CliConfig, options?: ResolveAgentModelOptions): Promise<ResolvedAgentModel>;
256
+ export declare function resolveAgentModelDetailed(config: CliConfig, options?: ResolveAgentModelOptions): Promise<ResolvedAgentModelDetailed>;
197
257
  export declare function readRawConfigObject(path: string): Record<string, unknown>;
198
258
  /** Atomically replace a config file, preserving the caller's JSON object. */
199
259
  export declare function writeConfigObject(path: string, config: unknown): void;