@autorag/librarian 2.8.0 → 2.10.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 (97) hide show
  1. package/NOTICE +4 -4
  2. package/README.md +120 -24
  3. package/dist/agent/agent.d.ts +147 -78
  4. package/dist/agent/answer-citations.d.ts +22 -0
  5. package/dist/agent/answer-guidelines.d.ts +9 -9
  6. package/dist/agent/citations.d.ts +42 -7
  7. package/dist/agent/datasource-skill.d.ts +30 -16
  8. package/dist/agent/evidence-judgment.d.ts +58 -0
  9. package/dist/agent/evidence-ledger.d.ts +54 -0
  10. package/dist/agent/evidence-origins.d.ts +49 -0
  11. package/dist/agent/index.d.ts +2 -2
  12. package/dist/agent/jikji-find-tool.d.ts +2 -1
  13. package/dist/agent/pi-session.d.ts +8 -1
  14. package/dist/agent/query-peer-tool.d.ts +3 -0
  15. package/dist/agent/query-routing.d.ts +71 -10
  16. package/dist/agent/{emit-results-tool.d.ts → results.d.ts} +11 -11
  17. package/dist/agent/search-all-tool.d.ts +5 -5
  18. package/dist/agent/search-documents.d.ts +14 -27
  19. package/dist/agent/search-minsync-tool.d.ts +5 -5
  20. package/dist/agent/search-single-datasource-tool.d.ts +9 -8
  21. package/dist/agent/self-config.d.ts +40 -0
  22. package/dist/agent/system-prompt.d.ts +2 -3
  23. package/dist/agent/web-fetch-tool.d.ts +2 -1
  24. package/dist/agent/web-search-tool.d.ts +2 -1
  25. package/dist/cli/commands/evidence.d.ts +2 -2
  26. package/dist/cli/commands/memory.d.ts +1 -1
  27. package/dist/cli/commands/report.d.ts +2 -2
  28. package/dist/cli/commands/tui.d.ts +3 -2
  29. package/dist/cli/config.d.ts +16 -8
  30. package/dist/cli/index.d.ts +1 -1
  31. package/dist/cli/index.js +11133 -10103
  32. package/dist/cli/output.d.ts +2 -6
  33. package/dist/cloud/authorize.d.ts +12 -0
  34. package/dist/cloud/callback-server.d.ts +33 -0
  35. package/dist/cloud/callback.d.ts +23 -0
  36. package/dist/cloud/config.d.ts +23 -0
  37. package/dist/cloud/errors.d.ts +46 -0
  38. package/dist/cloud/index.d.ts +12 -0
  39. package/dist/cloud/models.d.ts +32 -0
  40. package/dist/cloud/oauth-login.d.ts +22 -0
  41. package/dist/cloud/pkce.d.ts +20 -0
  42. package/dist/cloud/provider.d.ts +40 -0
  43. package/dist/cloud/token.d.ts +22 -0
  44. package/dist/config/home.d.ts +6 -0
  45. package/dist/core.d.ts +10 -21
  46. package/dist/core.js +15272 -14207
  47. package/dist/datasource/chunk-store.d.ts +2 -6
  48. package/dist/datasource/connector-skill.d.ts +2 -3
  49. package/dist/datasource/index.d.ts +2 -4
  50. package/dist/datasource/registry.d.ts +11 -13
  51. package/dist/datasource/scope.d.ts +19 -0
  52. package/dist/datasource/skills/github-gist/index.d.ts +1 -1
  53. package/dist/datasource/skills/github-gist/semantic.d.ts +3 -44
  54. package/dist/datasource/skills/github-gist/skill.d.ts +3 -3
  55. package/dist/datasource/types.d.ts +14 -28
  56. package/dist/embedding-runtime/gateway-embedder.d.ts +41 -0
  57. package/dist/index.d.ts +2 -1
  58. package/dist/index.js +15488 -14359
  59. package/dist/language.d.ts +2 -1
  60. package/dist/mcp/index.js +15413 -14341
  61. package/dist/memory/check-memory-tool.d.ts +8 -4
  62. package/dist/memory/context.d.ts +51 -0
  63. package/dist/memory/index.d.ts +8 -1
  64. package/dist/memory/judged-evidence.d.ts +32 -0
  65. package/dist/memory/memory.d.ts +36 -120
  66. package/dist/memory/renderer.d.ts +16 -7
  67. package/dist/memory/similar-queries.d.ts +40 -0
  68. package/dist/minsync/client.d.ts +1 -1
  69. package/dist/minsync/errors.d.ts +14 -0
  70. package/dist/minsync/index.d.ts +1 -0
  71. package/dist/minsync/installer.d.ts +1 -1
  72. package/dist/minsync/method.d.ts +3 -3
  73. package/dist/mirror/sync.d.ts +5 -2
  74. package/dist/observability/run-log.d.ts +1 -1
  75. package/dist/parser/defaults.d.ts +16 -5
  76. package/dist/parser/index.d.ts +1 -1
  77. package/dist/parser/kordoc.d.ts +8 -1
  78. package/dist/parser/ocr-engines.d.ts +19 -0
  79. package/dist/retrieval/bm25.d.ts +19 -0
  80. package/dist/retrieval/engine.d.ts +17 -58
  81. package/dist/retrieval/index.d.ts +3 -2
  82. package/dist/retrieval/merger.d.ts +6 -0
  83. package/dist/retrieval/rerank.d.ts +2 -2
  84. package/dist/retrieval/selection.d.ts +33 -41
  85. package/dist/retrieval/types.d.ts +1 -26
  86. package/dist/web/search/format.d.ts +5 -2
  87. package/dist/web/search/index.d.ts +7 -1
  88. package/package.json +5 -5
  89. package/skills/autorag/SKILL.md +21 -22
  90. package/skills/autorag-doctor/SKILL.md +20 -15
  91. package/skills/autorag-lite-setup/SKILL.md +22 -19
  92. package/skills/autorag-setup/SKILL.md +34 -21
  93. package/dist/agent/fast-answer-tool.d.ts +0 -46
  94. package/dist/cli/commands/feedback.d.ts +0 -8
  95. package/dist/datasource/access-context.d.ts +0 -43
  96. package/dist/datasource/result-filter.d.ts +0 -64
  97. package/dist/parser/ocr.d.ts +0 -31
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import type { AgentTool } from "@earendil-works/pi-agent-core";
11
11
  import { Type } from "typebox";
12
+ import { EvidenceLedger } from "./evidence-ledger.js";
12
13
  export declare const WEB_FETCH_TOOL_NAME = "web_fetch";
13
14
  declare const webFetchSchema: Type.TObject<{
14
15
  url: Type.TString;
@@ -28,5 +29,5 @@ export interface WebFetchToolDetails {
28
29
  readonly available: boolean;
29
30
  readonly error?: string;
30
31
  }
31
- export declare function createWebFetchTool(options?: WebFetchToolOptions): AgentTool<typeof webFetchSchema, WebFetchToolDetails>;
32
+ export declare function createWebFetchTool(options?: WebFetchToolOptions, ledger?: EvidenceLedger): AgentTool<typeof webFetchSchema, WebFetchToolDetails>;
32
33
  export {};
@@ -13,6 +13,7 @@ import type { AgentTool } from "@earendil-works/pi-agent-core";
13
13
  import { Type } from "typebox";
14
14
  import type { ModelNativeSearchAuth } from "../web/search/model-auth.js";
15
15
  import type { SearchProviderId } from "../web/search/types.js";
16
+ import { EvidenceLedger } from "./evidence-ledger.js";
16
17
  export declare const WEB_SEARCH_TOOL_NAME = "web_search";
17
18
  declare const webSearchSchema: Type.TObject<{
18
19
  query: Type.TString;
@@ -44,5 +45,5 @@ export interface WebSearchToolDetails {
44
45
  readonly available: boolean;
45
46
  readonly error?: string;
46
47
  }
47
- export declare function createWebSearchTool(options?: WebSearchToolOptions): AgentTool<typeof webSearchSchema, WebSearchToolDetails>;
48
+ export declare function createWebSearchTool(options?: WebSearchToolOptions, ledger?: EvidenceLedger): AgentTool<typeof webSearchSchema, WebSearchToolDetails>;
48
49
  export {};
@@ -1,4 +1,4 @@
1
- import type { MemorySchemaV4 } from "../../memory/memory.js";
1
+ import type { MemorySchema } from "../../memory/memory.js";
2
2
  import type { CommandContext } from "./types.js";
3
3
  interface EvidenceView {
4
4
  readonly stableEvidenceId: string;
@@ -11,7 +11,7 @@ interface EvidenceView {
11
11
  readonly lineNumber?: number;
12
12
  readonly metadata?: Record<string, unknown>;
13
13
  }
14
- export declare function evidenceFor(schema: MemorySchemaV4, sessionId: string, resultNumber?: number): {
14
+ export declare function evidenceFor(schema: MemorySchema, sessionId: string, resultNumber?: number): {
15
15
  sessionId: string;
16
16
  results: {
17
17
  number: number;
@@ -1,7 +1,7 @@
1
1
  import type { CommandContext } from "./types.js";
2
2
  /**
3
3
  * `autorag memory inspect` — render a path-opaque snapshot of the retrieval
4
- * memory (curated results, feedback signals, insights, signal defaults).
4
+ * memory (judged evidence, curated results, evidence chunks, insights).
5
5
  * Model-free. The memory file is resolved from config and loaded read-only;
6
6
  * only the rendered schema is emitted, never the storage path.
7
7
  */
@@ -1,6 +1,6 @@
1
- import { type AutoRAGResultsDetails } from "../../agent/emit-results-tool.js";
1
+ import { type AutoRAGResultsDetails } from "../../agent/results.js";
2
2
  import type { CommandContext } from "./types.js";
3
- /** Validate a curated report payload against the `emit_autorag_results` contract. */
3
+ /** Validate a curated report payload against the `autorag report` contract (explicit number -> source mapping). */
4
4
  export declare function validateReport(value: unknown): AutoRAGResultsDetails;
5
5
  /** Persist a structured report submitted by an external curator. */
6
6
  export declare function runReport(ctx: CommandContext): Promise<number>;
@@ -5,8 +5,9 @@ import type { CommandContext } from "./types.js";
5
5
  * Pi owns the terminal UI, `read`/`bash`/`edit`/`write`/`grep`/`find`/`ls`
6
6
  * tools, provider credentials/OAuth, model selection, session persistence and
7
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
8
+ * its domain tools and runs the two-phase search in the same session through
9
+ * the agent's interactive runtime; the model's progress notes, first answer, and
10
+ * final answer are ordinary assistant messages there. The native
10
11
  * `/login`, `/model`, `/resume`, `/new`, `/tree`, `/compact`, and `/settings`
11
12
  * commands are therefore always available.
12
13
  */
@@ -4,7 +4,6 @@ import type { AutoRAGAgentOptions, AutoRAGRetrievalLimits } from "../agent/agent
4
4
  import type { JevBackendName } from "../agent/jev-extension.js";
5
5
  import { type LoadLocalAutoRAGModelOptions } from "../agent/local-model.js";
6
6
  import type { DecompositionModel } from "../agent/query-decomposition.js";
7
- import type { DatasourceAccessContextOptions } from "../datasource/access-context.js";
8
7
  import { type DatasourcesConfig } from "../datasource/skills/factory.js";
9
8
  import type { EnsureMinSyncBinaryOptions, MinSyncEmbedderConfig } from "../minsync/index.js";
10
9
  export declare const DEFAULT_CONFIG_FILENAME = "config.json";
@@ -19,7 +18,8 @@ export declare class ConfigError extends Error {
19
18
  * the MinSync vector embedder settings validated by {@link normalizeEmbedder}.
20
19
  */
21
20
  export interface MinSyncMethodConfig {
22
- enabled?: boolean;
21
+ /** Accepted as `true` so existing configs load; `false` is rejected, MinSync is required. */
22
+ enabled?: true;
23
23
  autoInstall?: boolean;
24
24
  workspacePath?: string;
25
25
  maxChunkSize?: number;
@@ -143,6 +143,8 @@ export interface AgentModelConfig {
143
143
  maxTokens?: number;
144
144
  }
145
145
  export interface CliConfig {
146
+ /** Absolute path of the config file this config was resolved from (it may not exist yet). */
147
+ configPath?: string;
146
148
  searchPaths: string[];
147
149
  workspacePath: string;
148
150
  memoryPath: string;
@@ -168,7 +170,7 @@ export interface CliConfig {
168
170
  } | false;
169
171
  webSearch?: WebSearchCliConfig;
170
172
  /**
171
- * Jev query routing (local / web / direct), the decomposition check, the
173
+ * Jev query routing (direct / local), the decomposition check, the
172
174
  * post-fast-answer follow-up check, and the `jev` tool. On by default with
173
175
  * the OpenRouter backend; `false` or `enabled: false` disables it. Secrets
174
176
  * never appear here: `jev-use` reads the backend key from its own
@@ -195,10 +197,8 @@ export interface CliConfig {
195
197
  excludePaths?: string[];
196
198
  /** Hard caps on retrieval, baseline prefetch, and model-facing candidate lists. */
197
199
  limits?: AutoRAGRetrievalLimits;
198
- /** Trusted datasource skill configuration (skill name → config). */
200
+ /** Datasource skill configuration (skill name → config). */
199
201
  datasources?: DatasourcesConfig;
200
- /** Trusted datasource allow-tags/allow-scopes. Absent ⇒ default-deny. */
201
- datasourceAccess?: DatasourceAccessContextOptions;
202
202
  /** P2P sharing configuration. Disabled by default. */
203
203
  p2p?: P2pConfig;
204
204
  }
@@ -226,8 +226,8 @@ export declare function normalizeEmbedder(raw: unknown, path: string): MinSyncEm
226
226
  * Normalize raw indexing method config into a fully-populated shape.
227
227
  *
228
228
  * - `undefined` / missing key => `{ enabled: true, autoInstall: true }`
229
- * - `false` => `{ enabled: false }` (disabled marker)
230
229
  * - object merges with `enabled: true` default and is validated
230
+ * - `false` and `enabled: false` throw: MinSync is required
231
231
  *
232
232
  * Unknown fields, invalid embedder settings, and bad numeric values throw
233
233
  * {@link ConfigError}.
@@ -250,7 +250,7 @@ export declare const DEFAULT_JEV_BACKEND: JevBackendName;
250
250
  * Question-decomposition model used when the config names none. Picked from a
251
251
  * live OpenRouter bench (6 questions incl. Korean, 2 runs each): 12/12 valid,
252
252
  * covering, language-preserving decompositions at ~0.9s p50, about 3.5x
253
- * cheaper per call than google/gemini-2.5-flash-lite at equal quality.
253
+ * cheaper per call than the previous default (a 2025 Gemini flash-lite) at equal quality.
254
254
  */
255
255
  export declare const DEFAULT_QUERY_DECOMPOSITION_MODEL: AgentModelConfig;
256
256
  /** Validate the `queryDecomposition` config section (`false` = decompose with the session model). */
@@ -303,6 +303,14 @@ export interface ResolvedAgentModelDetailed {
303
303
  readonly role: ResolvedAgentModelRole;
304
304
  }
305
305
  export declare function resolveAgentModel(config: CliConfig, options?: ResolveAgentModelOptions): Promise<ResolvedAgentModel>;
306
+ /**
307
+ * Check that a config file still resolves to a callable model, the way the
308
+ * next `autorag` launch will read it: invalid JSON, a schema error, or a model
309
+ * id that neither the pi catalog nor a declared endpoint knows is a problem.
310
+ * A missing credential is not (that is `autorag health`'s `auth_missing`).
311
+ * Resolves to a problem description, or `undefined` when the config is fine.
312
+ */
313
+ export declare function validateAgentConfigFile(configPath: string, options?: ResolveAgentModelOptions): Promise<string | undefined>;
306
314
  /**
307
315
  * Resolve the question-decomposition model and its credential through the same
308
316
  * chain as the agent model. An absent section or `{}` uses
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- declare const COMMANDS: readonly ["init", "setup", "refresh", "status", "search", "feedback", "evidence", "memory", "index", "watch", "health", "duplicates", "tui", "serve", "p2p", "lite", "models", "gateway", "update-check"];
2
+ declare const COMMANDS: readonly ["init", "setup", "refresh", "status", "search", "evidence", "memory", "index", "watch", "health", "duplicates", "tui", "serve", "p2p", "lite", "models", "gateway", "update-check"];
3
3
  type CommandName = (typeof COMMANDS)[number];
4
4
  export type { CommandName };
5
5
  interface ParsedArgs {