@autorag/librarian 2.4.1 → 2.5.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 (94) hide show
  1. package/NOTICE +68 -0
  2. package/README.md +72 -30
  3. package/dist/agent/agent.d.ts +74 -2
  4. package/dist/agent/emit-results-tool.d.ts +1 -2
  5. package/dist/agent/fast-answer-tool.d.ts +46 -0
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/peer-target-tool.d.ts +19 -0
  8. package/dist/agent/search-all-tool.d.ts +3 -0
  9. package/dist/agent/search-datasource-tool.d.ts +3 -0
  10. package/dist/agent/search-documents.d.ts +50 -5
  11. package/dist/agent/search-minsync-tool.d.ts +3 -0
  12. package/dist/agent/system-prompt.d.ts +1 -0
  13. package/dist/cli/commands/duplicates.d.ts +6 -0
  14. package/dist/cli/commands/gateway.d.ts +7 -0
  15. package/dist/cli/commands/lite-refresh.d.ts +10 -0
  16. package/dist/cli/commands/lite-retrieve.d.ts +33 -0
  17. package/dist/cli/commands/lite.d.ts +3 -0
  18. package/dist/cli/commands/models.d.ts +18 -0
  19. package/dist/cli/commands/p2p-policy.d.ts +2 -0
  20. package/dist/cli/commands/p2p.d.ts +7 -0
  21. package/dist/cli/commands/report.d.ts +3 -0
  22. package/dist/cli/commands/serve.d.ts +18 -0
  23. package/dist/cli/commands/setup.d.ts +2 -0
  24. package/dist/cli/commands/status.d.ts +2 -0
  25. package/dist/cli/commands/tui.d.ts +1 -1
  26. package/dist/cli/commands/watch.d.ts +2 -0
  27. package/dist/cli/config.d.ts +20 -0
  28. package/dist/cli/index.js +7911 -2518
  29. package/dist/cli/output.d.ts +6 -0
  30. package/dist/cli/setup.d.ts +59 -0
  31. package/dist/core.d.ts +67 -0
  32. package/dist/core.js +18172 -0
  33. package/dist/datasource/access-context.d.ts +1 -1
  34. package/dist/datasource/connector-skill.d.ts +1 -1
  35. package/dist/datasource/connector.d.ts +1 -1
  36. package/dist/datasource/index.d.ts +0 -1
  37. package/dist/datasource/result-filter.d.ts +1 -1
  38. package/dist/datasource/skills/discrawl/client.d.ts +6 -2
  39. package/dist/datasource/skills/discrawl/index.d.ts +1 -1
  40. package/dist/datasource/skills/discrawl/skill.d.ts +2 -1
  41. package/dist/datasource/skills/discrawl/types.d.ts +22 -0
  42. package/dist/datasource/skills/factory.d.ts +2 -1
  43. package/dist/datasource/skills/katok/client.d.ts +4 -7
  44. package/dist/datasource/skills/katok/types.d.ts +1 -6
  45. package/dist/embedding-runtime/cache.d.ts +21 -0
  46. package/dist/embedding-runtime/gateway.d.ts +27 -0
  47. package/dist/embedding-runtime/index.d.ts +120 -0
  48. package/dist/embedding-runtime/manifest.d.ts +24 -0
  49. package/dist/embedding-runtime/supervisor.d.ts +74 -0
  50. package/dist/embedding-runtime/types.d.ts +66 -0
  51. package/dist/filesystem/source-paths.d.ts +27 -0
  52. package/dist/index.d.ts +2 -1
  53. package/dist/index.js +13214 -8659
  54. package/dist/minsync/client.d.ts +26 -1
  55. package/dist/minsync/embedder-config.d.ts +12 -0
  56. package/dist/minsync/index.d.ts +4 -3
  57. package/dist/minsync/installer.d.ts +7 -1
  58. package/dist/minsync/local-embedder.d.ts +16 -0
  59. package/dist/minsync/method.d.ts +8 -2
  60. package/dist/minsync/types.d.ts +9 -0
  61. package/dist/mirror/index.d.ts +1 -1
  62. package/dist/mirror/paths.d.ts +2 -0
  63. package/dist/mirror/sync.d.ts +1 -0
  64. package/dist/observability/run-log.d.ts +2 -0
  65. package/dist/p2p/approval-store.d.ts +31 -0
  66. package/dist/p2p/egress-gate.d.ts +22 -0
  67. package/dist/p2p/file-sharing.d.ts +33 -0
  68. package/dist/p2p/injection-classifier.d.ts +33 -0
  69. package/dist/p2p/injection-gate.d.ts +37 -0
  70. package/dist/p2p/pii-gate.d.ts +47 -0
  71. package/dist/p2p/policy-filter.d.ts +15 -0
  72. package/dist/p2p/policy.d.ts +77 -0
  73. package/dist/p2p/simplex-server.d.ts +95 -0
  74. package/dist/p2p/simplex-transport.d.ts +38 -0
  75. package/dist/p2p/wire.d.ts +39 -0
  76. package/dist/process/terminate-tree.d.ts +20 -0
  77. package/dist/retrieval/engine.d.ts +123 -0
  78. package/dist/retrieval/index.d.ts +1 -0
  79. package/licenses/apache-2.0.txt +202 -0
  80. package/licenses/embedding-assets.json +104 -0
  81. package/licenses/gemma-notice.txt +24 -0
  82. package/licenses/gemma-section-3.2-flow-down.txt +9 -0
  83. package/licenses/gemma-terms-of-use.html +4750 -0
  84. package/licenses/gemma-terms-of-use.txt +158 -0
  85. package/licenses/llama.cpp-MIT.txt +21 -0
  86. package/licenses/qwen3-embedding-notice.txt +13 -0
  87. package/package.json +19 -10
  88. package/skills/autorag/SKILL.md +16 -6
  89. package/skills/autorag-lite-search/SKILL.md +155 -0
  90. package/skills/autorag-lite-setup/SKILL.md +182 -0
  91. package/skills/autorag-setup/SKILL.md +58 -27
  92. package/dist/datasource/skills/gmail/connector.d.ts +0 -30
  93. package/dist/datasource/skills/gmail/index.d.ts +0 -2
  94. package/dist/datasource/skills/gmail/skill.d.ts +0 -24
@@ -8,5 +8,6 @@ export interface SystemPromptConfig {
8
8
  manifests: StoreManifest[];
9
9
  jikjiIndexingEnabled?: boolean;
10
10
  datasourceSkills?: readonly Skill[];
11
+ retrievedContentGuard?: boolean;
11
12
  }
12
13
  export declare function buildSystemPrompt(config: SystemPromptConfig): string;
@@ -1,4 +1,10 @@
1
1
  import type { DupeyScanResult } from "../../dupey/index.js";
2
2
  import type { CommandContext } from "./types.js";
3
3
  export type DuplicateScanner = (path: string) => Promise<DupeyScanResult>;
4
+ /**
5
+ * `autorag duplicates` — scan configured roots for exact and near duplicate
6
+ * document families. Never deletes or moves source files.
7
+ *
8
+ * Exit codes: 0 on success, 2 on config error, 1 on runtime error.
9
+ */
4
10
  export declare function runDuplicates(ctx: CommandContext, scanner?: DuplicateScanner): Promise<number>;
@@ -0,0 +1,7 @@
1
+ import { type RuntimeStatus } from "../../embedding-runtime/index.js";
2
+ import type { CommandContext } from "./types.js";
3
+ export interface GatewayCommandDeps {
4
+ runtimeStatus?: () => Promise<RuntimeStatus>;
5
+ stopRuntime?: () => Promise<void>;
6
+ }
7
+ export declare function runGateway(ctx: CommandContext, deps?: GatewayCommandDeps): Promise<number>;
@@ -0,0 +1,10 @@
1
+ import type { CommandContext } from "./types.js";
2
+ /**
3
+ * `autorag lite refresh` — model-free index refresh using AutoRAGLite.
4
+ *
5
+ * Delegates to the agent's refresh pipeline (parsed mirrors, MinSync,
6
+ * datasources, Jikji) without requiring any model configuration.
7
+ *
8
+ * Exit codes: 0 on success, 2 on config error, 1 on runtime error.
9
+ */
10
+ export declare function runLiteRefresh(ctx: CommandContext): Promise<number>;
@@ -0,0 +1,33 @@
1
+ import type { CommandContext } from "./types.js";
2
+ export interface LiteRetrieveEnvelope {
3
+ readonly ok: true;
4
+ readonly query: string;
5
+ readonly results: readonly LiteRetrieveResultItem[];
6
+ readonly diagnostics: readonly LiteRetrieveDiagnostic[];
7
+ }
8
+ export interface LiteRetrieveResultItem {
9
+ readonly number: number;
10
+ readonly source: string;
11
+ readonly method: string;
12
+ readonly score: number;
13
+ readonly metadata: Record<string, unknown>;
14
+ readonly content: string;
15
+ }
16
+ export interface LiteRetrieveDiagnostic {
17
+ readonly code: string;
18
+ readonly severity: string;
19
+ readonly message: string;
20
+ readonly source?: string;
21
+ }
22
+ /**
23
+ * Run the `autorag lite retrieve` command.
24
+ *
25
+ * Returns exit code 2 for:
26
+ * - Empty query
27
+ * - Config resolution failure
28
+ * - Index not ready (never refreshed)
29
+ *
30
+ * Returns exit code 0 on successful retrieval (results may be empty).
31
+ * Returns exit code 1 for runtime errors.
32
+ */
33
+ export declare function runLiteRetrieve(ctx: CommandContext): Promise<number>;
@@ -0,0 +1,3 @@
1
+ import type { CommandContext } from "./types.js";
2
+ export declare function liteUsage(): string;
3
+ export declare function runLite(ctx: CommandContext): Promise<number>;
@@ -0,0 +1,18 @@
1
+ import type { ProfileId } from "../../embedding-runtime/types.js";
2
+ import type { CommandContext } from "./types.js";
3
+ export interface ModelsCommandDeps {
4
+ prefetchModel?: (profileId?: ProfileId) => Promise<{
5
+ profileId: ProfileId;
6
+ path: string;
7
+ }>;
8
+ importModel?: (profileId: ProfileId | undefined, sourcePath: string) => Promise<{
9
+ profileId: ProfileId;
10
+ path: string;
11
+ }>;
12
+ verifyModel?: (profileId?: ProfileId) => Promise<{
13
+ profileId: ProfileId;
14
+ path: string;
15
+ hash: string;
16
+ }>;
17
+ }
18
+ export declare function runModels(ctx: CommandContext, deps?: ModelsCommandDeps): Promise<number>;
@@ -0,0 +1,2 @@
1
+ import type { CommandContext } from "./types.js";
2
+ export declare function runP2pPolicy(ctx: CommandContext): number;
@@ -0,0 +1,7 @@
1
+ import type { CommandContext } from "./types.js";
2
+ /** Resolve the workspace used for P2P identity/policy, matching `autorag serve`. */
3
+ export declare function resolveP2pWorkspace(ctx: CommandContext): string;
4
+ /**
5
+ * `autorag p2p` — SimpleX peer trust management.
6
+ */
7
+ export declare function runP2p(ctx: CommandContext): Promise<number>;
@@ -0,0 +1,3 @@
1
+ import type { CommandContext } from "./types.js";
2
+ /** Persist a structured report submitted by an external curator. */
3
+ export declare function runReport(ctx: CommandContext): Promise<number>;
@@ -0,0 +1,18 @@
1
+ import type { InjectionClassifierModel } from "../../p2p/injection-classifier.js";
2
+ import { type SimplexPeerServer, startSimplexPeerServer } from "../../p2p/simplex-server.js";
3
+ import { type SimplexTransport, type StartSimplexOptions } from "../../p2p/simplex-transport.js";
4
+ import { type ResolvedAgentModel, resolveAgentModel } from "../config.js";
5
+ import type { CommandContext } from "./types.js";
6
+ export interface ServeCommandDeps {
7
+ readonly startSimplexPeerServer?: typeof startSimplexPeerServer;
8
+ readonly startSimplexChat?: (options: StartSimplexOptions) => Promise<SimplexTransport>;
9
+ readonly waitUntilStopped?: (server: SimplexPeerServer) => Promise<void>;
10
+ readonly modelResolver?: typeof resolveAgentModel;
11
+ }
12
+ export declare function createInjectionClassifierModel(resolved: ResolvedAgentModel): InjectionClassifierModel;
13
+ /**
14
+ * `autorag serve` — start the P2P peer query server over SimpleX Chat.
15
+ * Peers reach this installation through SimpleX; all security gates run
16
+ * unchanged.
17
+ */
18
+ export declare function runServe(ctx: CommandContext, deps?: ServeCommandDeps): Promise<number>;
@@ -0,0 +1,2 @@
1
+ import type { CommandContext } from "./types.js";
2
+ export declare function runSetupCommand(ctx: CommandContext): Promise<number>;
@@ -3,5 +3,7 @@ import type { CommandContext } from "./types.js";
3
3
  * `autorag status` — path-opaque snapshot of corpus freshness and index health.
4
4
  * Runs a cheap parse-free staleness scan plus the cached last-refresh outcome.
5
5
  * Model-free. Never emits filesystem paths; only the renderered status text.
6
+ *
7
+ * Exit codes: 0 on success, 2 on config error, 1 on runtime error.
6
8
  */
7
9
  export declare function runStatus(ctx: CommandContext): Promise<number>;
@@ -26,7 +26,7 @@ export interface TuiPresenter {
26
26
  }
27
27
  type TuiAgent = Pick<AutoRAGAgent, "searchDocumentsStream"> & Partial<Pick<AutoRAGAgent, "subscribe" | "abort">>;
28
28
  export interface TuiDeps {
29
- agentFactory?: (opts?: AutoRAGAgentOptions) => TuiAgent;
29
+ agentFactory?: (opts?: Partial<AutoRAGAgentOptions>) => TuiAgent;
30
30
  modelResolver?: (config: CliConfig) => ResolvedAgentModel;
31
31
  tuiFactory?: (ctx: CommandContext) => TuiDriver;
32
32
  sessionStore?: TuiSessionStore;
@@ -4,5 +4,7 @@ import type { CommandContext } from "./types.js";
4
4
  *
5
5
  * - default: long-running recursive fs watch with debounced refresh
6
6
  * - `--once`: single refresh tick (for cron / launchd / Task Scheduler)
7
+ *
8
+ * Exit codes: 0 on success, 2 on config error, 1 on runtime error.
7
9
  */
8
10
  export declare function runWatch(ctx: CommandContext): Promise<number>;
@@ -31,6 +31,24 @@ export interface RawIndexingMethods {
31
31
  export interface NormalizedIndexingConfig {
32
32
  minSync: MinSyncMethodConfig;
33
33
  }
34
+ export interface P2pConfig {
35
+ enabled?: boolean;
36
+ port?: number;
37
+ host?: string;
38
+ /** SimpleX CLI database prefix (defaults to <workspace>/.autorag/p2p/simplex). */
39
+ simplexDbPrefix?: string;
40
+ maxBodyBytes?: number;
41
+ maxFileBytes?: number;
42
+ policy?: Record<string, unknown>;
43
+ quotas?: {
44
+ queriesPerHour?: number;
45
+ burst?: number;
46
+ };
47
+ injectionClassifier?: boolean;
48
+ piiNer?: boolean;
49
+ searchTimeoutMs?: number;
50
+ newFilesPublic?: boolean;
51
+ }
34
52
  export interface UiConfig {
35
53
  host?: string;
36
54
  port?: number;
@@ -86,6 +104,8 @@ export interface CliConfig {
86
104
  datasourceAccess?: DatasourceAccessContextOptions;
87
105
  /** Optional local/deployment settings for the datasource UI. */
88
106
  ui?: UiConfig;
107
+ /** P2P sharing configuration. Disabled by default. */
108
+ p2p?: P2pConfig;
89
109
  }
90
110
  export interface ResolveConfigInput {
91
111
  flags: Record<string, string | boolean | undefined>;