@autorag/librarian 2.0.0 → 2.2.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 (63) hide show
  1. package/README.md +104 -2
  2. package/dist/agent/agent.d.ts +11 -0
  3. package/dist/agent/search-bm25-tool.d.ts +1 -1
  4. package/dist/agent/search-documents.d.ts +1 -0
  5. package/dist/agent/search-minsync-tool.d.ts +1 -1
  6. package/dist/cli/config.d.ts +6 -0
  7. package/dist/cli/index.js +5871 -587
  8. package/dist/datasource/chunk-store.d.ts +67 -0
  9. package/dist/datasource/connector-skill.d.ts +107 -0
  10. package/dist/datasource/connector.d.ts +72 -0
  11. package/dist/datasource/crawler-client.d.ts +9 -0
  12. package/dist/datasource/crawler-skill.d.ts +41 -0
  13. package/dist/datasource/crawler-types.d.ts +53 -0
  14. package/dist/datasource/http.d.ts +49 -0
  15. package/dist/datasource/index.d.ts +16 -0
  16. package/dist/datasource/skills/discrawl/client.d.ts +23 -0
  17. package/dist/datasource/skills/discrawl/config.d.ts +9 -0
  18. package/dist/datasource/skills/discrawl/index.d.ts +5 -0
  19. package/dist/datasource/skills/discrawl/methods.d.ts +55 -0
  20. package/dist/datasource/skills/discrawl/paths.d.ts +30 -0
  21. package/dist/datasource/skills/discrawl/skill.d.ts +58 -0
  22. package/dist/datasource/skills/discrawl/types.d.ts +198 -0
  23. package/dist/datasource/skills/factory.d.ts +35 -0
  24. package/dist/datasource/skills/gdrive/connector.d.ts +30 -0
  25. package/dist/datasource/skills/gdrive/index.d.ts +3 -0
  26. package/dist/datasource/skills/gdrive/rclone-connector.d.ts +51 -0
  27. package/dist/datasource/skills/gdrive/skill.d.ts +24 -0
  28. package/dist/datasource/skills/github/connector.d.ts +28 -0
  29. package/dist/datasource/skills/github/index.d.ts +2 -0
  30. package/dist/datasource/skills/github/skill.d.ts +20 -0
  31. package/dist/datasource/skills/gmail/connector.d.ts +30 -0
  32. package/dist/datasource/skills/gmail/himalaya-connector.d.ts +40 -0
  33. package/dist/datasource/skills/gmail/index.d.ts +3 -0
  34. package/dist/datasource/skills/gmail/skill.d.ts +24 -0
  35. package/dist/datasource/skills/mail-export/connector.d.ts +21 -0
  36. package/dist/datasource/skills/mail-export/index.d.ts +2 -0
  37. package/dist/datasource/skills/mail-export/skill.d.ts +20 -0
  38. package/dist/datasource/skills/notion/index.d.ts +15 -0
  39. package/dist/datasource/skills/obsidian/client.d.ts +15 -0
  40. package/dist/datasource/skills/obsidian/index.d.ts +6 -0
  41. package/dist/datasource/skills/obsidian/methods.d.ts +26 -0
  42. package/dist/datasource/skills/obsidian/paths.d.ts +27 -0
  43. package/dist/datasource/skills/obsidian/skill.d.ts +43 -0
  44. package/dist/datasource/skills/obsidian/types.d.ts +90 -0
  45. package/dist/datasource/skills/rss/connector.d.ts +28 -0
  46. package/dist/datasource/skills/rss/index.d.ts +2 -0
  47. package/dist/datasource/skills/rss/skill.d.ts +22 -0
  48. package/dist/datasource/skills/slack/index.d.ts +15 -0
  49. package/dist/datasource/skills/spotlight/connector.d.ts +59 -0
  50. package/dist/datasource/skills/spotlight/index.d.ts +2 -0
  51. package/dist/datasource/skills/spotlight/skill.d.ts +20 -0
  52. package/dist/datasource/skills/telecrawl/index.d.ts +15 -0
  53. package/dist/datasource/skills/wacrawl/index.d.ts +15 -0
  54. package/dist/index.js +5971 -673
  55. package/dist/parser/defaults.d.ts +2 -0
  56. package/dist/parser/hwp-markdown.d.ts +25 -0
  57. package/dist/parser/hwp.d.ts +7 -0
  58. package/dist/parser/index.d.ts +2 -1
  59. package/dist/parser/rhwp-adapter.d.ts +30 -0
  60. package/dist/retrieval/merger.d.ts +1 -0
  61. package/dist/retrieval/scope.d.ts +10 -0
  62. package/package.json +19 -18
  63. package/skills/autorag-setup/SKILL.md +74 -0
@@ -0,0 +1,198 @@
1
+ import type { RetrievalOptions } from "../../../retrieval/types.js";
2
+ /**
3
+ * Search modes accepted by the external `discrawl search --mode` flag.
4
+ *
5
+ * - `fts` — SQLite FTS5 lexical ranking over archived messages.
6
+ * - `semantic` — dense vector similarity over locally stored message vectors.
7
+ * - `hybrid` — runs both, deduplicates by message id, falls back to FTS when
8
+ * semantic is unavailable.
9
+ */
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
+ /**
28
+ * Embedding models known to be English-only. Selecting one for a non-English
29
+ * archive silently degrades semantic search to noise rather than failing, so
30
+ * the skill emits a diagnostic instead of staying quiet.
31
+ *
32
+ * Measured on a real Korean archive: unrelated `nomic-embed-text` Korean
33
+ * sentence pairs score 0.65-0.82 cosine (vs 0.30-0.46 for English), i.e. the
34
+ * embedding space collapses and top-k ranking becomes random.
35
+ *
36
+ * See AutoRAG issue #1414.
37
+ */
38
+ export declare const ENGLISH_ONLY_EMBEDDING_MODELS: ReadonlySet<string>;
39
+ /**
40
+ * Default embedding model AutoRAG configures for workspace-managed discrawl
41
+ * configs. `embeddinggemma`
42
+ * (Gemma 3 300M, 768 dimensions) covers 100+ languages and matches the
43
+ * EmbeddingGemma embedder katok uses for KakaoTalk, so every CLI-backed
44
+ * datasource shares one local embedding model (served through Ollama).
45
+ */
46
+ export declare const DEFAULT_DISCRAWL_EMBEDDING_MODEL = "embeddinggemma";
47
+ export declare const DEFAULT_DISCRAWL_EMBEDDING_PROVIDER = "ollama";
48
+ /**
49
+ * Configuration for the discrawl client. All fields optional; defaults mirror
50
+ * the katok client. The client spawns the `discrawl` binary as a child process
51
+ * — it never opens the Discord archive database directly.
52
+ */
53
+ export interface DiscrawlOptions {
54
+ /** Explicit path to the `discrawl` binary. Defaults to a bare PATH lookup. */
55
+ readonly binaryPath?: string;
56
+ /** Spawn timeout in milliseconds. Default 30_000 (sync/embed are slow). */
57
+ readonly timeoutMs?: number;
58
+ /** Max stdout/stderr bytes retained. Default 1_048_576 (1 MiB). */
59
+ readonly maxBufferBytes?: number;
60
+ /** Archive source for the CLI. Default `wiretap` (no token required). */
61
+ readonly source?: DiscrawlSourceKind;
62
+ /**
63
+ * Explicit operator-owned discrawl config file passed as `--config`.
64
+ * AutoRAG never rewrites an explicit config.
65
+ */
66
+ readonly configPath?: string;
67
+ /** Workspace root used to compute the default discrawl workspace path. */
68
+ readonly root?: string;
69
+ /** Explicit workspace directory overriding the computed default. */
70
+ readonly workspacePath?: string;
71
+ /** Restrict search and sync to one guild id. */
72
+ readonly guildId?: string;
73
+ /**
74
+ * Embedding provider written to AutoRAG's workspace-local discrawl config.
75
+ * Defaults to `ollama`; explicit operator-owned config files are untouched.
76
+ */
77
+ readonly embeddingProvider?: string;
78
+ /**
79
+ * Embedding model discrawl should use for semantic/hybrid search. Defaults
80
+ * to {@link DEFAULT_DISCRAWL_EMBEDDING_MODEL}. English-only models are
81
+ * accepted but reported through a diagnostic.
82
+ */
83
+ readonly embeddingModel?: string;
84
+ /**
85
+ * Default search mode. Defaults to `hybrid` so semantic retrieval covers
86
+ * terms FTS cannot reach: discrawl strips newlines without substituting a
87
+ * space, welding words across line breaks into a single unsearchable token
88
+ * (measured at ~47% of post-newline words on a real archive). See AutoRAG
89
+ * issue #1413.
90
+ */
91
+ readonly defaultMode?: DiscrawlSearchMode;
92
+ /** Environment overrides merged on top of `process.env` for the child. */
93
+ readonly env?: Readonly<Record<string, string | undefined>>;
94
+ }
95
+ export declare const DEFAULT_DISCRAWL_BINARY = "discrawl";
96
+ export declare const DEFAULT_DISCRAWL_TIMEOUT_MS = 30000;
97
+ export declare const DEFAULT_DISCRAWL_MAX_BUFFER_BYTES = 1048576;
98
+ export declare const DEFAULT_DISCRAWL_SOURCE: DiscrawlSourceKind;
99
+ export declare const DEFAULT_DISCRAWL_MODE: DiscrawlSearchMode;
100
+ /**
101
+ * Reasons a discrawl CLI invocation can fail. The client never throws for
102
+ * these — every method returns a discriminated union with `ok: false`.
103
+ */
104
+ export type DiscrawlFailureReason = "binary-missing" | "user-token-rejected" | "nonzero-exit" | "spawn-error" | "timeout" | "aborted" | "stdout-too-large" | "stderr-too-large" | "invalid-json" | "invalid-shape";
105
+ /** Common failure payload shared by every method result union. */
106
+ export interface DiscrawlFailure {
107
+ readonly ok: false;
108
+ readonly reason: DiscrawlFailureReason;
109
+ readonly stdout: string;
110
+ readonly stderr: string;
111
+ readonly code: number | null;
112
+ /**
113
+ * The offending environment key when `reason === "user-token-rejected"`.
114
+ * A config key name (never a path, never the key's value).
115
+ */
116
+ readonly violatingKey?: string;
117
+ readonly hits?: readonly unknown[];
118
+ }
119
+ /** A single archived Discord message returned by the discrawl CLI. */
120
+ export interface DiscrawlMessage {
121
+ readonly messageId: string;
122
+ readonly content: string;
123
+ readonly channelId?: string;
124
+ readonly channelName?: string;
125
+ readonly guildId?: string;
126
+ readonly guildName?: string;
127
+ readonly authorName?: string;
128
+ readonly timestamp?: string;
129
+ readonly metadata?: Readonly<Record<string, unknown>>;
130
+ }
131
+ /** A scored search hit. */
132
+ export interface DiscrawlSearchHit extends DiscrawlMessage {
133
+ readonly score: number;
134
+ }
135
+ /** Result of `discrawl status`. */
136
+ export interface DiscrawlStatusInfo {
137
+ readonly messages: number;
138
+ readonly channels: number;
139
+ readonly guilds: number;
140
+ readonly databasePath?: string;
141
+ readonly metadata?: Readonly<Record<string, unknown>>;
142
+ }
143
+ /** Result of `discrawl doctor`. */
144
+ export interface DiscrawlDoctorInfo {
145
+ readonly ready: boolean;
146
+ readonly configOk: boolean;
147
+ readonly databaseOk: boolean;
148
+ readonly ftsOk: boolean;
149
+ readonly embeddingsOk: boolean;
150
+ readonly embeddingModel?: string;
151
+ readonly embeddingProvider?: string;
152
+ readonly metadata?: Readonly<Record<string, unknown>>;
153
+ }
154
+ /** Result of `discrawl sync` / `discrawl wiretap`. */
155
+ export interface DiscrawlSyncInfo {
156
+ readonly messages: number;
157
+ readonly guilds?: number;
158
+ readonly channels?: number;
159
+ readonly metadata?: Readonly<Record<string, unknown>>;
160
+ }
161
+ /** Result of `discrawl embed`. */
162
+ export interface DiscrawlEmbedInfo {
163
+ readonly processed: number;
164
+ readonly succeeded: number;
165
+ readonly failed: number;
166
+ readonly remainingBacklog: number;
167
+ readonly model?: string;
168
+ readonly provider?: string;
169
+ readonly metadata?: Readonly<Record<string, unknown>>;
170
+ }
171
+ /** Discriminated ok-success shape carrying typed `data`. */
172
+ export interface DiscrawlOk<T> {
173
+ readonly ok: true;
174
+ readonly data: T;
175
+ readonly stdout: string;
176
+ readonly stderr: string;
177
+ readonly code: number;
178
+ }
179
+ export interface DiscrawlSearchOk {
180
+ readonly ok: true;
181
+ readonly hits: readonly DiscrawlSearchHit[];
182
+ readonly stdout: string;
183
+ readonly stderr: string;
184
+ readonly code: number;
185
+ readonly data: {
186
+ readonly hits: readonly DiscrawlSearchHit[];
187
+ };
188
+ }
189
+ export type DiscrawlDoctorResult = DiscrawlOk<DiscrawlDoctorInfo> | DiscrawlFailure;
190
+ export type DiscrawlStatusResult = DiscrawlOk<DiscrawlStatusInfo> | DiscrawlFailure;
191
+ export type DiscrawlSyncResult = DiscrawlOk<DiscrawlSyncInfo> | DiscrawlFailure;
192
+ export type DiscrawlEmbedResult = DiscrawlOk<DiscrawlEmbedInfo> | DiscrawlFailure;
193
+ export type DiscrawlSearchResult = DiscrawlSearchOk | DiscrawlFailure;
194
+ /**
195
+ * Search-specific options. Reuses the shared {@link RetrievalOptions} so the
196
+ * retrieval methods can pass their options straight through.
197
+ */
198
+ export type DiscrawlSearchOptions = RetrievalOptions;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Config-driven factory for the built-in connector-backed datasource skills.
3
+ *
4
+ * The CLI/server layer passes the trusted `datasources` section of
5
+ * `config.json`; this factory materializes one skill per configured entry.
6
+ * Model/tool arguments never reach this factory — it is part of the trusted
7
+ * configuration path. Unknown skill names and disabled entries are skipped
8
+ * and reported so setup surfaces actionable (but path-opaque) feedback.
9
+ */
10
+ import type { DatasourceSkill } from "../types.js";
11
+ /** One configured datasource entry (the trusted `datasources.<name>` value). */
12
+ export interface DatasourceSkillConfig {
13
+ readonly enabled?: boolean;
14
+ readonly instanceId?: string;
15
+ readonly pollingIntervalMs?: number;
16
+ readonly tags?: readonly string[];
17
+ /** Connector-specific options (token env names, repos, feeds, paths, …). */
18
+ readonly connector?: Record<string, unknown>;
19
+ }
20
+ /** The trusted `datasources` config section: skill name → config. */
21
+ export type DatasourcesConfig = Readonly<Record<string, DatasourceSkillConfig | boolean>>;
22
+ export interface BuildDatasourceSkillsResult {
23
+ readonly skills: readonly DatasourceSkill[];
24
+ /** Names that were configured but not recognized. */
25
+ readonly unknown: readonly string[];
26
+ }
27
+ /** Skill names this factory can build. */
28
+ export declare const BUILTIN_DATASOURCE_SKILL_NAMES: readonly string[];
29
+ /**
30
+ * Build datasource skills from the trusted config section. `false` or
31
+ * `{ enabled: false }` entries are skipped silently; unrecognized names are
32
+ * collected in `unknown` (never thrown) so callers can surface setup
33
+ * feedback without failing agent construction.
34
+ */
35
+ export declare function buildDatasourceSkills(config: DatasourcesConfig | undefined, workspaceRoot?: string): BuildDatasourceSkillsResult;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Google Drive connector (issue #1301).
3
+ *
4
+ * Lists files through the Drive v3 API with a trusted, server-configured
5
+ * OAuth access token, exporting Google Docs/Sheets as plain text/CSV and
6
+ * downloading plain-text files. Binary formats are skipped. Per-file export
7
+ * failures degrade to warnings. Never throws; messages stay path/PII-opaque.
8
+ */
9
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
10
+ export interface GDriveConnectorOptions {
11
+ /** Drive v3 REST base; override to point at a mock server in tests. */
12
+ readonly baseUrl?: string;
13
+ /** OAuth access token; explicit value wins over {@link tokenEnv}. */
14
+ readonly token?: string;
15
+ /** Env var name holding the access token. Default `GDRIVE_ACCESS_TOKEN`. */
16
+ readonly tokenEnv?: string;
17
+ /** Restrict to files whose parent is this folder id. */
18
+ readonly folderId?: string;
19
+ /** Include shared-drive items in listings. */
20
+ readonly includeSharedDrives?: boolean;
21
+ readonly timeoutMs?: number;
22
+ readonly fetchImpl?: typeof fetch;
23
+ readonly maxPages?: number;
24
+ readonly maxDocuments?: number;
25
+ }
26
+ export declare class GDriveConnector implements DatasourceConnector {
27
+ private readonly options;
28
+ constructor(options?: GDriveConnectorOptions);
29
+ fetch(signal?: AbortSignal): Promise<ConnectorFetchResult>;
30
+ }
@@ -0,0 +1,3 @@
1
+ export { GDriveConnector, type GDriveConnectorOptions } from "./connector.js";
2
+ export { RcloneConnector, type RcloneConnectorOptions, type RcloneRunner, type RcloneRunResult, } from "./rclone-connector.js";
3
+ export { GDRIVE_SKILL_DEFINITION, GDriveSkill, type GDriveSkillOptions } from "./skill.js";
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Rclone-backed drive connector (issue #1301, rclone path).
3
+ *
4
+ * Uses the external `rclone` CLI (https://rclone.org) as the trusted bridge
5
+ * to Google Drive — or any of rclone's 70+ storage backends — so OAuth
6
+ * setup and token refresh live entirely in `rclone config`, not here
7
+ * (katok/himalaya pattern). Google Docs/Sheets are transparently exported
8
+ * as text via rclone's `--drive-export-formats`. Never throws; failures map
9
+ * onto the coarse connector failure union with path/PII-opaque messages.
10
+ *
11
+ * Listing: `rclone lsjson <remote> --recursive --files-only`
12
+ * Content: `rclone cat <remote>/<path>` (bounded, text formats only)
13
+ */
14
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
15
+ export interface RcloneRunResult {
16
+ readonly ok: boolean;
17
+ readonly stdout: string;
18
+ readonly stderr: string;
19
+ readonly code: number | null;
20
+ }
21
+ export type RcloneRunner = (args: readonly string[], timeoutMs: number) => Promise<RcloneRunResult>;
22
+ export interface RcloneConnectorOptions {
23
+ /** Path to the rclone binary. Default bare `rclone` PATH lookup. */
24
+ readonly binaryPath?: string;
25
+ /**
26
+ * Rclone remote path, e.g. `gdrive:` or `gdrive:Team/Docs`. Required
27
+ * trusted configuration (`rclone config` defines the remote).
28
+ */
29
+ readonly remote?: string;
30
+ /**
31
+ * Indexable file extensions (lowercase, with dot). Google Docs/Sheets
32
+ * surface as these after `--drive-export-formats txt,csv`.
33
+ */
34
+ readonly extensions?: readonly string[];
35
+ /** Drive export formats forwarded to rclone. Default `txt,csv`. */
36
+ readonly exportFormats?: string;
37
+ /** Max files whose contents are fetched per run. Default 200. */
38
+ readonly maxDocuments?: number;
39
+ /** Files larger than this are skipped. Default 2 MiB. */
40
+ readonly maxBytesPerFile?: number;
41
+ /** Per-spawn timeout. Default 60s (cloud listings can be slow). */
42
+ readonly timeoutMs?: number;
43
+ /** Injectable process runner for tests. */
44
+ readonly runner?: RcloneRunner;
45
+ }
46
+ export declare class RcloneConnector implements DatasourceConnector {
47
+ private readonly options;
48
+ private readonly runner;
49
+ constructor(options?: RcloneConnectorOptions);
50
+ fetch(): Promise<ConnectorFetchResult>;
51
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Google Drive datasource skill (issue #1301).
3
+ *
4
+ * Thin composition of GDriveConnector with the shared
5
+ * {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
6
+ * ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
7
+ * the shared pipeline, opaque `/gdrive/<instance>/…` sources, and a
8
+ * progressive-disclosure agent-skill manifest.
9
+ */
10
+ import type { DatasourceConnector } from "../../connector.js";
11
+ import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
12
+ import { type GDriveConnectorOptions } from "./connector.js";
13
+ export declare const GDRIVE_SKILL_DEFINITION: ConnectorSkillDefinition;
14
+ export interface GDriveSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
15
+ /**
16
+ * Trusted pre-built connector; wins over {@link connectorOptions}. Accepts
17
+ * any drive-backed connector (Drive REST or the rclone CLI bridge).
18
+ */
19
+ readonly connector?: DatasourceConnector;
20
+ readonly connectorOptions?: GDriveConnectorOptions;
21
+ }
22
+ export declare class GDriveSkill extends ConnectorDatasourceSkill {
23
+ constructor(options?: GDriveSkillOptions);
24
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * GitHub Issues/PRs connector (issue #1303).
3
+ *
4
+ * Fetches issues and pull requests for a trusted list of `owner/repo`
5
+ * targets through the GitHub REST API. A token is optional (public repos
6
+ * work unauthenticated). Per-repo 404s degrade to warnings; 401 fails as
7
+ * auth and rate limiting fails the whole fetch. Never throws.
8
+ */
9
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
10
+ export interface GitHubConnectorOptions {
11
+ /** GitHub REST base; override to point at a mock server in tests. */
12
+ readonly baseUrl?: string;
13
+ /** Optional token; explicit value wins over {@link tokenEnv}. */
14
+ readonly token?: string;
15
+ /** Env var name holding the token. Default `GITHUB_TOKEN`. */
16
+ readonly tokenEnv?: string;
17
+ /** Repositories to index as `owner/repo`. Required trusted configuration. */
18
+ readonly repos?: readonly string[];
19
+ readonly timeoutMs?: number;
20
+ readonly fetchImpl?: typeof fetch;
21
+ readonly maxPages?: number;
22
+ readonly maxDocuments?: number;
23
+ }
24
+ export declare class GitHubConnector implements DatasourceConnector {
25
+ private readonly options;
26
+ constructor(options?: GitHubConnectorOptions);
27
+ fetch(signal?: AbortSignal): Promise<ConnectorFetchResult>;
28
+ }
@@ -0,0 +1,2 @@
1
+ export { GitHubConnector, type GitHubConnectorOptions } from "./connector.js";
2
+ export { GITHUB_SKILL_DEFINITION, GitHubSkill, type GitHubSkillOptions } from "./skill.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * GitHub Issues/PRs datasource skill (issue #1303).
3
+ *
4
+ * Thin composition of GitHubConnector with the shared
5
+ * {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
6
+ * ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
7
+ * the shared pipeline, opaque `/github/<instance>/…` sources, and a
8
+ * progressive-disclosure agent-skill manifest.
9
+ */
10
+ import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
11
+ import { GitHubConnector, type GitHubConnectorOptions } from "./connector.js";
12
+ export declare const GITHUB_SKILL_DEFINITION: ConnectorSkillDefinition;
13
+ export interface GitHubSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
14
+ /** Trusted connector configuration; a pre-built connector wins. */
15
+ readonly connector?: GitHubConnector;
16
+ readonly connectorOptions?: GitHubConnectorOptions;
17
+ }
18
+ export declare class GitHubSkill extends ConnectorDatasourceSkill {
19
+ constructor(options?: GitHubSkillOptions);
20
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Gmail connector (issue #1304).
3
+ *
4
+ * Lists and fetches messages through the Gmail REST v1 API with a trusted,
5
+ * server-configured OAuth access token. Per-message fetch failures degrade
6
+ * to warnings. Never throws; messages stay path/PII-opaque (addresses appear
7
+ * only inside indexed chunk content, never in diagnostics).
8
+ */
9
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
10
+ export interface GmailConnectorOptions {
11
+ /** Gmail REST base; override to point at a mock server in tests. */
12
+ readonly baseUrl?: string;
13
+ /** OAuth access token; explicit value wins over {@link tokenEnv}. */
14
+ readonly token?: string;
15
+ /** Env var name holding the access token. Default `GMAIL_ACCESS_TOKEN`. */
16
+ readonly tokenEnv?: string;
17
+ /** Restrict to these label ids (e.g. `["INBOX"]`). */
18
+ readonly labelIds?: readonly string[];
19
+ /** Gmail search query (the `q` parameter). */
20
+ readonly query?: string;
21
+ readonly timeoutMs?: number;
22
+ readonly fetchImpl?: typeof fetch;
23
+ readonly maxPages?: number;
24
+ readonly maxDocuments?: number;
25
+ }
26
+ export declare class GmailConnector implements DatasourceConnector {
27
+ private readonly options;
28
+ constructor(options?: GmailConnectorOptions);
29
+ fetch(signal?: AbortSignal): Promise<ConnectorFetchResult>;
30
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Himalaya-backed mail connector (issue #1304, IMAP path).
3
+ *
4
+ * Uses the external `himalaya` CLI (https://pimalaya.org) as the trusted
5
+ * bridge to any IMAP/Maildir account it has configured — Gmail included —
6
+ * so no OAuth token plumbing is needed here. Mirrors the katok pattern:
7
+ * AutoRAG never opens the mailbox itself; it spawns the CLI, parses JSON
8
+ * envelopes, and reads message bodies. Never throws; failures map onto the
9
+ * coarse connector failure union with path/PII-opaque messages.
10
+ */
11
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
12
+ export interface HimalayaRunResult {
13
+ readonly ok: boolean;
14
+ readonly stdout: string;
15
+ readonly stderr: string;
16
+ readonly code: number | null;
17
+ }
18
+ export type HimalayaRunner = (args: readonly string[], timeoutMs: number) => Promise<HimalayaRunResult>;
19
+ export interface HimalayaConnectorOptions {
20
+ /** Path to the himalaya binary. Default bare `himalaya` PATH lookup. */
21
+ readonly binaryPath?: string;
22
+ /** Himalaya account name (`himalaya account list`). Default account when omitted. */
23
+ readonly account?: string;
24
+ /** Mail folder, e.g. `INBOX`. Himalaya's default folder when omitted. */
25
+ readonly folder?: string;
26
+ /** Envelopes per listing page. Default 100. */
27
+ readonly pageSize?: number;
28
+ /** Max messages whose bodies are fetched per run. Default 50. */
29
+ readonly maxDocuments?: number;
30
+ /** Per-spawn timeout. Default 30s (IMAP fetches can be slow). */
31
+ readonly timeoutMs?: number;
32
+ /** Injectable process runner for tests. */
33
+ readonly runner?: HimalayaRunner;
34
+ }
35
+ export declare class HimalayaConnector implements DatasourceConnector {
36
+ private readonly options;
37
+ private readonly runner;
38
+ constructor(options?: HimalayaConnectorOptions);
39
+ fetch(): Promise<ConnectorFetchResult>;
40
+ }
@@ -0,0 +1,3 @@
1
+ export { GmailConnector, type GmailConnectorOptions } from "./connector.js";
2
+ export { HimalayaConnector, type HimalayaConnectorOptions, type HimalayaRunner, type HimalayaRunResult, } from "./himalaya-connector.js";
3
+ export { GMAIL_SKILL_DEFINITION, GmailSkill, type GmailSkillOptions } from "./skill.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Gmail datasource skill (issue #1304).
3
+ *
4
+ * Thin composition of GmailConnector with the shared
5
+ * {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
6
+ * ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
7
+ * the shared pipeline, opaque `/gmail/<instance>/…` sources, and a
8
+ * progressive-disclosure agent-skill manifest.
9
+ */
10
+ import type { DatasourceConnector } from "../../connector.js";
11
+ import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
12
+ import { type GmailConnectorOptions } from "./connector.js";
13
+ export declare const GMAIL_SKILL_DEFINITION: ConnectorSkillDefinition;
14
+ export interface GmailSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
15
+ /**
16
+ * Trusted pre-built connector; wins over {@link connectorOptions}. Accepts
17
+ * any mail-backed connector (Gmail REST or the himalaya CLI bridge).
18
+ */
19
+ readonly connector?: DatasourceConnector;
20
+ readonly connectorOptions?: GmailConnectorOptions;
21
+ }
22
+ export declare class GmailSkill extends ConnectorDatasourceSkill {
23
+ constructor(options?: GmailSkillOptions);
24
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Local mail export connector (issue #1311).
3
+ *
4
+ * Parses `.eml` files and `.mbox` archives from trusted, server-configured
5
+ * filesystem paths using the existing `mailparser` dependency. No network
6
+ * access. Per-message parse failures aggregate into one count-only warning;
7
+ * absolute paths never appear in warnings or failure messages.
8
+ */
9
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
10
+ export interface MailExportConnectorOptions {
11
+ /** Files or directories containing `.eml` / `.mbox` archives. Required. */
12
+ readonly paths?: readonly string[];
13
+ readonly maxDocuments?: number;
14
+ /** Files larger than this are skipped with a warning. Default 50 MiB. */
15
+ readonly maxBytesPerFile?: number;
16
+ }
17
+ export declare class MailExportConnector implements DatasourceConnector {
18
+ private readonly options;
19
+ constructor(options?: MailExportConnectorOptions);
20
+ fetch(): Promise<ConnectorFetchResult>;
21
+ }
@@ -0,0 +1,2 @@
1
+ export { MailExportConnector, type MailExportConnectorOptions } from "./connector.js";
2
+ export { MAIL_EXPORT_SKILL_DEFINITION, MailExportSkill, type MailExportSkillOptions } from "./skill.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Local mail export datasource skill (issue #1311).
3
+ *
4
+ * Thin composition of MailExportConnector with the shared
5
+ * {@link ConnectorDatasourceSkill} base: descriptor, polling metadata,
6
+ * ok/fail indexing with path/PII-opaque diagnostics, lexical retrieval via
7
+ * the shared pipeline, opaque `/mail-export/<instance>/…` sources, and a
8
+ * progressive-disclosure agent-skill manifest.
9
+ */
10
+ import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
11
+ import { MailExportConnector, type MailExportConnectorOptions } from "./connector.js";
12
+ export declare const MAIL_EXPORT_SKILL_DEFINITION: ConnectorSkillDefinition;
13
+ export interface MailExportSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
14
+ /** Trusted connector configuration; a pre-built connector wins. */
15
+ readonly connector?: MailExportConnector;
16
+ readonly connectorOptions?: MailExportConnectorOptions;
17
+ }
18
+ export declare class MailExportSkill extends ConnectorDatasourceSkill {
19
+ constructor(options?: MailExportSkillOptions);
20
+ }
@@ -0,0 +1,15 @@
1
+ import { CrawlerCliClient } from "../../crawler-client.js";
2
+ import { CrawlerDatasourceSkill, type CrawlerDatasourceSkillOptions, type CrawlerSkillClient } from "../../crawler-skill.js";
3
+ import type { CrawlerCliOptions } from "../../crawler-types.js";
4
+ export interface NotcrawlOptions extends CrawlerCliOptions {
5
+ }
6
+ export declare class NotcrawlClient extends CrawlerCliClient {
7
+ constructor(options?: NotcrawlOptions);
8
+ }
9
+ export interface NotionSkillOptions extends Omit<CrawlerDatasourceSkillOptions, "client"> {
10
+ readonly client?: CrawlerSkillClient;
11
+ readonly connectorOptions?: NotcrawlOptions;
12
+ }
13
+ export declare class NotionSkill extends CrawlerDatasourceSkill {
14
+ constructor(options?: NotionSkillOptions);
15
+ }
@@ -0,0 +1,15 @@
1
+ import type { QmdEmbedResult, QmdEnsureResult, QmdOptions, QmdSearchMode, QmdSearchOptions, QmdSearchResult, QmdUpdateResult } from "./types.js";
2
+ /**
3
+ * Thin external `qmd` CLI wrapper for Obsidian vault indexing/search.
4
+ * Every method spawns the `qmd` binary, never throws for expected failures,
5
+ * and isolates config/cache under the AutoRAG workspace.
6
+ */
7
+ export declare class QmdClient {
8
+ private readonly options;
9
+ constructor(options?: QmdOptions);
10
+ ensureCollection(signal?: AbortSignal): Promise<QmdEnsureResult>;
11
+ update(signal?: AbortSignal): Promise<QmdUpdateResult>;
12
+ embed(signal?: AbortSignal): Promise<QmdEmbedResult>;
13
+ search(mode: QmdSearchMode, query: string, options?: QmdSearchOptions): Promise<QmdSearchResult>;
14
+ private run;
15
+ }
@@ -0,0 +1,6 @@
1
+ export { QmdClient } from "./client.js";
2
+ export { ObsidianBm25Method, type ObsidianMethodOptions, type ObsidianSearchClient, ObsidianSemanticMethod, } from "./methods.js";
3
+ export { obsidianDatasourceRoot, obsidianQmdCacheDir, obsidianQmdConfigDir, obsidianSourcePath, parseObsidianSourcePath, stripEdgeDashes, toQmdCollectionName, } from "./paths.js";
4
+ export { ObsidianSkill, type ObsidianSkillClient, type ObsidianSkillOptions } from "./skill.js";
5
+ export type { QmdEmbedResult, QmdEnsureResult, QmdFailureReason, QmdOptions, QmdSearchHit, QmdSearchMode, QmdSearchOptions, QmdSearchResult, QmdUpdateResult, } from "./types.js";
6
+ export { DEFAULT_QMD_BINARY, DEFAULT_QMD_MAX_BUFFER_BYTES, DEFAULT_QMD_TIMEOUT_MS, } from "./types.js";
@@ -0,0 +1,26 @@
1
+ import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
2
+ import type { QmdSearchMode, QmdSearchOptions, QmdSearchResult } from "./types.js";
3
+ export interface ObsidianSearchClient {
4
+ search(mode: QmdSearchMode, query: string, options?: QmdSearchOptions): Promise<QmdSearchResult>;
5
+ }
6
+ export interface ObsidianMethodOptions {
7
+ readonly client: ObsidianSearchClient;
8
+ readonly instanceId: string;
9
+ readonly tags?: readonly string[];
10
+ }
11
+ export declare class ObsidianBm25Method implements RetrievalMethod {
12
+ private readonly client;
13
+ private readonly instanceId;
14
+ private readonly tags;
15
+ constructor(options: ObsidianMethodOptions);
16
+ describe(): RetrievalMethodDescriptor;
17
+ retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
18
+ }
19
+ export declare class ObsidianSemanticMethod implements RetrievalMethod {
20
+ private readonly client;
21
+ private readonly instanceId;
22
+ private readonly tags;
23
+ constructor(options: ObsidianMethodOptions);
24
+ describe(): RetrievalMethodDescriptor;
25
+ retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
26
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Path helpers for the Obsidian (`qmd`) datasource skill.
3
+ *
4
+ * All AutoRAG-managed state lives under
5
+ * `<workspaceRoot>/.autorag/datasources/obsidian/<instanceId>/`. The external
6
+ * `qmd` CLI is pointed at isolated config/cache dirs so multiple workspaces
7
+ * never share an index. Callers surface opaque slash-hierarchical sources of
8
+ * the form `/obsidian/<instance-id>/chunks/<chunk-id>`.
9
+ */
10
+ export declare const AUTORAG_DIRNAME = ".autorag";
11
+ export declare const DATASOURCES_DIRNAME = "datasources";
12
+ export declare const OBSIDIAN_DATASOURCE_DIRNAME = "obsidian";
13
+ export declare const OBSIDIAN_SOURCE_KIND: "obsidian";
14
+ export declare function obsidianDatasourceRoot(workspaceRoot: string, instanceId: string): string;
15
+ /** Directory passed to `QMD_CONFIG_DIR` (holds `index.yml`). */
16
+ export declare function obsidianQmdConfigDir(workspaceRoot: string, instanceId: string): string;
17
+ /** Directory passed to `XDG_CACHE_HOME` (holds `qmd/index.sqlite`). */
18
+ export declare function obsidianQmdCacheDir(workspaceRoot: string, instanceId: string): string;
19
+ export declare function obsidianSourcePath(instanceId: string, chunkId: string): string;
20
+ export declare function parseObsidianSourcePath(source: string): {
21
+ readonly instanceId: string;
22
+ readonly chunkId: string;
23
+ } | undefined;
24
+ /** Strip leading and trailing ASCII dashes without a quadratic regex. */
25
+ export declare function stripEdgeDashes(value: string): string;
26
+ /** Sanitize an instance id into a qmd collection name. */
27
+ export declare function toQmdCollectionName(instanceId: string): string;