@autorag/librarian 2.0.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/LICENSE +27 -0
- package/README.md +275 -0
- package/dist/agent/agent.d.ts +294 -0
- package/dist/agent/bash-tool.d.ts +41 -0
- package/dist/agent/datasource-skill.d.ts +45 -0
- package/dist/agent/emit-results-tool.d.ts +75 -0
- package/dist/agent/index.d.ts +11 -0
- package/dist/agent/jikji-find-tool.d.ts +73 -0
- package/dist/agent/search-all-tool.d.ts +36 -0
- package/dist/agent/search-bm25-tool.d.ts +18 -0
- package/dist/agent/search-datasource-tool.d.ts +26 -0
- package/dist/agent/search-documents.d.ts +56 -0
- package/dist/agent/search-minsync-tool.d.ts +24 -0
- package/dist/agent/system-prompt.d.ts +13 -0
- package/dist/agent/watch-refresh.d.ts +29 -0
- package/dist/cli/commands/feedback.d.ts +8 -0
- package/dist/cli/commands/health.d.ts +146 -0
- package/dist/cli/commands/index.d.ts +9 -0
- package/dist/cli/commands/init.d.ts +9 -0
- package/dist/cli/commands/memory.d.ts +8 -0
- package/dist/cli/commands/refresh.d.ts +19 -0
- package/dist/cli/commands/search.d.ts +34 -0
- package/dist/cli/commands/status.d.ts +7 -0
- package/dist/cli/commands/types.d.ts +10 -0
- package/dist/cli/commands/watch.d.ts +8 -0
- package/dist/cli/config.d.ts +172 -0
- package/dist/cli/index.d.ts +10 -0
- package/dist/cli/index.js +10845 -0
- package/dist/cli/output.d.ts +32 -0
- package/dist/config/home.d.ts +2 -0
- package/dist/datasource/access-context.d.ts +49 -0
- package/dist/datasource/diagnostics.d.ts +20 -0
- package/dist/datasource/index.d.ts +9 -0
- package/dist/datasource/polling.d.ts +51 -0
- package/dist/datasource/registry.d.ts +52 -0
- package/dist/datasource/result-filter.d.ts +63 -0
- package/dist/datasource/scope.d.ts +38 -0
- package/dist/datasource/skills/katok/client.d.ts +24 -0
- package/dist/datasource/skills/katok/index.d.ts +12 -0
- package/dist/datasource/skills/katok/methods.d.ts +40 -0
- package/dist/datasource/skills/katok/paths.d.ts +40 -0
- package/dist/datasource/skills/katok/skill.d.ts +33 -0
- package/dist/datasource/skills/katok/types.d.ts +146 -0
- package/dist/datasource/types.d.ts +183 -0
- package/dist/filesystem/file-lock.d.ts +16 -0
- package/dist/filesystem/source-paths.d.ts +38 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +9361 -0
- package/dist/jikji/answer-pack.d.ts +31 -0
- package/dist/jikji/client.d.ts +18 -0
- package/dist/jikji/diagnostics.d.ts +26 -0
- package/dist/jikji/index.d.ts +10 -0
- package/dist/jikji/installer.d.ts +46 -0
- package/dist/jikji/path-map.d.ts +8 -0
- package/dist/jikji/types.d.ts +112 -0
- package/dist/manifest/index.d.ts +2 -0
- package/dist/manifest/loader.d.ts +3 -0
- package/dist/manifest/types.d.ts +8 -0
- package/dist/memory/check-memory-tool.d.ts +13 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/memory.d.ts +179 -0
- package/dist/memory/renderer.d.ts +6 -0
- package/dist/minsync/client.d.ts +14 -0
- package/dist/minsync/embedder-config.d.ts +22 -0
- package/dist/minsync/index.d.ts +7 -0
- package/dist/minsync/installer.d.ts +27 -0
- package/dist/minsync/method.d.ts +37 -0
- package/dist/minsync/paths.d.ts +4 -0
- package/dist/minsync/process.d.ts +10 -0
- package/dist/minsync/types.d.ts +33 -0
- package/dist/minsync/workspace.d.ts +14 -0
- package/dist/mirror/index-store.d.ts +16 -0
- package/dist/mirror/index.d.ts +5 -0
- package/dist/mirror/paths.d.ts +6 -0
- package/dist/mirror/sync.d.ts +38 -0
- package/dist/observability/run-log.d.ts +53 -0
- package/dist/parser/defaults.d.ts +6 -0
- package/dist/parser/eml.d.ts +6 -0
- package/dist/parser/errors.d.ts +5 -0
- package/dist/parser/hwp.d.ts +6 -0
- package/dist/parser/index.d.ts +10 -0
- package/dist/parser/ocr.d.ts +25 -0
- package/dist/parser/office.d.ts +16 -0
- package/dist/parser/opendataloader-pdf.d.ts +21 -0
- package/dist/parser/plain-text.d.ts +6 -0
- package/dist/parser/registry.d.ts +8 -0
- package/dist/parser/text.d.ts +2 -0
- package/dist/parser/types.d.ts +14 -0
- package/dist/parser/xml-text.d.ts +2 -0
- package/dist/retrieval/evidence-id.d.ts +16 -0
- package/dist/retrieval/index.d.ts +7 -0
- package/dist/retrieval/merger.d.ts +18 -0
- package/dist/retrieval/methods/bm25.d.ts +52 -0
- package/dist/retrieval/registry.d.ts +8 -0
- package/dist/retrieval/scope.d.ts +4 -0
- package/dist/retrieval/types.d.ts +64 -0
- package/dist/subagents/contracts.d.ts +90 -0
- package/dist/subagents/dispatch-templates.d.ts +104 -0
- package/dist/subagents/dispatch-validation.d.ts +169 -0
- package/dist/subagents/explorer-tools-extension.d.ts +4 -0
- package/dist/subagents/explorer-tools-extension.js +130 -0
- package/dist/subagents/local-models.d.ts +14 -0
- package/dist/subagents/model-policy.d.ts +31 -0
- package/dist/subagents/runtime.d.ts +52 -0
- package/dist/tool/index.d.ts +1 -0
- package/dist/types/errors.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +66 -0
- package/skills/autorag/SKILL.md +149 -0
- package/skills/autorag-setup/SKILL.md +396 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandContext } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* `autorag status` — path-opaque snapshot of corpus freshness and index health.
|
|
4
|
+
* Runs a cheap parse-free staleness scan plus the cached last-refresh outcome.
|
|
5
|
+
* Model-free. Never emits filesystem paths; only the renderered status text.
|
|
6
|
+
*/
|
|
7
|
+
export declare function runStatus(ctx: CommandContext): Promise<number>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CommandContext {
|
|
2
|
+
positionals: string[];
|
|
3
|
+
flags: Record<string, string | boolean | undefined>;
|
|
4
|
+
json: boolean;
|
|
5
|
+
debug: boolean;
|
|
6
|
+
cwd: string;
|
|
7
|
+
stdout: (line: string) => void;
|
|
8
|
+
stderr: (line: string) => void;
|
|
9
|
+
promptYesNo?: (question: string) => Promise<boolean>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommandContext } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* `autorag watch` — keep parsed/BM25/MinSync indexes current.
|
|
4
|
+
*
|
|
5
|
+
* - default: long-running recursive fs watch with debounced refresh
|
|
6
|
+
* - `--once`: single refresh tick (for cron / launchd / Task Scheduler)
|
|
7
|
+
*/
|
|
8
|
+
export declare function runWatch(ctx: CommandContext): Promise<number>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { AutoRAGAgentOptions } from "../agent/agent.js";
|
|
3
|
+
import type { EnsureMinSyncBinaryOptions, MinSyncEmbedderConfig } from "../minsync/index.js";
|
|
4
|
+
import type { BM25Engine, BM25FallbackMode } from "../retrieval/methods/bm25.js";
|
|
5
|
+
import { type LoadLocalAutoRAGModelsOptions } from "../subagents/local-models.js";
|
|
6
|
+
export declare const DEFAULT_CONFIG_FILENAME = "config.json";
|
|
7
|
+
export declare const LEGACY_CONFIG_FILENAME = "autorag.config.json";
|
|
8
|
+
export { AUTORAG_HOME_ENV, resolveAutoRAGHome } from "../config/home.js";
|
|
9
|
+
export declare class ConfigError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Typed BM25 method config persisted in `config.json`. Missing `enabled` means
|
|
14
|
+
* enabled (true). `false` as a top-level value is also accepted and disables.
|
|
15
|
+
*/
|
|
16
|
+
export interface Bm25MethodConfig {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
indexPath?: string;
|
|
19
|
+
fallback?: BM25FallbackMode;
|
|
20
|
+
forceEngine?: Exclude<BM25Engine, "none">;
|
|
21
|
+
importBinding?: () => Promise<typeof import("@pngwasi/node-tantivy-binding")>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Typed MinSync method config persisted in `config.json`. Missing `enabled`
|
|
25
|
+
* means enabled (true); `autoInstall` defaults to false. `embedder` carries
|
|
26
|
+
* the MinSync vector embedder settings validated by {@link normalizeEmbedder}.
|
|
27
|
+
*/
|
|
28
|
+
export interface MinSyncMethodConfig {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
autoInstall?: boolean;
|
|
31
|
+
binaryPath?: string;
|
|
32
|
+
workspacePath?: string;
|
|
33
|
+
installer?: Omit<EnsureMinSyncBinaryOptions, "root">;
|
|
34
|
+
embedder?: MinSyncEmbedderConfig;
|
|
35
|
+
}
|
|
36
|
+
/** Indexing method config as it appears in a raw config file (before normalization). */
|
|
37
|
+
export interface RawIndexingMethods {
|
|
38
|
+
bm25?: Bm25MethodConfig | false;
|
|
39
|
+
minSync?: MinSyncMethodConfig | false;
|
|
40
|
+
}
|
|
41
|
+
/** Result of {@link normalizeIndexingConfig}: always fully populated. */
|
|
42
|
+
export interface NormalizedIndexingConfig {
|
|
43
|
+
bm25: Bm25MethodConfig;
|
|
44
|
+
minSync: MinSyncMethodConfig;
|
|
45
|
+
}
|
|
46
|
+
export interface AgentModelConfig {
|
|
47
|
+
/** Provider identity used for auth lookup and Model.provider (e.g. openrouter, fireworks, ollama). */
|
|
48
|
+
provider: string;
|
|
49
|
+
/** Wire model id sent to the provider API. */
|
|
50
|
+
id: string;
|
|
51
|
+
/** Optional display name; defaults to id when omitted. */
|
|
52
|
+
name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* API wire format. Required only when `baseUrl` is set and you need something
|
|
55
|
+
* other than the default `openai-completions`.
|
|
56
|
+
*/
|
|
57
|
+
api?: Api;
|
|
58
|
+
/**
|
|
59
|
+
* Endpoint base URL. When set, AutoRAG builds a Model from this config
|
|
60
|
+
* instead of requiring a pi-ai catalog entry. Omit for catalog/local models.
|
|
61
|
+
*/
|
|
62
|
+
baseUrl?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Environment variable name holding the API key (never the secret itself).
|
|
65
|
+
* Defaults to `${PROVIDER}_API_KEY` when `baseUrl` is set.
|
|
66
|
+
*/
|
|
67
|
+
apiKeyEnv?: string;
|
|
68
|
+
reasoning?: boolean;
|
|
69
|
+
input?: Array<"text" | "image">;
|
|
70
|
+
contextWindow?: number;
|
|
71
|
+
maxTokens?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface CliConfig {
|
|
74
|
+
searchPaths: string[];
|
|
75
|
+
workspacePath: string;
|
|
76
|
+
memoryPath: string;
|
|
77
|
+
/** @deprecated Prefer agents.orchestrator. Kept for legacy single-model configs. */
|
|
78
|
+
model?: AgentModelConfig;
|
|
79
|
+
agents?: {
|
|
80
|
+
orchestrator?: AgentModelConfig;
|
|
81
|
+
explorer?: AgentModelConfig;
|
|
82
|
+
};
|
|
83
|
+
minSync?: MinSyncMethodConfig;
|
|
84
|
+
bm25?: Bm25MethodConfig;
|
|
85
|
+
jikji?: Record<string, unknown>;
|
|
86
|
+
parserOptions?: Record<string, unknown>;
|
|
87
|
+
}
|
|
88
|
+
export interface ResolveConfigInput {
|
|
89
|
+
flags: Record<string, string | boolean | undefined>;
|
|
90
|
+
env?: NodeJS.ProcessEnv;
|
|
91
|
+
cwd?: string;
|
|
92
|
+
readOnly?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface ResolvedConfigPath {
|
|
95
|
+
configPath: string;
|
|
96
|
+
explicit: boolean;
|
|
97
|
+
legacyPath?: string;
|
|
98
|
+
}
|
|
99
|
+
export declare function resolveConfigPath(input: ResolveConfigInput): ResolvedConfigPath;
|
|
100
|
+
/** Normalize inherited legacy paths against the legacy workspace, not the caller's cwd. */
|
|
101
|
+
export declare function normalizeLegacyConfigPaths(partial: Partial<CliConfig>, origin: string): Partial<CliConfig>;
|
|
102
|
+
/**
|
|
103
|
+
* Normalize and validate a raw MinSync embedder config object.
|
|
104
|
+
* Rejects unknown fields (e.g. `extraArgs`), invalid `apiKeyEnv` names, and
|
|
105
|
+
* non-positive numeric fields. Returns a cleaned {@link MinSyncEmbedderConfig}.
|
|
106
|
+
*/
|
|
107
|
+
export declare function normalizeEmbedder(raw: unknown, path: string): MinSyncEmbedderConfig;
|
|
108
|
+
/**
|
|
109
|
+
* Normalize raw indexing method config into a fully-populated shape.
|
|
110
|
+
*
|
|
111
|
+
* - `undefined` / missing key => `{ enabled: true }` (minSync `autoInstall: false`)
|
|
112
|
+
* - `false` => `{ enabled: false }` (disabled marker)
|
|
113
|
+
* - object merges with `enabled: true` default and is validated
|
|
114
|
+
*
|
|
115
|
+
* Unknown fields, invalid embedder settings, and bad numeric values throw
|
|
116
|
+
* {@link ConfigError}.
|
|
117
|
+
*/
|
|
118
|
+
export declare function normalizeIndexingConfig(raw: RawIndexingMethods): NormalizedIndexingConfig;
|
|
119
|
+
export declare function resolveConfig(input: ResolveConfigInput): CliConfig;
|
|
120
|
+
/**
|
|
121
|
+
* Resolve config without writing, migrating, or locking. Health and other
|
|
122
|
+
* non-destructive preflights use this so legacy cwd configs are read as search
|
|
123
|
+
* would resolve them but never copied into `~/.autorag/config.json`.
|
|
124
|
+
*/
|
|
125
|
+
export declare function resolveConfigReadOnly(input: ResolveConfigInput): CliConfig;
|
|
126
|
+
export declare function buildAgentOptions(config: CliConfig): Omit<AutoRAGAgentOptions, "model">;
|
|
127
|
+
export declare function resolveModel(config: CliConfig): Model<Api>;
|
|
128
|
+
export interface ResolvedAgentModel {
|
|
129
|
+
readonly model: Model<Api>;
|
|
130
|
+
readonly explorerModel: Model<Api>;
|
|
131
|
+
readonly apiKey?: string;
|
|
132
|
+
readonly providerApiKeys?: Readonly<Record<string, string>>;
|
|
133
|
+
}
|
|
134
|
+
export type AgentModelResolutionSource = "config" | "flags" | "env" | "local_runtime" | "catalog" | "configured_alias" | "mixed";
|
|
135
|
+
export interface AgentModelAuth {
|
|
136
|
+
readonly present: boolean;
|
|
137
|
+
readonly source: "env" | "local_runtime" | "catalog" | "none" | "unknown";
|
|
138
|
+
readonly envName?: string;
|
|
139
|
+
}
|
|
140
|
+
export interface ResolvedAgentModelRole {
|
|
141
|
+
readonly provider: string;
|
|
142
|
+
readonly modelId: string;
|
|
143
|
+
readonly displayName: string;
|
|
144
|
+
readonly api: Api;
|
|
145
|
+
readonly baseUrl: string | undefined;
|
|
146
|
+
readonly contextWindow: number | undefined;
|
|
147
|
+
readonly maxTokens: number | undefined;
|
|
148
|
+
readonly capabilities: {
|
|
149
|
+
readonly input: readonly string[];
|
|
150
|
+
readonly reasoning: boolean;
|
|
151
|
+
};
|
|
152
|
+
readonly auth: AgentModelAuth;
|
|
153
|
+
readonly resolutionSource: AgentModelResolutionSource;
|
|
154
|
+
}
|
|
155
|
+
export interface ResolvedAgentModelDetailed {
|
|
156
|
+
readonly model: Model<Api>;
|
|
157
|
+
readonly explorerModel: Model<Api>;
|
|
158
|
+
readonly apiKey?: string;
|
|
159
|
+
readonly providerApiKeys?: Readonly<Record<string, string>>;
|
|
160
|
+
readonly roles: {
|
|
161
|
+
readonly orchestrator: ResolvedAgentModelRole;
|
|
162
|
+
readonly explorer: ResolvedAgentModelRole;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export declare function resolveAgentModel(config: CliConfig, localOptions?: LoadLocalAutoRAGModelsOptions): ResolvedAgentModel;
|
|
166
|
+
export declare function resolveAgentModelDetailed(config: CliConfig, localOptions?: LoadLocalAutoRAGModelsOptions): ResolvedAgentModelDetailed;
|
|
167
|
+
export declare function writeDefaultConfig(path: string, partial: Partial<CliConfig>, opts?: {
|
|
168
|
+
force?: boolean;
|
|
169
|
+
atomicCreate?: boolean;
|
|
170
|
+
cwd?: string;
|
|
171
|
+
env?: NodeJS.ProcessEnv;
|
|
172
|
+
}): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface ParsedArgs {
|
|
3
|
+
positionals: string[];
|
|
4
|
+
flags: Record<string, string | boolean>;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseArgs(argv: readonly string[]): ParsedArgs | {
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function main(argv: readonly string[]): Promise<number>;
|
|
10
|
+
export {};
|