@autorag/librarian 2.5.1 → 2.5.3

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 (100) hide show
  1. package/NOTICE +3 -0
  2. package/README.md +230 -490
  3. package/dist/agent/agent.d.ts +40 -3
  4. package/dist/agent/index.d.ts +1 -1
  5. package/dist/agent/search-single-datasource-tool.d.ts +63 -0
  6. package/dist/agent/web-fetch-tool.d.ts +32 -0
  7. package/dist/agent/web-search-tool.d.ts +48 -0
  8. package/dist/cli/commands/lite-retrieve.d.ts +15 -0
  9. package/dist/cli/commands/search.d.ts +6 -0
  10. package/dist/cli/config.d.ts +20 -0
  11. package/dist/cli/index.js +17643 -10464
  12. package/dist/core.d.ts +3 -1
  13. package/dist/core.js +11081 -3945
  14. package/dist/datasource/connector-skill.d.ts +6 -0
  15. package/dist/datasource/crawler-skill.d.ts +2 -0
  16. package/dist/datasource/errors.d.ts +26 -0
  17. package/dist/datasource/index.d.ts +3 -2
  18. package/dist/datasource/skills/discrawl/skill.d.ts +1 -1
  19. package/dist/datasource/skills/discrawl/types.d.ts +2 -2
  20. package/dist/datasource/skills/github-gist/connector.d.ts +38 -0
  21. package/dist/datasource/skills/github-gist/index.d.ts +3 -0
  22. package/dist/datasource/skills/github-gist/semantic.d.ts +102 -0
  23. package/dist/datasource/skills/github-gist/skill.d.ts +39 -0
  24. package/dist/datasource/skills/lark/client.d.ts +23 -0
  25. package/dist/datasource/skills/lark/index.d.ts +2 -0
  26. package/dist/datasource/skills/lark/skill.d.ts +36 -0
  27. package/dist/datasource/skills/lazykatok/client.d.ts +28 -0
  28. package/dist/datasource/skills/lazykatok/index.d.ts +12 -0
  29. package/dist/datasource/skills/{katok → lazykatok}/methods.d.ts +12 -12
  30. package/dist/datasource/skills/lazykatok/paths.d.ts +40 -0
  31. package/dist/datasource/skills/{katok → lazykatok}/skill.d.ts +10 -10
  32. package/dist/datasource/skills/lazykatok/types.d.ts +134 -0
  33. package/dist/datasource/skills/mailcrawl/client.d.ts +2 -0
  34. package/dist/datasource/skills/mailcrawl/types.d.ts +12 -0
  35. package/dist/datasource/skills/slack/index.d.ts +8 -0
  36. package/dist/datasource/tool-naming.d.ts +11 -0
  37. package/dist/datasource/types.d.ts +4 -4
  38. package/dist/embedding-runtime/manifest.d.ts +8 -0
  39. package/dist/embedding-runtime/types.d.ts +4 -0
  40. package/dist/index.js +11598 -4461
  41. package/dist/minsync/types.d.ts +7 -0
  42. package/dist/process/terminate-tree.d.ts +2 -0
  43. package/dist/retrieval/engine.d.ts +14 -5
  44. package/dist/retrieval/index.d.ts +2 -1
  45. package/dist/retrieval/merger.d.ts +30 -5
  46. package/dist/retrieval/skip.d.ts +41 -0
  47. package/dist/retrieval/types.d.ts +24 -3
  48. package/dist/web/entities.d.ts +10 -0
  49. package/dist/web/fetch/convert.d.ts +35 -0
  50. package/dist/web/fetch/feeds.d.ts +37 -0
  51. package/dist/web/fetch/html-renderer.d.ts +54 -0
  52. package/dist/web/fetch/index.d.ts +12 -0
  53. package/dist/web/fetch/negotiate.d.ts +27 -0
  54. package/dist/web/fetch/page-loader.d.ts +60 -0
  55. package/dist/web/fetch/render.d.ts +23 -0
  56. package/dist/web/fetch/turndown/gfm.d.ts +11 -0
  57. package/dist/web/fetch/turndown/html.d.ts +5 -0
  58. package/dist/web/fetch/turndown/index.d.ts +10 -0
  59. package/dist/web/fetch/turndown/service.d.ts +21 -0
  60. package/dist/web/fetch/turndown/types.d.ts +73 -0
  61. package/dist/web/fetch/url-target.d.ts +29 -0
  62. package/dist/web/search/browser-headers.d.ts +17 -0
  63. package/dist/web/search/browser-loader.d.ts +56 -0
  64. package/dist/web/search/browser-page.d.ts +41 -0
  65. package/dist/web/search/credentials.d.ts +10 -0
  66. package/dist/web/search/format.d.ts +30 -0
  67. package/dist/web/search/index.d.ts +46 -0
  68. package/dist/web/search/model-auth.d.ts +36 -0
  69. package/dist/web/search/provider.d.ts +62 -0
  70. package/dist/web/search/providers/anthropic.d.ts +9 -0
  71. package/dist/web/search/providers/base.d.ts +106 -0
  72. package/dist/web/search/providers/codex.d.ts +9 -0
  73. package/dist/web/search/providers/duckduckgo.d.ts +22 -0
  74. package/dist/web/search/providers/ecosia.d.ts +29 -0
  75. package/dist/web/search/providers/gemini.d.ts +9 -0
  76. package/dist/web/search/providers/google.d.ts +22 -0
  77. package/dist/web/search/providers/mojeek.d.ts +24 -0
  78. package/dist/web/search/providers/parallel.d.ts +10 -0
  79. package/dist/web/search/providers/perplexity.d.ts +10 -0
  80. package/dist/web/search/providers/public.d.ts +15 -0
  81. package/dist/web/search/providers/responses-api.d.ts +26 -0
  82. package/dist/web/search/providers/searxng.d.ts +19 -0
  83. package/dist/web/search/providers/startpage.d.ts +25 -0
  84. package/dist/web/search/providers/utils.d.ts +39 -0
  85. package/dist/web/search/providers/xai.d.ts +9 -0
  86. package/dist/web/search/query.d.ts +193 -0
  87. package/dist/web/search/types.d.ts +198 -0
  88. package/dist/web/search/utils.d.ts +8 -0
  89. package/licenses/embedding-assets.json +20 -4
  90. package/package.json +2 -1
  91. package/skills/autorag/SKILL.md +2 -1
  92. package/skills/autorag-doctor/SKILL.md +238 -0
  93. package/skills/autorag-lite-search/SKILL.md +29 -7
  94. package/skills/autorag-lite-setup/SKILL.md +22 -15
  95. package/skills/autorag-setup/SKILL.md +40 -19
  96. package/dist/agent/search-datasource-tool.d.ts +0 -29
  97. package/dist/datasource/skills/katok/client.d.ts +0 -21
  98. package/dist/datasource/skills/katok/index.d.ts +0 -12
  99. package/dist/datasource/skills/katok/paths.d.ts +0 -40
  100. package/dist/datasource/skills/katok/types.d.ts +0 -123
@@ -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 (lazykatok, 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;
@@ -12,8 +12,9 @@ export { CLOUD_DRIVE_SKILL_DEFINITION, CloudDriveSkill, type CloudDriveSkillOpti
12
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
- export type { KatokFailureReason, KatokHit, KatokOptions, KatokSearchMode, KatokSearchOptions, KatokSearchResult, KatokSkillClient, KatokSkillOptions, } from "./skills/katok/index.js";
16
- export { KatokBm25Method, KatokClient, KatokSemanticMethod, KatokSkill, } from "./skills/katok/index.js";
15
+ export { LarkClient, type LarkClientOptions, LarkSkill, type LarkSkillOptions } from "./skills/lark/index.js";
16
+ export type { LazykatokFailureReason, LazykatokHit, LazykatokOptions, LazykatokSearchMode, LazykatokSearchOptions, LazykatokSearchResult, LazykatokSkillClient, LazykatokSkillOptions, } from "./skills/lazykatok/index.js";
17
+ export { LazykatokBm25Method, LazykatokClient, LazykatokSemanticMethod, LazykatokSkill, } from "./skills/lazykatok/index.js";
17
18
  export { MailExportConnector, type MailExportConnectorOptions, MailExportSkill, type MailExportSkillOptions, } from "./skills/mail-export/index.js";
18
19
  export { MAILCRAWL_MODES, MailcrawlClient, type MailcrawlFailure, type MailcrawlFailureReason, type MailcrawlIndexInfo, MailcrawlMethod, type MailcrawlOptions, type MailcrawlSearchHit, type MailcrawlSearchMode, type MailcrawlSearchResult, MailcrawlSkill, type MailcrawlSyncInfo, type MailcrawlSyncResult, } from "./skills/mailcrawl/index.js";
19
20
  export { NotcrawlClient, type NotcrawlOptions, NotionSkill, type NotionSkillOptions, } from "./skills/notion/index.js";
@@ -26,7 +26,7 @@ export interface DiscrawlSkillOptions {
26
26
  /**
27
27
  * Discord datasource skill backed by the external `discrawl` CLI.
28
28
  *
29
- * Mirrors the katok model: the CLI owns the archive, the FTS5 index, and the
29
+ * Mirrors the lazykatok model: the CLI owns the archive, the FTS5 index, and the
30
30
  * vector index; AutoRAG only spawns it and maps results. AutoRAG never calls
31
31
  * the Discord API itself and never reads the Discord Desktop cache directly.
32
32
  *
@@ -24,14 +24,14 @@ export declare const ENGLISH_ONLY_EMBEDDING_MODELS: ReadonlySet<string>;
24
24
  * Default embedding model AutoRAG configures for workspace-managed discrawl
25
25
  * configs. `embeddinggemma`
26
26
  * (Gemma 3 300M, 768 dimensions) covers 100+ languages and matches the
27
- * EmbeddingGemma embedder katok uses for KakaoTalk, so every CLI-backed
27
+ * EmbeddingGemma embedder lazykatok uses for KakaoTalk, so every CLI-backed
28
28
  * datasource shares one local embedding model (served through Ollama).
29
29
  */
30
30
  export declare const DEFAULT_DISCRAWL_EMBEDDING_MODEL = "embeddinggemma";
31
31
  export declare const DEFAULT_DISCRAWL_EMBEDDING_PROVIDER = "ollama";
32
32
  /**
33
33
  * Configuration for the discrawl client. All fields optional; defaults mirror
34
- * the katok client. The client spawns the `discrawl` binary as a child process
34
+ * the lazykatok client. The client spawns the `discrawl` binary as a child process
35
35
  * — it never opens the Discord archive database directly.
36
36
  *
37
37
  * AutoRAG drives discrawl's local archive only: `wiretap` to import the
@@ -0,0 +1,38 @@
1
+ /**
2
+ * GitHub Gist connector (issue #1588).
3
+ *
4
+ * Indexes the authenticated account's gists (public + secret, bounded by the
5
+ * token's scopes) through the GitHub REST API. Incremental: the gist list
6
+ * endpoint returns `id` + `updated_at` cheaply, so a persisted cursor map
7
+ * (`state.json`) decides which gists need a full content fetch and which
8
+ * disappeared (reported via `deletedDocIds`). Token resolution order:
9
+ * explicit `token` > `tokenEnv` (default `GITHUB_TOKEN`) > `gh auth token`
10
+ * when the gh CLI fallback is enabled. Never throws.
11
+ */
12
+ import type { ConnectorFetchResult, DatasourceConnector } from "../../connector.js";
13
+ export interface GitHubGistConnectorOptions {
14
+ /** GitHub REST base; override to point at a mock server in tests. */
15
+ readonly baseUrl?: string;
16
+ /** Personal access token; explicit value wins over {@link tokenEnv}. */
17
+ readonly token?: string;
18
+ /** Env var name holding the token. Default `GITHUB_TOKEN`. */
19
+ readonly tokenEnv?: string;
20
+ /** When true (default), fall back to `gh auth token` for auth. */
21
+ readonly ghCliFallback?: boolean;
22
+ /** Injectable gh-token resolver (tests); defaults to spawning `gh auth token`. */
23
+ readonly ghTokenRunner?: () => Promise<string | undefined>;
24
+ readonly timeoutMs?: number;
25
+ readonly fetchImpl?: typeof fetch;
26
+ /** Persisted incremental cursor; omitted ⇒ every fetch is a full sync. */
27
+ readonly statePath?: string;
28
+ readonly maxPages?: number;
29
+ readonly maxGists?: number;
30
+ }
31
+ export declare class GitHubGistConnector implements DatasourceConnector {
32
+ private readonly options;
33
+ constructor(options?: GitHubGistConnectorOptions);
34
+ fetch(signal?: AbortSignal): Promise<ConnectorFetchResult>;
35
+ private resolveAuth;
36
+ private loadState;
37
+ private saveState;
38
+ }
@@ -0,0 +1,3 @@
1
+ export { GitHubGistConnector, type GitHubGistConnectorOptions } from "./connector.js";
2
+ export { createGatewayGistEmbedder, type GatewayGistEmbedderOptions, type GistEmbedder, type GistEmbeddingIdentity, GistSemanticIndex, GitHubGistSemanticMethod, } from "./semantic.js";
3
+ export { GITHUB_GIST_SKILL_DEFINITION, type GitHubGistSemanticOptions, GitHubGistSkill, type GitHubGistSkillOptions, gistDatasourceDir, } from "./skill.js";
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Semantic retrieval for the github-gist datasource (issue #1588).
3
+ *
4
+ * A small persisted vector sidecar (`vectors.json`) mirrors the chunk store:
5
+ * entries are keyed by chunk id with a content hash so unchanged chunks are
6
+ * never re-embedded, removed chunks are pruned, and an embedding-identity
7
+ * change (provider/model/dimension) forces a full re-embed. The default
8
+ * embedder talks to the loopback autorag-gateway (`ensureRuntime` with
9
+ * `cachedOnly`, then `POST /v1/embeddings`); tests inject a stub. Every
10
+ * failure degrades — indexing stays lexical-only and retrieval returns [].
11
+ */
12
+ import type { ProfileId } from "../../../embedding-runtime/types.js";
13
+ import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
14
+ import type { DatasourceChunkStore, StoredChunk } from "../../chunk-store.js";
15
+ export interface GistEmbeddingIdentity {
16
+ readonly provider: string;
17
+ readonly model: string;
18
+ readonly dimension: number;
19
+ }
20
+ /** Embedder contract: identity is async because the gateway resolves it lazily. */
21
+ export interface GistEmbedder {
22
+ identity(): Promise<GistEmbeddingIdentity>;
23
+ embed(texts: readonly string[]): Promise<readonly (readonly number[])[]>;
24
+ }
25
+ export interface GistSemanticSyncOk {
26
+ readonly ok: true;
27
+ /** Number of chunks (re-)embedded in this sync. */
28
+ readonly embedded: number;
29
+ }
30
+ export interface GistSemanticSyncFail {
31
+ readonly ok: false;
32
+ readonly message: string;
33
+ }
34
+ /** Persisted per-instance vector sidecar mirroring the chunk store. */
35
+ export declare class GistSemanticIndex {
36
+ private readonly statePath;
37
+ private identity;
38
+ private entries;
39
+ private loaded;
40
+ constructor(options?: {
41
+ readonly statePath?: string;
42
+ });
43
+ /**
44
+ * Embed new/changed chunks, prune removed ones, and persist. Never throws;
45
+ * an embedder failure leaves prior entries intact and reports ok:false.
46
+ */
47
+ sync(chunks: readonly StoredChunk[], embedder: GistEmbedder): Promise<GistSemanticSyncOk | GistSemanticSyncFail>;
48
+ /** Cosine-ranked chunk ids for a query vector. Never throws. */
49
+ searchByVector(queryVector: readonly number[], topK: number): readonly {
50
+ chunkId: string;
51
+ score: number;
52
+ }[];
53
+ private ensureLoaded;
54
+ private persist;
55
+ }
56
+ export interface GitHubGistSemanticMethodOptions {
57
+ readonly skillName: string;
58
+ readonly skillType: string;
59
+ readonly instanceId: string;
60
+ readonly tags: readonly string[];
61
+ readonly store: DatasourceChunkStore;
62
+ readonly index: GistSemanticIndex;
63
+ readonly embedder: GistEmbedder;
64
+ }
65
+ /** Cosine similarity retrieval over the gist vector sidecar. Never throws. */
66
+ export declare class GitHubGistSemanticMethod implements RetrievalMethod {
67
+ private readonly options;
68
+ constructor(options: GitHubGistSemanticMethodOptions);
69
+ describe(): RetrievalMethodDescriptor;
70
+ retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
71
+ private matchesScope;
72
+ }
73
+ export interface GatewayGistEmbedderOptions {
74
+ /** Runtime resolver; defaults to the shared embedding-runtime ensureRuntime. */
75
+ readonly runtime?: {
76
+ ensureRuntime(input?: {
77
+ profileId?: ProfileId;
78
+ cachedOnly?: boolean;
79
+ }): Promise<{
80
+ baseUrl: string;
81
+ identity: {
82
+ provider: string;
83
+ model: string;
84
+ dimension: number;
85
+ };
86
+ }>;
87
+ };
88
+ readonly profileId?: ProfileId;
89
+ readonly fetchImpl?: typeof fetch;
90
+ }
91
+ /**
92
+ * Production embedder backed by the loopback autorag-gateway. The runtime is
93
+ * ensured lazily with `cachedOnly` so semantic retrieval never triggers a
94
+ * model download; an unprimed cache surfaces as a sync/retrieve degrade.
95
+ */
96
+ /**
97
+ * Texts per `/v1/embeddings` call. The llama.cpp upstream rejects very large
98
+ * batches (HTTP 413 on a full-archive sync), so embedding fans out in
99
+ * bounded sequential batches while preserving input order.
100
+ */
101
+ export declare const GIST_EMBED_BATCH_SIZE = 32;
102
+ export declare function createGatewayGistEmbedder(options?: GatewayGistEmbedderOptions): GistEmbedder;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * GitHub Gist datasource skill (issue #1588).
3
+ *
4
+ * Composition: {@link GitHubGistConnector} incrementally mirrors the
5
+ * authenticated account's gists into the shared chunk store (lexical BM25),
6
+ * and a {@link GistSemanticIndex} vector sidecar adds semantic retrieval
7
+ * through the loopback embedding gateway. Embedding failures degrade to a
8
+ * `semantic-unavailable` warning — indexing and lexical retrieval continue.
9
+ */
10
+ import type { RetrievalMethod } from "../../../retrieval/types.js";
11
+ import { ConnectorDatasourceSkill, type ConnectorSkillDefinition, type ConnectorSkillOptions } from "../../connector-skill.js";
12
+ import type { DatasourceIndexResult } from "../../types.js";
13
+ import { GitHubGistConnector, type GitHubGistConnectorOptions } from "./connector.js";
14
+ import { type GatewayGistEmbedderOptions, type GistEmbedder } from "./semantic.js";
15
+ export declare const GITHUB_GIST_SKILL_DEFINITION: ConnectorSkillDefinition;
16
+ export declare function gistDatasourceDir(workspaceRoot: string, skillName: string, instanceId: string): string;
17
+ export interface GitHubGistSemanticOptions {
18
+ /** Set false to run lexical-only. Default true. */
19
+ readonly enabled?: boolean;
20
+ /** Injected embedder (tests); defaults to the loopback gateway embedder. */
21
+ readonly embedder?: GistEmbedder;
22
+ readonly embedderOptions?: GatewayGistEmbedderOptions;
23
+ /** Vector sidecar path override; defaults under `.autorag/datasources/…`. */
24
+ readonly statePath?: string;
25
+ }
26
+ export interface GitHubGistSkillOptions extends Omit<ConnectorSkillOptions, "connector"> {
27
+ /** Trusted connector configuration; a pre-built connector wins. */
28
+ readonly connector?: GitHubGistConnector;
29
+ readonly connectorOptions?: GitHubGistConnectorOptions;
30
+ readonly semantic?: GitHubGistSemanticOptions;
31
+ }
32
+ export declare class GitHubGistSkill extends ConnectorDatasourceSkill {
33
+ private readonly semanticIndex;
34
+ private readonly semanticEmbedder;
35
+ private readonly semanticMethod;
36
+ constructor(options?: GitHubGistSkillOptions);
37
+ index(): Promise<DatasourceIndexResult>;
38
+ retrievalMethods(): readonly RetrievalMethod[];
39
+ }
@@ -0,0 +1,23 @@
1
+ import { CrawlerCliClient } from "../../crawler-client.js";
2
+ import type { CrawlerSearchResult } from "../../crawler-types.js";
3
+ export interface LarkClientOptions {
4
+ readonly binaryPath?: string;
5
+ readonly env?: Readonly<Record<string, string | undefined>>;
6
+ readonly timeoutMs?: number;
7
+ readonly chatIds?: readonly string[];
8
+ readonly sleep?: (ms: number) => Promise<void>;
9
+ }
10
+ export declare class LarkClient {
11
+ private readonly version;
12
+ private readonly auth;
13
+ private readonly messages;
14
+ private readonly docs;
15
+ private readonly sleep;
16
+ constructor(options?: LarkClientOptions);
17
+ probeVersion(): Promise<CrawlerSearchResult | Awaited<ReturnType<CrawlerCliClient["sync"]>>>;
18
+ probeAuth(): Promise<Awaited<ReturnType<CrawlerCliClient["sync"]>>>;
19
+ searchMessages(query: string, topK: number | undefined): Promise<CrawlerSearchResult>;
20
+ searchDocs(query: string, topK: number | undefined): Promise<CrawlerSearchResult>;
21
+ private retry;
22
+ }
23
+ export declare function isSafeId(value: string): boolean;
@@ -0,0 +1,2 @@
1
+ export { isSafeId, LarkClient, type LarkClientOptions } from "./client.js";
2
+ export { LarkSkill, type LarkSkillOptions } from "./skill.js";
@@ -0,0 +1,36 @@
1
+ import type { RetrievalMethod, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
2
+ import type { DatasourceIndexResult, DatasourceSkill, DatasourceSkillDescriptor, DatasourceSkillManifest, PollingMetadata, SourceDescription } from "../../types.js";
3
+ import { LarkClient, type LarkClientOptions } from "./client.js";
4
+ export interface LarkSkillOptions extends LarkClientOptions {
5
+ readonly client?: LarkClient;
6
+ readonly datasourceId?: string;
7
+ readonly instanceId?: string;
8
+ readonly instances?: readonly string[];
9
+ readonly tags?: readonly string[];
10
+ readonly embedderBaseUrl?: string;
11
+ }
12
+ type Surface = "messages" | "docs";
13
+ export declare class LarkSkill implements DatasourceSkill {
14
+ private readonly client;
15
+ private readonly datasourceId;
16
+ private readonly instanceId;
17
+ private readonly instances;
18
+ private readonly tags;
19
+ private readonly chatIds;
20
+ private readonly embedderBaseUrl;
21
+ private lastIndexedAt;
22
+ private lastError;
23
+ constructor(options?: LarkSkillOptions);
24
+ describe(): DatasourceSkillDescriptor;
25
+ polling(): PollingMetadata;
26
+ index(): Promise<DatasourceIndexResult>;
27
+ retrievalMethods(): readonly RetrievalMethod[];
28
+ describeSources(): readonly SourceDescription[];
29
+ skillManifest(): DatasourceSkillManifest;
30
+ search(surface: Surface, query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
31
+ methodTags(surface: Surface): readonly string[];
32
+ private ok;
33
+ private fail;
34
+ private note;
35
+ }
36
+ export {};
@@ -0,0 +1,28 @@
1
+ import type { LazykatokChunkResult, LazykatokContextResult, LazykatokDoctorResult, LazykatokIndexResult, LazykatokOptions, LazykatokParentResult, LazykatokSearchMode, LazykatokSearchOptions, LazykatokSearchResult, LazykatokSyncResult } from "./types.js";
2
+ /**
3
+ * Thin external `lazykatok` CLI wrapper. Every method spawns the `lazykatok` binary as
4
+ * a child process, parses JSON from stdout, and returns a discriminated ok/fail
5
+ * union. No method throws for expected failures (missing binary, CLI nonzero
6
+ * exit, timeout, oversized output, or invalid JSON). The client never opens the
7
+ * KakaoTalk database directly.
8
+ */
9
+ export declare class LazykatokClient {
10
+ private readonly options;
11
+ constructor(options?: LazykatokOptions);
12
+ doctor(signal?: AbortSignal): Promise<LazykatokDoctorResult>;
13
+ sync(signal?: AbortSignal): Promise<LazykatokSyncResult>;
14
+ index(signal?: AbortSignal): Promise<LazykatokIndexResult>;
15
+ search(mode: LazykatokSearchMode, query: string, options?: LazykatokSearchOptions): Promise<LazykatokSearchResult>;
16
+ chunkGet(chunkId: string, signal?: AbortSignal): Promise<LazykatokChunkResult>;
17
+ context(chunkId: string, signal?: AbortSignal): Promise<LazykatokContextResult>;
18
+ parent(chunkId: string, signal?: AbortSignal): Promise<LazykatokParentResult>;
19
+ /** Single retrieval pipeline: build env, spawn, parse-free raw result. */
20
+ private run;
21
+ }
22
+ /**
23
+ * `sync` argv for the configured source adapter. A bare `sync --json` makes the CLI
24
+ * fall back to its config file, whose default adapter is `fixture` and fails with
25
+ * "fixture source requires a JSONL path", so the live macOS adapter is named
26
+ * explicitly on darwin while other platforms defer to the CLI's own config.
27
+ */
28
+ export declare function syncArgs(options: LazykatokOptions, platform?: NodeJS.Platform): readonly string[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * KakaoTalk datasource skill barrel.
3
+ *
4
+ * Re-exports the retrieval methods and skill plus the underlying client/types
5
+ * from sibling modules. Public source paths are path-opaque virtual paths of
6
+ * the form `/kakao/<instance-id>/chunks/<chunk-id>`.
7
+ */
8
+ export { LazykatokClient } from "./client.js";
9
+ export { LazykatokBm25Method, type LazykatokMethodOptions, type LazykatokSearchClient, LazykatokSemanticMethod, } from "./methods.js";
10
+ export { LazykatokSkill, type LazykatokSkillClient, type LazykatokSkillOptions } from "./skill.js";
11
+ export type { LazykatokChunkResult, LazykatokDoctorResult, LazykatokFailureReason, LazykatokHit, LazykatokIndexResult, LazykatokOptions, LazykatokSearchMode, LazykatokSearchOptions, LazykatokSearchResult, LazykatokSyncResult, } from "./types.js";
12
+ export { DEFAULT_LAZYKATOK_OPTIONS } from "./types.js";
@@ -1,42 +1,42 @@
1
1
  import type { RetrievalMethod, RetrievalMethodDescriptor, RetrievalOptions, RetrievalResult } from "../../../retrieval/types.js";
2
- import type { KatokSearchMode, KatokSearchOptions, KatokSearchResult } from "./types.js";
2
+ import type { LazykatokSearchMode, LazykatokSearchOptions, LazykatokSearchResult } from "./types.js";
3
3
  /**
4
4
  * Narrow client surface required by the KakaoTalk retrieval methods.
5
- * The real {@link KatokClient} satisfies this structurally; tests may stub it.
5
+ * The real {@link LazykatokClient} satisfies this structurally; tests may stub it.
6
6
  */
7
- export interface KatokSearchClient {
8
- search(mode: KatokSearchMode, query: string, options?: KatokSearchOptions): Promise<KatokSearchResult>;
7
+ export interface LazykatokSearchClient {
8
+ search(mode: LazykatokSearchMode, query: string, options?: LazykatokSearchOptions): Promise<LazykatokSearchResult>;
9
9
  }
10
- export interface KatokMethodOptions {
11
- readonly client: KatokSearchClient;
10
+ export interface LazykatokMethodOptions {
11
+ readonly client: LazykatokSearchClient;
12
12
  readonly instanceId: string;
13
13
  readonly tags?: readonly string[];
14
14
  }
15
15
  /**
16
16
  * Lexical (BM25) retrieval over a KakaoTalk datasource via the external
17
- * `katok` CLI in keyword mode. Katok does not expose source scopes; access is
17
+ * `lazykatok` CLI in keyword mode. Lazykatok does not expose source scopes; access is
18
18
  * controlled at the datasource/tag level. All client failures collapse to an
19
19
  * empty result set; retrieval never throws.
20
20
  */
21
- export declare class KatokBm25Method implements RetrievalMethod {
21
+ export declare class LazykatokBm25Method implements RetrievalMethod {
22
22
  private readonly client;
23
23
  private readonly instanceId;
24
24
  private readonly tags;
25
- constructor(options: KatokMethodOptions);
25
+ constructor(options: LazykatokMethodOptions);
26
26
  describe(): RetrievalMethodDescriptor;
27
27
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
28
28
  }
29
29
  /**
30
30
  * Semantic (vector) retrieval over a KakaoTalk datasource via the external
31
- * `katok` CLI in semantic mode. Katok does not expose source scopes; access is
31
+ * `lazykatok` CLI in semantic mode. Lazykatok does not expose source scopes; access is
32
32
  * controlled at the datasource/tag level. All client failures collapse to an
33
33
  * empty result set; retrieval never throws.
34
34
  */
35
- export declare class KatokSemanticMethod implements RetrievalMethod {
35
+ export declare class LazykatokSemanticMethod implements RetrievalMethod {
36
36
  private readonly client;
37
37
  private readonly instanceId;
38
38
  private readonly tags;
39
- constructor(options: KatokMethodOptions);
39
+ constructor(options: LazykatokMethodOptions);
40
40
  describe(): RetrievalMethodDescriptor;
41
41
  retrieve(query: string, options: RetrievalOptions): Promise<RetrievalResult[]>;
42
42
  }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Path helpers for the KakaoTalk (`lazykatok`) datasource skill.
3
+ *
4
+ * All paths are workspace-relative and live under
5
+ * `<workspaceRoot>/.autorag/datasources/lazykatok`. The client never exposes raw
6
+ * filesystem paths to callers; chunk identifiers are surfaced as opaque
7
+ * slash-hierarchical sources of the form
8
+ * `/kakao/<instance-id>/chunks/<chunk-id>`.
9
+ */
10
+ export declare const AUTORAG_DIRNAME = ".autorag";
11
+ export declare const DATASOURCES_DIRNAME = "datasources";
12
+ export declare const LAZYKATOK_DATASOURCE_DIRNAME = "lazykatok";
13
+ /** Logical datasource kind for source identifiers. */
14
+ export declare const LAZYKATOK_SOURCE_KIND: "kakao";
15
+ /**
16
+ * Root directory for lazykatok-managed state under a workspace. This is where the
17
+ * external `lazykatok` CLI stores its index, chunks, and sync state.
18
+ */
19
+ export declare function lazykatokDatasourceRoot(workspaceRoot: string): string;
20
+ /** Directory holding the lazykatok chunk index. */
21
+ export declare function lazykatokIndexPath(workspaceRoot: string): string;
22
+ /** Directory holding materialized lazykatok chunks. */
23
+ export declare function lazykatokChunksPath(workspaceRoot: string): string;
24
+ /** Directory holding lazykatok sync state. */
25
+ export declare function lazykatokSyncPath(workspaceRoot: string): string;
26
+ /**
27
+ * Builds the path-opaque, slash-hierarchical source identifier for a single
28
+ * lazykatok chunk. Callers (the LazykatokSkill methods) use this to populate
29
+ * `RetrievalResult.source` so no real filesystem path ever leaks.
30
+ */
31
+ export declare function lazykatokSourcePath(instanceId: string, chunkId: string): string;
32
+ /**
33
+ * Parses a lazykatok source identifier back into its `{ instanceId, chunkId }`
34
+ * components. Returns `undefined` for malformed or non-kakao sources so that
35
+ * deny decisions remain explicit rather than undefined-as-deny.
36
+ */
37
+ export declare function parseLazykatokSourcePath(source: string): {
38
+ readonly instanceId: string;
39
+ readonly chunkId: string;
40
+ } | undefined;
@@ -1,28 +1,28 @@
1
1
  import type { RetrievalMethod } from "../../../retrieval/types.js";
2
2
  import type { DatasourceIndexResult, DatasourceSkill, DatasourceSkillDescriptor, DatasourceSkillManifest, PollingMetadata, SourceDescription } from "../../types.js";
3
- import { type KatokSearchClient } from "./methods.js";
4
- import type { KatokDoctorResult, KatokIndexResult, KatokSyncResult } from "./types.js";
5
- export interface KatokSkillClient extends KatokSearchClient {
6
- doctor(): Promise<KatokDoctorResult>;
7
- sync(): Promise<KatokSyncResult>;
8
- index(): Promise<KatokIndexResult>;
3
+ import { type LazykatokSearchClient } from "./methods.js";
4
+ import type { LazykatokDoctorResult, LazykatokIndexResult, LazykatokSyncResult } from "./types.js";
5
+ export interface LazykatokSkillClient extends LazykatokSearchClient {
6
+ doctor(): Promise<LazykatokDoctorResult>;
7
+ sync(): Promise<LazykatokSyncResult>;
8
+ index(): Promise<LazykatokIndexResult>;
9
9
  }
10
- export interface KatokSkillOptions {
11
- readonly client: KatokSkillClient;
10
+ export interface LazykatokSkillOptions {
11
+ readonly client: LazykatokSkillClient;
12
12
  readonly instanceId?: string;
13
13
  readonly instances?: readonly string[];
14
14
  readonly pollingIntervalMs?: number;
15
15
  readonly tags?: readonly string[];
16
16
  readonly lastIndexedAt?: number;
17
17
  }
18
- export declare class KatokSkill implements DatasourceSkill {
18
+ export declare class LazykatokSkill implements DatasourceSkill {
19
19
  private readonly client;
20
20
  private readonly instanceId;
21
21
  private readonly instances;
22
22
  private readonly pollingIntervalMs;
23
23
  private readonly tags;
24
24
  private lastIndexedAt;
25
- constructor(options: KatokSkillOptions);
25
+ constructor(options: LazykatokSkillOptions);
26
26
  describe(): DatasourceSkillDescriptor;
27
27
  polling(): PollingMetadata;
28
28
  index(): Promise<DatasourceIndexResult>;