@autorag/librarian 2.5.0 → 2.5.2

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 (90) hide show
  1. package/NOTICE +3 -0
  2. package/README.md +229 -487
  3. package/dist/agent/agent.d.ts +52 -2
  4. package/dist/agent/index.d.ts +1 -0
  5. package/dist/agent/search-datasource-tool.d.ts +1 -0
  6. package/dist/agent/search-documents.d.ts +1 -1
  7. package/dist/agent/search-single-datasource-tool.d.ts +57 -0
  8. package/dist/agent/web-fetch-tool.d.ts +32 -0
  9. package/dist/agent/web-search-tool.d.ts +48 -0
  10. package/dist/cli/command-help.d.ts +1 -0
  11. package/dist/cli/commands/lite-retrieve.d.ts +24 -0
  12. package/dist/cli/commands/search.d.ts +6 -0
  13. package/dist/cli/config.d.ts +20 -0
  14. package/dist/cli/index.d.ts +3 -1
  15. package/dist/cli/index.js +22378 -15702
  16. package/dist/cli/setup.d.ts +2 -0
  17. package/dist/core.d.ts +3 -1
  18. package/dist/core.js +6709 -425
  19. package/dist/datasource/connector-skill.d.ts +6 -0
  20. package/dist/datasource/crawler-skill.d.ts +2 -0
  21. package/dist/datasource/errors.d.ts +26 -0
  22. package/dist/datasource/index.d.ts +1 -1
  23. package/dist/datasource/skills/discrawl/client.d.ts +6 -0
  24. package/dist/datasource/skills/discrawl/index.d.ts +1 -1
  25. package/dist/datasource/skills/discrawl/types.d.ts +7 -21
  26. package/dist/datasource/skills/slack/index.d.ts +8 -0
  27. package/dist/datasource/tool-naming.d.ts +11 -0
  28. package/dist/filesystem/source-paths.d.ts +6 -2
  29. package/dist/index.js +6721 -436
  30. package/dist/minsync/client.d.ts +1 -1
  31. package/dist/minsync/embedder-config.d.ts +3 -0
  32. package/dist/minsync/index.d.ts +1 -1
  33. package/dist/minsync/installer.d.ts +1 -1
  34. package/dist/minsync/method.d.ts +2 -0
  35. package/dist/minsync/types.d.ts +14 -1
  36. package/dist/minsync/workspace.d.ts +6 -0
  37. package/dist/mirror/index-store.d.ts +17 -0
  38. package/dist/mirror/sync.d.ts +7 -4
  39. package/dist/retrieval/engine.d.ts +14 -5
  40. package/dist/retrieval/index.d.ts +2 -1
  41. package/dist/retrieval/merger.d.ts +30 -5
  42. package/dist/retrieval/skip.d.ts +41 -0
  43. package/dist/retrieval/types.d.ts +23 -2
  44. package/dist/web/entities.d.ts +10 -0
  45. package/dist/web/fetch/convert.d.ts +35 -0
  46. package/dist/web/fetch/feeds.d.ts +37 -0
  47. package/dist/web/fetch/html-renderer.d.ts +54 -0
  48. package/dist/web/fetch/index.d.ts +12 -0
  49. package/dist/web/fetch/negotiate.d.ts +27 -0
  50. package/dist/web/fetch/page-loader.d.ts +60 -0
  51. package/dist/web/fetch/render.d.ts +23 -0
  52. package/dist/web/fetch/turndown/gfm.d.ts +11 -0
  53. package/dist/web/fetch/turndown/html.d.ts +5 -0
  54. package/dist/web/fetch/turndown/index.d.ts +10 -0
  55. package/dist/web/fetch/turndown/service.d.ts +21 -0
  56. package/dist/web/fetch/turndown/types.d.ts +73 -0
  57. package/dist/web/fetch/url-target.d.ts +29 -0
  58. package/dist/web/search/browser-headers.d.ts +17 -0
  59. package/dist/web/search/browser-loader.d.ts +56 -0
  60. package/dist/web/search/browser-page.d.ts +41 -0
  61. package/dist/web/search/credentials.d.ts +10 -0
  62. package/dist/web/search/format.d.ts +30 -0
  63. package/dist/web/search/index.d.ts +46 -0
  64. package/dist/web/search/model-auth.d.ts +36 -0
  65. package/dist/web/search/provider.d.ts +62 -0
  66. package/dist/web/search/providers/anthropic.d.ts +9 -0
  67. package/dist/web/search/providers/base.d.ts +106 -0
  68. package/dist/web/search/providers/codex.d.ts +9 -0
  69. package/dist/web/search/providers/duckduckgo.d.ts +22 -0
  70. package/dist/web/search/providers/ecosia.d.ts +29 -0
  71. package/dist/web/search/providers/gemini.d.ts +9 -0
  72. package/dist/web/search/providers/google.d.ts +22 -0
  73. package/dist/web/search/providers/mojeek.d.ts +24 -0
  74. package/dist/web/search/providers/parallel.d.ts +10 -0
  75. package/dist/web/search/providers/perplexity.d.ts +10 -0
  76. package/dist/web/search/providers/public.d.ts +15 -0
  77. package/dist/web/search/providers/responses-api.d.ts +26 -0
  78. package/dist/web/search/providers/searxng.d.ts +19 -0
  79. package/dist/web/search/providers/startpage.d.ts +25 -0
  80. package/dist/web/search/providers/utils.d.ts +39 -0
  81. package/dist/web/search/providers/xai.d.ts +9 -0
  82. package/dist/web/search/query.d.ts +193 -0
  83. package/dist/web/search/types.d.ts +198 -0
  84. package/dist/web/search/utils.d.ts +8 -0
  85. package/package.json +3 -2
  86. package/skills/autorag/SKILL.md +5 -2
  87. package/skills/autorag-doctor/SKILL.md +237 -0
  88. package/skills/autorag-lite-search/SKILL.md +53 -13
  89. package/skills/autorag-lite-setup/SKILL.md +28 -13
  90. package/skills/autorag-setup/SKILL.md +32 -14
@@ -42,6 +42,12 @@ export interface ConnectorSkillDefinition {
42
42
  readonly manifestDescription: string;
43
43
  /** Extra path-opaque manifest body lines (after the standard sections). */
44
44
  readonly manifestNotes?: readonly string[];
45
+ /**
46
+ * Native CLI note for the manifest, e.g. how to inspect the underlying
47
+ * tool directly. Omit when the connector has no external CLI; the manifest
48
+ * then states that the dedicated search tool is the only search path.
49
+ */
50
+ readonly nativeCliNote?: string;
45
51
  }
46
52
  export interface ConnectorSkillOptions {
47
53
  readonly connector: DatasourceConnector;
@@ -13,6 +13,8 @@ export interface CrawlerDatasourceDefinition {
13
13
  readonly contentType: string;
14
14
  readonly manifestDescription: string;
15
15
  readonly backendName: string;
16
+ /** One copy-pastable native CLI search example shown in the skill manifest. */
17
+ readonly nativeCliSearchExample: string;
16
18
  }
17
19
  export interface CrawlerDatasourceSkillOptions {
18
20
  readonly client: CrawlerSkillClient;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Datasource retrieval errors.
3
+ *
4
+ * A CLI-backed datasource that cannot answer must say why. Its retrieval method
5
+ * throws this error instead of returning an empty result set, so the retrieval
6
+ * pipeline reports the surface as unsearched and hands the operator the CLI's
7
+ * own words: failure kind, exit status, and stderr verbatim.
8
+ */
9
+ /** The failure payload every datasource CLI client returns (katok, discrawl, qmd, …). */
10
+ export interface DatasourceCliFailure {
11
+ readonly reason: string;
12
+ readonly stderr?: string;
13
+ readonly stdout?: string;
14
+ readonly code?: number | null;
15
+ }
16
+ /** Error thrown by a datasource retrieval method when its CLI failed. */
17
+ export declare class DatasourceCliError extends Error {
18
+ readonly datasourceId: string;
19
+ readonly command: string;
20
+ readonly reason: string;
21
+ readonly stderr: string;
22
+ readonly code: number | null;
23
+ constructor(datasourceId: string, command: string, failure: DatasourceCliFailure);
24
+ }
25
+ /** Build the error a datasource retrieval method throws for a failed CLI call. */
26
+ export declare function datasourceCliError(datasourceId: string, command: string, failure: DatasourceCliFailure): DatasourceCliError;
@@ -9,7 +9,7 @@ export { DatasourceSkillRegistry, type RegisteredDatasourceSkill } from "./regis
9
9
  export { DatasourceResultFilter, type ResultsByMethod } from "./result-filter.js";
10
10
  export { buildDatasourceChunkSource, buildDatasourceInstanceSource, DATASOURCE_CHUNKS_SEGMENT, datasourceSourceHasFragment, datasourceSourcePath, isDatasourceSource, matchesDatasourceScope, matchesVirtualPathScope, normalizeVirtualPath, } from "./scope.js";
11
11
  export { CLOUD_DRIVE_SKILL_DEFINITION, CloudDriveSkill, type CloudDriveSkillOptions, RcloneConnector, type RcloneConnectorOptions, type RcloneRunner, type RcloneRunResult, } from "./skills/cloud-drive/index.js";
12
- export { DEFAULT_DISCRAWL_EMBEDDING_MODEL, DEFAULT_DISCRAWL_MODE, DEFAULT_DISCRAWL_SOURCE, DiscrawlClient, type DiscrawlFailureReason, DiscrawlFtsMethod, DiscrawlHybridMethod, type DiscrawlOptions, type DiscrawlSearchHit, type DiscrawlSearchMode, type DiscrawlSearchOptions, type DiscrawlSearchResult, DiscrawlSemanticMethod, DiscrawlSkill, type DiscrawlSkillClient, type DiscrawlSkillOptions, type DiscrawlSourceKind, ENGLISH_ONLY_EMBEDDING_MODELS, } from "./skills/discrawl/index.js";
12
+ export { DEFAULT_DISCRAWL_EMBEDDING_MODEL, DEFAULT_DISCRAWL_MODE, DiscrawlClient, type DiscrawlFailureReason, DiscrawlFtsMethod, DiscrawlHybridMethod, type DiscrawlOptions, type DiscrawlSearchHit, type DiscrawlSearchMode, type DiscrawlSearchOptions, type DiscrawlSearchResult, DiscrawlSemanticMethod, DiscrawlSkill, type DiscrawlSkillClient, type DiscrawlSkillOptions, ENGLISH_ONLY_EMBEDDING_MODELS, } from "./skills/discrawl/index.js";
13
13
  export { BUILTIN_DATASOURCE_SKILL_NAMES, type BuildDatasourceSkillsResult, buildDatasourceSkills, type DatasourceSkillConfig, type DatasourcesConfig, } from "./skills/factory.js";
14
14
  export { GitHubConnector, type GitHubConnectorOptions, GitHubSkill, type GitHubSkillOptions, } from "./skills/github/index.js";
15
15
  export type { KatokFailureReason, KatokHit, KatokOptions, KatokSearchMode, KatokSearchOptions, KatokSearchResult, KatokSkillClient, KatokSkillOptions, } from "./skills/katok/index.js";
@@ -17,6 +17,12 @@ export declare class DiscrawlClient {
17
17
  metadata(signal?: AbortSignal): Promise<DiscrawlMetadataResult>;
18
18
  doctor(signal?: AbortSignal): Promise<DiscrawlDoctorResult>;
19
19
  status(signal?: AbortSignal): Promise<DiscrawlStatusResult>;
20
+ /**
21
+ * Imports new messages from the local Discord Desktop cache through
22
+ * `discrawl wiretap`. AutoRAG never drives discrawl's bot sync — that path
23
+ * belongs to the CLI, which owns its own credential — so no Discord token is
24
+ * involved in an AutoRAG refresh.
25
+ */
20
26
  sync(signal?: AbortSignal): Promise<DiscrawlSyncResult>;
21
27
  embed(limit?: number, rebuild?: boolean, signal?: AbortSignal): Promise<DiscrawlEmbedResult>;
22
28
  search(mode: DiscrawlSearchMode, query: string, options?: DiscrawlSearchOptions): Promise<DiscrawlSearchResult>;
@@ -2,4 +2,4 @@ export { DiscrawlClient, discrawlWorkspace } from "./client.js";
2
2
  export { DiscrawlFtsMethod, DiscrawlHybridMethod, type DiscrawlMethodOptions, type DiscrawlSearchClient, DiscrawlSemanticMethod, } from "./methods.js";
3
3
  export { DISCRAWL_SOURCE_KIND, discrawlConfigPath, discrawlDatabasePath, discrawlDatasourceRoot, discrawlSourcePath, parseDiscrawlSourcePath, } from "./paths.js";
4
4
  export { DiscrawlSkill, type DiscrawlSkillClient, type DiscrawlSkillOptions } from "./skill.js";
5
- export { DEFAULT_DISCRAWL_BINARY, DEFAULT_DISCRAWL_EMBEDDING_MODEL, DEFAULT_DISCRAWL_EMBEDDING_PROVIDER, DEFAULT_DISCRAWL_MAX_BUFFER_BYTES, DEFAULT_DISCRAWL_MODE, DEFAULT_DISCRAWL_SOURCE, DEFAULT_DISCRAWL_TIMEOUT_MS, type DiscrawlDoctorInfo, type DiscrawlDoctorResult, type DiscrawlEmbeddingConfigResult, type DiscrawlEmbeddingRuntime, type DiscrawlEmbedInfo, type DiscrawlEmbedResult, type DiscrawlFailure, type DiscrawlFailureReason, type DiscrawlMessage, type DiscrawlMetadataInfo, type DiscrawlMetadataResult, type DiscrawlOptions, type DiscrawlSearchHit, type DiscrawlSearchMode, type DiscrawlSearchOptions, type DiscrawlSearchResult, type DiscrawlSourceKind, type DiscrawlStatusInfo, type DiscrawlStatusResult, type DiscrawlSyncInfo, type DiscrawlSyncResult, ENGLISH_ONLY_EMBEDDING_MODELS, } from "./types.js";
5
+ export { DEFAULT_DISCRAWL_BINARY, DEFAULT_DISCRAWL_EMBEDDING_MODEL, DEFAULT_DISCRAWL_EMBEDDING_PROVIDER, DEFAULT_DISCRAWL_MAX_BUFFER_BYTES, DEFAULT_DISCRAWL_MODE, DEFAULT_DISCRAWL_TIMEOUT_MS, type DiscrawlDoctorInfo, type DiscrawlDoctorResult, type DiscrawlEmbeddingConfigResult, type DiscrawlEmbeddingRuntime, type DiscrawlEmbedInfo, type DiscrawlEmbedResult, type DiscrawlFailure, type DiscrawlFailureReason, type DiscrawlMessage, type DiscrawlMetadataInfo, type DiscrawlMetadataResult, type DiscrawlOptions, type DiscrawlSearchHit, type DiscrawlSearchMode, type DiscrawlSearchOptions, type DiscrawlSearchResult, type DiscrawlStatusInfo, type DiscrawlStatusResult, type DiscrawlSyncInfo, type DiscrawlSyncResult, ENGLISH_ONLY_EMBEDDING_MODELS, } from "./types.js";
@@ -8,22 +8,6 @@ import type { RetrievalOptions } from "../../../retrieval/types.js";
8
8
  * semantic is unavailable.
9
9
  */
10
10
  export type DiscrawlSearchMode = "fts" | "semantic" | "hybrid";
11
- /**
12
- * Where the `discrawl` CLI reads Discord data from.
13
- *
14
- * - `wiretap` — the local Discord Desktop cache. Requires no token and issues
15
- * no Discord API calls; it reads only files Discord already
16
- * wrote to disk. Includes classifiable direct messages.
17
- * - `discord` — the Discord bot API using a server-configured bot token. This
18
- * is the ToS-sanctioned automation path (a bot token identifies
19
- * an OAuth2 application, not a human user).
20
- * - `both` — bot API plus desktop cache.
21
- *
22
- * AutoRAG never uses a Discord *user* token: automating a user account is
23
- * prohibited by Discord's Community Guidelines and can get the account
24
- * terminated.
25
- */
26
- export type DiscrawlSourceKind = "wiretap" | "discord" | "both";
27
11
  /**
28
12
  * Embedding models known to be English-only. Selecting one for a non-English
29
13
  * archive silently degrades semantic search to noise rather than failing, so
@@ -49,6 +33,11 @@ export declare const DEFAULT_DISCRAWL_EMBEDDING_PROVIDER = "ollama";
49
33
  * Configuration for the discrawl client. All fields optional; defaults mirror
50
34
  * the katok client. The client spawns the `discrawl` binary as a child process
51
35
  * — it never opens the Discord archive database directly.
36
+ *
37
+ * AutoRAG drives discrawl's local archive only: `wiretap` to import the
38
+ * Discord Desktop cache plus search/embed against that native store. The bot
39
+ * API path belongs to the CLI, which owns its own credential, so no Discord
40
+ * token is configured, required, or forwarded here.
52
41
  */
53
42
  export interface DiscrawlEmbeddingRuntime {
54
43
  readonly provider: string;
@@ -76,8 +65,6 @@ export interface DiscrawlOptions {
76
65
  readonly timeoutMs?: number;
77
66
  /** Max stdout/stderr bytes retained. Default 1_048_576 (1 MiB). */
78
67
  readonly maxBufferBytes?: number;
79
- /** Archive source for the CLI. Default `wiretap` (no token required). */
80
- readonly source?: DiscrawlSourceKind;
81
68
  /**
82
69
  * Explicit operator-owned discrawl config file passed as `--config`.
83
70
  * AutoRAG never rewrites an explicit config.
@@ -87,7 +74,7 @@ export interface DiscrawlOptions {
87
74
  readonly root?: string;
88
75
  /** Explicit workspace directory overriding the computed default. */
89
76
  readonly workspacePath?: string;
90
- /** Restrict search and sync to one guild id. */
77
+ /** Restrict search to one guild id. */
91
78
  readonly guildId?: string;
92
79
  /** Embedding provider understood by the native discrawl configuration. */
93
80
  readonly embeddingProvider?: string;
@@ -112,7 +99,6 @@ export interface DiscrawlOptions {
112
99
  export declare const DEFAULT_DISCRAWL_BINARY = "discrawl";
113
100
  export declare const DEFAULT_DISCRAWL_TIMEOUT_MS = 30000;
114
101
  export declare const DEFAULT_DISCRAWL_MAX_BUFFER_BYTES = 1048576;
115
- export declare const DEFAULT_DISCRAWL_SOURCE: DiscrawlSourceKind;
116
102
  export declare const DEFAULT_DISCRAWL_MODE: DiscrawlSearchMode;
117
103
  /**
118
104
  * Reasons a discrawl CLI invocation can fail. The client never throws for
@@ -168,7 +154,7 @@ export interface DiscrawlDoctorInfo {
168
154
  readonly embeddingProvider?: string;
169
155
  readonly metadata?: Readonly<Record<string, unknown>>;
170
156
  }
171
- /** Result of `discrawl sync` / `discrawl wiretap`. */
157
+ /** Result of `discrawl wiretap`. */
172
158
  export interface DiscrawlSyncInfo {
173
159
  readonly messages: number;
174
160
  readonly guilds?: number;
@@ -2,6 +2,14 @@ import { CrawlerCliClient } from "../../crawler-client.js";
2
2
  import { CrawlerDatasourceSkill, type CrawlerDatasourceSkillOptions, type CrawlerSkillClient } from "../../crawler-skill.js";
3
3
  import type { CrawlerCliOptions } from "../../crawler-types.js";
4
4
  export interface SlacrawlOptions extends CrawlerCliOptions {
5
+ /**
6
+ * Slack workspace (team) id to scope reads to, e.g. `T0435JHH63Z`.
7
+ *
8
+ * slacrawl's `search`/`messages` read paths return nothing unless a workspace
9
+ * is named explicitly, even when the archive and its FTS index hold matching
10
+ * rows, so an unscoped search silently looks like an empty archive.
11
+ */
12
+ readonly workspace?: string;
5
13
  }
6
14
  export declare class SlacrawlClient extends CrawlerCliClient {
7
15
  constructor(options?: SlacrawlOptions);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Canonical model-visible search tool name for one datasource connection.
3
+ *
4
+ * The agent generates one `search_datasource_<id>` tool per authorized
5
+ * connection (see `src/agent/search-single-datasource-tool.ts`), and skill
6
+ * manifests must be able to name that tool without importing the agent layer
7
+ * (the import direction is agent → datasource, never the reverse). The alias
8
+ * rewrite in `aliased-skill.ts` relies on this exact transformation, so keep
9
+ * it stable: lowercase, non-alphanumerics collapse to `_`, edges trimmed.
10
+ */
11
+ export declare function datasourceSearchToolName(datasourceId: string): string;
@@ -24,8 +24,12 @@ export declare function isFilesystemAbsolutePath(source: string): boolean;
24
24
  /**
25
25
  * Normalize an opaque virtual source id. Returns the normalized id, or
26
26
  * `undefined` when the input is syntactically invalid or unsafe (no leading
27
- * slash, URL scheme, fragment/query, traversal, NUL, backslash). Never throws
28
- * and never returns a real path — failures are signaled as `undefined`.
27
+ * slash, URL scheme, traversal, NUL, backslash). Never throws and never
28
+ * returns a real path — failures are signaled as `undefined`.
29
+ *
30
+ * `#` and `?` are NOT rejected: they are ordinary characters in a real file
31
+ * name, and ids are derived verbatim from real file names. URL-shaped input
32
+ * is already rejected by the scheme check above.
29
33
  */
30
34
  export declare function normalizeVirtualPath(virtual: string | undefined | null): string | undefined;
31
35
  /**