@autorag/librarian 2.8.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.
- package/NOTICE +4 -4
- package/README.md +65 -24
- package/dist/agent/agent.d.ts +126 -63
- package/dist/agent/citations.d.ts +23 -0
- package/dist/agent/datasource-skill.d.ts +30 -16
- package/dist/agent/emit-results-tool.d.ts +37 -2
- package/dist/agent/evidence-judgment.d.ts +58 -0
- package/dist/agent/evidence-ledger.d.ts +59 -0
- package/dist/agent/evidence-origins.d.ts +49 -0
- package/dist/agent/fast-answer-tool.d.ts +16 -6
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/jikji-find-tool.d.ts +2 -1
- package/dist/agent/pi-session.d.ts +8 -1
- package/dist/agent/query-peer-tool.d.ts +3 -0
- package/dist/agent/query-routing.d.ts +71 -10
- package/dist/agent/search-all-tool.d.ts +5 -5
- package/dist/agent/search-documents.d.ts +3 -11
- package/dist/agent/search-minsync-tool.d.ts +5 -5
- package/dist/agent/search-single-datasource-tool.d.ts +9 -8
- package/dist/agent/self-config.d.ts +40 -0
- package/dist/agent/system-prompt.d.ts +2 -3
- package/dist/agent/web-fetch-tool.d.ts +2 -1
- package/dist/agent/web-search-tool.d.ts +2 -1
- package/dist/cli/commands/evidence.d.ts +2 -2
- package/dist/cli/commands/memory.d.ts +1 -1
- package/dist/cli/commands/report.d.ts +1 -1
- package/dist/cli/config.d.ts +16 -8
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +10450 -9902
- package/dist/cli/output.d.ts +2 -6
- package/dist/config/home.d.ts +6 -0
- package/dist/core.d.ts +8 -16
- package/dist/core.js +16465 -15823
- package/dist/datasource/chunk-store.d.ts +2 -6
- package/dist/datasource/connector-skill.d.ts +2 -3
- package/dist/datasource/index.d.ts +2 -4
- package/dist/datasource/registry.d.ts +11 -13
- package/dist/datasource/scope.d.ts +19 -0
- package/dist/datasource/skills/github-gist/index.d.ts +1 -1
- package/dist/datasource/skills/github-gist/semantic.d.ts +3 -44
- package/dist/datasource/skills/github-gist/skill.d.ts +3 -3
- package/dist/datasource/types.d.ts +14 -28
- package/dist/embedding-runtime/gateway-embedder.d.ts +41 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14767 -14173
- package/dist/language.d.ts +2 -1
- package/dist/mcp/index.js +14797 -14204
- package/dist/memory/check-memory-tool.d.ts +8 -4
- package/dist/memory/context.d.ts +51 -0
- package/dist/memory/index.d.ts +8 -1
- package/dist/memory/judged-evidence.d.ts +32 -0
- package/dist/memory/memory.d.ts +36 -120
- package/dist/memory/renderer.d.ts +16 -7
- package/dist/memory/similar-queries.d.ts +40 -0
- package/dist/minsync/errors.d.ts +14 -0
- package/dist/minsync/index.d.ts +1 -0
- package/dist/minsync/method.d.ts +3 -3
- package/dist/mirror/sync.d.ts +5 -2
- package/dist/parser/defaults.d.ts +16 -5
- package/dist/parser/index.d.ts +1 -1
- package/dist/parser/kordoc.d.ts +8 -1
- package/dist/parser/ocr-engines.d.ts +19 -0
- package/dist/retrieval/bm25.d.ts +19 -0
- package/dist/retrieval/engine.d.ts +17 -58
- package/dist/retrieval/index.d.ts +2 -1
- package/dist/retrieval/merger.d.ts +6 -0
- package/dist/retrieval/rerank.d.ts +2 -2
- package/dist/retrieval/selection.d.ts +33 -41
- package/dist/retrieval/types.d.ts +1 -3
- package/dist/web/search/format.d.ts +5 -2
- package/dist/web/search/index.d.ts +7 -1
- package/package.json +5 -5
- package/skills/autorag/SKILL.md +21 -22
- package/skills/autorag-doctor/SKILL.md +20 -15
- package/skills/autorag-lite-setup/SKILL.md +21 -18
- package/skills/autorag-setup/SKILL.md +33 -20
- package/dist/cli/commands/feedback.d.ts +0 -8
- package/dist/datasource/access-context.d.ts +0 -43
- package/dist/datasource/result-filter.d.ts +0 -64
- package/dist/parser/ocr.d.ts +0 -31
|
@@ -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
|
|
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
|
|
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
|
|
22
|
-
*
|
|
23
|
-
*
|
|
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
|
-
/**
|
|
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,12 @@
|
|
|
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
|
|
9
|
+
datasourceSkills?: readonly DatasourceAgentSkill[];
|
|
11
10
|
retrievedContentGuard?: boolean;
|
|
12
11
|
remoteSession?: boolean;
|
|
13
12
|
}
|
|
@@ -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 {
|
|
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:
|
|
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,
|
|
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 `
|
|
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>;
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
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
|
-
/**
|
|
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
|
|
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
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
declare const COMMANDS: readonly ["init", "setup", "refresh", "status", "search", "
|
|
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 {
|