@autorag/librarian 2.5.2 → 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 (41) hide show
  1. package/README.md +7 -6
  2. package/dist/agent/agent.d.ts +9 -14
  3. package/dist/agent/index.d.ts +1 -2
  4. package/dist/agent/search-single-datasource-tool.d.ts +14 -8
  5. package/dist/cli/index.js +2130 -1057
  6. package/dist/core.js +1711 -665
  7. package/dist/datasource/errors.d.ts +1 -1
  8. package/dist/datasource/index.d.ts +3 -2
  9. package/dist/datasource/skills/discrawl/skill.d.ts +1 -1
  10. package/dist/datasource/skills/discrawl/types.d.ts +2 -2
  11. package/dist/datasource/skills/github-gist/connector.d.ts +38 -0
  12. package/dist/datasource/skills/github-gist/index.d.ts +3 -0
  13. package/dist/datasource/skills/github-gist/semantic.d.ts +102 -0
  14. package/dist/datasource/skills/github-gist/skill.d.ts +39 -0
  15. package/dist/datasource/skills/lark/client.d.ts +23 -0
  16. package/dist/datasource/skills/lark/index.d.ts +2 -0
  17. package/dist/datasource/skills/lark/skill.d.ts +36 -0
  18. package/dist/datasource/skills/lazykatok/client.d.ts +28 -0
  19. package/dist/datasource/skills/lazykatok/index.d.ts +12 -0
  20. package/dist/datasource/skills/{katok → lazykatok}/methods.d.ts +12 -12
  21. package/dist/datasource/skills/lazykatok/paths.d.ts +40 -0
  22. package/dist/datasource/skills/{katok → lazykatok}/skill.d.ts +10 -10
  23. package/dist/datasource/skills/lazykatok/types.d.ts +134 -0
  24. package/dist/datasource/skills/mailcrawl/client.d.ts +2 -0
  25. package/dist/datasource/skills/mailcrawl/types.d.ts +12 -0
  26. package/dist/datasource/types.d.ts +4 -4
  27. package/dist/embedding-runtime/manifest.d.ts +8 -0
  28. package/dist/embedding-runtime/types.d.ts +4 -0
  29. package/dist/index.js +1719 -671
  30. package/dist/process/terminate-tree.d.ts +2 -0
  31. package/dist/retrieval/types.d.ts +1 -1
  32. package/licenses/embedding-assets.json +20 -4
  33. package/package.json +1 -1
  34. package/skills/autorag-doctor/SKILL.md +4 -3
  35. package/skills/autorag-lite-setup/SKILL.md +2 -2
  36. package/skills/autorag-setup/SKILL.md +9 -6
  37. package/dist/agent/search-datasource-tool.d.ts +0 -30
  38. package/dist/datasource/skills/katok/client.d.ts +0 -21
  39. package/dist/datasource/skills/katok/index.d.ts +0 -12
  40. package/dist/datasource/skills/katok/paths.d.ts +0 -40
  41. package/dist/datasource/skills/katok/types.d.ts +0 -123
@@ -16,5 +16,7 @@ export declare const TREE_KILL_GRACE_MS = 500;
16
16
  * live parent/child chain and therefore requires `detached: false` there.
17
17
  *
18
18
  * Returns whether the process group / tree was signalled.
19
+ * Default SIGKILL: SIGTERM lets a Node descendant close inherited stdio during
20
+ * shutdown while the pid is still kill(pid,0)-visible (zombie or exiting).
19
21
  */
20
22
  export declare function terminateProcessTree(child: ChildProcess, signal?: NodeJS.Signals): boolean;
@@ -7,7 +7,7 @@ export interface RetrievalResult {
7
7
  }
8
8
  export interface RetrievalMethodDescriptor {
9
9
  name: string;
10
- type: "posix" | "vector" | "bm25" | "hybrid" | "visual";
10
+ type: "posix" | "vector" | "bm25" | "hybrid" | "visual" | "remote";
11
11
  description: string;
12
12
  status: "active" | "stub";
13
13
  capabilities: string[];
@@ -16,7 +16,11 @@
16
16
  "modelAssetId": "qwen3-embedding-0.6b",
17
17
  "licenseId": "Apache-2.0",
18
18
  "noticeFile": "licenses/qwen3-embedding-notice.txt",
19
- "noticeReference": "Qwen3 model card and Apache-2.0 license"
19
+ "noticeReference": "Qwen3 model card and Apache-2.0 license",
20
+ "intendedUse": "Local loopback embedding for AutoRAG MinSync and native-datasource semantic retrieval. Not a generative model.",
21
+ "unsuitableUse": "Chat or generation, remote embedding of corpus text, shipping weights in the npm package, any GGUF other than the pinned SHA-256.",
22
+ "upstreamCardUrl": "https://huggingface.co/Qwen/Qwen3-Embedding-0.6B",
23
+ "modelCard": "docs/model-cards/qwen3-embedding-0.6b.md"
20
24
  },
21
25
  {
22
26
  "profileId": "embeddinggemma-300m",
@@ -32,7 +36,11 @@
32
36
  "modelAssetId": "embeddinggemma-300m",
33
37
  "licenseId": "Gemma Terms of Use",
34
38
  "noticeFile": "licenses/gemma-notice.txt",
35
- "noticeReference": "Google EmbeddingGemma model card and Gemma Terms of Use"
39
+ "noticeReference": "Google EmbeddingGemma model card and Gemma Terms of Use",
40
+ "intendedUse": "Local loopback embedding for AutoRAG MinSync and native-datasource semantic retrieval. Not a generative model.",
41
+ "unsuitableUse": "Chat or generation, remote embedding of corpus text, shipping weights in the npm package, any GGUF other than the pinned SHA-256, uses restricted by the Gemma Prohibited Use Policy.",
42
+ "upstreamCardUrl": "https://ai.google.dev/gemma/docs/embeddinggemma/model_card",
43
+ "modelCard": "docs/model-cards/embeddinggemma-300m.md"
36
44
  }
37
45
  ],
38
46
  "assets": [
@@ -45,7 +53,11 @@
45
53
  "sha256": "06507c7b42688469c4e7298b0a1e16deff06caf291cf0a5b278c308249c3e439",
46
54
  "licenseId": "Apache-2.0",
47
55
  "noticeFile": "licenses/qwen3-embedding-notice.txt",
48
- "noticeReference": "Qwen3 model card and Apache-2.0 license"
56
+ "noticeReference": "Qwen3 model card and Apache-2.0 license",
57
+ "intendedUse": "Local loopback embedding for AutoRAG MinSync and native-datasource semantic retrieval. Not a generative model.",
58
+ "unsuitableUse": "Chat or generation, remote embedding of corpus text, shipping weights in the npm package, any GGUF other than the pinned SHA-256.",
59
+ "upstreamCardUrl": "https://huggingface.co/Qwen/Qwen3-Embedding-0.6B",
60
+ "modelCard": "docs/model-cards/qwen3-embedding-0.6b.md"
49
61
  },
50
62
  {
51
63
  "kind": "model",
@@ -56,7 +68,11 @@
56
68
  "sha256": "b5ce9d77a3fc4b3b39ccb5643c36777911cc4eb46a66962eadfa3f5f60490d63",
57
69
  "licenseId": "Gemma Terms of Use",
58
70
  "noticeFile": "licenses/gemma-notice.txt",
59
- "noticeReference": "Google EmbeddingGemma model card and Gemma Terms of Use"
71
+ "noticeReference": "Google EmbeddingGemma model card and Gemma Terms of Use",
72
+ "intendedUse": "Local loopback embedding for AutoRAG MinSync and native-datasource semantic retrieval. Not a generative model.",
73
+ "unsuitableUse": "Chat or generation, remote embedding of corpus text, shipping weights in the npm package, any GGUF other than the pinned SHA-256, uses restricted by the Gemma Prohibited Use Policy.",
74
+ "upstreamCardUrl": "https://ai.google.dev/gemma/docs/embeddinggemma/model_card",
75
+ "modelCard": "docs/model-cards/embeddinggemma-300m.md"
60
76
  },
61
77
  {
62
78
  "kind": "runtime",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorag/librarian",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: autorag-doctor
3
- description: Diagnose and repair a broken or half-working AutoRAG install so every configured source is both indexed and searchable. Checks AutoRAG, MinSync, Jikji, the embedding gateway, and every CLI-backed datasource (katok, discrawl, slacrawl, wacrawl, telecrawl, notcrawl, qmd, mailcrawl, rclone, Spotlight), then fixes orphan locks, orphan processes, embedding dimension or identity mismatches, stale indexes, and missing setup. Use when search returns nothing or too little, refresh hangs or fails, a datasource disappeared from results, indexes look stale, the gateway will not start, or the user asks to check, diagnose, verify, or repair AutoRAG.
3
+ description: Diagnose and repair a broken or half-working AutoRAG install so every configured source is both indexed and searchable. Checks AutoRAG, MinSync, Jikji, the embedding gateway, and every CLI-backed datasource (lazykatok, discrawl, slacrawl, wacrawl, telecrawl, notcrawl, qmd, mailcrawl, rclone, Spotlight), then fixes orphan locks, orphan processes, embedding dimension or identity mismatches, stale indexes, and missing setup. Use when search returns nothing or too little, refresh hangs or fails, a datasource disappeared from results, indexes look stale, the gateway will not start, or the user asks to check, diagnose, verify, or repair AutoRAG.
4
4
  license: MIT
5
5
  ---
6
6
 
@@ -16,7 +16,7 @@ Always finish with the status table in [Report](#report).
16
16
  ## Safety
17
17
 
18
18
  - Never delete, move, or edit source documents.
19
- - Never delete a datasource's **native** store (`~/.katok`, `~/.discrawl`,
19
+ - Never delete a datasource's **native** store (`~/Library/Application Support/katok`, `~/.discrawl`,
20
20
  `~/.mailcrawl`, `.qmd`, Telegram/WhatsApp/Notion archives). AutoRAG only
21
21
  reads them; rebuilding them is the owning CLI's job.
22
22
  - Only AutoRAG-owned state under `AUTORAG_HOME` and the workspace `.autorag`
@@ -58,7 +58,7 @@ Each CLI owns its archive, so ask the CLI, not AutoRAG. A datasource is only
58
58
  |---|---|---|
59
59
  | MinSync (local docs) | `minsync status`, `minsync check`, `minsync verify` | `autorag refresh --method minsync` |
60
60
  | Jikji (discovery) | `jikji doctor` | `autorag refresh --method jikji` |
61
- | KakaoTalk | `katok doctor` | `katok sync && katok index` |
61
+ | KakaoTalk | `lazykatok doctor` | `lazykatok sync && lazykatok index` |
62
62
  | Discord | `discrawl --json metadata` | `discrawl sync` |
63
63
  | Slack | `slacrawl --json doctor` | `slacrawl sync` |
64
64
  | WhatsApp | `wacrawl --json doctor` | `wacrawl import` |
@@ -68,6 +68,7 @@ Each CLI owns its archive, so ask the CLI, not AutoRAG. A datasource is only
68
68
  | Mail | `mailcrawl doctor`, `mailcrawl status` | `mailcrawl sync && mailcrawl index` |
69
69
  | Cloud drive | `rclone listremotes` | `autorag refresh --method datasources` |
70
70
  | Spotlight (macOS) | `mdutil -s /` | indexed by the OS; no AutoRAG sync |
71
+ | Lark / Feishu | `lark-cli auth status --format json` | no local sync; search is remote |
71
72
 
72
73
  Rules:
73
74
 
@@ -63,7 +63,7 @@ include `AUTORAG_HOME`, `AUTORAG_CONFIG`, `AUTORAG_SEARCH_PATHS`,
63
63
  setup. Configure datasources directly in trusted config, wizard-style:
64
64
 
65
65
  1. Probe every datasource for setup feasibility before asking the user
66
- anything: the backing CLI exists (`katok`, `discrawl`, `slacrawl`,
66
+ anything: the backing CLI exists (`lazykatok`, `discrawl`, `slacrawl`,
67
67
  `wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`) and its
68
68
  local store or archive is present. CLI-backed datasources own their own
69
69
  archive, index, and authentication, so environment credentials (such as bot
@@ -88,7 +88,7 @@ Datasource skills belong in trusted config and remain default-deny.
88
88
 
89
89
  Config keys may be builtin template names (`kakao`, `whatsapp`, `telegram`,
90
90
  `slack`, `discord`, `clawgallery`, `notion`, `github`, `cloud-drive`,
91
- `mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`) or connection
91
+ `mail-export`, `mailcrawl`, `obsidian`, `rss`, `spotlight`, `lark`) or connection
92
92
  aliases with `"type": "<template>"`. Unknown names are skipped with an
93
93
  `unknown-datasource-skill` warning; they do not fail config resolution.
94
94
  `datasourceAccess.allowedTags` and `allowedScopes` narrow trusted access and
@@ -184,8 +184,8 @@ autorag setup --format json
184
184
  setup. Configure datasources directly in trusted config, wizard-style:
185
185
 
186
186
  1. Probe every datasource for setup feasibility before asking the user
187
- anything: the backing CLI exists (`katok`, `discrawl`, `slacrawl`,
188
- `wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`) and its
187
+ anything: the backing CLI exists (`lazykatok`, `discrawl`, `slacrawl`,
188
+ `wacrawl`, `telecrawl`, `notcrawl`, `qmd`, `mailcrawl`, `rclone`, `lark-cli`) and its
189
189
  local store or archive is present. CLI-backed datasources own their own
190
190
  archive, index, and authentication, so environment credentials (such as bot
191
191
  tokens) are never required or checked for them. Non-CLI connectors
@@ -207,8 +207,8 @@ setup. Configure datasources directly in trusted config, wizard-style:
207
207
 
208
208
  Datasource skills belong in trusted config and remain default-deny. Builtin
209
209
  template names are `kakao`, `whatsapp`, `telegram`, `slack`, `discord`,
210
- `clawgallery`, `notion`, `github`, `cloud-drive`, `mail-export`,
211
- `mailcrawl`, `obsidian`, `rss`, and `spotlight`. Config keys may be connection
210
+ `clawgallery`, `notion`, `github`, `github-gist`, `cloud-drive`, `mail-export`,
211
+ `mailcrawl`, `obsidian`, `rss`, `spotlight`, and `lark`. Config keys may be connection
212
212
  aliases with `"type": "<template>"`. Unknown names are skipped with an
213
213
  `unknown-datasource-skill` warning; they do not fail config resolution.
214
214
  `scope` and tags can narrow trusted access but cannot grant it.
@@ -217,6 +217,7 @@ aliases with `"type": "<template>"`. Unknown names are skipped with an
217
217
  {
218
218
  "datasources": {
219
219
  "github": { "connector": { "repos": ["owner/repo"], "tokenEnv": "GITHUB_TOKEN" } },
220
+ "github-gist": { "connector": { "tokenEnv": "GITHUB_TOKEN" } },
220
221
  "google-drive": { "type": "cloud-drive", "connector": { "provider": "google-drive", "remote": "gdrive:" } },
221
222
  "archive-drive": { "type": "cloud-drive", "connector": { "remote": "archive:" } },
222
223
  "mailcrawl": { "instanceId": "personal", "connector": { "account": "personal", "mailbox": "INBOX", "binaryPath": "mailcrawl" } },
@@ -233,11 +234,13 @@ aliases with `"type": "<template>"`. Unknown names are skipped with an
233
234
  Tokens are environment-variable names, not raw secrets. CLI-backed connectors
234
235
  keep authentication in their external tool configuration.
235
236
 
236
- Mailcrawl must be installed separately (`@nomadamas/mailcrawl@0.1.6` or newer)
237
+ Mailcrawl must be installed separately (`@nomadamas/mailcrawl@0.2.0` or newer)
237
238
  and configured through its own Himalaya account. AutoRAG runs its local `sync`
238
239
  and `index` lifecycle, then uses the mailcrawl CLI for BM25, semantic, or
239
240
  hybrid search. Do not use 0.1.3 or earlier: a no-op sync followed by `index`
240
- fails with `text array must be non-empty`.
241
+ fails with `text array must be non-empty`. 0.2.0 defaults to the in-process
242
+ native `Qwen/Qwen3-Embedding-0.6B` embedder and keeps vectors in LanceDB, so a
243
+ cold cache makes the first `index` download ONNX weights and run for minutes.
241
244
  Use mailcrawl for Gmail, IMAP, and Maildir retrieval. The former Gmail REST
242
245
  datasource is removed.
243
246
 
@@ -1,30 +0,0 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
2
- import { Type } from "typebox";
3
- import type { RetrievalDiagnostic, RetrievalResult } from "../retrieval/types.js";
4
- import { type SearchDocumentRetrievalTraceResult } from "./search-documents.js";
5
- export declare const SEARCH_DATASOURCE_DOCUMENTS_TOOL_NAME = "search_datasource_documents";
6
- declare const searchDatasourceSchema: Type.TObject<{
7
- query: Type.TString;
8
- topK: Type.TOptional<Type.TInteger>;
9
- scope: Type.TOptional<Type.TString>;
10
- }>;
11
- export interface SearchDatasourceDocumentsDetails {
12
- readonly method: "datasource";
13
- readonly resultCount: number;
14
- readonly sources: readonly string[];
15
- readonly diagnostics: readonly RetrievalDiagnostic[];
16
- /** Top candidates in traceable shape (additive; used for the run's retrieval trace). */
17
- readonly results?: readonly SearchDocumentRetrievalTraceResult[];
18
- }
19
- export interface DatasourceSearchProvider {
20
- searchDatasourceDocuments(query: string, options?: {
21
- readonly topK?: number;
22
- readonly scope?: string;
23
- }): Promise<{
24
- readonly results: readonly RetrievalResult[];
25
- readonly diagnostics: readonly RetrievalDiagnostic[];
26
- }>;
27
- }
28
- export declare function createSearchDatasourceDocumentsTool(provider: DatasourceSearchProvider): AgentTool<typeof searchDatasourceSchema, SearchDatasourceDocumentsDetails>;
29
- export declare function formatDatasourceResults(results: readonly RetrievalResult[], diagnostics: readonly RetrievalDiagnostic[]): string;
30
- export {};
@@ -1,21 +0,0 @@
1
- import type { KatokChunkResult, KatokContextResult, KatokDoctorResult, KatokIndexResult, KatokOptions, KatokParentResult, KatokSearchMode, KatokSearchOptions, KatokSearchResult, KatokSyncResult } from "./types.js";
2
- /**
3
- * Thin external `katok` CLI wrapper. Every method spawns the `katok` 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 KatokClient {
10
- private readonly options;
11
- constructor(options?: KatokOptions);
12
- doctor(signal?: AbortSignal): Promise<KatokDoctorResult>;
13
- sync(signal?: AbortSignal): Promise<KatokSyncResult>;
14
- index(signal?: AbortSignal): Promise<KatokIndexResult>;
15
- search(mode: KatokSearchMode, query: string, options?: KatokSearchOptions): Promise<KatokSearchResult>;
16
- chunkGet(chunkId: string, signal?: AbortSignal): Promise<KatokChunkResult>;
17
- context(chunkId: string, signal?: AbortSignal): Promise<KatokContextResult>;
18
- parent(chunkId: string, signal?: AbortSignal): Promise<KatokParentResult>;
19
- /** Single retrieval pipeline: build env, spawn, parse-free raw result. */
20
- private run;
21
- }
@@ -1,12 +0,0 @@
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 { KatokClient } from "./client.js";
9
- export { KatokBm25Method, type KatokMethodOptions, type KatokSearchClient, KatokSemanticMethod } from "./methods.js";
10
- export { KatokSkill, type KatokSkillClient, type KatokSkillOptions } from "./skill.js";
11
- export type { KatokChunkResult, KatokDoctorResult, KatokFailureReason, KatokHit, KatokIndexResult, KatokOptions, KatokSearchMode, KatokSearchOptions, KatokSearchResult, KatokSyncResult, } from "./types.js";
12
- export { DEFAULT_KATOK_OPTIONS } from "./types.js";
@@ -1,40 +0,0 @@
1
- /**
2
- * Path helpers for the KakaoTalk (`katok`) datasource skill.
3
- *
4
- * All paths are workspace-relative and live under
5
- * `<workspaceRoot>/.autorag/datasources/katok`. 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 KATOK_DATASOURCE_DIRNAME = "katok";
13
- /** Logical datasource kind for source identifiers. */
14
- export declare const KATOK_SOURCE_KIND: "kakao";
15
- /**
16
- * Root directory for katok-managed state under a workspace. This is where the
17
- * external `katok` CLI stores its index, chunks, and sync state.
18
- */
19
- export declare function katokDatasourceRoot(workspaceRoot: string): string;
20
- /** Directory holding the katok chunk index. */
21
- export declare function katokIndexPath(workspaceRoot: string): string;
22
- /** Directory holding materialized katok chunks. */
23
- export declare function katokChunksPath(workspaceRoot: string): string;
24
- /** Directory holding katok sync state. */
25
- export declare function katokSyncPath(workspaceRoot: string): string;
26
- /**
27
- * Builds the path-opaque, slash-hierarchical source identifier for a single
28
- * katok chunk. Callers (the KatokSkill methods) use this to populate
29
- * `RetrievalResult.source` so no real filesystem path ever leaks.
30
- */
31
- export declare function katokSourcePath(instanceId: string, chunkId: string): string;
32
- /**
33
- * Parses a katok 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 parseKatokSourcePath(source: string): {
38
- readonly instanceId: string;
39
- readonly chunkId: string;
40
- } | undefined;
@@ -1,123 +0,0 @@
1
- import type { RetrievalOptions } from "../../../retrieval/types.js";
2
- /**
3
- * Search modes accepted by the external `katok search` subcommand.
4
- *
5
- * - `semantic` — dense vector similarity over indexed chunks.
6
- * - `keyword` — exact / tokenized keyword matching.
7
- * - `hybrid` — fused semantic + keyword scores.
8
- */
9
- export type KatokSearchMode = "semantic" | "keyword" | "hybrid";
10
- /**
11
- * Configuration for {@link KatokClient}. All fields optional; sensible defaults
12
- * mirror the jikji client. The client spawns the `katok` binary as a child
13
- * process — it never opens the KakaoTalk database directly.
14
- */
15
- export interface KatokOptions {
16
- /** Explicit path to the `katok` binary. Defaults to a bare `katok` PATH lookup. */
17
- readonly binaryPath?: string;
18
- /** Spawn timeout in milliseconds. Default 60_000 (sync/index over large archives can be slow). */
19
- readonly timeoutMs?: number;
20
- /** Max stdout/stderr bytes retained. Default 1_048_576 (1 MiB). */
21
- readonly maxBufferBytes?: number;
22
- /** Explicit native katok data directory, passed as `--data-dir`. */
23
- readonly workspacePath?: string;
24
- /** Explicit operator-owned configuration/workspace transport. */
25
- readonly configPath?: string;
26
- /** Environment overrides merged on top of `process.env` for the child. */
27
- readonly env?: Readonly<Record<string, string | undefined>>;
28
- }
29
- export declare const DEFAULT_KATOK_BINARY = "katok";
30
- export declare const DEFAULT_KATOK_TIMEOUT_MS = 60000;
31
- export declare const DEFAULT_KATOK_MAX_BUFFER_BYTES = 1048576;
32
- export declare const DEFAULT_KATOK_OPTIONS: {
33
- readonly binaryPath: "katok";
34
- readonly timeoutMs: 60000;
35
- readonly maxBufferBytes: 1048576;
36
- };
37
- /**
38
- * Reasons a katok CLI invocation can fail. The client never throws for these —
39
- * every method returns a discriminated union with `ok: false` and one of these
40
- * reasons.
41
- */
42
- export type KatokFailureReason = "binary-missing" | "nonzero-exit" | "spawn-error" | "timeout" | "aborted" | "stdout-too-large" | "stderr-too-large" | "invalid-json" | "invalid-shape";
43
- /** Common failure payload shared by every method result union. */
44
- export interface KatokFailure {
45
- readonly ok: false;
46
- readonly reason: KatokFailureReason;
47
- /** Raw stdout captured (may be partial / empty). Never a binary path. */
48
- readonly stdout: string;
49
- /** Raw stderr captured (may be partial / empty). Never a binary path. */
50
- readonly stderr: string;
51
- /** Exit code, or `null` when the process never exited normally. */
52
- readonly code: number | null;
53
- readonly hits?: readonly unknown[];
54
- }
55
- /** A single indexed chat chunk returned by the katok CLI. */
56
- export interface KatokChunk {
57
- readonly chunkId: string;
58
- readonly content: string;
59
- readonly metadata?: Readonly<Record<string, unknown>>;
60
- }
61
- /** A scored search hit. */
62
- export interface KatokSearchHit {
63
- readonly chunkId: string;
64
- readonly score: number;
65
- readonly content: string;
66
- readonly metadata?: Readonly<Record<string, unknown>>;
67
- readonly source?: string;
68
- }
69
- export type KatokHit = KatokSearchHit;
70
- /** Result of `katok doctor`. */
71
- export interface KatokDoctorInfo {
72
- readonly version?: string;
73
- readonly ready: boolean;
74
- readonly metadata?: Readonly<Record<string, unknown>>;
75
- }
76
- /** Result of `katok sync`. */
77
- export interface KatokSyncInfo {
78
- readonly synced: boolean;
79
- readonly messageCount?: number;
80
- readonly metadata?: Readonly<Record<string, unknown>>;
81
- }
82
- /** Result of `katok index`. */
83
- export interface KatokIndexInfo {
84
- readonly chunkCount: number;
85
- readonly metadata?: Readonly<Record<string, unknown>>;
86
- }
87
- /** Context payload: the chunks surrounding a target chunk. */
88
- export interface KatokContext {
89
- readonly chunks: readonly KatokChunk[];
90
- readonly metadata?: Readonly<Record<string, unknown>>;
91
- }
92
- /** Discriminated ok-success shape carrying typed `data`. */
93
- export interface KatokOk<T> {
94
- readonly ok: true;
95
- readonly data: T;
96
- readonly stdout: string;
97
- readonly stderr: string;
98
- readonly code: number;
99
- }
100
- export interface KatokSearchOk {
101
- readonly ok: true;
102
- readonly hits: readonly KatokSearchHit[];
103
- readonly stdout: string;
104
- readonly stderr: string;
105
- readonly code: number;
106
- readonly data: {
107
- readonly hits: readonly KatokSearchHit[];
108
- };
109
- }
110
- export type KatokDoctorResult = KatokOk<KatokDoctorInfo> | KatokFailure;
111
- export type KatokSyncResult = KatokOk<KatokSyncInfo> | KatokFailure;
112
- export type KatokIndexResult = KatokOk<KatokIndexInfo> | KatokFailure;
113
- export type KatokSearchResult = KatokSearchOk | KatokFailure;
114
- export type KatokChunkResult = KatokOk<KatokChunk> | KatokFailure;
115
- export type KatokContextResult = KatokOk<KatokContext> | KatokFailure;
116
- export type KatokParentResult = KatokOk<KatokChunk> | KatokFailure;
117
- /**
118
- * Search-specific options. Reuses the shared {@link RetrievalOptions} so the
119
- * KatokSkill retrieval method can pass its options straight through. The
120
- * client maps `topK` to the native CLI limit flag; other fields are handled
121
- * by the retrieval layer or are not supported by katok.
122
- */
123
- export type KatokSearchOptions = RetrievalOptions;