@autorag/librarian 2.7.0 → 2.9.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 (98) hide show
  1. package/NOTICE +10 -4
  2. package/README.md +122 -38
  3. package/dist/agent/agent.d.ts +210 -53
  4. package/dist/agent/answer-guidelines.d.ts +19 -0
  5. package/dist/agent/citations.d.ts +43 -0
  6. package/dist/agent/datasource-skill.d.ts +30 -16
  7. package/dist/agent/emit-results-tool.d.ts +37 -2
  8. package/dist/agent/evidence-judgment.d.ts +58 -0
  9. package/dist/agent/evidence-ledger.d.ts +59 -0
  10. package/dist/agent/evidence-origins.d.ts +49 -0
  11. package/dist/agent/fast-answer-tool.d.ts +16 -6
  12. package/dist/agent/index.d.ts +2 -1
  13. package/dist/agent/jev-extension.d.ts +68 -0
  14. package/dist/agent/jikji-find-tool.d.ts +2 -1
  15. package/dist/agent/pi-session.d.ts +28 -1
  16. package/dist/agent/query-decomposition.d.ts +25 -0
  17. package/dist/agent/query-peer-tool.d.ts +3 -0
  18. package/dist/agent/query-routing.d.ts +115 -0
  19. package/dist/agent/search-all-tool.d.ts +5 -5
  20. package/dist/agent/search-documents.d.ts +3 -11
  21. package/dist/agent/search-minsync-tool.d.ts +5 -5
  22. package/dist/agent/search-single-datasource-tool.d.ts +9 -8
  23. package/dist/agent/self-config.d.ts +40 -0
  24. package/dist/agent/system-prompt.d.ts +3 -3
  25. package/dist/agent/web-fetch-tool.d.ts +2 -1
  26. package/dist/agent/web-search-tool.d.ts +2 -1
  27. package/dist/cli/commands/evidence.d.ts +22 -0
  28. package/dist/cli/commands/init.d.ts +2 -1
  29. package/dist/cli/commands/memory.d.ts +1 -1
  30. package/dist/cli/commands/report.d.ts +1 -1
  31. package/dist/cli/commands/update-check.d.ts +8 -0
  32. package/dist/cli/config.d.ts +80 -7
  33. package/dist/cli/index.d.ts +1 -1
  34. package/dist/cli/index.js +3844 -2291
  35. package/dist/cli/output.d.ts +2 -6
  36. package/dist/cli/update-check.d.ts +34 -0
  37. package/dist/cli/version.d.ts +5 -0
  38. package/dist/config/home.d.ts +6 -0
  39. package/dist/core.d.ts +30 -6
  40. package/dist/core.js +7742 -6225
  41. package/dist/datasource/chunk-store.d.ts +2 -6
  42. package/dist/datasource/connector-skill.d.ts +2 -3
  43. package/dist/datasource/index.d.ts +2 -4
  44. package/dist/datasource/registry.d.ts +11 -13
  45. package/dist/datasource/scope.d.ts +19 -0
  46. package/dist/datasource/skills/github-gist/index.d.ts +1 -1
  47. package/dist/datasource/skills/github-gist/semantic.d.ts +3 -44
  48. package/dist/datasource/skills/github-gist/skill.d.ts +3 -3
  49. package/dist/datasource/types.d.ts +14 -28
  50. package/dist/embedding-runtime/gateway-embedder.d.ts +41 -0
  51. package/dist/everything/bundle.d.ts +15 -3
  52. package/dist/everything/client.d.ts +22 -5
  53. package/dist/everything/index.d.ts +1 -1
  54. package/dist/filesystem/name-search.d.ts +57 -0
  55. package/dist/fsearch/client.d.ts +7 -1
  56. package/dist/index.d.ts +2 -1
  57. package/dist/index.js +9139 -6376
  58. package/dist/jikji/client.d.ts +6 -1
  59. package/dist/language.d.ts +2 -1
  60. package/dist/mcp/index.d.ts +2 -0
  61. package/dist/mcp/index.js +30542 -0
  62. package/dist/mcp/server.d.ts +9 -0
  63. package/dist/memory/check-memory-tool.d.ts +8 -4
  64. package/dist/memory/context.d.ts +51 -0
  65. package/dist/memory/index.d.ts +8 -1
  66. package/dist/memory/judged-evidence.d.ts +32 -0
  67. package/dist/memory/memory.d.ts +36 -120
  68. package/dist/memory/renderer.d.ts +16 -7
  69. package/dist/memory/similar-queries.d.ts +40 -0
  70. package/dist/minsync/errors.d.ts +14 -0
  71. package/dist/minsync/index.d.ts +1 -0
  72. package/dist/minsync/method.d.ts +8 -5
  73. package/dist/mirror/index.d.ts +1 -1
  74. package/dist/mirror/paths.d.ts +6 -0
  75. package/dist/mirror/sync.d.ts +5 -2
  76. package/dist/parser/defaults.d.ts +16 -5
  77. package/dist/parser/index.d.ts +1 -1
  78. package/dist/parser/kordoc.d.ts +8 -1
  79. package/dist/parser/ocr-engines.d.ts +19 -0
  80. package/dist/retrieval/bm25.d.ts +19 -0
  81. package/dist/retrieval/engine.d.ts +33 -43
  82. package/dist/retrieval/index.d.ts +3 -1
  83. package/dist/retrieval/merger.d.ts +6 -0
  84. package/dist/retrieval/rerank.d.ts +4 -2
  85. package/dist/retrieval/selection.d.ts +89 -0
  86. package/dist/retrieval/types.d.ts +1 -3
  87. package/dist/web/search/format.d.ts +5 -2
  88. package/dist/web/search/index.d.ts +7 -1
  89. package/package.json +11 -7
  90. package/skills/autorag/SKILL.md +43 -23
  91. package/skills/autorag-doctor/SKILL.md +40 -26
  92. package/skills/autorag-lite-setup/SKILL.md +123 -64
  93. package/skills/autorag-setup/SKILL.md +107 -22
  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
  98. package/skills/autorag-lite-search/SKILL.md +0 -245
@@ -1,11 +1,12 @@
1
1
  import type { AgentTool } from "@earendil-works/pi-agent-core";
2
2
  import { Type } from "typebox";
3
3
  import type { RetrievalDiagnostic, RetrievalResult } from "../retrieval/types.js";
4
+ import { EvidenceLedger } from "./evidence-ledger.js";
4
5
  import { type SearchDocumentRetrievalTraceResult } from "./search-documents.js";
5
6
  /**
6
7
  * Per-datasource search tools.
7
8
  *
8
- * One tool is generated per authorized datasource connection (e.g.
9
+ * One tool is generated per configured datasource connection (e.g.
9
10
  * `search_datasource_discord`, or `search_datasource_kakao_work` for a
10
11
  * `kakao-work` account alias). Its execution registers only that connection's
11
12
  * retrieval methods with the retriever, so no other datasource CLI is spawned
@@ -14,13 +15,13 @@ import { type SearchDocumentRetrievalTraceResult } from "./search-documents.js";
14
15
  * These generated tools are the only model-facing datasource retrieval
15
16
  * surface. Cross-datasource fan-out belongs to `search_all_documents`, which
16
17
  * already spans every configured retrieval method — including datasources — so
17
- * a datasource-only fan-out tool would be redundant. Every authorized
18
+ * a datasource-only fan-out tool would be redundant. Every configured
18
19
  * connection must therefore appear here; a datasource with no generated tool
19
20
  * would become unreachable except through the full fan-out.
20
21
  *
21
- * Tools are generated from the configured, access-authorized datasource skills
22
- * at agent construction, so a datasource that is disabled in config or denied
23
- * by the trusted access context never appears in the tool list.
22
+ * Tools are generated from the configured datasource skills at agent
23
+ * construction; a connection not present in the config never appears in the
24
+ * tool list.
24
25
  */
25
26
  export declare const SEARCH_SINGLE_DATASOURCE_TOOL_PREFIX = "search_datasource_";
26
27
  /** Model-visible tool name for one datasource connection. */
@@ -31,7 +32,7 @@ export interface SingleDatasourceToolSpec {
31
32
  readonly datasourceId: string;
32
33
  /** Operator/descriptor-authored context shown in the tool description. */
33
34
  readonly description: string;
34
- /** Authorized instance roots (e.g. `/kakao/personal`) for the description. */
35
+ /** Instance roots (e.g. `/kakao/personal`) for the description. */
35
36
  readonly instanceScopes: readonly string[];
36
37
  }
37
38
  export interface SingleDatasourceSearchProvider {
@@ -52,12 +53,12 @@ export interface SearchSingleDatasourceDetails {
52
53
  /** Top candidates in traceable shape (additive; used for the run's retrieval trace). */
53
54
  readonly results?: readonly SearchDocumentRetrievalTraceResult[];
54
55
  }
55
- export declare function createSingleDatasourceSearchTools(provider: SingleDatasourceSearchProvider, specs: readonly SingleDatasourceToolSpec[]): AgentTool<typeof searchSingleDatasourceSchema, SearchSingleDatasourceDetails>[];
56
+ export declare function createSingleDatasourceSearchTools(provider: SingleDatasourceSearchProvider, specs: readonly SingleDatasourceToolSpec[], ledger?: EvidenceLedger): AgentTool<typeof searchSingleDatasourceSchema, SearchSingleDatasourceDetails>[];
56
57
  declare const searchSingleDatasourceSchema: Type.TObject<{
57
58
  query: Type.TString;
58
59
  topK: Type.TOptional<Type.TInteger>;
59
60
  scope: Type.TOptional<Type.TString>;
60
61
  }>;
61
62
  /** Shared rendering for datasource search tool results (fan-out removed). */
62
- export declare function formatDatasourceResults(results: readonly RetrievalResult[], diagnostics: readonly RetrievalDiagnostic[]): string;
63
+ export declare function formatDatasourceResults(results: readonly RetrievalResult[], diagnostics: readonly RetrievalDiagnostic[], evidenceIds: readonly string[]): string;
63
64
  export {};
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Host opt-in for agent self-configuration: the Jev `config` branch, where the
3
+ * agent edits its own settings with the full `autorag-setup` skill in hand.
4
+ */
5
+ export interface SelfConfigOptions {
6
+ /** The active AutoRAG config file the agent may read and edit. */
7
+ readonly configPath: string;
8
+ /** Override for the `autorag-setup` SKILL.md; defaults to the packaged skill. */
9
+ readonly skillPath?: string;
10
+ /**
11
+ * Check the config file after a config turn changed it. Resolves to a
12
+ * problem description when the file no longer works, or `undefined` when it
13
+ * is fine. A reported problem restores the pre-turn file.
14
+ */
15
+ readonly validate?: (configPath: string) => Promise<string | undefined>;
16
+ }
17
+ /** Full text of the `autorag-setup` skill with its YAML front matter removed. */
18
+ export declare function loadSetupSkill(skillPath?: string): string;
19
+ export interface SelfConfigPromptInput {
20
+ readonly query: string;
21
+ readonly configPath: string;
22
+ readonly agentDir: string;
23
+ readonly skill: string;
24
+ }
25
+ /** The config file's current text, or `undefined` when it does not exist. */
26
+ export declare function snapshotConfigFile(configPath: string): string | undefined;
27
+ /**
28
+ * After a config turn: when the model changed the file and the host's
29
+ * `validate` says the result no longer works, put the pre-turn text back.
30
+ * Returns the problem that triggered the rollback, or `undefined` when the
31
+ * file is unchanged, valid, or the host supplied no validator. An unchanged
32
+ * file is never touched, even if it was already invalid before the turn.
33
+ */
34
+ export declare function rollbackIfBroken(options: SelfConfigOptions, before: string | undefined): Promise<string | undefined>;
35
+ /**
36
+ * The turn prompt for the `config` branch: the whole setup skill, where this
37
+ * run's config lives, the safety rules for editing it, and the user's request.
38
+ * The turn ends with `emit_autorag_results`; there is no fast answer.
39
+ */
40
+ export declare function buildSelfConfigPrompt(input: SelfConfigPromptInput): string;
@@ -1,13 +1,13 @@
1
- import type { Skill } from "@earendil-works/pi-agent-core";
2
1
  import type { StoreManifest } from "../manifest/types.js";
2
+ import type { DatasourceAgentSkill } from "./datasource-skill.js";
3
3
  export interface SystemPromptConfig {
4
4
  toolNames: string[];
5
5
  modelId?: string;
6
- memorySignalCount?: number;
7
6
  memoryEntries?: readonly unknown[];
8
7
  manifests: StoreManifest[];
9
8
  jikjiIndexingEnabled?: boolean;
10
- datasourceSkills?: readonly Skill[];
9
+ datasourceSkills?: readonly DatasourceAgentSkill[];
11
10
  retrievedContentGuard?: boolean;
11
+ remoteSession?: boolean;
12
12
  }
13
13
  export declare function buildSystemPrompt(config: SystemPromptConfig): string;
@@ -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,3 +1,25 @@
1
+ import type { MemorySchema } from "../../memory/memory.js";
1
2
  import type { CommandContext } from "./types.js";
3
+ interface EvidenceView {
4
+ readonly stableEvidenceId: string;
5
+ readonly method: string;
6
+ readonly source: string;
7
+ readonly excerpt?: string;
8
+ readonly content?: string;
9
+ readonly retrievalResultId?: string;
10
+ readonly chunkIndex?: number;
11
+ readonly lineNumber?: number;
12
+ readonly metadata?: Record<string, unknown>;
13
+ }
14
+ export declare function evidenceFor(schema: MemorySchema, sessionId: string, resultNumber?: number): {
15
+ sessionId: string;
16
+ results: {
17
+ number: number;
18
+ title: string;
19
+ summary: string;
20
+ chunks: EvidenceView[];
21
+ }[];
22
+ };
2
23
  /** Show the persisted source/chunk evidence attached to a search session. */
3
24
  export declare function runEvidence(ctx: CommandContext): Promise<number>;
25
+ export {};
@@ -4,6 +4,7 @@ import type { CommandContext } from "./types.js";
4
4
  * Model flags are folded into the generated config. A legacy
5
5
  * `autorag.config.json` in the current working directory may be migrated
6
6
  * non-destructively. An existing home config is not overwritten without
7
- * `--force`.
7
+ * `--force`, and `--force` only replaces an existing config when the caller
8
+ * selected the path explicitly (`--config` or `AUTORAG_CONFIG`).
8
9
  */
9
10
  export declare function runInit(ctx: CommandContext): Promise<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
1
  import { type AutoRAGResultsDetails } from "../../agent/emit-results-tool.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>;
@@ -0,0 +1,8 @@
1
+ import { type AutoRAGUpdateResult } from "../update-check.js";
2
+ import type { CommandContext } from "./types.js";
3
+ export interface UpdateCheckDeps {
4
+ readonly currentVersion?: string;
5
+ readonly check?: (currentVersion: string) => Promise<AutoRAGUpdateResult>;
6
+ }
7
+ /** `autorag update-check`: compare the running package against the npm registry. */
8
+ export declare function runUpdateCheck(ctx: CommandContext, deps?: UpdateCheckDeps): Promise<number>;
@@ -1,8 +1,9 @@
1
1
  import type { Api, Model } from "@earendil-works/pi-ai";
2
2
  import { ModelRuntime } from "@earendil-works/pi-coding-agent";
3
3
  import type { AutoRAGAgentOptions, AutoRAGRetrievalLimits } from "../agent/agent.js";
4
+ import type { JevBackendName } from "../agent/jev-extension.js";
4
5
  import { type LoadLocalAutoRAGModelOptions } from "../agent/local-model.js";
5
- import type { DatasourceAccessContextOptions } from "../datasource/access-context.js";
6
+ import type { DecompositionModel } from "../agent/query-decomposition.js";
6
7
  import { type DatasourcesConfig } from "../datasource/skills/factory.js";
7
8
  import type { EnsureMinSyncBinaryOptions, MinSyncEmbedderConfig } from "../minsync/index.js";
8
9
  export declare const DEFAULT_CONFIG_FILENAME = "config.json";
@@ -17,7 +18,8 @@ export declare class ConfigError extends Error {
17
18
  * the MinSync vector embedder settings validated by {@link normalizeEmbedder}.
18
19
  */
19
20
  export interface MinSyncMethodConfig {
20
- enabled?: boolean;
21
+ /** Accepted as `true` so existing configs load; `false` is rejected, MinSync is required. */
22
+ enabled?: true;
21
23
  autoInstall?: boolean;
22
24
  workspacePath?: string;
23
25
  maxChunkSize?: number;
@@ -51,6 +53,26 @@ export interface WebSearchCliConfig {
51
53
  timeoutSeconds?: number;
52
54
  } | false;
53
55
  }
56
+ /**
57
+ * Jev decision-tool config. Absent disables the tool; `enabled: false` disables
58
+ * it explicitly. Secrets never appear here: the `jev-use` engine reads the
59
+ * backend credential from its own environment variable (`TYPESAFE_API_KEY`,
60
+ * `OPENROUTER_API_KEY`, or `AI_GATEWAY_API_KEY`).
61
+ */
62
+ export interface JevCliConfig {
63
+ enabled?: boolean;
64
+ /** Force one backend; omit to let the first credential present win. */
65
+ backend?: JevBackendName;
66
+ /** Model id sent with every call, e.g. `jev-latest`. */
67
+ model?: string;
68
+ /** Escalate verdicts below this confidence (0-1). Default: per-source thresholds. */
69
+ confidenceThreshold?: number;
70
+ }
71
+ /** Question-decomposition config. Secrets stay in env/pi auth like the main model. */
72
+ export interface QueryDecompositionConfig {
73
+ /** Dedicated decomposition model; same shape and auth rules as the top-level `model`. */
74
+ model?: AgentModelConfig;
75
+ }
54
76
  /**
55
77
  * Post-merge reranking config. Routes merged evidence through a dedicated
56
78
  * rerank model. `provider` is `openrouter` today; `model` is the OpenRouter
@@ -68,7 +90,7 @@ export interface RerankConfig {
68
90
  apiKeyEnv?: string;
69
91
  /** Override the provider base URL (e.g. a gateway). */
70
92
  baseUrl?: string;
71
- /** Return only the top N merged results. Omitted ⇒ all distinct results are reordered. */
93
+ /** Return only the top N merged results. @default 25 (DEFAULT_RERANK_TOP_N) */
72
94
  topN?: number;
73
95
  /** Per-request timeout in milliseconds. */
74
96
  timeoutMs?: number;
@@ -121,6 +143,8 @@ export interface AgentModelConfig {
121
143
  maxTokens?: number;
122
144
  }
123
145
  export interface CliConfig {
146
+ /** Absolute path of the config file this config was resolved from (it may not exist yet). */
147
+ configPath?: string;
124
148
  searchPaths: string[];
125
149
  workspacePath: string;
126
150
  memoryPath: string;
@@ -145,6 +169,21 @@ export interface CliConfig {
145
169
  watch?: boolean;
146
170
  } | false;
147
171
  webSearch?: WebSearchCliConfig;
172
+ /**
173
+ * Jev query routing (direct / local), the decomposition check, the
174
+ * post-fast-answer follow-up check, and the `jev` tool. On by default with
175
+ * the OpenRouter backend; `false` or `enabled: false` disables it. Secrets
176
+ * never appear here: `jev-use` reads the backend key from its own
177
+ * environment variable.
178
+ */
179
+ jev?: JevCliConfig | false;
180
+ /**
181
+ * Question decomposition for the Jev query pipeline. `model` names the LLM
182
+ * that splits one question into at most five search queries; absent or `{}`
183
+ * uses {@link DEFAULT_QUERY_DECOMPOSITION_MODEL}, and `false` lets the
184
+ * agent's own model decompose.
185
+ */
186
+ queryDecomposition?: QueryDecompositionConfig | false;
148
187
  /** Post-merge reranking. Absent ⇒ reranking disabled. `false` disables it. */
149
188
  rerank?: RerankConfig | false;
150
189
  parserOptions?: Record<string, unknown>;
@@ -158,10 +197,8 @@ export interface CliConfig {
158
197
  excludePaths?: string[];
159
198
  /** Hard caps on retrieval, baseline prefetch, and model-facing candidate lists. */
160
199
  limits?: AutoRAGRetrievalLimits;
161
- /** Trusted datasource skill configuration (skill name → config). */
200
+ /** Datasource skill configuration (skill name → config). */
162
201
  datasources?: DatasourcesConfig;
163
- /** Trusted datasource allow-tags/allow-scopes. Absent ⇒ default-deny. */
164
- datasourceAccess?: DatasourceAccessContextOptions;
165
202
  /** P2P sharing configuration. Disabled by default. */
166
203
  p2p?: P2pConfig;
167
204
  }
@@ -189,8 +226,8 @@ export declare function normalizeEmbedder(raw: unknown, path: string): MinSyncEm
189
226
  * Normalize raw indexing method config into a fully-populated shape.
190
227
  *
191
228
  * - `undefined` / missing key => `{ enabled: true, autoInstall: true }`
192
- * - `false` => `{ enabled: false }` (disabled marker)
193
229
  * - object merges with `enabled: true` default and is validated
230
+ * - `false` and `enabled: false` throw: MinSync is required
194
231
  *
195
232
  * Unknown fields, invalid embedder settings, and bad numeric values throw
196
233
  * {@link ConfigError}.
@@ -205,6 +242,19 @@ export declare function resolveConfig(input: ResolveConfigInput): CliConfig;
205
242
  * would resolve them but never copied into `~/.autorag/config.json`.
206
243
  */
207
244
  export declare function resolveConfigReadOnly(input: ResolveConfigInput): CliConfig;
245
+ /** Validate and normalize the `jev` config section. */
246
+ export declare function normalizeJevConfig(raw: unknown): JevCliConfig;
247
+ /** Jev backend used when the config names none (absent section or `{}`). */
248
+ export declare const DEFAULT_JEV_BACKEND: JevBackendName;
249
+ /**
250
+ * Question-decomposition model used when the config names none. Picked from a
251
+ * live OpenRouter bench (6 questions incl. Korean, 2 runs each): 12/12 valid,
252
+ * covering, language-preserving decompositions at ~0.9s p50, about 3.5x
253
+ * cheaper per call than the previous default (a 2025 Gemini flash-lite) at equal quality.
254
+ */
255
+ export declare const DEFAULT_QUERY_DECOMPOSITION_MODEL: AgentModelConfig;
256
+ /** Validate the `queryDecomposition` config section (`false` = decompose with the session model). */
257
+ export declare function normalizeQueryDecompositionConfig(raw: unknown): QueryDecompositionConfig | false;
208
258
  /** Normalize and validate the `rerank` config section, filling in defaults. */
209
259
  export declare function normalizeRerankConfig(raw: unknown, path: string): RerankConfig | false;
210
260
  export declare function buildAgentOptions(config: CliConfig): Omit<AutoRAGAgentOptions, "model">;
@@ -253,6 +303,21 @@ export interface ResolvedAgentModelDetailed {
253
303
  readonly role: ResolvedAgentModelRole;
254
304
  }
255
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>;
314
+ /**
315
+ * Resolve the question-decomposition model and its credential through the same
316
+ * chain as the agent model. An absent section or `{}` uses
317
+ * {@link DEFAULT_QUERY_DECOMPOSITION_MODEL}; `queryDecomposition: false`
318
+ * returns undefined so the agent's own model decomposes.
319
+ */
320
+ export declare function resolveQueryDecompositionModel(config: CliConfig, options?: ResolveAgentModelOptions): Promise<DecompositionModel | undefined>;
256
321
  export declare function resolveAgentModelDetailed(config: CliConfig, options?: ResolveAgentModelOptions): Promise<ResolvedAgentModelDetailed>;
257
322
  export declare function readRawConfigObject(path: string): Record<string, unknown>;
258
323
  /** Atomically replace a config file, preserving the caller's JSON object. */
@@ -262,4 +327,12 @@ export declare function writeDefaultConfig(path: string, partial: Partial<CliCon
262
327
  atomicCreate?: boolean;
263
328
  cwd?: string;
264
329
  env?: NodeJS.ProcessEnv;
330
+ /**
331
+ * Whether the target path was selected explicitly by the caller
332
+ * (`--config` / `AUTORAG_CONFIG`). When `false`, `force` refuses to
333
+ * replace an existing file: an implicit home config may only be
334
+ * replaced through an explicit config path. `undefined` (callers that
335
+ * do not distinguish) keeps the historical force semantics.
336
+ */
337
+ explicit?: boolean;
265
338
  }): void;
@@ -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"];
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 {